NG_/Assets/Scripts/UI/综合信息/PieChartLabelUpdater.cs

25 lines
529 B
C#
Raw Normal View History

2024-12-13 19:40:05 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XCharts.Runtime;
public class PieChartLabelUpdater : MonoBehaviour
{
public PieChart pieChart; // 引用圆饼图组件
void Start()
{
SetPieChartLabels();
}
void SetPieChartLabels()
{
var series = pieChart.series[0]; // 假设只有一个系列
// 设置Formatter使用自定义格式来显示百分比
pieChart.RefreshChart(); // 刷新图表以应用变化
}
}