Hi there,
Following your example “Change Render Series Type” I’d like to know if there is a straightforward way of extending it to include the XyScatterRenderSeries? I’d like to be able to have relatively the same styled appearance when selected and toggled between a FastLineRenderableSeries and an XyScatterRenderableSeries but am uncertain of how this would be accomplished. I apologize in advance if the answer is obvious, I’m quite new to this whole WPF, C#, MVVM thing and any help would be appreciated.
Matt
- Matt Brown asked 10 years ago
- You must login to post comments
Hi Matt,
To change a renderable series type is as simple as swapping the RenderableSeries type and assigning the data series. For instance:
var data = new XyDataSeries<double, double>();
var lineSeries = new FastLineRenderableSeries() { DataSeries = data };
sciChartSurface.RenderableSeries.Add(lineSeries);
// Swap for scatter series
var scatterSeries = new XyScatterRenderableSeries() { DataSeries = data };
scatterSeries.PointMarker = new EllipsePointMarker();
sciChartSurface.RenderableSeries[0] = scatterSeries;
To do this in MVVM you need to have some way to control the swapping of renderable series in the viewmodel. There are many ways to do this.
We have an FAQ called Switching Chart Type (RenderableSeries) at runtime which details a few of the ways. We provide an API called the SeriesSource API which lets you bind pairs of RenderableSeries / DataSeries to a viewmodel, and we also present a pure MVVM solution which binds only to POCO (Plain Old Clr Objects) in viewmodels and dynamically creates RenderableSer
Take a look at that article and let me know what you think,
Best regards,
Andrew
- Andrew Burnett-Thompson answered 10 years ago
- You must login to post comments
Hello again! Thanks for the response! I’m attempting to use a Collection of ChartSeriesViewModels to bind to my chart, how do I remove a specific instance from the collection/chart or select the current series on the chart so that I might modify its properties (specifically its line type)?
Also how might I leverage the SeriesSelectionModifier to give the effect of a selected series after the series type is changed. The idea is to have multiple series of different colors on a graph and allow for the selection of a lineSeries (it should be highlighted on selection, maybe change the SeriesColor to White) then the user can choose to view the points as a scatter plot but I’m having trouble maintaining the original series color to use as the fill for the point markers with a white stroke to denote that it is still the selected series, when the series is deselected the stroke should return to the original SeriesColor. Any advice on how to accomplish this?
- Matt Brown answered 10 years ago
-
Hi Matt, ChartSeriesViewModel has two properties - RenderableSeries, DataSeries. Simply change the RenderableSeries property to another type of r-series, and raise PropertyChanged, and the SciChartSurface should pick up the change. Does this not occur? SelectedSeries - you don't need the modifier, just a BaseRenderableSeries.SelectedSeriesStyle and to set the BaseRenderableSeries.IsSelected property = true. Does this help?
- You must login to post comments
Sorry didn’t see your last post there, never mind the never mind. lol
- Matt Brown answered 10 years ago
- You must login to post comments
Thanks for the quick reply and for taking time out for a newbie like me!!! I’ll give this a try and let you know if I have any more questions.
- Matt Brown answered 10 years ago
-
no probs, glad to be of help!
-
Sorry to keep nagging but I'm still a little confused as to where/how to set the BaseRenderableSeries.SelectedSeriesStyle property could you give an example? Also how can I get the index of the specific view model in the collection on selection of the series?
-
Hi Matt, no problem at all! Please see http://support.scichart.com/index.php?/Knowledgebase/Article/View/17185/28/series-selection-and-selected-series-styling for using the selected series style. Please also see the Series Selection demo in our examples suite for a demo https://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/InspectDatapoints/SeriesSelectionExampleView.xaml. You do not need to have the SeriesSelectionModifier to visually show a series as selected, just set the *RenderableSeries.SelectedSeriesStyle and then set *RenderableSeries.IsSelected = true to switch over to that style. The SeriesSelectionModifier just wraps these up into a nice point & click to select API. Hope this helps!
- You must login to post comments
Never mind I think I’ve got it thanks.
- Matt Brown answered 10 years ago
- You must login to post comments
Please login first to submit.