getData
getData(options:Object, callbackHandler:Function, updateHandler:Function)
This method is for integration with third-party charting libraries. It is used for requesting the data from the pivot table, pre-processing it to the appropriate format for the required type of the chart in the charting library and passing the data to callbackHandler and updateHandler.
Check out our step-by-step tutorial to integrate with any charting library.
Parameters
| Name | Type | Description | 
|---|---|---|
| options | Object | Options for data pre-processing. This object has the following parameters: | 
| 
 | Object | optional Defines the slice of data for pre-processing. If the slice is not defined, the API call sends the data displayed in the pivot table. | 
| callbackHandler | Function | Specifies what happens after the data is ready. It has one input parameter – rawData(non-aggregated data for sending to the chart). | 
| updateHandler | Function | optional Triggered when the data in the pivot table is updated, sorted or filtered. It has one input parameter – rawData. | 
Response
rawData is an object returned by getData() API call and then asynchronously passed to callbackHandler and updateHandler. It consists of the following fields:
| Name | Type | Description | 
|---|---|---|
| data | Array | Array of objects describing the data from the dataset. Each object can have  c0 - cN, r0 - rNand v0 - vNfields, wherec0 - cNare for column members,r0 - rNare for row members andv0 - vNare for values. If a cell has no value,NaNis put the appropriatev0 - vNfield. | 
| meta | Object | Metadata for the data API call returns: | 
| 
 | Number | Columns’ quantity in the sliceobject. | 
| 
 | String | The title of the columns’ first field in the sliceobject. The quantity ofc0Name,c1Name,c2Name, … ,cnNameis equal tocAmountof the meta object. | 
| 
 | Array | Array of format objects for measures in the sliceobject. The quantity of format objects is equal tovAmount. | 
| 
 | Number | The quantity of fields in rows in the sliceobject. | 
| 
 | String | The title of the rows’ first field in the sliceobject. The number ofr0Name,r1Name,r2Name, … ,rnNameis equal torAmountof the meta object. | 
| 
 | Number | The measures’ quantity in the sliceobject. | 
| 
 | String | The title of the first measure in the sliceobject. The number ofv0Name,v1Name,v2Name, … ,vnNameis equal tovAmountof the meta object. | 
Example
Assume that you have the pivot table with the following content:

Then the output of the API call
webdatarocks.getData({}, function(data) {console.log(data)})
is the following one:
{
  data: [
    {
      v0: 131295
    },
    {
      r0: "France",
      v0: 76900
    },
    {
      r0: "Germany",
      v0: 54395
    },
    {
      c0: "Bikes",
      v0: 131295
    },
    {
      c0: "Bikes",
      r0: "France",
      v0: 76900
    },
    {
      c0: "Bikes",
      r0: "Germany",
      v0: 54395
    }
  ],
  meta: {
    cAmount: 1,
    c0Name: "Category",
    formats: [
      {
        currencySymbol: "$",
        currencySymbolAlign: "left",
        decimalPlaces: 2,
        decimalSeparator: ".",
        divideByZeroValue: "Infinity",
        infinityValue: "Infinity",
        isCount: false,
        isPercent: false,
        maxDecimalPlaces: -1,
        maxSymbols: 20,
        name: "currency",
        nullValue: "",
        textAlign: "right",
        thousandsSeparator: ","
      }
    ],
    r0Name: "Country",
    rAmount: 1,
    v0Name: "Sum of Price",
    vAmount: 1:
  }
}
This data array in rawData object contains all the data from the pivot table’s slice. It includes grand totals, totals, and subtotals as well.
Objects with grand totals contain only (v0 - vN) values. In our example you can see such an object with grand totals:
{
  v0: 131295
}
Similarly, objects with totals contain either values (v0 - vN) and columns (c0 - cN ) or values (v0 - vN) and rows ( r0 - rN). The following set of objects corresponds to the example described before:
{
  r0: "France",
  v0: 76900
}, 
{
  r0: "Germany",
  v0: 54395
},
{
  c0: "Bikes",
  v0: 131295
}
Various charting libraries may have different requirements for data pre-processing before sending it from the pivot table to the charts. The data can be with grand totals, totals and subtotals or without them.