Help required - issues in number formatting and aggregations

Answered
Navaneethakrishnan Sampath asked on June 29, 2018

We’re facing some issues in number formatting and the aggregations on the measures while loading the PivotGrid. For your reference I have attached the sample code along with data, and it can be downloaded from the URL
Few details about the sample application to replicate the issue:-

  1. It’s an angular application, and the angular component to load the pivotgrids are available under path “\src\app\pages\pivotgrid\”.
  2. Internally the data is loading from the path “\src\assets\Data\”. Both the json data and the code for configuration of the Pivotgrids are loaded from the CacheJsonData.json and ConfigData.json files respectively.
  3. When executing the application it doesn’t require any credentials to login.
  4. In the left menu click on the “PivotGrid” option to load the pivotgrid components.
  5. On changing the dropdown, the different pivotgrids with different set of data can be loaded

 
Issues:-

  1. % not working correctly :

As per the documentation, if we need to have any % (percentage) column, then we need to set the following properties i.e. "formatAsPercent":"true", “isPercent":"true" in the formatter section (it is defined in \src\assets\Data\PercentageIssue\ConfigData.json).
We tried implementing it but looks like correct properties are not being assigned, and hence the % column is not working as expected. Please refer the snapshot for the issue.
  2. Sell Price column aggregation should be on average, instead it is summing up:-
Please refer the json data file \src\assets\Data\SellPriceIssue\CacheJsonData.json, which contains the actual data to load the pivot grid. As per the documentation if the aggregation has to work correctly, then the first record of the json data should have the datatype defined in it.
For the column “Sell Price”, we have defined as "Sell_Price": {      "type": "number"    },
Also in the measures in the \src\assets\Data\SellPriceIssue\ConfigData.json, we have given the aggregation as “avg”. But while loading the pivotgrid it is summing up?
 
  3. Column headers alignment:
We have a requirement in which the column headers alignment also to be defined dynamically from the config json data. Can you please clarify what is the correct way to achieve this?

Attachments:
PivotGrid.zip

1 answer

Public
Tanya Gryshko Tanya Gryshko Flexmonster June 29, 2018

Hi, Krishnan,
Thank you for writing to us!
Your detailed description of the issues with the screenshots and sample application is very helpful. Please find our comments below:
1. % not working correctly
First of all, we'd like to mention that there is no such property as formatAsPercent . "Format as percent" label is visible via UI, however, programmatically you need to specify only isPercent property. Please note, isPercent has type Boolean. This means it should be set as "isPercent": true, not "isPercent": "true". After updating ConfigData.json everything should work as expected.
2. Sell Price column aggregation should be on average, instead, it is summing up
The unique name of aggregation that will show the average value of the measure should be specified as "average", not "avg". For more details regarding other aggregation names please refer to our docs: Slice Object
3. Column headers alignment
We suggest you the following approach: use your own parameter (e.g. headerAlignment) in the config file to specify column headers alignment. When parsing the config file, apply CSS styles to change the alignment according to the value of the parameter. We have prepared a JSFiddle showing which CSS styles should be used to change column headers alignment. Please check CSS box here: http://jsfiddle.net/flexmonster/rkprvhhs/705/.
I hope the information above was useful. Please inform me in case of further questions.
Regards,
Tanya

Please login or Register to Submit Answer