Helo there, I hope my subject isn't too general.
I was experimenting with your trial and came across the pivotgrid with the dataselector, it works pretty well, I could reproduce some examples and experiment some new things, but then I came across this situation. I would also need the information displayed in the table on a chart too. I saw that you have an example for this, it works well, but as I see, with two conditions.
You cant drag another item to rows, columns and only the rowheaders can expand.
In my case I would need it to work like this example https://www.igniteui.com/pivot-grid/overview but with a chart. Is it possible ?
I'm facing problems with these two examples together because when you expand rows and columns, the row or column with colspan mess things up.
If there isn't a way to work with your chart, is there any way I could retrieve the information from the grid to put it in a chart ? I tried to work with the codes from the examples (adapting it a little, debugging) but without success either.
Is there a way to retrieve the data from the grid ? Or I don't know, get the items dragged to the grid and then access their data ? Or get the two examples to work together ?
Cheers
Hello,
I have looked into the specified samples and what I could share is (in the context of this online sample )
$pivotGrid.data("igPivotGrid")._tableView is the igPivotGrid’s data, which could be used for the igDataChart as a dataSource. In the sample, you could find the updateChart function to accept both the tableView and transpose. Also a check is made and if the data is not appropriate - igDataChart is destroyed and created anew. This function should be different for any particular scenario, depending on the rows and columns items in the igPivotGrid.
So summarizing,
Is there a way to retrieve the data from the grid ?
I suggest referring to the $pivotGrid.data("igPivotGrid")._tableView, and further building the necessary custom functionality based on the online sample .
Well, first thanks for the reply.
I'll try to be more specific about my case.
My table look like this now: https://i.imgur.com/WxwQXnX.jpg
Sellers and periods expanded. My problem is the cell marked in the image below:
https://i.imgur.com/DgQtAGG.jpg
And then the chart looks like this:
https://i.imgur.com/hNdlljJ.jpg
Did you get the problem ? I was wondering if there is a workaround for this kind of thing.
Hope you can do better than I did. Also, did you try to drag another fields to columns, measures... as I showed in my example ? Expanding rows and columns results in something worse than your graph.
Hello aaa bbb,
As far as I can see you're using the following sample: https://www.igniteui.com/pivot-grid/chart-integration to base your application on. And I can't understand what concerns you about displaying the pivot grid data in chart. On my side everything seems to work correctly. Regarding the "All Sellers" level that acts as multi-column header, please note that this is the default layout configuration of the pivot grid and it works this way. You can see that the sample code from the API documentation demonstrates the same look: https://www.igniteui.com/help/api/2014.1/ig.OlapFlatDataSource
If I can provide further assistance, feel free to contact me.
Sincerely,
Tsanna
Hello Tsanna,
I think you didn't really try to reproduce the problem. Yes, I'm using that example of integration together with this other sample of pivot grid that you provided.
I don't remember how the columns/rows are arranged by default in the sample that I posted, but to reproduce the problem you must drag all period to rows, unit solds as measure and sellers to the column. If you expand only the sellers, then you'll have the same graph as Ivaylo which is already wrong as he posted. AND, if you expand the rows (periods), then you'll get the same ugly graph that I got. Do you get it now ? You can see that it has a problem just by looking at the end of the groups. For "All Periods" you'll have 1 bar more than you should, for the next you'll have 2 more and so on.
Also, I'm not telling you must modify or remove the "All Sellers" header, I was just pointing that because of it, the error was ocurring.
Thanks in advance.
After further testing, I found that the logic that is related to the adding of the respective columns to the chart is not correct. It seems that "All Sellers" column that spans all columns under it (seller's names) is added to the chart with 0 value at last position, although the last column should be the one that summarizes all sellers data. Therefore I've added the following code to the updateChart function:
for (i = 0; i < columnCount; i++) { if (typeof columnHeaders[i].columnSpan === "function" && columnHeaders[i].columnSpan() > 1) { continue; }
actualColumnsCount++; }
It iterates through the columns and checks whether the respective columnHeader spans more than one other columnHeader. If true, then the columnHeader is skipped (not added to the chart). Now the chart displays the data the way that it should be. I'm attaching the sample with these modifications for your reference.
If you have any questions, please let me know.
Apparently it works great. Are you planning to update the demo too ? I'm sure a lot of people would like this to work for them too.
No more questions for now, thank you very much Tsanna and Ivaylo.
We will update the demo too.