Chart variables serve as configuration parameters that can be read from the chart’s code and are used to promote re-usability of charts across Zoomdata data sources. There are two types of chart variables in Zoomdata:
- Query Variables
- Constant Variables
These variables drive the type of query that executes against the backend database. For example, a chart with a single query variable of type Group aggregates the data based on the configured field and uses count as the aggregation function. If the developer additionally adds a query variable of type Multi-Metric, the data includes the aggregated values of the configured metrics based on the aggregation functions specified.
These variables are useful for chart settings specified as numeric, text, or list values. For example, a custom chart might use a service that requires an API key. A chart developer can create a string constant variable for the API key to allow users to specify a different key per data source.
Where are they configured?
The data source definition contains the configuration of variables for each chart. When editing a Zoomdata data source, click on the Charts link and switch to the Custom tab to see a list of custom charts. Clicking on any chart shows the list of variables and the default settings can be configured and saved.