This is probably simple but I searched the forums and documentation and couldn’t find anything. Am I able to determine the Z-Order of my series? For example if I have a series that I always want to appear on top. It seems like this is determined by the order that I add a series to the RenderableSeries collection. My issue is that I would like a specific series to show up first in the legend, but also on top of each other series on my chart. If I add it to RenderableSeries last, it will be at the bottom of the legend. In the LegendModifier.LegendData series info objects I do not see a value I could easily set to define the order in the legend. That would really be find for the time being.
So I either need a way to define the order of the objects in the legend or their render order, and need to be able to handle multiple series (for example order by series 1-2-3, 3-2-1, 2-1-3, etc.)
I apologize if this is somewhere obvious and I missed it.
Thank you
- Matt Machalinski asked 10 years ago
- You must login to post comments
Hi there,
Thanks for the inquiry!
Concerning the request, please, take a look at this thread on this topic, also at these articles: Changing ZOrder of RenderableSeries, Selection and SelectedSeries Styling, Selected Series API. I would suggest you to play around with order of series in RenderableSeries collection..
And regarding order of series in the legend, it gets the data from LegendModifier.LegendData property. It is of type ChartDataObject and contains collection of SeriesInfo objects inside. So you could change order of its items inside binding’s value converter, based on SeriesInfo.RenderableSeries.IsSelected property.
Alternatively, you could create a custom modifier which will provide property of ChartDataObject which will be used as source for LegendControl. To do this, you need to gather info from RenderableSeries inside loop using hit-test API:
// inside custom modifier class
var seriesInfo = new ObservableCollection<SeriesInfo>();
foreach (var renderableSeries in ParentSurface.RenderableSeries)
{
// Hit test each series
var hitResult = renderableSeries.DataSeries.HasValues
? renderableSeries.HitTest(new Point(ModifierSurface.ActualWidth, 0))
: default(HitTestInfo);
// Get series info
var s = renderableSeries.GetSeriesInfo(hitResult);
seriesInfo.Add(s);
}
LegendData = new ChartDataObject { SeriesInfo = new ObservableCollection<SeriesInfo>() }
Hope this helps! Please, feel free to ask if you need more assistance with this.
Best regards,
Yuriy
- Yuriy Zadereckiy answered 10 years ago
- last edited 5 years ago
-
Yuriy, This helps a bit, but doesn't really answer my question. What if I want to order multiple series in some dynamic fashion, how would I order with two marked as IsSelected? Also, in the LegendModifier.LegendData series info objects I do not see a value I could easily set to define the order in the legend. That would really be find for the time being. So I either need a way to define the order of the objects in the legend or their render order, and need to be able to handle multiple series (for example order by series 1-2-3, 3-2-1, 2-1-3, etc.) Thank you, Matt
-
I'm sorry, I don't believe this was answered or I missed it. Is there a way to dictate the order of series either in the legend or in the rendering outside of IsSelected? Can I specify a specific order somehow, and potentially change that order dynamically?
- You must login to post comments
Please login first to submit.