在饼图之外显示值

时间:2019-08-13 14:34:48

标签: swift charts pie-chart

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

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

Image

1 个答案:

答案 0 :(得分:0)

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()
}