A report object contains all configurations for a pivot table. This includes:

  • which data to show
  • how to show it
  • conditional formatting rules
  • number formatting
  • localization

Properties

Report object has the following properties:

Name Type Description
dataSource Data Source Object –°ontains the information about the data source of the report
slice Slice Object optional Defines which fields should be placed into the rows, columns, and measures. Besides, it contains information about the filtering, sorting, expands, drills and report filtering features.
options Options Object optional Defines the view and functionality available for users.
conditions Array of Conditional Format Objects optional Used for defining conditional formatting rules.
formats Array of Format Objects optional Used for defining number formatting in the component.
localization String|Object optional Sets a localization. For more details, refer to language localization tutorial.

Example of a report

{
    "dataSource": {
        "dataSourceType": "csv",
        "filename": "https://cdn.webdatarocks.com/data/data.csv"
    },
    "slice": {
        "rows": [
            {
                "uniqueName": "Country"
            }
        ],
        "columns": [
            {
                "uniqueName": "Color"
            },
            {
                "uniqueName": "Measures"
            }
        ],
        "measures": [
            {
                "uniqueName": "Price",
                "aggregation": "sum",
                "format": "currency"
            },
            {
                "uniqueName": "Discount",
                "aggregation": "sum",
                "format": "currency"
            }
        ]
    },
    "options": {
        "grid": {
            "showGrandTotals": "off"
        }
    },
    "conditions": [
        {
            "formula": "#value > 350000",
            "format": {
                "backgroundColor": "#0598df",
                "color": "#FFFFFF"
            }
        },
        {
            "formula": "AND(#value > 1000, #value < 3000)",
            "format": {
                "backgroundColor": "#f45328",
                "color": "#FFFFFF"
            }
        }
    ],
    "formats": [
        {
            "name": "currency",
            "thousandsSeparator": ",",
            "decimalPlaces": 2,
            "currencySymbol": "$",
            "currencySymbolAlign": "left"
        }
    ],
    "localization": "https://cdn.webdatarocks.com/loc/es.json"
}