Page 1 of 1

NaN data in IntensityGridSeries

Posted: Wed Dec 18, 2013 4:35 pm
by Greg9504
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 8707 times
PixelRendering true
PixelRendering true
IntensityGridSeriesNaN_PixelRendering.jpg (212.31 KiB) Viewed 8707 times
Thanks
Greg.

Re: NaN data in IntensityGridSeries

Posted: Thu Dec 19, 2013 10:12 am
by ArctionPasi
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 8697 times
Is this OK?

Re: NaN data in IntensityGridSeries

Posted: Tue Apr 02, 2024 1:33 pm
by ArctionKestutis
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).