Heatmap palette


https://www.nevron.com/Forum/Topic12128.aspx
Print Topic | Close Window

By Lennart Bossér - 7 Years Ago
Hello,

How many colors can be handled with m_heatmap.Palette.AutoPaletteColors?

It seems to me that about the 8 first colours are used regardless of the size of the palette.
See excerpt of code below



  private byte[,] swecadecol = {{0, 0, 102},  {0, 0, 119},  {0, 0, 136},  {0, 0, 153},  {0, 0, 170},
             {0, 0, 187},  {0, 0, 204},  {0, 0, 221},  {0, 0, 238},  {0, 38, 225},
             {0, 60, 200},  {0, 137, 221}, {0, 135, 219}, {0, 181, 205}, {0, 223, 120},
             {0, 255, 128}, {0, 255, 45},  {84, 255, 84}, {85, 255, 85}, {119, 255, 119},
             {151, 255, 129}, {136, 255, 136}, {153, 255, 153}, {187, 255, 187}, {221, 255, 221},
             {255, 255, 255}, {255, 255, 187}, {255, 255, 153}, {255, 255, 119}, {255, 255, 85},
             {255, 255, 51}, {255, 255, 17}, {243, 240, 0}, {245, 243, 0}, {239, 197, 158},
             {234, 179, 128}, {228, 159, 97}, {223, 140, 66}, {255, 119, 119}, {255, 85, 85},
             {255, 68, 68}, {255, 34, 34}, {255, 17, 17}, {238, 0, 0},  {221, 0, 0},
             {187, 0, 0},  {170, 0, 0},  {136, 0, 0},  {102, 0, 0},  {68, 0, 0},
             {51, 0, 0}};
  private NHeatMapSeries m_heatmap = new NHeatMapSeries();
   m_heatmap.Palette.SmoothPalette = true;
   NArgbColorValue[] newcolors = new NArgbColorValue[51];
   for (int i = 0; i < 51; i++)
   {
      newcolors[i] = new NArgbColorValue(255, swecadecol[i, 0], swecadecol[i, 1], swecadecol[i, 2]);
   }
   m_heatmap.Palette.AutoPaletteColors = newcolors;

    ...



I expected to see the whole range of colours from dark blue via white to dark red.
But I only see dark shades of blue.

best regards,
Lennart
By Nevron Support - 7 Years Ago
Hi Lennart,
You also need to tell the palette to use the same number of steps as the autocolors - for example in your case:
m_heatmap.Palette.PaletteSteps = 51;

Let us know if you meet any problems.
By Lennart Bossér - 7 Years Ago
Thank you very much, that helped.
Where do I find such information in the documentation? Sorry to bother you all the time :-)

By the way, it seems to work even better if the number of palette steps is one less than the number of colours,
in this case m_heatmap.Palette.PaletteSteps = 50;

Best regard,
Lennart

By Nevron Support - 7 Years Ago
Hi Lennart,
Sometimes not all features / properties are well documented or in this case the combination of properties, because it is a very large control. We try to improve the documentation constantly though when we find discrepancies or if something is incorrect. Also the example sometimes are a better source to learn the API. If you don't find something or something is not quite clear please let us know Smile.