25 lines
529 B
C#
25 lines
529 B
C#
|
|
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(); // 刷新图表以应用变化
|
|||
|
|
}
|
|||
|
|
}
|