2

In my application I'm using iOS Charts and I want to split my line chart to sectors by vertical grid line with different color than have others (someting like on chart below). I looked into documentation but I didn't find any solution how to do that. I know only how to change color of all grid lines at once. Thanks for any advice.

example chart

UPDATE:

Here is my solution. I have array with x positions for vertical lines and in for loop I will add limit lines to chart.

for k:Int in 0 ..< limitLines.count {

        let limitLine = ChartLimitLine()
        limitLine.lineColor = UIColor.red
        limitLine.limit = limitLines[k]
        limitLine.lineWidth = 0.8
        lineChartView.xAxis.addLimitLine(limitLine)

 }

Here is resulting chart.

enter image description here

maho125
  • 33
  • 1
  • 8

1 Answers1

1

well.. this is not officially supported, but you could override drawGridLine() on x axis to do so, just need to know which grid line needs another color.

Wingzero
  • 9,644
  • 10
  • 39
  • 80