SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components



I am playing with the heatmap chart and stumbled upon an IndexOutOfRange exception when updating the chart.

I initialise my chart where Height=2 and Width=3:

var data = new double[Height, Width]; // 2 rows, 3 columns
double d = 0.0;
for (int y = 0; y < Height; y++)
    for (int x = 0; x < Width; x++)
        data[y, x] = d++;

heatmapSeries.DataSeries = new UniformHeatmapDataSeries<int, int, double>(data, 0, 1, 0, 1);

Calling the following line returns 5 which is equivalent to getting the value with data[1,2] (all good so far):

dataseries.GetZValue(yIndex: 1, xIndex: 2);

Now let’s update that value to, say 7.1, with:

dataseries.UpdateZValue(xIndex: 2, yIndex: 1, zValue: 7.1);

Executing the above line throws an IndexOutOfRangeException. Looking at the source code, the UpdateZValue() method does:

_zValues[xIndex, yIndex] = zValue;
// ...

No wonder why the exception gets thrown… I reckon it should be _zValues[yIndex, xIndex] = zValue; (xIndex and yIndex swapped).

  • Andrew
    Thanks for reporting! We will investigate this after the weekend. Best regards, Andrew
  • Gia D.
    Any update? I have also noticed that the Clear() method re-initializes the zValues array with the width and height swapped.
  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.