Flexmonster Pivot Table and Charts Component has a lot of configuration options. It can be configured via configuration XML file. By default it is called config.xml.
Configuration XML file is responsible for the following Pivot Table aspects:
Flexmonster Pivot Table supports different data sources, such as: CSV, Mondrian, and Microsoft Analysis Services.
The tag <dataSource> of configuration XML file is responsible for data source configuration.
To connect Pivot Table component to your CSV data source, you should accomplish the following steps:
<config>
...
<dataSource type="CSV">
</dataSource>
...
</config>
<config>
...
<dataSource type="CSV">
<filename>data/data.csv</filename>
</dataSource>
...
</config>
To connect Pivot Table component to Mondrian, you should accomplish the following steps:
<config>
...
<dataSource type="Mondrian">
</dataSource>
...
</config>
<config>
...
<dataSource type="Mondrian">
<dataSourceInfo>Provider=Mondrian;DataSource=MondrianFoodMart;</dataSourceInfo>
</dataSource>
...
</config>
<config>
...
<dataSource type="Mondrian">
<dataSourceInfo>Provider=Mondrian;DataSource=MondrianFoodMart;</dataSourceInfo>
<catalog>FoodMart</catalog>
</dataSource>
...
</config>
<config>
...
<dataSource type="Mondrian">
<dataSourceInfo>Provider=Mondrian;DataSource=MondrianFoodMart;</dataSourceInfo>
<catalog>FoodMart</catalog>
<cube>Sales</cube>
</dataSource>
...
</config>
<config>
...
<dataSource type="Mondrian">
<dataSourceInfo>Provider=Mondrian;DataSource=MondrianFoodMart;</dataSourceInfo>
<catalog>FoodMart</catalog>
<cube>Sales</cube>
<proxyUrl>http://extranetold:8080/mondrian/xmla</proxyUrl>
</dataSource>
...
</config>
To connect Pivot Table component to Microsoft Analysis Services, you should accomplish the following steps:
<config>
...
<dataSource type="MSOLAP">
</dataSource>
...
</config>
<config>
...
<dataSource type="MSOLAP">
<dataSourceInfo>Provider=MSOLAP; Data Source=extranet;</dataSourceInfo>
</dataSource>
...
</config>
<config>
...
<dataSource type="MSOLAP">
<dataSourceInfo>Provider=MSOLAP; Data Source=extranet;</dataSourceInfo>
<catalog>Adventure Works DW Standard Edition</catalog>
</dataSource>
...
</config>
<config>
...
<dataSource type="MSOLAP">
<dataSourceInfo>Provider=MSOLAP; Data Source=extranet;</dataSourceInfo>
<catalog>Adventure Works DW Standard Edition</catalog>
<cube>Adventure Works</cube>
</dataSource>
...
</config>
<config>
...
<dataSource type="MSOLAP">
<dataSourceInfo>Provider=MSOLAP; Data Source=extranet;</dataSourceInfo>
<catalog>Adventure Works DW Standard Edition</catalog>
<cube>Adventure Works</cube>
<proxyUrl>http://10.14.2.102/olap/msmdpump.dll</proxyUrl>
</dataSource>
...
</config>
You can create a predefined report via XML configuration; define columns, rows, values, and filters to get exact data you need immediately after the Pivot Table is opened. The tag <defaultSlice> of configuration XML file is responsible for this. The structure of <defaultSlice> is the same for CSV and OLAP data sources.
The <defaultSlice> block has 2 groups of tags:
<defaultSlice><axes></axes><axis name="rows">
...
</axis>
<axis name="columns">
...
</axis>
<axis name="pages">
...
</axis><measures></defaultSlice>
...
</measures>
To create the predefined report you have define which fields from your data source you would like to see in rows, which in columns, create a filter for them if needed, and define which values should be shown.
Rows, columns and values are required.
To define the field for rows, you should add the <hierarchy> block with its description to <axis name="rows">. You can add to rows as much fields as you like. For example, if you want to see in predefined report 2 fields: Country and Color, the <axis name="rows"> block would be the following:
<axis name="rows">
<hierarchy></axis>
<dimensionName>[Country]</dimensionName></hierarchy>
<hierarchyName>[Country].[Country]</hierarchyName>
<hierarchy>
<dimensionName>[Color]</dimensionName></hierarchy>
<hierarchyName>[Color].[Color]</hierarchyName>
To define the field for columns, you should add the <hierarchy> block with its description to <axis name="columns">. You can add to columns as much fields as you like.
<axis name="columns">
<hierarchy></axis>
<dimensionName>[Category]</dimensionName></hierarchy>
<hierarchyName>[Category].[Category]</hierarchyName>
Define which values you would like to be shown on the report. You can add several values.
<measures>
<measure>[Measures].[Price]</measure></measures>
<measure>[Measures].[Quantity]</measure>
Also, you have to specify where measures should be shown, on rows or on columns. For example, you the following code shows how to add measures to columns:
<axis name="columns">
<hierarchy></axis>
<dimensionName>[Category]</dimensionName></hierarchy>
<hierarchyName>[Category].[Category]</hierarchyName>
<hierarchy>
<dimensionName>[Measures]</dimensionName></hierarchy>
<hierarchyName>[Measures]</hierarchyName>
Report filter, aggregations for values and filter data are optional.
You can configure the report filter. It gives an ability to filter the entire report based on the selected field in the report filter.
To define the field for report filter, you should add the <hierarchy> block with its description to <axis name="pages">. You can add to report filter as much fields as you like. For example, if you want to have predefined report filter on Destination field, the <axis name="pages"> block would be the following:
<axis name="pages">
<hierarchy></axis>
<dimensionName>[Destination]</dimensionName></hierarchy>
<hierarchyName>[Destination].[Destination]</hierarchyName>
This option is available only for CSV data sources.
You can define an aggregation for each value you add by setting aggregation property of <measure> tag. For example,
<measure aggregation="Count">[Measures].[Quantity]</measure>
The following aggregation functions are available for CSV data source:
| Function | Summarizes |
|---|---|
| Sum | The sum of the values. This is the default function for numeric data. |
| Count | The number of data values |
| Average | The average of the values |
| Max | The largest value |
| Min | The smallest value |
| Product | The product of the values |
| Percent | Values in percent |
You can filter data both on rows and on columns in the Pivot Table report. Filters are additive ('AND' filters), and can be applied to any field from rows or columns. Each additional filter reduces the subset of data.
Each <hierarchy> tag can have additional <filter> block which includes all the members of the field which would be included into report.
For example, if you would like to add filter to Color field, you should add <filter> tag, as it is shown below, and add to it all the members which you would like to be shown:
<axis name="rows">
<hierarchy></axis>
<dimensionName>[Color]</dimensionName></hierarchy>
<hierarchyName>[Color].[Color]</hierarchyName>
<filter>
<member>[Color].[Color].[red]</member></filter>
<member>[Color].[Color].[green]</member>
UI configuration block of XML configuration consists of the following 3 parts:
Skins and visual appearance can be controlled with easy-to-edit CSS and images. To define the path to CSS file, <style> tag of XML configuration file is used:
<style source="original.css"/>
To get more information on Pivot Table CSS please read CSS for Pivot Table Skins and Visual Appearance.
You can easily configure UI, define which UI elements are needed and which ones should be turned off using <params> tag.
You can enable or disable via XML configuration file the following set of visual elements:
<param name="configuratorActive">on</param>
<param name="configuratorButton">off</param>
<param name="viewType">grid</param>
<param name="chartType">line</param>
<param name="showChartZeroValues">on</param>
<param name="showHeaders">on</param>
<param name="fitGridlines">off</param>
<param name="showTotals">on</param>
<param name="showGrandTotals">on</param>
<param name="expandAll">off</param>
<param name="saveReportURL"><![CDATA[http://localhost/flex_demos/save.php]]></param>
<param name="localSettingsURL">local_settings.xml</param>
<param name="exportHTMLTemplateURL">styles/misc/export.html</param>
<param name="emptyDataWarning">off</param>
<param name="chartTitle">Revenue</param>
The example of <params> block of XML configuration file:
<params>
<param name="configuratorActive">on</param>
<param name="configuratorButton">off</param>
<param name="viewType">grid</param>
<param name="chartType">line</param>
<param name="showChartZeroValues">on</param>
<param name="showHeaders">on</param>
<param name="fitGridlines">off</param>
<param name="showTotals">on</param>
<param name="showGrandTotals">on</param>
<param name="expandAll">on</param>
<param name="saveReportURL"><![CDATA[http://localhost/flex_demos/save.php]]></param>
<param name="localSettingsURL">local_settings.xml</param>
<param name="exportHTMLTemplateURL">styles/misc/export.html</param>
<param name="emptyDataWarning">off</param>
<param name="chartTitle"></param>
</params>
To set values formatting the <format> tag is used. Each <format> tag can have name, for example: <format name="currency">. If the <format> tag has no name, it is default format. The following parameters of values formatting can be set:
<format name="currency">
<param name="thousandsSeparator"><![CDATA[ ]]></param></format>
<param name="decimalSeparator"><![CDATA[.]]></param>
<param name="decimalPlaces">3</param>
<param name="maxSymbols">20</param>
<param name="currencySymbol">$</param>
<param name="currencySymbolAlign">left</param>
<param name="nullValue"><![CDATA[no value]]></param>
To apply different formats you should do the following changes in the configuration XML file:
<format name="number">
<param name="thousandsSeparator"><![CDATA[ ]]></param></format>
<param name="decimalSeparator"><![CDATA[.]]></param>
<param name="decimalPlaces">2</param>
<param name="maxSymbols">20</param>
<param name="currencySymbol"></param>
<param name="currencySymbolAlign">left</param>
<param name="nullValue"><![CDATA[ ]]></param>
<format name="currency">
<param name="thousandsSeparator"><![CDATA[ ]]></param></format>
<param name="decimalSeparator"><![CDATA[.]]></param>
<param name="decimalPlaces">3</param>
<param name="maxSymbols">20</param>
<param name="maxDecimalPlaces">2</param>
<param name="currencySymbol">$</param>
<param name="currencySymbolAlign">left</param>
<param name="nullValue"><![CDATA[no value]]></param>
<measures><measure format="currency">[Measures].[Price]</measure></measures>
<measure format="number">[Measures].[Quantity]</measure>