How to insert empty data?

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

ehdrnsep
Posts: 48
Joined: Mon Jan 12, 2015 6:52 am

How to insert empty data?

Post by ehdrnsep » Mon Apr 06, 2015 9:36 am

I using the SampleDataSeries, inserts the data in the certain period.

I want to skip the "float.NaN" data.

Such as images "float.NaN" data is broken line.

To put a float array at a time because of performance ....

What to change FirstSampleTimeStamp properties as shown in the following code?

Code: Select all

for (int i = 0; i <value.Length; i ++)
{
     if (float.IsNaN (value [i]))
     {
         series.FirstSampleTimeStamp + = 1 / samplingFrequency;
     }
     else
     {
         series.AddSamples (new float [] {value [object]}, false);
     }
}
Attachments
I want to like the image.
I want to like the image.
2.png (8.02 KiB) Viewed 4094 times
y value 5 is float.NaN.
y value 5 is float.NaN.
floatNaN.png (8.37 KiB) Viewed 4095 times

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

Re: How to insert empty data?

Post by ArctionPasi » Tue Apr 07, 2015 1:54 pm

Don't set NaN data in 2D series.

Workaround 1:
Spawn a new series after NaN position.
See ExampleBreakingLineByNaN in the demo applications.
Line break handled by several series.jpg
Line break handled by several series.jpg (204.93 KiB) Viewed 4088 times

Workaround 2:
Replace NaNs with 0's or -10000's or some value outside the valid Y range.
Use ClipAreas to mask off the bad intervals. See ExampleClipAreas
ClipAres.jpg
ClipAres.jpg (287.1 KiB) Viewed 4088 times
LightningChart Support Team, PT