From 621bc3dcfd1364fbfe9c7b533ab9f9aeb8a26cc5 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Thu, 7 Apr 2022 08:16:50 +0800 Subject: [PATCH] [bug] Fix pie color --- Runtime/Helper/SeriesHelper.cs | 9 +++++---- Runtime/Serie/SerieHandler.cs | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Runtime/Helper/SeriesHelper.cs b/Runtime/Helper/SeriesHelper.cs index ddf5c459..8296ed8b 100644 --- a/Runtime/Helper/SeriesHelper.cs +++ b/Runtime/Helper/SeriesHelper.cs @@ -58,11 +58,12 @@ public static void UpdateSerieNameList(BaseChart chart, ref List serieNa { for (int i = 0; i < serie.data.Count; i++) { - if (serie is Pie && serie.IsIgnoreValue(serie.data[i])) continue; - if (string.IsNullOrEmpty(serie.data[i].name)) + var serieData = serie.data[i]; + if (serie is Pie && serie.IsIgnoreValue(serieData)) continue; + if (string.IsNullOrEmpty(serieData.name)) serieNameList.Add(ChartCached.IntToStr(i)); - else if (!serieNameList.Contains(serie.data[i].name)) - serieNameList.Add(serie.data[i].name); + else if (!serieNameList.Contains(serieData.name)) + serieNameList.Add(serieData.name); } } else diff --git a/Runtime/Serie/SerieHandler.cs b/Runtime/Serie/SerieHandler.cs index 4a3c4702..13bc06cd 100644 --- a/Runtime/Serie/SerieHandler.cs +++ b/Runtime/Serie/SerieHandler.cs @@ -82,6 +82,7 @@ public override void Update() } if (serie.dataDirty) { + SeriesHelper.UpdateSerieNameList(chart, ref chart.m_LegendRealShowName); serie.OnDataUpdate(); serie.dataDirty = false; }