SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
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!
Please login first to submit.