Drawing horizontal straight Line inside Area Chart


#1

Hello,

Can anyone help me to draw horizontal straight Line inside Area Chart.

I attached a screenshot fro what I mean.

Thanks


#2

follow those steps:

1- add a line serie ( the delegate methode will now return two)

2- look at the demo and choose one function from there and then make it y = cstValue (where cstValue is a constant value where you want you horizontal straight to be drawn)

3-  you have a two properties in the lineserie: linewidth  for the width and lineColor. you know what are there for.

if you need code let me know


#3

Hi,the solution above should work just fine. 

But we also have annotations for his purpose. The following code should add a line across the chart at an arbitrary value:

SChartAnnotation *a = [SChartAnnotation horizontalLineAtPosition:@(50) withXAxis:chart.xAxis andYAxis:chart.yAxis withWidth:2.f withColor:[UIColor redColor]];
    [chart addAnnotation:a];