Hi
I have a requirement to implement Hierarchical XamDoughnutChart where the width of each segment is based on value1 and the color is based on value2 of ItemSource ( for example market value and priceChange) , and as values change, segments width and colors need to be changed. Heatmap + Hierarchical XamDoughnutChart chart ;)
(see top chart image)
IG new hierarchical XamDoughnutChart (v15.1) allows me easily display hierarchical data based on value1 , but I can not find way to access/assign specific segment color brush
(see bottom chart image)
Any help will be greatly appriciated
best regards,
Dmitri
Hello Dmitri and thank you for posting!
I have been looking into this and created a sample application to illustrate how a specific slice could be accessed. By setting its Background property to a SolidColorBrush with a specific color you can change the default look like this:xamDoughnutChart1.Rings[0].ArcItems[0].SliceItems[0].Slice.Background = new SolidColorBrush(Colors.YellowGreen);Let me know if I can assist you with anything further.
Hi Maria
Thank you for quick reply.
Your example changes background color in Loaded event handler
private void xamDoughnutChart1_Loaded(object sender, RoutedEventArgs e)
{
xamDoughnutChart1.Rings[0].ArcItems[0].SliceItems[0].Slice.Background = new SolidColorBrush(Colors.Red);
}
See image #1
However, if I try to resize window (and it resize chart) than color returns back to some predefined color.
See image #2
Questions:
1.What needs to be done to keep color I defined for specified slice?
2.What is the best way to find a slice associated with ItemSource it is bound to?
xamDoughnutChart1.Rings[0].ArcItems[0].SliceItems[0]. is not a very elegant solution because by data does not know binding details
Best regards,
Dmtiri
Hello Dmitri,
I am just checking if my last reply was helpful for you.
If you require any further assistance, please do not hesitate to ask.
Here is a modified sample for the same. It illustrates how the RingSeries’s brushes collection could be changed by handling the RingSeries loaded event and how to access the data context of the slice. Here is a blog post where Marina, has shared some additional information on the slices’ styling: http://es.infragistics.com/community/blogs/marina_stoyanova/archive/2013/10/24/how-to-build-xaml-doughnut-chart.aspx. I hope it will be helpful for you. If you have any other questions on the matter, do not hesitate to ask.