🎉 Flexmonster Pivot Table & Charts v2.8 has arrived!Read the blog post
Get Free Trial
Get Free Trial
  1. API reference
  2. Welcome
    1. Component overview
    2. Quick start
    3. System requirements
    4. Troubleshooting
    5. Managing license keys
    6. Migrating from WebDataRocks to Flexmonster
  3. Connecting to Data Source
    1. JSON
      1. Connecting to JSON
      2. Data types in JSON
    2. CSV
      1. Connecting to CSV
      2. Data types in CSV
    3. Database
      1. Connecting to SQL databases
      2. Connecting to other databases
      3. Connecting to a database with Node.js
      4. Connecting to a database with .NET
      5. Connecting to a database with .NET Core
      6. Connecting to a database with Java
      7. Connecting to a database with PHP
    4. MongoDB
      1. Introduction to the Flexmonster MongoDB Connector
      2. Getting started with the MongoDB Connector
      3. Embedding the MongoDB Connector into the server
    5. Microsoft Analysis Services
      1. Connecting to Microsoft Analysis Services
      2. Getting started with the Accelerator
      3. Installing the Accelerator as a Windows service
      4. Referring the Accelerator as a DLL
      5. Configuring the authentication process
      6. Configuring a secure HTTPS connection
      7. Troubleshooting
    6. 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
    7. Elasticsearch
      1. Connecting to Elasticsearch
      2. Configuring the mapping
    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. Implementing the custom data source API server
      5. Implementing filters
      6. Returning data for the drill-through view
      7. Supporting more aggregation functions
  4. 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
    3. Security aspects when connecting to a database
      1. Ways of connecting to a database
      2. The data transfer process
      3. Data access management
  5. 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
  6. Integration with frameworks
    1. Available tutorials
    2. Integration with AngularJS (v1.x)
    3. Integration with Angular
    4. Integration with React
    5. Integration with React Native
    6. Integration with Vue
    7. Integration with Python
      1. Integration with Django
      2. Integration with Jupyter Notebook
    8. Integration with R Shiny
    9. Integration with Webpack
    10. Integration with ASP.NET
    11. Integration with jQuery
    12. Integration with JSP
    13. Integration with TypeScript
    14. Integration with RequireJS
    15. Integration with PhoneGap
  7. Integration with charts
    1. Integration with Highcharts
    2. Integration with Google Charts
    3. Integration with FusionCharts
    4. Integration with any charting library
  8. Customizing
    1. Customizing the Toolbar
    2. Customizing appearance
    3. Customizing the context menu
    4. 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
    9. Documentation for older versions
Table of contents

Mapping

Mapping is a process of defining how the fields contained in the data source are treated and presented within the component. For mapping in Flexmonster, you can use the Mapping Object which is a property of the Data Source.

The Mapping Object is available for all data sources but with some differences. 

For JSON, CSV, and database data, it’s possible to define field data types and captions, group fields under separate dimensions, create multi-level hierarchies and more. For SSAS and Mondrian data sources, it’s possible to set captions of dimensions and measures. For the data from Elasticsearch, it’s possible to customize hierarchies’ captions, formats, time zones, control fields’ visibility and more. 

We recommend using mapping instead of defining a meta-object for JSON or adding prefixes for CSV data since the former presents a powerful way to neatly separate a data source and its representation. Moreover, mapping provides more options than an approach with prefixes for CSV data.

For each field in the data source, you can set the following properties:

  • caption – the hierarchy’s caption.
  • type – the field’s data type. Can be:
    • "string" – the field stores string data. It can be aggregated only with count and distinctcount aggregations. Only for "csv" and "json" data sources.
    • "number" – the field stores numerical data. It can be aggregated with all the available aggregations. Only for "csv" and "json" data sources.
    • "level" – the field is a level of the hierarchy. This type is used together with other properties such as hierarchy, level, and parent. Only for "csv" and "json" data sources.
    • "month" – the field stores months. Only for "csv" and "json" data sources.
    • "weekday" – the field stores days of the week. Only for "csv" and "json" data sources.
    • "date" – the field stores a date. The field of this type is split into 3 different fields: Year, Month, Day. Only for "csv" and "json" data sources.
    • "date string" – the field stores a date. It can be formatted using the datePattern option (default is "dd/MM/yyyy"). Only for "csv" and "json" data sources.
    • "year/month/day" – the field stores a date. It’s displayed as a multi-level hierarchy with the following levels: Year > Month > Day. Only for "csv" and "json" data sources.
    • "year/quarter/month/day" – the field is a date. It’s displayed as a multi-level hierarchy with the following levels: Year > Quarter > Month > Day. Only for "csv" and "json" data sources.
    • "time" – the field stores time. It can be formatted using the timePattern option (default is "HH:mm:ss"). Only for "csv" and "json" data sources.
    • "datetime" – the field is a date. It can be formatted using the dateTimePattern option (default is "dd/MM/yyyy HH:mm:ss"). min, max, count, and distinctcount aggregations can be applied to it. Only for "csv" and "json" data sources.
    • "id" – the field is an id. The field of this type can be used for editing data. It’s not shown in the Field List. Only for "csv" and "json" data sources.
    • "hidden" – the field is hidden. The field of this type is not shown in the Field List. Only for "csv" and "json" data sources.
    • "property" – the field for setting member properties. This field is not shown in the Field List. For example, it can be used to associate a productID with a product. Only for a "json" data source. See the example.
  • hierarchy – the hierarchy’s name. This property is necessary to specify only if the field is a level of a hierarchy ("type": "level") or if the field is a member property of a hierarchy ("type": "property"). Only for "csv" and "json" data sources.
  • level – the level’s caption. This property can be specified only if the field is a level of hierarchy ("type": "level"). Only for "csv" and "json" data sources.
  • parent – the unique name of the parent level. This property can be specified only if the field is a level of hierarchy ("type": "level"). Only for "csv" and "json" data sources.
  • dimensionUniqueName – the dimension’s unique name. This property can be used to group several fields under one dimension. Only for "csv" and "json" data sources.
  • dimensionCaption – the dimension’s caption. This property specifies the name of a folder in the Field List under which several fields are grouped. Only for "csv" and "json" data sources.
  • aggregations (optional) — Array of strings that represents the list of aggregation functions that can be applied to the current measure. If it is a calculated measure, the list is [].
  • visible (optional) – Boolean. When set as false, hides the field from the Field List. Only for "elasticsearch" and "api" data source types.
  • interval (optional) – String. Used for date histogram. Only for "elasticsearch" data source type. Check out supported time units.
  • time_zone (optional) – String. Used for date histogram. You can specify timezones as either an ISO 8601 UTC offset (e.g. +01:00 or -08:00) or as a timezone ID as specified in the IANA timezone database, such as `America/Los_Angeles`. Only for "elasticsearch" data source type. Check out the example.
  • format (optional) – String. Used for date histogram. Only for "elasticsearch" data source type. Check out the date format/pattern.
  • min_doc_count (optional) – Number. Only for "elasticsearch" data source type. Used for date histogram. Can be used to show intervals with empty values (min_doc_count: 0). Default value: 1 (empty intervals are hidden).

Other ways to customize fields presentation

Another way to define how the fields are displayed in the report is by setting these configurations right in the data source. Please note that this approach is available only for CSV and JSON data sources. For more details, please refer to the Data types in CSV and Data types in JSON articles. It also should be noted that there are certain limitations in the case of CSV data source – not all the field properties can be customized using prefixes.

Thus, we strongly recommend preferring the Mapping Object to other types of fields’ customization.

Examples

1) See the demo on JSFiddle to learn how to set custom captions, hierarchy levels, and field data types in the JSON data source.

2) See the demo on JSFiddle to learn how to set custom captions, hierarchy levels, and field data types in the CSV data source.

3) See the demo on JSFiddle to learn how to set custom captions for hierarchies and measures for SSAS.

4) See the demo on JSFiddle to learn how to set custom captions for hierarchies and measures for Mondrian.