0
votes

I have a requirement to draw Core Plot horizontal bar chart with everything on the negative y-axis. I.e. the first index should appear at -1, like below:

demo

I have figured out how to draw horizontal Bar Chart. But figuring out how to draw them in an "inverted" manner (to let user scroll downward with the tallest bar on top). My thought: 1) Convert the Y-index to negative 2) offset the Y-axis to the top of the graph instead of bottom

Is there any better way to do it?

1

1 Answers

0
votes

I have found a historical article that's similar to my request (core-plot iOS reversed Y axis).

I have got what I needed after using this:

CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-yMax-1) length:CPTDecimalFromFloat(yMax)

P.S. you need to add the -1 to the Location parameter (-yMax-1) otherwise the horizontal bar at index 0 will not be shown clearly.