Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Customizing grid lines on a chart with two Y-axes
posted

I've created a chart that has two line series. They share the same x-axis but they each have their own y-axis, one on the left and one on the right. The left y-axis goes from 0-120 and the right y-axis goes from 0-100.

The problem I'm having is that the grid lines look all funky, since there's a horizontal grid line at each 20-interval from the left and each 10-interval from the right. I'd like to clean this up.

Can you let me know which of the following solutions are possible. I'm using Swift 4:

  1. Remove horizontal grid lines for one of the axes. The lines won't line up with the labels on one of the axes, but this isn't a big deal.
  2. Remove horizontal gridlines entirely.
  3. Remove all grid lines. I've been able to remove all gridlines by setting the IGChartView.gridMode property, but that's also removing the outer border of the graph, which I don't want.
  4. Modify the right y-axis (0-100) so that it stays in step with the left y-axis and doesn't extend to the top of the graph. That line series would just never reach the top of the graph.

I would prefer to go with option 1 if possible.

Related question: Is there a way to put a border on the graph that isn't dependant on grid lines? I'd like to add a permanent border to the right side of the graph as well.

Thanks!