1

enter image description here

According example image I want to create my chart like that. My data entries have both positive and negative values, I want to set 0 in the middle of y-axis everytime.

Is impossible to do that? Ps. I use Charts library with swift version 5.

Tar journey
  • 379
  • 4
  • 13

1 Answers1

1

Calculate the biggest number on the Y-axis in the chart's dataSet.

let maxValue = max(dataSet)
chart.setChartMinMaxYValues(chartYMin: -(maxValue), chartYMax: maxValue)
Mohammad Reza
  • 184
  • 2
  • 11