SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

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

  • You must to post comments
0
0

Hi there,

Thanks for the inquiry!

First of all, I would suggest you to use google search, as it indexes forums really well and works much better than internal search. We are working on improving the site now to improve users experience with it.

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

  • Matt Machalinski
    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
  • Matt Machalinski
    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 to post comments
Showing 1 result
Your Answer

Please first to submit.