Simon
Simon

Reputation: 25993

How do I match up the grid lines for a secondary y-axis in core plot?

I've set up a core plot graph with two plot spaces - one for a set of bar charts, with its y-axis on the left, and one for a scatter plot with its y-axis on the right. It works, except that the grid lines don't match up:

enter image description here

Both axes have their labeling policy set to CPTAxisLabelingPolicyAutomatic. Is there a way to change the axes so that the grid lines match up?

Upvotes: 0

Views: 842

Answers (1)

Eric Skroch
Eric Skroch

Reputation: 27381

Not with the automatic labeling policy on both axes. You could keep the automatic labels on one side. Read the tick locations and use that to decide what plot range (yRange) and tick locations to use on the other side so they match up. If you allow the user to change the plot range outside control of your app (e.g., by scrolling and/or zooming), use a plot space delegate to monitor changes and update the secondary axis labels as needed.

Upvotes: 1

Related Questions