SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
I have 4 or 8 series on screen and I want to select 1 of them to display some info about it.
How can I use the SeriesSelectionModifier with MVVM and also change the color of the selected serie.
Is it also possible to get an event when the selection has been changed?
I started with:
SeriesSelectionModifier seriesSelectionModifier = new SeriesSelectionModifier();
But don’t know how to continue.
Thanks in advance,
First of all, SeriesSelectionModifier is used for selecting series on chart by mouse. If you want select series from ViewModel, you just need to set IsSelected=True for this series(IsSelected is defined in IRenderableSeries). There is also SelectedSeriesStyle property, so you should set SeriesColor to color value you want to have when the series is selected there. Also IRenderableSeries has defined SelectionChanged event, and there is SelectedRenderableSeries property of type ObservableCollection defined in SciChartSurface, so you can subscribe to listen SelectionChanged event for each of the renderable series, or to CollectionChanged event of SelectedRenderableSeries (you need to have such a property in your ViewModel and bind it by One-way binding to surface’s property).
Therefore, what we have:
Please, don’t hesitate to ask if you have any questions!
this example is a but dated. I have a button on my legend that is intended to allow the users to select all the series or deselect all the series. the button essentially goes through the renderable series view models and set the IsSelected to either true or false, this approach doesnt work. what is the best solution to accomplish this?
Please login first to submit.