iOS Charts ValueFormatter

后端 未结 4 1211
天命终不由人
天命终不由人 2021-02-15 19:04

I am using iOS charts plugin (line chart) and wish to style the chart values (the number above each point) to a decimal number.

The value is a double, but charts by defa

4条回答
  •  抹茶落季
    2021-02-15 19:13

     let data = PieChartData(dataSet: set) 
    
     let formatter = NumberFormatter() 
     formatter.numberStyle = .percent 
     formatter.maximumFractionDigits = 2 
     formatter.multiplier = 1.0 
     formatter.percentSymbol = "%" 
     formatter.zeroSymbol = "" 
     data.setValueFormatter(DefaultValueFormatter(formatter: formatter))
    

提交回复
热议问题