How to add string labels( xAxis labels) to horizontal bar in Charts framework

后端 未结 4 1245
囚心锁ツ
囚心锁ツ 2020-12-20 07:52

I am using charts framework for drawing charts. I need to add some strings in left of every bars. In my code always there are two bars, one for Income and o

4条回答
  •  误落风尘
    2020-12-20 08:14

    When you create your BarChartDataSet you can pass the label.

    let data = BarChartData()
    let ds1 = BarChartDataSet(values: yse1, label: "Income")
    ds1.colors = [UIColor.red, UIColor.blue]
    

    Hope this helps.

提交回复
热议问题