mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
修复饼图添加数据时Label异常的问题
This commit is contained in:
@@ -461,6 +461,7 @@ namespace XCharts
|
||||
/// 饼图的数据项之和
|
||||
/// </summary>
|
||||
public float runtimePieDataTotal { get; internal set; }
|
||||
internal int runtimeLastCheckDataCount { get; set; }
|
||||
|
||||
internal List<Vector3> GetUpSmoothList(int dataIndex, int size = 100)
|
||||
{
|
||||
|
||||
@@ -289,7 +289,6 @@ namespace XCharts
|
||||
{
|
||||
var labelObject = ChartHelper.AddObject(s_SerieLabelObjectName, transform, chartAnchorMin,
|
||||
chartAnchorMax, chartPivot, new Vector2(chartWidth, chartHeight));
|
||||
//ChartHelper.DestroyAllChildren(labelObject.transform);
|
||||
SerieLabelPool.ReleaseAll(labelObject.transform);
|
||||
int count = 0;
|
||||
for (int i = 0; i < m_Series.Count; i++)
|
||||
@@ -484,6 +483,14 @@ namespace XCharts
|
||||
|
||||
protected void CheckRefreshLabel()
|
||||
{
|
||||
foreach (var serie in m_Series.list)
|
||||
{
|
||||
if (serie.label.show && serie.runtimeLastCheckDataCount != serie.dataCount)
|
||||
{
|
||||
m_ReinitLabel = true;
|
||||
serie.runtimeLastCheckDataCount = serie.dataCount;
|
||||
}
|
||||
}
|
||||
if (m_ReinitLabel)
|
||||
{
|
||||
m_ReinitLabel = false;
|
||||
|
||||
@@ -387,6 +387,7 @@ namespace XCharts
|
||||
|
||||
protected void UpdateLabelPostion(Serie serie, SerieData serieData)
|
||||
{
|
||||
if (serieData.labelText == null) return;
|
||||
var currAngle = serieData.runtimePieHalfAngle;
|
||||
var currRad = currAngle * Mathf.Deg2Rad;
|
||||
var offsetRadius = serieData.runtimePieOffsetRadius;
|
||||
|
||||
Reference in New Issue
Block a user