style: 简化饼图显示
- 禁用饼图的图例显示 - 移除图例相关的配置代码 - 将 PieDataSet 的标题设置为空字符串 - 优化界面简洁度
This commit is contained in:
parent
47e202fa61
commit
71deaaa288
@ -36,16 +36,8 @@ fun CategoryPieChart(
|
|||||||
setUsePercentValues(true)
|
setUsePercentValues(true)
|
||||||
setDrawEntryLabels(true)
|
setDrawEntryLabels(true)
|
||||||
|
|
||||||
// 配置图例
|
// 禁用图例显示
|
||||||
legend.apply {
|
legend.isEnabled = false
|
||||||
isEnabled = true
|
|
||||||
this.textColor = textColor // 使用Material Theme的文字颜色
|
|
||||||
textSize = 12f
|
|
||||||
form = Legend.LegendForm.CIRCLE
|
|
||||||
formSize = 12f
|
|
||||||
formToTextSpace = 8f
|
|
||||||
xEntrySpace = 16f
|
|
||||||
}
|
|
||||||
|
|
||||||
isDrawHoleEnabled = true
|
isDrawHoleEnabled = true
|
||||||
holeRadius = 40f
|
holeRadius = 40f
|
||||||
@ -65,7 +57,7 @@ fun CategoryPieChart(
|
|||||||
PieEntry(amount, category)
|
PieEntry(amount, category)
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataSet = PieDataSet(entries, "分类占比").apply {
|
val dataSet = PieDataSet(entries, "").apply { // 将标题设为空字符串
|
||||||
colors = ColorTemplate.MATERIAL_COLORS.toList()
|
colors = ColorTemplate.MATERIAL_COLORS.toList()
|
||||||
valueTextSize = 14f
|
valueTextSize = 14f
|
||||||
valueFormatter = PercentFormatter(chart)
|
valueFormatter = PercentFormatter(chart)
|
||||||
|
Loading…
Reference in New Issue
Block a user