All the possible aspects of pivot tables and pivot charts configuration can be set via the ReportObject. The component supports saving reports and loading previously saved ones.
You can get the report using getReport() API call. To set the report use setReport() API call.
For more details on the ReportObject usage, see this guide: Getting started with the report.
report: {
dataSource: DataSourceObject,
slice: SliceObject,
options: OptionsObject,
conditions: ConditionalFormatObject[],
formats: FormatObject[],
tableSizes: TableSizesObject,
customFields: CustomFieldObject[],
localization: string | object,
version: string,
creationDate: string
}
Property/Type | Description |
---|---|
dataSource DataSourceObject | optional Contains information about the data source. |
slice SliceObject | optional There you can define fields that go to rows, go to columns and go to measures, add filtering, sorting, report filtering, expands, and drills. |
options OptionsObject | optional Allows configuring the component's UI and specifying functionality available to users. |
conditions ConditionalFormatObject[] | optional Allows setting conditional formatting. |
formats FormatObject[] | optional Allows defining number formats. |
tableSizes TableSizesObject | optional Contains information about table sizes. |
customFields CustomFieldObject[] | optional Allows setting custom fields for Excel export or storing some additional information. They are not shown on the grid, but they will be displayed in the exported Excel table. Live example |
localization String | Object | optional Allows localizing the component. The localization property can be either inline JSON or the URL to a localization JSON file. Learn more about setting localization in this tutorial: Localizing the component. |
version String | optional It contains the current version of Flexmonster. |
creationDate String | optional Represents the date (in ISO format) of the report creation. |
Example of the ReportObject:
{
"dataSource": {
"type": "json",
"filename": "https://cdn.flexmonster.com/data/data.json",
"mapping": {
"Category": {
"hierarchy": "Item"
},
"Color": {
"hierarchy": "Item",
"parent": "Category"
},
"Size": {
"hierarchy": "Item",
"parent": "Color"
}
}
},
"slice": {
"rows": [
{
"uniqueName": "Item",
"sort": "asc"
}
],
"columns": [
{
"uniqueName": "Country",
"filter": {
"members": [
"country.[australia]",
"country.[france]",
"country.[united kingdom]"
]
},
"sort": "asc"
},
{
"uniqueName": "Business Type",
"sort": "asc"
},
{
"uniqueName": "[Measures]"
}
],
"measures": [
{
"uniqueName": "Price",
"aggregation": "sum",
"active": true,
"format": "currency"
}
],
"sorting": {
"row": {
"type": "desc",
"tuple": ["item.[cars].[red]"],
"measure": {
"uniqueName": "Price",
"aggregation": "sum"
}
}
},
"expands": {
"expandAll": false,
"columns": [
{
"tuple": ["country.[australia]"]
}
]
},
"drills": {
"drillAll": false,
"rows": [
{
"tuple": ["item.[accessories]"]
},
{
"tuple": ["item.[cars]"]
}
]
}
},
"options": {
"viewType": "grid",
"grid": {
"type": "compact",
"title": "",
"showFilter": true,
"showHeaders": true,
"showTotals": "on",
"showGrandTotals": "on",
"grandTotalsPosition": "top",
"showExtraTotalLabels": false,
"showHierarchies": true,
"showHierarchyCaptions": true,
"drillthroughMaxRows": 1000,
"showReportFiltersArea": true,
"dragging": true,
"showAutoCalculationBar": true
},
"chart": {
"type": "column",
"title": "",
"showFilter": true,
"multipleMeasures": false,
"oneLevel": false,
"autoRange": false,
"reversedAxes": false,
"showLegend": true,
"showLegendButton": false,
"showDataLabels": false,
"showAllLabels": false,
"showMeasures": true,
"showOneMeasureSelection": true,
"showWarning": true,
"activeMeasure": {}
},
"filter": {
"allowEmptyMembersFilter": false,
"weekOffset": 1,
"dateFormat": "dd/MM/yyyy",
"liveSearch": true
},
"configuratorActive": false,
"configuratorButton": true,
"showAggregations": true,
"showCalculatedValuesButton": true,
"grouping": false,
"editing": false,
"drillThrough": true,
"showDrillThroughConfigurator": true,
"sorting": "on",
"defaultDateType": "date",
"strictDataTypes": false,
"datePattern": "dd/MM/yyyy",
"dateTimePattern": "dd/MM/yyyy HH:mm:ss",
"saveAllFormats": false,
"showDefaultSlice": true,
"useOlapFormatting": false,
"showMemberProperties": false,
"showEmptyData": true,
"defaultHierarchySortName": "asc",
"showOutdatedDataAlert": false,
"showAggregationLabels": true,
"showAllFieldsDrillThrough": false,
"showFieldListSearch": false,
"validateFormulas": true,
"caseSensitiveMembers": false,
"simplifyFieldListFolders": false,
"validateReportFiles": true,
"allowBrowsersCache": false,
"showEmptyValues": false,
"distinguishNullUndefinedEmpty": false,
"useCaptionsInCalculatedValueEditor": false,
"readOnly": false
},
"conditions": [
{
"formula": "#value < 20000",
"measure": "Price",
"aggregation": "sum",
"format": {
"backgroundColor": "#F44336",
"color": "#FFFFFF",
"fontFamily": "Arial",
"fontSize": "12px",
"fontStyle": "italic",
"fontWeight": "bold",
"textAlign": "start",
"textIndent": 10
}
}
],
"formats": [
{
"name": "-currency",
"currencySymbol": "$"
}
],
"tableSizes": {
"columns": [
{
"tuple": [
"country.[australia]",
"business type.[warehouse]"
],
"measure": {
"uniqueName": "Price",
"aggregation": "sum"
},
"width": 121
}
]
},
"localization": "https://cdn.flexmonster.com/loc/es.json",
"version": "2.9.8",
"creationDate": "2021-09-22T11:54:40.925Z"
}