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.
Hello aaa bbb,
We will update the demo too.
If I can provide further assistance, feel free to contact me.
Sincerely,
Tsanna
Hello Tsanna,
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.
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.
After following the steps to reproduce the issue, I was able to reproduce it on my side too.
Currently I'm looking into this matter what could be the reason that causes the columns from every next chart to increase with one. I will update you with any available information as soon as possible.
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.