我在显示饼图之外的值时遇到麻烦。当前值重叠,有什么可以改善的吗?请参见下图。

chartDataSet.valueLinePart1Length = 0.5
chartDataSet.valueLinePart2Length = 1
//set.xValuePosition = .outsideSlice
chartDataSet.yValuePosition = .outsideSlice


swift - 在饼图之外显示值-LMLPHP

最佳答案

func setupPiChart() {
    // This will align label text to top right corner
    let l = pieChartView.legend
    l.horizontalAlignment = .left
    l.verticalAlignment = .bottom
    l.orientation = .horizontal
    l.xEntrySpace = 10
    l.yEntrySpace = 0
    l.font = self.isPhone ? Typography.robotoRegular14 : Typography.robotoRegular18

    self.pieChartView.entryLabelFont = Typography.robotoRegular14
    self.pieChartView.drawHoleEnabled = false
    self.pieChartView.drawEntryLabelsEnabled = false
    self.pieChartView.notifyDataSetChanged()
}

关于swift - 在饼图之外显示值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57480008/

10-13 02:37