Hi, I have placed an XamDoughnutChart onto my WPF application based on the XamDoughnutChart sample app.
I wish to click on click on a segment on a ring and only show the segments that are included in that section of the ring.
How can I do this? Are there any example on how to do this?
Hello Harry,
My team and I have done an initial investigation into your requirement in this case, and I'm not entirely sure I completely understand the functionality you are looking to achieve in this case. Would it be possible for you to please provide a little more detail on what exactly is meant by this line?:
"I wish to click on click on a segment on a ring and only show the segments that are included in that section of the ring."
It sounds like you are looking to only show parts of your XamDoughnutChart, or perhaps create a drill-down behavior with this chart. Also, is your XamDoughnutChart hierarchical in this case, or is it only using a single RingSeries?
Any additional information you can provide about your requirement in this case may be helpful as well. Please let me know if you have any other questions or concerns.
Sincerely,AndrewAssociate Developer
Hi Andrew, thanks for the quick reply.
This is the example I am workign with here: https://ko.infragistics.com/community/blogs/marina_stoyanova/archive/2013/10/24/how-to-build-xaml-doughnut-chart.aspx.
I am using the Custom hierarchical chart example.
What I want to do is initially load all the data to the grid but hide the outer rings. (Only show "Accessories", "Tech", "Footware" & "Clothing".
Then when the user clicks e.g "Tech" the slices "PC", "Laptops", "Tablets" & "Phones" appear (Only them).
And if the user clicks e.g. "PC" then "PC1", "PC2" & "PC2" appear.
Are there any examples of how this can be done?
Kind Regards
Harry
Thank you for your update on this matter. It sounds like you are essentially looking for a drill-down type of behavior with the XamDoughnutChart, which is not supported out of the box. You can achieve this by traversing the visual tree of the XamDoughnutChart, though. Also, utilizing the HierarchicalRingSeries object will help you to achieve this behavior more easily than using multiple RingSeries elements.
The HierarchicalRingSeries elements have a RootCanvas property that returns their drawing Canvas. This Canvas will be full of either RingControl elements. These RingControl elements have a RootCanvas of their own which contains Arc elements. These Arcs have a ContentPresenter in their visual tree named "ContentPresenter." Using the Infragistics.Windows.Utilities class and its GetDescendantFromName method, you can obtain this ContentPresenter using the code below:
ContentPresenter cp = Utilities.GetDescendantFromName(arc, "ContentPresenter") as ContentPresenter;
The Content of this ContentPresenter is another Canvas element, which in turn has a pair of Canvas' in its Children collection. The first one contains the Slice elements for that particular Ring of the XamDoughnutChart, and you can toggle their Visibility. This will only hide the actual path element, though, and so I would recommend that you also set the Foreground property to whatever your Background color is in order to "hide" the Label as well. You can do this when the HierarchicalRingSeries loads, and hide all slices that do not exist in the first RingControl.
The DataContext of these Slice elements is the underlying data item that it represents, and so by utilizing the SliceClick event of the XamDoughnutChart, you can check the DataContext of the slice using the event arguments of the event handler and find any descendant child data items. At this point, you can loop through the XamDoughnutChart's slices using the method mentioned above and check for slices that aren't visible and have a DataContext corresponding to a data item that exists in the child collection of your clicked slice's data item. If these do exist, you can set the Foreground and Visibility properties of those slices back to the desired value.
I have attached a sample project to demonstrate the above. I hope this helps.
Please let me know if you have any other questions or concerns on this matter.
Hi Andrew thanks for your reply.
I had to alter the sample app to get it to work.
I had to add in Binding like so:
ItemsSource="{Binding Mode=OneWay, Source={StaticResource source}}"
Thank you for this it is exactly what I am after