NaN data in IntensityGridSeries

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

Greg9504
Posts: 38
Joined: Fri Dec 06, 2013 4:51 pm

NaN data in IntensityGridSeries

Post by Greg9504 » Wed Dec 18, 2013 4:35 pm

Hello,

When I have data that contains NaN values the IntensityGridSeries does not ignore these values when PixelRendering = false. See the screen shots with PixelRendering on and off. I would like to have PixelRendering off so that I can get the interpolation and contour lines.

I've attached a demo project and with data that shows the problem. The NaN values are in upper left corner, the areas that look like "C" and "@". FWIW these NaN areas display fine on SurfaceGridSeries3D plots.
PixelRendering false
PixelRendering false
IntensityGridSeriesNaN.jpg (174.36 KiB) Viewed 7638 times
PixelRendering true
PixelRendering true
IntensityGridSeriesNaN_PixelRendering.jpg (212.31 KiB) Viewed 7638 times
Thanks
Greg.
Attachments
LightningChartTest.zip
(181.34 KiB) Downloaded 992 times

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

Re: NaN data in IntensityGridSeries

Post by ArctionPasi » Thu Dec 19, 2013 10:12 am

In general, don't use NaN values. LightningChart doesn't have check for them. It is up to the GPU how it handles them in specific visualization.

To make certain parts of IntensityGridSeries transparent, define auxiliary steps with transparent colors in your ValueRangePalette:

Code: Select all

 private ValueRangePalette CreatePalette(Arction.LightningChartUltimate.SeriesXY.SeriesBaseXY ownerSeries, double ymin, double YRange)
        {
            ValueRangePalette palette = new ValueRangePalette(ownerSeries);
            palette.Type = PaletteType.Gradient;
            double yRange = YRange - ymin;
            palette.Steps.Clear();
            palette.MinValue = ymin;
            palette.Steps.Add(new PaletteStep(palette, Color.Blue, ymin));
            palette.Steps.Add(new PaletteStep(palette, Color.Lime, ymin + 33 * yRange / 100.0));
            palette.Steps.Add(new PaletteStep(palette, Color.Yellow, ymin + 66 * yRange / 100.0));
            palette.Steps.Add(new PaletteStep(palette, Color.Red, ymin + 100.0 * yRange / 100.0));

            palette.Steps.Add(new PaletteStep(palette, Color.FromArgb(0, 0, 0, 0), ymin -10)); //Aux step
            palette.Steps.Add(new PaletteStep(palette, Color.FromArgb(0,0,0,0), -1E9)); //Aux step

            return palette;
        }
In data filling, replace your NaNs with aux step extreme value, to make a sharp cut without interpolated colors.

Code: Select all

for (int iCol = 0; iCol < iSizeX; iCol++)
                {
                    float intensity = (Z[iCol * nY + iRow]);
                    if(float.IsNaN(intensity))
                        intensity = -1E9f; 
                    data[iCol, (nY - 1) - iRow].Value = intensity;
                    
                }
And by setting

Code: Select all

m_intensityGrid.FullInterpolation = false;
, it won't cross-render the semi-transparent triangles in the cut zone.

Then the chart appears as:
Intensity Grid transparent values
Intensity Grid transparent values
IntensityGridSeriesWithTransparentValues.png (238.07 KiB) Viewed 7628 times
Is this OK?
LightningChart Support Team, PT