ChartsOrg / Charts

Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Apache License 2.0
27.48k stars 5.98k forks source link

lowestVisibleX and highestVisibleX Accuracy problem #5094

Open full-of-fire opened 12 months ago

full-of-fire commented 12 months ago

The accuracy problem will cause the maximum and minimum values in the screen to change, causing the Chart to shake up and down.

Cause of the problem

In my project lowestVisibleX sometimes returns 386.5 and sometimes returns 386.49999999999999. When calling the following method

image

When the value of lowestVisibleX is 386.5 and the value of indexFrom is 387, when the value of lowestVisibleX is 386.49999999999999, indexFrom only returns 386. As a result, the maximum value of the Y value in the screen has been changing. which in turn causes the screen graph to jump。Is there any good solution?

Charts Environment

Charts 4.1.0 14.3.1: 5.7: iOS running Charts:

full-of-fire commented 12 months ago

Here is the video https://github.com/danielgindi/Charts/assets/11729172/7b7af198-b1c9-4c14-b005-219b8faca953