min
and max
of the cnt
value of the aggregated bins from the query.source
data definitions and performing aggregation transforms on that data, decreasing chart rendering time and redundancy.min
and max
of the cnt
value of the bins from the query, you need to run a prequery to gather these statistics manually. Here, this is done using a subquery SQL statement:heatmap_stats
has a source data table defined by the "source": "heatmap_query"
line:"heatmap_stats"
data takes as input the "heatmap_query"
data, which is the data supplied by the SQL query. Use the source
data type to apply intermediary steps or expressions (transforms) to the input source data.source
and transform
properties, see the Data property."heatmap_stats"
section as follows to:scale
domain:distinct
: An array of distinct values from an input data column.median
: The median of an input data column.quantile
: An array of quantile separators; operates on numeric columns and takes the following pameters:numQuantiles
: The number of contiguous intervals to create; returns the separators for the intervals. The number of separators equals numQuantiles - 1
.includeExtrema
: Whether to include min and max values (extrema) in the resulting separator array. The size of the resulting separator array will be numQuantiles
+ 1.distinct
Vega transform, this can be performed when evaluating the Vega code in the backend, so you do not need to run the prequery. This can improve performance considerably.median
and quantile
to create a more meaningful probability distribution of the data. Median and quantiles are computed dynamically when Vega is evaluated and can be used to drive different render properties.median
to drive the color of the hex bins. Notice in the final render that roughly half of the bins are colored red, and the other half are blue.numQuantiles
is the number of contiguous intervals to create and returns the separators for the intervals. The number of returned separators is numQuantiles
- 1.includeExtrema
is a true
or false
value indicating whether to include the extrema (min and max) in the resulting separator array. If true
, the number of returned values is numQuantiles
+ 1."followers"
:{3, 6, 7, 8, 8, 10, 13, 15, 16, 20}
{"type": "quantile", "numQuantiles": 4}
, the result of the operator would be the following array:[7, 9, 15]
{"type": "quantile", "numQuantiles": 4, "includeExtrema": true}
, the result of the operator would be the following array:[3, 7, 9, 15, 20]
."includeExtrema" == true
, the min and max are included in the resulting array, so 25% of the data has between 3 and 7 followers, 25% has between 7 and 9, 25% has between 9 and 15, and 25% has between 15 and 20."followers"
: