getScatter
A Scatter model is a data model that represents bi-variable data points defined as numerical x and y values. Suitable for rendering scatter plots and other similar charts.
Usage
const formula = await dataSource.getScatter({
xAxisColumn: 'column_A',
xAxisJoinOperation: 'count',
yAxisColumn: 'column_B'
yAxisOperationColumn: 'sum'
// + base options...
});
Options
The getScatter
model inherits all options from the base options, plus:
export interface ScatterRequestOptions extends BaseRequestOptions {
xAxisColumn: string | string[];
xAxisJoinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
yAxisColumn: string | string[];
yAxisJoinOperation?: 'count' | 'avg' | 'min' | 'max' | 'sum';
}
xAxisColumn: the name of the column that will be used for getting the first variable (x axis) of each set. It also accepts a list of column names, that can be then aggregated using
xAxisJoinOperation
.xAxisJoinOperation (optional): the aggregation that will be performed to aggregate an array in
xAxisColumn
into a single one. Accepted values are:count
avg
min
max
sum
yAxisColumn: the name of the column that will be used for getting the second variable (y axis) of each set. It also accepts a list of column names, that can be then aggregated using y
AxisJoinOperation
.yAxisJoinOperation (optional): the aggregation that will be performed to aggregate an array in y
AxisColumn
into a single one. Accepted values are:count
avg
min
max
sum
Response
A two-dimensional array containing a pair of numerical values for each set of variables.
The response will be limited to the first 500 rows for the given combination of sources and filters.
type CategoriesModelResponse = [number, number][];
/* example response
[
[1939, 34820],
[2374, 59231],
[3781, 61732],
[3200, 57689],
[4589, 98478],
[4873, 89573],
[4109, 84023]
];
*/
The response can be then freely mapped to any charting library to create data visualizations like a scatterplot chart.

Last updated
Was this helpful?