Pre loader

How can I overlay multiple traces on a chart?

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

0
0

I’ve developed a chart that plots a number of line series (typically up to 16). The chart works in a “sweep” motion – when the lines reach the r.h. side they start again from the left. This is accomplished by populating the series with the appropriate number of points (known in advance), then sequentially updating the series values as the data arrives from the external source. This results in an ECG chart style, where the previous sweep’s line is gradually overwritten as the points are updated.

There is now a requirement to place the chart into “overlay mode”, where each sweep line remains visible. Over time more and more lines will be superimposed on top of each other, allowing us to see variations in the data.

The only way I can think of doing this is to start each “sweep” as a new series in my DataSeriesSet, however I’m concerned about performance – charting could run for hours, and a sweep is typically 20 seconds – multiplied by the number of lines being plotted (up to 16). Is there a better way?
Assuming this is the approach to take, how would I manage the view’s RenderableSeries, which currently contains 16 hardcoded FastLineRenderableSeries? As I add new series to my DataSeriesSet, how would I also add to the RenderableSeries from the viewmodel?

Also, there is another requirement for an “averaging mode”, where each sweep plots the average of the data values from this and all previous sweeps. I can obviously calculate the averages in my viewmodel and plot these, but I wondered if SciChart contained any nifty feature to do such a thing automatically?!

  • You must to post comments
0
0

Hi Andy,

sounds to me like your approach is the best way. It’s going to result in a lot of manual coding on your side I’m afraid as its not a scenario we support out of the box.

The process should be as follows.

  • To add a new series, add DataSeries, RenderableSeries to the chart.
  • Note that you can set RenderableSeries.DataSeriesIndex to tell it where it gets its data from. It tries to default this to the index of RenderSeries in its parent collection.
  • Note you can remove series, insert from both DataSeries/RenderableSeries collections so you should be able to manipulate these in tandem.

I think performance should be fine, we have examples with hundreds of series each with thousands of points and no problems.

Let me know if I can help in some way.

  • andyste1
    I've got this working, however each new set of series that I add appears on the legend. I only need the first 16 on the legend - all subsequent series are just there to implement the overlay effect. Is there any way to control whether or not a series appears in the legend?
  • Andrew Burnett-Thompson
    Hi Andy, The simplest way is to set the series you want in the legend to be selected (set IsSelected=true) and then bind the legend to the SelectedSeries. I believe our Series Selection demo (see the examples application, go to Series Selection) binds a legend to selected series only. Just be advised with series selection comes style overriding. This might actually be a benefit - you might want the currently active series to have a different style. Again see the above example which shows how to apply a style to a selected series. A more complex way would be to override the LegendModifier which generates the data for the legend and modify its behaviour. The source for it is not complicated (less than 100 lines or so) - you can take a peek with one of the common CLR decompilers, then create your own custom implementation. This is actually a useful tip if ever you want custom modifiers/interaction. All the deep proprietary code is obfuscated but the public API elements are not.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies