I have encountered an issue with the value axis autoscaling of the SFCartesian chart. I have attached a small demo program that demonstrates the problem.
The chart has 1000 data points. They all vary in value between 30 and 50, except for point 500, which has a value of 10000. The chart is set with an inital zoom of 0.2 and an initial pan of 1. This causes only the last 200 points to be displayed. However on initial startup the vertical range is set to include the 10,000 value from point 500 even though it is not visible. So in essence we see a flat line. The instant I pan the chart at all, it redraws with the correct vertical range. And if I pan back to the end it still shows it correctly.
Is there a bug fix for this or Is there something I can call on initial startup to make this rescale properly?
Here is a screen shot of the initial startup:
Here is after panning and then back to original position:
I have attached the code that causes this. The screenshots are from Windows but the same thing happens in Android.
The forum won't allow me to attach a .dart file so I had to zip it.
Please let me know if there is a workaround for this.
We are validating your query at our end and we will update further details in one business day on 19 Dec 2022. We appreciate your patience until then.
We can replicate the issue with the auto range calculation in the y axis not working when setting the zoom factor. We are currently working on providing a feasible solution to perform the auto range calculation at the initial render. We will update you in one business day on 20 Dec 2022. We appreciate your patience until then.
As of now, you can achieve your requirement to auto-scale on the y-axis range when setting the zoomFactor
by finding the visible minimum and visible maximum range for the x-axis from the data source with the help of the given zoomFactor and zoomPosition value. We have created a sample that includes a method called "findVisibleRange," which calculates the visible minimum and visible maximum range based on the given zoom factor and zoom position, then assigns them to the visibleMinimum and visibleMaximum properties, respectively. We have shared the sample below for your reference.