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.

2
  • There should be max/min values like in stackoverflow.com/questions/32176581/… ? Commented Jan 26, 2022 at 15:35
  • @Larme Thx you so much, I will try. Commented Jan 26, 2022 at 16:18

1 Answer 1

1

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

let maxValue = max(dataSet)
chart.setChartMinMaxYValues(chartYMin: -(maxValue), chartYMax: maxValue)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.