enter image description here
如图所示,我无法删除下面的 Camel 文本。
class ChartViewController: UIViewController {
@IBOutlet weak var pieChartView: PieChartView!
override func viewDidLoad() {
super.viewDidLoad()
let entries = [
PieChartDataEntry(value: 10, label: "Camel"),
PieChartDataEntry(value: 20, label: "Cat"),
PieChartDataEntry(value: 30, label: "Dog"),
PieChartDataEntry(value: 40, label: "Fish")
]
let set = PieChartDataSet(entries: entries, label: "") // Set the label to an empty string
let data = PieChartData(dataSet: set)
// Customize the pie chart
pieChartView.data = data
pieChartView.holeRadiusPercent = 0.5
pieChartView.transparentCircleRadiusPercent = 1
pieChartView.chartDescription.text = "" // Set the chart description to an empty string
pieChartView.frame = CGRect(x: 20, y: 100, width: 400, height: 400)
// Set the colors for the pie slices
set.colors = [UIColor.red, UIColor.green, UIColor.blue, UIColor.orange]
}
}
光做这个是不够的
1条答案
按热度按时间nom7f22z1#
我找到解决办法了。
pieChartView.图例.已启用=假