iOS charts - force showing gridlines at custom x axis values


#1

I’m trying to customize my Shinobi Chart on iOS. I need to have a chart when on x axis I have values from 0 to 30 and for each of these values I want to have a vertical grid line from top to the bottom of the chart. I’m using the method sChart:majorTickValuesForAxis: to return all values from 0 to 30 and I have xAxis.style.majorGridLineStyle.showMajorGridLines = YES; however all grid lines are visible only when I zoom the chart. When the chart is not zoomed then some of the values that I return in the sChart:majorTickValuesForAxis: are skipped and I see grid lines for example only at values: 0, 5, 10, 15, 20, 25, 30. Is there any way to disable this automatic removing of gridlines/ticks so these lines are always visible even without zooming when there is a small distance between them? I also tried using xAxis.majorTickFrequency = @1; but it also does not seem to work because currentMajorTickFrequency returns 5 instead of 1 after that operation.


#2

Hi leszek123,

I’m afraid the chart currently doesn’t support overloading ticklabels, however depending on your desired behaviour, you may be able to get vertical lines by using annotations, specifically the +[SChartAnnotation verticalLineAtPosition:withXAxis:andYAxis:withWidth:withColor:], which allows you to create vertical lines wherever you like on the chart.

Hope this helps!
Rob