Background color of bar area in SChartBarSeries


#1

How do I make a chart like this in swift:

        let bar = SChartBarSeries()

        bar.style().showArea = true

        bar.style().showAreaWithGradient = false

        bar.style().areaColor = UIColor.grayColor()


#2

Hi leonara,

This can be done by using a stacked bar chart.

You have a series per coloured bar making sure the stackIndex is set to the same value.

You will then have to calculate each stacked (light grey) bar’s value base on the first (dark grey) bar to make sure the stacked bar all line up to the same value.

For example, if you had an X-Axis range of 100 and the value for “0.0-0.5” = 10 and “0.5-1.0” = 60.
The second series for the value “0.0-0.5” = 90 and “0.5-1.0” = 40.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn