Pre loader

Tag: IndexOutOfRange

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0 votes
0 answers
6k views

Hi,

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).

Showing 1 result

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies