Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial
  1. API reference
  2. Welcome
    1. Component overview
    2. Get Flexmonster
    3. Quick start
    4. System requirements
    5. Troubleshooting
    6. Managing license keys
    7. Migrating from WebDataRocks to Flexmonster
  3. Integration with frameworks
    1. Available tutorials
    2. Integration with Angular
    3. Integration with React
    4. Integration with Vue
    5. Other integrations
      1. Integration with Python
        1. Integration with Django
        2. Integration with Jupyter Notebook
      2. Integration with React Native
      3. Integration with AngularJS (v1.x)
      4. Integration with TypeScript
      5. Integration with R Shiny
      6. Integration with jQuery
      7. Integration with Ionic
      8. Integration with Electron.js
      9. Integration with Webpack
      10. Integration with RequireJS
  4. Connecting to Data Source
    1. Supported data sources
    2. JSON
      1. Connecting to JSON
      2. Connecting to JSON using Flexmonster Data Server
      3. Data types in JSON
    3. CSV
      1. Connecting to CSV
      2. Connecting to CSV using Flexmonster Data Server
      3. Data types in CSV
    4. Database
      1. Connecting to SQL databases
      2. Connecting to a MySQL database
      3. Connecting to a Microsoft SQL Server database
      4. Connecting to a PostgreSQL database
      5. Connecting to an Oracle database
      6. Connecting to other databases
    5. Flexmonster Data Server
      1. Getting started with Flexmonster Data Server
      2. Installation guide
      3. Configurations reference
      4. Data sources guide
      5. Security and authorization guide
      6. The Data Server as a DLL
        1. Getting started with the Data Server as a DLL
        2. Referring the Data Server as a DLL
        3. Implementing the API controller
        4. Implementing the server filter
        5. Implementing the custom parser
        6. DLL configurations reference
        7. The controller's methods for request handling
    6. MongoDB
      1. Introduction to Flexmonster MongoDB Connector
      2. Getting started with the MongoDB Connector
      3. Embedding the MongoDB Connector into the server
    7. Microsoft Analysis Services
      1. Connecting to Microsoft Analysis Services
      2. Getting started with Flexmonster Accelerator
      3. Referring the Accelerator as a DLL
      4. Configuring the authentication process
      5. Configuring a secure HTTPS connection
      6. Troubleshooting
    8. Custom data source API
      1. Introduction to the custom data source API
      2. A quick overview of a sample Node.js server
      3. A quick overview of a sample .NET Core server
      4. Implement your own server
        1. Implementing the custom data source API server
        2. Implementing filters
        3. Supporting more aggregation functions
        4. Returning data for the drill-through view
    9. Elasticsearch
      1. Connecting to Elasticsearch
      2. Configuring the mapping
    10. Pentaho Mondrian
      1. Connecting to Pentaho Mondrian
      2. Getting started with the Accelerator
      3. Configuring Mondrian roles
      4. Configuring username/password protection
      5. Configuring a secure HTTPS connection
      6. Troubleshooting
  5. Security
    1. Security in Flexmonster
    2. Security aspects of connecting to an OLAP cube
      1. Ways of connecting to an OLAP cube
      2. The data transfer process
      3. Data security
      4. Data access management
  6. Configuring report
    1. What is a report
    2. Data source
    3. Slice
    4. Options
    5. Mapping
    6. Number formatting
    7. Conditional formatting
    8. Set the report for the component
    9. Get the report from the component
    10. Date and time formatting
    11. Configuring global options
    12. Export and print
    13. Calculated values
    14. Custom sorting
  7. Charts
    1. Available tutorials
    2. Flexmonster Pivot Charts
    3. Integration with Highcharts
    4. Integration with amCharts
    5. Integration with Google Charts
    6. Integration with FusionCharts
    7. Integration with any charting library
  8. Customizing
    1. Customizing the Toolbar
    2. Customizing appearance
    3. Customizing the context menu
    4. Customizing the grid
    5. Customizing the pivot charts
    6. Localizing the component
  9. Updating to the latest version
    1. Updating to the latest version
    2. Release notes
    3. Migration guide from 2.7 to 2.8
    4. Migration guide from 2.6 to 2.7
    5. Migration guide from 2.5 to 2.6
    6. Migration guide from 2.4 to 2.5
    7. Migration guide from 2.3 to 2.4
    8. Migration guide from 2.2 to 2.3
  10. Flexmonster CLI Reference
    1. Overview
    2. Troubleshooting the CLI
    3. flexmonster create
    4. flexmonster add
    5. flexmonster update
    6. flexmonster version
    7. flexmonster help
  11. Documentation for older versions
Table of contents

Conditional formatting

Conditional formatting is used to format a cell or a range of cells based on specified criteria. In one report, you can create as many conditions as you need and each condition can apply different formatting rules. Multiple conditional formatting rules for the report will be applied one by one in the order that they were created.

Conditional formatting rules may be added to all pivot table cells, to the cell specifying row and column indexes, to totals and subtotals only, to regular cells only, or to the cells of the selected measure, hierarchy, and hierarchy’s member.

Conditions can be defined within a report. When you save the report all the conditional formatting will also be saved and loaded when the report is retrieved.

More details about conditional formatting are available in the following sections:

Conditional format properties

With conditional formatting you can define the following: a logical expression for the rules of the condition (the formula property); style objects for cells that pass the condition (the format property); and the cells to which the condition is applied. Style objects are composed of font size, font color, font family, and background color.

Here is a list of all available properties for conditions:

  • formula – String. A condition that can contain the following logical operators: AND, OR, ==, !=, >, <, >=, <=, +, -, *, /, isNaN(), !isNaN(). #value is used as a reference to the cell value in the condition. Example: '#value > 2'.
  • format – Object. The style object that will be applied to a cell if the condition for the cell value is met. Note: when exporting to Excel and PDF, colors should be set to hex color codes.
  • formatCSS (optional, read-only) – String. Represents a ready to use CSS string of the format style object. The format style object has properties with names that differ from CSS. The component transforms format to formatCSS.
  • id (optional) – String. The id of the conditional formatting rule. If the id property is not set, the id for the rule will be set inside the pivot component.
  • row (optional) – Number. The row index to which the condition should be applied.
  • column (optional) – Number. The column index to which the condition should be applied.
  • measure (optional) – String. The unique measure name to which the condition should be applied.
  • hierarchy (optional) – String. The unique hierarchy name to which the condition should be applied. Must be used with the member property.
  • member (optional) – String. The unique member name to which the condition should be applied. Must be used with the hierarchy property.
  • isTotal (optional) – Boolean. If it is not defined, the condition will be applied to all cells. If it is set to true, the condition will be applied to total and subtotal cells only. If it is set to false, the condition will be applied to regular cells only.

Style object format

format is a style object that can have the following properties:

"format": {
    "backgroundColor": "#FFFFFF",
    "color": "#0000FF",
    "fontFamily": "Arial",
    "fontSize": "12px"
}

You can specify only the necessary properties.

If you want to export the pivot table to Excel and PDF, colors should be set to hex color codes.

Conditional formatting for all values

You need to specify the formula and format properties to apply the conditional rule to all values. You can define a format the following way:

{
    "dataSource": {
        "filename": "http://www.flexmonster.com/download/data.csv"
    },
    "conditions": [
        {
            "formula": "#value < 400000",
            "format": {
                "backgroundColor": "#FFFFFF",
                "color": "#0000FF",
                "fontFamily": "Arial",
                "fontSize": "12px"
            }
        }
    ]
}

Open the example on JSFiddle.

Conditional formatting for specific values

A formatting rule can be applied to a specific measure, hierarchy, hierarchy member, column, or row. Additionally, you can apply it only to regular cells or to totals and subtotals. For example, if you are visualizing financial data, you may want to apply conditional formatting only to regular cells with prices. See an example below:

{
    "dataSource": {
        "filename": "http://www.flexmonster.com/download/data.csv"
    },
    "conditions": [
        {
            "formula": "#value < 400000",
            "measure": "Price",
            "isTotal": false,
            "format": {
                "backgroundColor": "#FFFFFF",
                "color": "#0000FF",
                "fontFamily": "Arial",
                "fontSize": "12px"
            }
        }
    ],
    "slice": {
        "rows": [ {"uniqueName": "Category"} ],
        "measures": [
            {"uniqueName": "Price"},
            {"uniqueName": "Quantity"}
        ]
    }
}

Open the example on JSFiddle.

Change conditional formatting using the Toolbar

Go to Format > Conditional formatting in the Toolbar to change/define conditional formatting rules for values at runtime.

conditionalformatting

This conditional formatting will be applied to the specified values and will be saved within the report.

Сonditional formatting via API

The API call addCondition() is used to add or change a conditional formatting rule at runtime. You can change conditions along with other report parts using the API call setReport().