Different color for y-axis grid line at zero value on chart


#1

I have a simple line chart that has value in both positive and negative regions.

How do I set a different color for my y-axis grid line at zero value.

Screenshot: http://take.ms/zUiSz


#2

Hi,

It sounds like an annotation (specifically a horizontal line annotation) should accomplish what you’re after - you may find our ‘Adding Annotations’ sample of some help to you.

e.g.

SChartAnnotation *baselineAnnotation = [SChartAnnotation horizontalLineAtPosition:@0 withXAxis:_chart.xAxis andYAxis:_chart.yAxis withWidth:1 withColor:[UIColor purpleColor]];

baselineAnnotation.position = SChartAnnotationBelowData;
[_chart addAnnotation:baselineAnnotation];

Thanks.

Sam