From 71deaaa2884ef8af887653cd166559feb9f82e86 Mon Sep 17 00:00:00 2001 From: yovinchen Date: Thu, 28 Nov 2024 09:10:03 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E7=AE=80=E5=8C=96=E9=A5=BC=E5=9B=BE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 禁用饼图的图例显示 - 移除图例相关的配置代码 - 将 PieDataSet 的标题设置为空字符串 - 优化界面简洁度 --- .../bookkeeping/ui/components/CategoryPieChart.kt | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/yovinchen/bookkeeping/ui/components/CategoryPieChart.kt b/app/src/main/java/com/yovinchen/bookkeeping/ui/components/CategoryPieChart.kt index 7410719..caac939 100644 --- a/app/src/main/java/com/yovinchen/bookkeeping/ui/components/CategoryPieChart.kt +++ b/app/src/main/java/com/yovinchen/bookkeeping/ui/components/CategoryPieChart.kt @@ -36,16 +36,8 @@ fun CategoryPieChart( setUsePercentValues(true) setDrawEntryLabels(true) - // 配置图例 - legend.apply { - isEnabled = true - this.textColor = textColor // 使用Material Theme的文字颜色 - textSize = 12f - form = Legend.LegendForm.CIRCLE - formSize = 12f - formToTextSpace = 8f - xEntrySpace = 16f - } + // 禁用图例显示 + legend.isEnabled = false isDrawHoleEnabled = true holeRadius = 40f @@ -65,7 +57,7 @@ fun CategoryPieChart( PieEntry(amount, category) } - val dataSet = PieDataSet(entries, "分类占比").apply { + val dataSet = PieDataSet(entries, "").apply { // 将标题设为空字符串 colors = ColorTemplate.MATERIAL_COLORS.toList() valueTextSize = 14f valueFormatter = PercentFormatter(chart)