pivot tips and tricks anyone ?

Let’s say that a server side service provides us with a json array of product sales on a daily basis.
Using pivot tables these data are represented on month or year basis and we display a corresponding chart.
Since this kind of representation is usually done for comparative reasons the difference between months or years (amount and %) is very important.

I cannot configure if and how this can be done.
Any ideas ?

Hello,

Sorry, but the issue is not clear enough. Could you provide more details ? if it is possible, please send a link to a picture that shows your idea.

Well, You prepare json data so that you can easily summarize them which means every dimension has to be one atribute in your object. So, lets say: [{year:2014,user:A,Sales:15,counter:1},{year:2014,user:B,Sales:15, counter:1}] I use counter as sum column.

So, all that is important to you put in every object. If it does not exist then use empty string or 0 in case of numbers. At the end, generate your pivot with given dimensions. You can put time dimensions as columns, using grouping webix options and in rows what you compare.

Then, the most important part is to make your pivot “clickable”. I made very powerfull tool with pivot because users can click numbers inside the pivot and I am able to retrieve rows that generates those numbers. Then you use result to make new window webix or datatable under or aside your pivot with details behind clicked value. I splited screen into two rows where first row is the pivottable and second row contains template:"

". When user clicks inside the pivot, the “onItemClick” will loop the data in order to find what generates the number. To do that, you need to use pivot.config and find which columns and rows are affected and then loop the data searching for those values.

The second row is clickable and editable as well so user can manipulate the data as “live” mode where I use ajax comunication with server. With click inside the datatable it is possible to make modal popup window which basically allows you three steps from pivot to final data.

My advice is that you spend 90% of your time thinking how to prepare the data in your json and then to use remaining 10% for programing. Webix is extremly fast and responsive and if you know how to use jquery than it is easy to make loops and background calculations where you compare data and show them.

Arnes > Thank you for your elaborated answer. Let me digest it and perhaps I will come back for some clarifications.

Maria > Thank you for your interest. I’ll post an example.

Hi Maria, this is an article about what I’m looking for http://chandoo.org/wp/2012/11/06/monthly-values-and-changes-pivot-table/

Hi,

There is not an easy solution to achieve the result you need. Pivot allows to define functions for custom grouping. And you need to add new columns in pivot after grouping to use results for value calculations.

Webix Team can create a demo with similar pivot (without popup for dynamic configuration). But the task is not trivial and is somewhat complex to code. So, if you have active support, please contact Webix support for such a demo.

Not directly related, but how would you configure “without popup for dynamic configuration”?

Dear Maria,

I am using Pivottable ,when I setting datatable form json data ,the datafiled
value empty will auto parse to number zero ?? why? how to fix?

Hello,

we made a fix for empty values in Pivot. But unfortunately, it is not in the official build yet. We will definitely add it into the next update (in 3-4 weeks). If you have a support subscription, please open a ticket in the members area - we can send fixed build.