NHeatMapSeries with negative X / Y values


Author
Message
joern kunze
joern kunze
Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)
Group: Forum Members
Posts: 86, Visits: 221
Hi Experts,

I want to display data in a NHeatMapSeries. If X and Y data is positive, it is working nice. But when I have negative X-values, only the values with positive X / Y values are displayed:
https://www.nevron.com/forum/uploads/images/38c3a090-5f63-4a86-a17e-d52f.jpg

Data is feed to the Chart like:
nevSeries.Data.SetValue(iX, iY, fValue);

when I change the Origin:
      nevSeries.XValuesMode = HeatMapValuesMode.OriginAndStep;
       nevSeries.OriginX = - 40; // -0.5; fXMinMax[0]
       nevSeries.StepX = 1;
It looks like that:
https://www.nevron.com/forum/uploads/images/211d500d-01e3-459e-a29a-53ee.jpg
But it should look like a full circle. Are there any special settings to be made for negative X-Values ?

Thanks for the help,
Best regards,
Joern


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Joern,
You cannot pass negative values to the heatMapSeries.Data.SetValue function - the x/y values passed there must always be in the range [0, gridSize). We just tested the control with the following code:

// set a chart title
   NLabel title = new NLabel("Wafer Chart");
   title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);
   title.TextStyle.FillStyle = new NColorFillStyle(Color.AliceBlue);

   // configure chart
   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];

   NHeatMapSeries heatMap = new NHeatMapSeries();
   chart.Series.Add(heatMap);

   NHeatMapData data = heatMap.Data;

   heatMap.Palette.Mode = PaletteMode.AutoFixedEntryCount;
   heatMap.Palette.AutoPaletteColors = new NArgbColorValue[] { new NArgbColorValue(Color.Green), new NArgbColorValue(Color.Red) };
   heatMap.Palette.SmoothPalette = true;

   int gridSizeX = 100;
   int gridSizeY = 100;
   data.SetGridSize(gridSizeX, gridSizeY);

   int centerX = gridSizeX / 2;
   int centerY = gridSizeY / 2;

   int radius = gridSizeX / 2;
   Random rand = new Random();

   for (int y = 0; y < gridSizeY; y++)
   {
    for (int x = 0; x < gridSizeX; x++)
    {
     int dx = x - centerX;
     int dy = y - centerY;

     double pointDistance = Math.Sqrt(dx * dx + dy * dy);

     if (pointDistance < radius)
     {
      // assign value
      data.SetValue(x, y, pointDistance + rand.Next(20));
     }
     else
     {
      data.SetValue(x, y, double.NaN);
     }
    }
   }

   heatMap.XValuesMode = HeatMapValuesMode.OriginAndStep;
   heatMap.OriginX = -40;
   heatMap.StepX = 1;

and the control was working properly. What is the version you're testing with?



Best Regards,
Nevron Support Team


joern kunze
joern kunze
Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)Junior Member (13 reputation)
Group: Forum Members
Posts: 86, Visits: 221
... thanks a lot for the detailed example. Now I added a manual offset for negative coordinate values and with this work-around all is displayed properly.

May be it would be a good enhancement for a future Nevron Chart version if the heatMapSeries would also support negative coordinate values so that no manual offset is necessary?

Thanks again & best regards,
Joern

 
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search