答案 0 :(得分:0)
通过覆盖NSNumberFormatter来解决它
class CustomNSNumberFormatter : NSNumberFormatter {
override func stringFromNumber(number: NSNumber) -> String? {
switch number {
case 0:
return "Severe"
case 2:
return "Moderate"
case 4:
return "Mild"
case 6:
return "Clear Skin"
default:
return ""
}
}
}
然后
chart.leftAxis.valueFormatter = CustomNSNumberFormatter()