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:

NameTypeDescription
dataSourceData Source Object–°ontains the information about the data source of the report
sliceSlice Objectoptional 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.
optionsOptions Objectoptional Defines the view and functionality available for users.
conditionsArray of Conditional Format Objectsoptional Used for defining conditional formatting rules.
formatsArray of Format Objectsoptional Used for defining number formatting in the component.
localizationString|Objectoptional 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"
}