KarthikRIyer / swiftplot

Swift library for Data Visualization :bar_chart:
Apache License 2.0
400 stars 39 forks source link

LineGraph hangs for certain data points #126

Closed neutralino closed 2 years ago

neutralino commented 3 years ago

A LineGraph with the following points appears to hang indefinitely:

    let x: [Float] = [0, 1]
    let y: [Float] = [0, 2.01]

(e.g. replacing the points in testLineChartSingleSeries with the points above).
It looks like the issue is within LineGraph's calculateMarkers method (when computing xM), though it's not clear to me what the fix should be. Replacing the y point 2.01 with a value of 2.0 or less works as expected.

KarthikRIyer commented 2 years ago

131 was just merged. I'm not sure if you were facing the same issue, but this might have fixed this. Do let me know if you give it a try again with the fix.

neutralino commented 2 years ago

Thanks, @KarthikRIyer! Yes, that fixed it, the plot renders now.