☝️Small business or a startup? See if you qualify for our special offer.
+
All documentation

fusioncharts.getData

fusioncharts.getData(options: Object, callbackHandler: Function, updateHandler: Function): Object []

Requests data from Flexmonster and preprocesses it to the format required by FusionCharts.

Parameters

Parameter/TypeDescription
options
Object
Sets options for data preprocessing.
options.type
String
The chart type to prepare data for.
List of supported types
  • "area2d"
  • "bar2d"
  • "bar3d"
  • "column2d"
  • "column3d"
  • "doughnut2d"
  • "doughnut3d"
  • "line"
  • "marimekko"
  • "msarea"
  • "msbar2d"
  • "msbar3d"
  • "mscolumn2d"
  • "mscolumn3d"
  • "mscolumn3dlinedy"
  • "msline"
  • "msspline"
  • "mssplinearea"
  • "pareto2d"
  • "pareto3d"
  • "pie2d"
  • "pie3d"
  • "radar"
  • "spline"
  • "splinearea"
  • "stackedarea2d"
  • "stackedbar2d"
  • "stackedcolumn2d"
  • "stackedcolumn3d"
  • "maps/worldwithcountries"
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:
  • rawData — Object. Raw data to preprocess. Check out the structure of rawData.
  • options — Object. It contains options set in the fusioncharts.getData() function.

Live example

callbackHandler
Function
Сreates the chart once the data is ready. Takes two input parameters:
  • chartData — Object. Data preprocessed by the Connector or prepareDataFunction (if specified).
  • rawData — Object. Raw data from the component. Can be used to get the number formatting specified in Flexmonster. Check out the structure of rawData.
updateHandler
Function
optional Updates the chart when the report is changed. It takes the same input parameters as the callbackHandler function: chartData and rawData.

Returns

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
}]

Examples

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";
}
);

Live example

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
},
);

Live example

See also