Back to homepage

dataloaded

dataloaded: String

The event is triggered once the component loads data.

Example

webdatarocks.on('dataloaded', function(){
alert('Data loaded!');
});

Check out the CodePen example.

celldoubleclick: String

Triggered once a user double-clicks the cell on the grid.

Data passed to the handler

NameTypeDescription
cellCell Data ObjectContains information about the double-clicked cell.

Example

webdatarocks.on('celldoubleclick', function(cell) {
alert("Double click on cell - row: " + cell.rowIndex +
", column: " + cell.columnIndex +
", label: " + cell.label);
});

See in the demo on CodePen.

getAllMeasures():Array

Returns a list of all available measures (both active and inactive) from the report.

Returns

Returns an array of objects. Each object is characterized by the following properties:

NameTypeDescription
aggregationStringThe measure’s aggregation name.
availableAggregationsString []An array of available aggregations for the measure.
availableAggregationsCaptionsString []An array of captions of available aggregations.
calculatedBooleanReturns true if the measure is calculated.
captionStringThe measure’s caption.
formatStringThe number formatting rule name.
formulaStringRepresents a formula if the measure is calculated.
grandTotalCaptionStringThe measure’s grand total caption.
individualBooleanDefines whether the formula is calculated using raw values (true) or using aggregated values (false).
nameStringThe measure’s name.
originalCaptionStringThe measure’s original caption.
uniqueNameStringThe measure’s unique name.

Example

webdatarocks.getAllMeasures();

/* The method returns an array of objects:
[
{
aggregation: "sum",
availableAggregations:
["sum", "count", "distinctcount", "average", "product",
"min", "max", "percent", "percentofcolumn", "index",
"difference", "%difference", "stdevp",
"stdevs", "runningtotals"],
availableAggregationsCaptions:
["Sum", "Count", "Distinct Count", "Average", "Product",
"Min", "Max", "Percent", "Percent of Column", "Index",
"Difference", "% Difference", "Population StDev",
"Sample StDev", "Running Totals"],
caption: "Sum of Sales",
format: "currency",
grandTotalCaption: "Total Sum of Sales",
name: "Sales",
originalCaption: "Sales",
uniqueName: "Sales"
},
{
aggregation: "none",
availableAggregations: [ ],
availableAggregationsCaptions: [ ],
caption: "Revenue",
format: "",
formula: "SUM('Price') * SUM('Quantity')",
grandTotalCaption: "Total Revenue",
name: "Revenue",
originalCaption: "Revenue",
uniqueName: "Revenue"
}
]
*/

Try on CodePen.

See also

getAllHierarchies():Array

Returns a list of all available hierarchies from the report.

Returns

Returns an array of objects. Each object is characterized by the following properties:

NameTypeDescription
captionStringThe field caption.
uniqueNameStringThe unique field name.

Example

webdatarocks.getAllHierarchies();

/* The method returns an array of objects:
[
{caption: "Month", uniqueName: "Month"},
{caption: "Region", uniqueName: Region"},
{caption: "Country", uniqueName: "Country"}
]
*/

Try on CodePen.

See also

getAllConditions():Array

Returns a list of all the rules for conditional formatting of the current report. This API call is most commonly used for editing existing conditional formatting rules.

Returns

Returns an array of Conditional Format Objects.

Example

Get all the conditional formatting rules from the report:

var conditions = webdatarocks.getAllConditions();

Try on CodePen.

See also

removeSelection()

Clears the selection from the cells on the grid.

Example

webdatarocks.removeSelection();

Try out on CodePen.

See also

getSelectedCell(): Cell Data Object | Array of Cell Data Objects

Returns all the information about the structure of the selected cell.

Returns

Cell Data Object that contains information about the selected cell. If multiple cells are selected, the method returns an array of Cell Data Objects.

Example

webdatarocks.getSelectedCell();

Try out on CodePen.

See also

getCell(rowIdx: Number, colIdx: Number): Cell Data Object

Returns all the information about the cell identified by the row and column indices.

Parameters

NameTypeDescription
rowIdxNumberSpecifies the index of the row to which the cell belongs.
colIdxNumberSpecifies the index of the column to which the cell belongs.

Returns

Cell Data Object that contains information about the requested cell.

Example

webdatarocks.getCell(2, 1);

Try out on CodePen.

See also

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

This method is used for integration with FusionCharts.

It gets the data from the pivot table and pre-processes it to the appropriate format for the required chart’s type.

To use this method, add the webdatarocks.fusioncharts.js library to your application. It serves as a connector between WebDataRocks Pivot Table and FusionCharts and handles the data processing.

You can find the full list of the chart’s types supported by WebDataRocks in the Integration with FusionCharts tutorial.

Parameters

NameTypeDescription
options Object Describes options for data pre-processing. It has the following parameters:
  • type
String optional Specifies a chart’s type to prepare the data for. The default value is "line".
  • slice
Object optional Specifies the slice of data that needs to be pre-processed for the specified chart. If not set, the method sends the data that is currently displayed in the pivot table.
  • prepareDataFunction
Function optional An external function. Use it if webdatarocks.fusioncharts.js does not support the specified chart’s type or you need to pre-process the data in a custom way. This function takes raw (non-aggregated) data from the table as rawData parameter and an object with options defined in fusioncharts.getData() as options parameter. Find more details about rawData‘s structure in the documentation
callbackHandler Function Specifies what happens when the data is ready. It has the following parameters: data – data that is ready to be used in the chart and rawData (optionally) – the raw data that is passed in case you need to get access rawData.meta properties, e.g., for defining number formatting.
updateHandler Function optional Triggered when the data in the pivot table is updated, sorted or filtered. It has the following parameters: data and rawData.

Number formatting for charts

WebDataRocks Connector for FusionCharts provides an API call fusioncharts.getNumberFormat(format:Object) – Object. This method takes a format object of a pivot table as an input parameter and returns a format object for number formatting in FusionCharts. It can be used in prepareDataFunction when you need to set the pivot table’s number formatting to the chart.

The response object has the following properties:

  • decimalSeparator
  • decimals
  • forceDecimals
  • numberPrefix
  • thousandsSeparator

Example

fusioncharts.getNumberFormat() can be used in prepareDataFunction as follows:

var format = pivot.fusioncharts.getNumberFormat(data.meta.formats[0]);

for (var prop in format) {
output.chart[prop] = format[prop];
}

cellclick: String

Triggered once a user clicks the cell on the grid.

Data passed to the handler

NameTypeDescription
cellCell Data ObjectContains information about the clicked cell.

Example

webdatarocks.on('cellclick', function(cell) {
alert("Click on cell - row: " + cell.rowIndex +
", column: " + cell.columnIndex +
", label: " + cell.label);
});

See in the demo on CodePen.

Move up