swift - 在饼图外显示值
问题描述
我无法在饼图之外显示值。目前这些值重叠,有什么办法可以改进吗?请看下图。
chartDataSet.valueLinePart1Length = 0.5
chartDataSet.valueLinePart2Length = 1
//set.xValuePosition = .outsideSlice
chartDataSet.yValuePosition = .outsideSlice
解决方案
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()
}
推荐阅读
- solr - 如何使用 Morphlines conf 文件读取 DECIMAL(38,10)
- angular - 如何在 Angular 6 中测试模板驱动的表单
- javascript - 动态更改输入值(javascript)
- ios - 在 Twilio 聊天 iOS APN 推送负载中将 mutable-content 设置为 1
- javascript - 在 WKWebView iOS 中加载本地 React 应用程序
- python - Django:字典到 HTML 表,当值是生成器时
- xamarin - 如何在 Xamarin Forms Application 的 WebView 中禁用复制粘贴选项?
- vba - vba powerpoint:使用相同的“with”更改多个形状
- java - java.lang.NullPointerException at largeNo.main 推入堆栈时出错
- ios - 在 iphone X 的横向模式下,UITabelView Cell 的内容正在向右移动