When I add a large amount of data using a decimal value for the step parameter, it results in an error

18 Views Asked by At

enter image description here As shown in the above figure.It seems to exceed the JavaScript array limit. Here is my code

const dataSet = curveData.split(" "); // A very large amount of data
console.log(" ~ dataSet:", dataSet.length); // 23503

enter image description here

const lineSeries = chart
    .addPointLineAreaSeries({
      dataPattern: "ProgressiveX",
    })
    .setAreaFillStyle(emptyFill)

    .appendSamples({
      yValues: dataSet,
      step: 2.5515118, // Due to project requirements, step has many decimal points.
    }); 

I would like to know what caused it. Is it because there are too many data points, or is it because of the decimal points in the step? I'm not clear on what happens internally when zooming and panning. If the issue cannot be resolved, what alternatives can achieve similar values for x and y?

Yalue:[32.864, 40.489, 43.141, 44.161, 44.463, 44.552, 44.578 ....]
Xalue:[0, 2.5515118, 5.1030298, 7.6545354, 10.2060472, 12.757559 ....]

Because initially, I receive an array of y values and a step, indicating the spacing between points. Of course, such precision might not be necessary, and even two decimal places would suffice. However, setting the step to 2.5 still triggers an error.

1

There are 1 best solutions below

0
Niilo Keinänen On

Seems to be a crash that happens with PointLineAreaSeries under very specific circumstances. In any case, quite confident it is a library issue. Will try to pinpoint and fix it for next version release in May.

In the mean-time, you can use the previous line series feature ChartXY.addLineSeries({ dataPattern: { pattern: 'ProgressiveX' } })