fusioncharts.getData(options: Object, callbackHandler: Function, updateHandler: Function): Object []
Requests data from Flexmonster and preprocesses it to the format required by FusionCharts.
Parameter/Type | Description |
---|---|
options Object | Sets options for data preprocessing. |
options.type String | The chart type to prepare data for. List of supported types
|
options.slice SliceObject | optional Defines the data slice for the chart
Live example. If options.slice is not specified, the Connector prepares the data based on the current slice in Flexmonster Pivot.Note If fusioncharts.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.Only for "json" and "csv" data source types. |
options.prepareDataFunction Function | optional A function that preprocesses data into the necessary format. Implement it to create a chart that is not present in the list of supported chart types.prepareDataFunction takes two input parameters:
|
callbackHandler Function | Сreates the chart once the data is ready. Takes two input parameters:
|
updateHandler Function | optional Updates the chart when the report is changed. It takes the same input parameters as the callbackHandler function: chartData and rawData . |
An array of objects, where each object represents a single data point with a label
field indicating the category name and a value
field representing the aggregated value. See an example:
[{
label: "Australia",
value: 1372281
},
{
label: "Canada",
value: 1034112
},
{
label: "France",
value: 1117794
}]
1) Calling the fusioncharts.getData()
method:
pivot.fusioncharts.getData({
type: chart.chartType()
},
function(chartConfig) {
chart.setJSONData(chartConfig);
chartConfig.chart.theme = "fusion";
chart.render();
},
function(chartConfig) {
chart.setJSONData(chartConfig);
chartConfig.chart.theme = "fusion";
}
);
2) Defining the options.slice
parameter in fusioncharts.getData()
:
pivot.fusioncharts.getData(
{
type: chart.chartType(),
slice: {
rows: [
{
uniqueName: "Color",
},
],
columns: [
{
uniqueName: "Country",
},
{
uniqueName: "[Measures]",
},
],
measures: [
{
uniqueName: "Price",
},
],
},
},
function (chartConfig) {
// Function to draw chart
},
function (chartConfig) {
// Function to update chart
},
);