Documentation menu
amcharts.getData
webdatarocks.amcharts.getData(options: Object, callbackHandler: Function, updateHandler: Function): Array
[starting from version: 1.3.1]
This method plays the most important role in communication between a pivot table component and a chart. It gets the data from the pivot table and pre-processes according to a format required by amCharts, namely to an array of objects.
Parameters
Name | Type | Description |
---|---|---|
options | Object | Describes the options for data pre-processing. Contains the following properties: |
| Slice Object |
optionalSpecifies the pivot table’s slice according to which to prepare the chart’s data. If not defined, the Connector prepares the data that is currently displayed on the grid. Note that if a slice is passed to amcharts.getData() explicitly, the chart will not be changed upon changes applied to the grid (via the UI or in code). The data shown in the chart will be static. See the example.
|
| Function | optionalThis function can be implemented and passed as a property of options if the data is required to be prepared differently from the way the Connector does by default. After the data is processed by prepareDataFunction , it is passed to callbackHandler and updateHandler (the description of these event handlers is given below).
|
callbackHandler | Function | Fired once the data is prepared. Accepts two input arguments:
|
updateHandler | Function |
optional Fired once any change is applied to the report’s configuration (e.g., the pivot table’s slice or number formatting are changed). Alike callbackHandler , accepts two input arguments: chartData and rawData .
|
Examples
1) Here is an example of how to pass the slice to the amcharts.getData()
method:
function createChart() {
pivot.amcharts.getData({
slice: {
rows: [
{
uniqueName: "Country"
}
],
columns: [
{
uniqueName: "Measures"
}
],
measures: [
{
uniqueName: "Quantity"
}
]
}
},
drawChart, updateChart);
}