Get Data

Using Get Data

After creating a VividChart object, associating it with its type and ensuring all required fields are used, get data is then used to query the table and return the data used to generate a chart. The exact format of the return will depend upon which chart type is associated with the VividChart object. See the documentation for your chosen chart type for specifics.
If used within a chart record script section there is a predefined variable called chartData that is used by the associated widget. To automatically use the widget associated with the chart type simply assign the result of get data to the chartData variable and the widget will take care of the rest.
Warning: Make sure the widget you are using is the same as the chart type associated with the VividChart object.

Getting data within a chart script

If within a chart script, the data can be assigned to chartData to be automatically used by the widget associated with the chart record.
Using get data within a script:
var vividChart = new VividChart(chart);
vividChart.setType('half donut');
chartData = vividChart.getData();

Getting data using a custom variable

If used outside of a chart script get data may be assigned to any variable you select and then can be manipulated however desired.
Using get data without assigning to chartData:
var vividChart = new VividChart();
vividChart.setType('progress score');
vividChart.option('table', 'incident');
vividChart.option('conditions', 'impact>1');
var data = vividChart.getData();