LineChart disappears when zoom on X axe
What did you do?
I have a LineChartView to display temperatures over a day.
self.lineChartView.gridBackgroundColor = .white
self.lineChartView.borderLineWidth = 2
self.lineChartView.borderColor = .systemGray
self.lineChartView.chartDescription.text = ""
self.lineChartView.gridBackgroundColor = .clear
self.lineChartView.backgroundColor = .clear
self.lineChartView.pinchZoomEnabled = false
self.lineChartView.doubleTapToZoomEnabled = false
self.lineChartView.delegate = self
self.lineChartView.scaleYEnabled = false
self.lineChartView.scaleXEnabled = true
self.lineChartView.extraBottomOffset = 10
What did you expect to happen?
Since I have a lot of values for a single day, and all single value is really important, I need to zoom over the X axe disabling zoom on Y axe.
What happened instead?
The problem is that the line disappears when I zoom-in. If I set y-zoom to true the line remains on screen, but If I set it to false, when zooming it disappears.
Charts Environment
Charts version: 4.1.0 Xcode version: 14.2 Swift version: 5 Platform(s) running Charts: macOS macOS version running Xcode: Ventura 13.0
Update to v5.0.0 and the problem still present. I have no idea how to resolve.
We had a similar issue, finally found the solution.
Issue was that when giving value to graph it was generating array of data in descending order.
so we've added logic revere value if it's in descending order
and assigning data after doing this,
// values.reverse() if needed
let set1 = LineChartDataSet(entries: values, label: "")
let data = LineChartData(dataSets: [set1])
self.lineChartView?.data = data
after doing this, graph was able to scroll and zoom properly without disappearing or glitching.