Pricing changes are coming in January. Contact our Sales team to secure the current price for your desired license.
All documentation
  • API Reference for older versions
  • amcharts.getData

    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.

    Parameters

    Parameter/TypeDescription
    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:
    • rawData – Object. Raw data to preprocess (check out the structure of rawData in getData()).
    • options – Object. It contains options set in the amcharts.getData() function.
    callbackHandler
    Function
    Used to create the chart once the data is ready to be passed to it. Takes two input parameters:
    • chartData – data preprocessed by either the Connector or prepareDataFunction (if it is defined).
    • rawData – raw data from the component. It can be used to get the number formatting specified in Flexmonster. Check out the structure of rawData.
    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

    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.

    Example

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

    See also

    amcharts.getCategoryName
    amcharts.getMeasureNameByIndex
    amcharts.getNumberOfMeasures
    amcharts.getNumberFormatPattern