googlecharts.getData
googlecharts.getData(options:Object, callbackHandler:Function, updateHandler:Function)
This method is used for integration with Google Charts. It is responsible for requesting the data from the pivot table and pre-processing it to the appropriate format for the required type of the chart. To use this method it is necessary to include the webdatarocks.googlecharts.js
library which serves as a connector between Pivot Table and Google Charts. More details can be found in the Integration with Google Charts tutorial.
Parameters
Name | Type | Description |
---|---|---|
options | Object | Options for data pre-processing. This object has the following parameters: |
| String | optional Specify the chart type to prepare the data for: "area" , "bar" , "column" , "line" , "pie" or "sankey" . The default value is "sankey" . |
| Object | optional Define the slice of data for pre-processing for the specified chart. If it is not defined, the API call will send the data displayed in the pivot table. |
| Function | optional An external function. Use it if webdatarocks.googlecharts.js does not support the necessary chart type or you need to pre-process the data differently. This function has the following parameters: rawData – raw (non-aggregated) data for sending to the chart; options – object with options defined in googlecharts.getData() . To learn more about the rawData object’s structure, turn to getData() API call documentation. |
callbackHandler | Function | This function specifies what happens after the data is ready. It has the following parameters: data and rawData (rawData is an optional argument, define it in case of special necessity: for defining number formatting in the tooltip, etc). |
updateHandler | Function | optional It is triggered when the data in the pivot table is updated, sorted or filtered. It has the following parameters: data and rawData . |
For setting a special number formatting for Google Charts, we offer to use two functions from webdatarocks.googlecharts.js
. These functions take a pivot table format object as an argument and return the formatting string in Google Charts format.
Name | Type | Description |
---|---|---|
getNumberFormat | Function | Takes the pivot table format object as an argument for format parameter and returns a format object for number formatting in Google Charts. Use this object for columns’ formatting in a DataTable, for example. |
getNumberFormatPattern | Function | Takes the pivot table format object as an argument for format parameter and returns Google Charts format pattern. Use this pattern to control the formatting of label numbers on axes. |
Example
The following sample shows how to integrate WebDataRocks Pivot Table with Google Charts and use googlecharts.getNumberFormat()
method to change the number formatting in the chart: