Pre loader

"Change Render Series Type" with XyScatterRenderableSeries

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

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

  • You must to post comments
1
0

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

  • You must to post comments
1
0

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?

  • Andrew Burnett-Thompson
    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 to post comments
0
0

Sorry didn’t see your last post there, never mind the never mind. lol

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

Never mind I think I’ve got it thanks.

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.