/workspace/templates/histogram

The query returns data organised in a specified number of buckets in order to visualise histogram for continuous data.

The query uses the percentile_cont function to calculate the 2nd and 98th percentiles of the specified field.

The query also calculates the minimum and maximum values of the specified field.

The buckets returned is actual the number of buckets defined + 2. Buckets default to 7.

A decimal value can be provided for the bucket min and max values. The default is 0 to round to the nearest integer.

This is because the first bucket is for values less than or equal to the 2nd percentile and the last bucket is for values greater than or equal to the 98th percentile.

The rest of the buckets are calculated by dividing the range between the 2nd and 98th percentiles into equal intervals.

If the parameter "chartjs" is set to true, the query returns a chart.js compatible string. Otherwise, the query returns the final data as a table.