Home Forums StockChart Support zoom into open-ended regions not working Reply To: zoom into open-ended regions not working

#38882

I can confirm that the .toFixed issue is indeed fixed in the latest StockChart v1.6.7.

To work around the problem with zooming into open-ended regions I had to use the following code in the end:
const viewportMinimum = this.canvasStockChart.charts[0].axisX[0].get(“viewportMinimum”);
this.canvasStockChart.charts[0].axisX[0].set(“minimum”, viewportMinimum, false);
const viewportMaximum = this.canvasStockChart.charts[0].axisX[0].get(“viewportMaximum”);
this.canvasStockChart.charts[0].axisX[0].set(“maximum”, viewportMaximum, true);

This is effectively saying: if you can see it (ie. it is part of the viewport) then you should be able to zoom into it.

It would perhaps be more intuitive if this was the default behavior of CanvasJS. Something to perhaps consider for a future release.

For anybody else reading this. It is also important to remember that the above code needs to be executed every time after a render since the axisX array gets overwritten each time.