I have a page with RadPivotGrid along with RadHtmlChart.
RadPivotGrid is getting populated programmatically with additional PivotGridColumnFields & PivotGridAggregateFields. (see attached)
Now, I need to generate an charts based on the RadPivotGrids data, however I am unable to set the binding to Chart with PivotGrid as source.
Does anybody have tried this before and can explain how shall I move ahead with this?
10 Answers, 1 is accepted
It all depends on your data and what you need. If might be possible. If is needed you may create additional object that work with both controls.
The issue I am currently struggling with is to bind the same Chart from RadPivotGrid's columns.
I am binding the RadPivit with a data source with 5 columns and rendering a pivot with 8 columns (additional 3 columns are being added programatically as PivotGridColumnFields & PivotGridAggregateFields.
Now , I wish to assign these additional columns as data source to my Charts.
Is there any blog/article/demo available for such bindings, as I did not found any?
Appreciate your comments.
An online example for retrieving value from RadPivotGrid and displaying them in a chart is available in the following link:
As you will notice, the cell values are retrieved within the OnCellDataBound event of the RadPivotGrid.
Hope this helps.
I have already checked this demo, the difference here is you are binding the original plain data source as it is to Pivot without any additional Aggregate columns in it.
This works well if we Bind the chart with original datasource with column series.
In my case (see attached) the chart binding is required on row level against the specific column(in this case Type as Online / Reservation / Walk-In).
Could you pls explain more on row-series binding against a specific column only?
I can not change the Rad Pivot rendering as its been finalize as standard export format in excel, hence the struggle to get the chart working.
Awaiting your response.
Is there any workaround pls, any help is appreciable.
You could use the same principal for retrieving the relevant columns and rows for each data cell, but you may need to modify the logic for binding to the chart as per your exact requirements:
Please note that rowName and columnName will hold the nested rows and columns, separated by " / ".
This logic is already been tried & works well for scenario where single rows are considered.
See my earlier attachement where in our case Pivot having multiple rows of Countries, now in this case binding grand total against each country rows
is the challenge.
More over, with above code snippet we can not reterive Grand Total rows/columns count ( or am I not cognizant on how to retrive those).
Attached is the sample project with dummy data for your kind reference .As you can see per Pivot Cell Bound event the Chart binding is not as expected.
We need to bind 2 charts as -
Chart 1 : Brand wise Total Count (See attached )
Chart 2 : Within single brand HOtel wise Total counts ( see attached)
Code location : https://www.dropbox.com/s/ax4h4i8darqm8so/RadPivotGridSample.zip?dl=0
Pls advise how do we achieve to retrieve specific rows/columns as highlighted.
Did you manage to look at this piece of thread pls. Yet we are not able to find a way to bind the chart as desired.
Looking for any workaround if possible
The OnCellDataBound event will fire for all cells and it is all a matter of custom handling. If you need to retrieve only the main level totals you could use the dataCell.ParentRowIndexes when the count of the objects equals 2 (for aloft and The Ritz-Carlton totals).
Please note that the ParentRowIndexes will contain all nested rows values, so you can retrieve the information that you need based on them.