getHistogram
A Histogram model is a data model that represents a list of labeled data points for bins (ranges) of data, defined as ticks over a numerical range, Suitable for histogram charts.
Usage
const formula = await dataSource.getHistogram({
column: 'column_A',
ticks: [5, 10, 15],
operation: 'count'
// + base options...
});
Options
The getHistogram
model inherits all options from the base options, plus:
export interface HistogramRequestOptions extends BaseRequestOptions {
column: string;
ticks: number[];
operation: 'count' | 'avg' | 'min' | 'max' | 'sum';
}
column: the name of the column that you will run the statistical operation on. It also accepts the
*
value, that willticks: the list of numerical upper bound thresholds that will be used to create the bins. There's no maximum number of ticks.
operation: the aggregation that will be performed on the
column
for each range bin. Accepted values are:count
avg
min
max
sum
Response
An ordered array containing the value for each histogram bin.
type HistogramModelResponse = number[];
/* example response
[
389, // < 5
648, // 5-9
478, // 10-14
120 // > 15
]
*/
The response can be then mapped to any HTML element, but commonly it will be mapped to a a charting library to create histogram charts.

Last updated
Was this helpful?