mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
Fixed bug where GaugeChart does not refresh label when changing splitNumber #167
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
|
||||
## master
|
||||
|
||||
* (2021.09.06) Fixed bug where `GaugeChart` changing `splitNumber` with code does not refresh `label` #167
|
||||
|
||||
## v2.4.0
|
||||
|
||||
### Main points
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
## master
|
||||
|
||||
* (2021.09.06) 修复`GaugeChart`用代码改变`splitNumber`不会刷新`label`的问题 #167
|
||||
|
||||
## v2.4.0
|
||||
|
||||
### 版本要点
|
||||
|
||||
@@ -9,6 +9,7 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using XUGL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
@@ -20,6 +21,7 @@ namespace XCharts
|
||||
private static readonly string s_AxisLabelObjectName = "axis_label";
|
||||
private bool m_UpdateTitleText = false;
|
||||
private bool m_UpdateLabelText = false;
|
||||
private Dictionary<int, int> m_LastSplitNumber = new Dictionary<int, int>();
|
||||
|
||||
public DrawSerieGauge(BaseChart chart)
|
||||
{
|
||||
@@ -61,6 +63,21 @@ namespace XCharts
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var serie in chart.series.list)
|
||||
{
|
||||
if (serie.type == SerieType.Gauge)
|
||||
{
|
||||
if (!m_LastSplitNumber.TryGetValue(serie.index, out var lastSplitNumber))
|
||||
{
|
||||
m_LastSplitNumber[serie.index] = lastSplitNumber;
|
||||
}
|
||||
else if (serie.splitNumber != lastSplitNumber)
|
||||
{
|
||||
m_LastSplitNumber[serie.index] = serie.splitNumber;
|
||||
InitAxisLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawBase(VertexHelper vh)
|
||||
|
||||
Reference in New Issue
Block a user