SampleDataSeries and Stair/Step shape

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 20
Joined: Tue Jun 28, 2016 7:54 am

SampleDataSeries and Stair/Step shape

Post by jorge » Tue Jul 05, 2016 8:24 am

We need to render a graph with a stair/step shape, exactly the same as in the "Stair/Step" demo example. We started using a PointLineSeries, but for memory concerns we would like to switch to SampleDataSeries. Would it be possible to get the step shape with this kind of series? My understanding is that, as two points with the same X value are needed to get the step shape it wouldn't be possible because of the sampling interval, but maybe I am missing something.

Many thanks in advance.

User avatar
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: SampleDataSeries and Stair/Step shape

Post by ArctionPasi » Tue Jul 05, 2016 10:34 am


SampleDataSeries is a fixed-interval series. X difference between data points is 1 / SamplingFrequency. So with this series type, it's unfortunately impossible to compose exactly vertical transition as it always has some slope in it because of progressing X.

In SampleDataSeries memory footprint is more compact regarding the points array, that's true. Points don't store X value, nor Tag field, and SampleDataSeries can also be used with 32-bit floating point accuracy, whereas PointLineSeries is 64-bit double only.

Currently PointLineSeries is the best way to achieve a stepping line.
LightningChart Support Team, PT

Posts: 20
Joined: Tue Jun 28, 2016 7:54 am

Re: SampleDataSeries and Stair/Step shape

Post by jorge » Tue Jul 05, 2016 12:25 pm

Ok, thanks Pasi.

Posts: 2
Joined: Tue Oct 16, 2018 2:26 pm

Re: SampleDataSeries and Stair/Step shape

Post by TheWiggin » Tue Oct 16, 2018 3:23 pm

I would like to second the request made by Jorge... Adding a Stair-step style to the PointLineSeries would be a real benefit to me.

My application works with a large volume of process data from industrial plants. Some of our users have accumulated mny years of data, such that a large data review plot might contain several million data points. With the graphics package we are currently using, it can take over a minute to render such a graph -- that is what led me to try out LightningChart. Using your package, drawing the plot takes less than a second. That's the difference between "it doesn't work" and "It works great!"

But in a plot with ~5 million data points, it is a major buden to allocate 10 million SeriesPoints... it literally halves the effective number of points we can show in a graph (i.e. before hitting the active memory limit & blowing up the performance).

I think this feature can be implemented with a very minor change. In the (inefficient) package I am currently using, I implemented a StepLine by subclassing their Series class to overide the OnDraw() behavior, and simply replaced the "LineTo(x,y)" with 2 calls, LineTo(x,y[i-1]); LineTo(x,y). Of course, I don't know what magic is required to achieve your high performance, so I might be way off. But please consider it... I imagine many of your customers could benefit from this.


Curt Carney (aka. TheWiggin)

Posts: 386
Joined: Mon Mar 14, 2016 9:22 am

Re: SampleDataSeries and Stair/Step shape

Post by ArctionKestutis » Wed Oct 17, 2018 8:55 am

see my answer here.