NG_/Assets/Scripts/UI/综合信息/PieChartLabelUpdater.cs
2024-12-13 19:40:05 +08:00

25 lines
529 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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(); // 刷新图表以应用变化
}
}