How to show Percentage sign in pie chart using daniel gindi/Chart library in swift(IOS Chart)

前端 未结 4 1321
情话喂你
情话喂你 2021-02-04 21:02

I am using the Charts framework (by Daniel gindi). It was working fine but how to show % (sign) on piechart?
I am also try use NSNumberFormatter() method for covert data v

4条回答
  •  既然无缘
    2021-02-04 21:50

    On Swift3 with latest version of charts you can do % formatting on pie chart as followings:

        let formatter = NumberFormatter()
        formatter.numberStyle = .percent
        formatter.maximumFractionDigits = 1
        formatter.multiplier = 1.0
        pieChartData.setValueFormatter(DefaultValueFormatter(formatter:formatter))
    

提交回复
热议问题