amcharts.getData(options: Object, callbackHandler: Function, updateHandler: Function)
Requests data from the component and preprocesses it to an array of objects. This format is supported by amCharts.
Parameter/Type | Description |
---|---|
options Object | Allows setting options for data preprocessing. |
options.slice SliceObject | optional Defines the data slice to be used for the chart. If not defined, the Connector prepares the data based on the current slice in Flexmonster Pivot. Note: if amcharts.getData() gets the slice as a parameter, the chart will not respond to further slice changes on the grid, which means data shown on the chart will be static. |
options.prepareDataFunction Function | optional Allows you to override the Connector's default prepareDataFunction and perform custom data preprocessing if needed.If prepareDataFunction is not specified, the Connector uses the built-in method to preprocess the data.prepareDataFunction takes two input parameters:
|
callbackHandler Function | Used to create the chart once the data is ready to be passed to it. Takes two input parameters:
|
updateHandler Function | optional Used to update the chart when the report is updated. It takes the same input parameters as the callbackHandler function: chartData and rawData . |
Returns an array of objects that contains the data for the chart. For example:
[ { "categoryName": "value", "measureName 1": "value", … "measureName n": "value", } … ]
Learn more about how the Connector prepares data for the chart.
1) Calling the amcharts.getData()
method:
pivot.amcharts.getData({}, drawChart, updateChart);
See a live demo on JSFiddle.
2) Passing the slice to the amcharts.getData()
method:
pivot.amcharts.getData(
{
slice: {
rows: [{uniqueName: "Country"}],
columns: [{uniqueName: "[Measures]"}],
measures: [{uniqueName: "Quantity"}]
}
},
drawChart,
updateChart
);
amcharts.getCategoryName
amcharts.getMeasureNameByIndex
amcharts.getNumberOfMeasures
amcharts.getNumberFormatPattern