NaN data in IntensityGridSeries

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
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 8681 times
PixelRendering true
PixelRendering true
IntensityGridSeriesNaN_PixelRendering.jpg (212.31 KiB) Viewed 8681 times
Thanks
Greg.
Attachments
LightningChartTest.zip
(181.34 KiB) Downloaded 1241 times

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

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 8671 times
Is this OK?
LightningChart Support Team, PT

ArctionKestutis
Posts: 555
Joined: Mon Mar 14, 2016 9:22 am

Re: NaN data in IntensityGridSeries

Post by ArctionKestutis » Tue Apr 02, 2024 1:33 pm

If user wanta node to be rendered as transparent, there are following options nowadays:

1) replace extreme value with NaN. If PixelRendering = false, then highest palette’s step color is used. If PixelRendering = true, then lowest palette’s step color is used. If you want color to be transparent, then added step with transparent color above/below main steps accordingly (as in above example).
2) Set each node’s color directly (including ‘problem’ value data[i, j].Color = Colors.Transparent) and use intensityGrid.Fill = IntensityFillStyle.FromSurfacePoints.
3) Use StencilAreas or in particular SubstractiveAreas+AdditiveAreas to clip data from particular area (User Manual chapter 6.34).
4) Use Series.ClipAreas property/feature, if want to hide row or columns of heatmap (User Manual chapter 6.30).

Post Reply