diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index fba2d36d..68d6a564 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -73,7 +73,8 @@ slug: /changelog ## master -* (2024.06.09) 调整`Tooltip`的`Corss`重命名为`Cross` +* (2024.06.11) 修复`Tooltip`在`Cross`时`Axis`的`IndicatorLabel`可能不显示的问题 (#315) +* (2024.06.10) 调整`Tooltip`的`Corss`重命名为`Cross` * (2024.06.09) 增加`Axis`的`minCategorySpacing`设置类目轴默认的最小类目间距 * (2024.06.09) 修复`Tooltip`的`Cross`在`Axis`是类目轴并且开启`DataZoom`的情况下指示位置不准确的问题 * (2024.06.06) 修复`Serie`在`Clone`时动画异常问题 (#320) diff --git a/Runtime/Internal/BaseChart.cs b/Runtime/Internal/BaseChart.cs index e8353ce5..a347d270 100644 --- a/Runtime/Internal/BaseChart.cs +++ b/Runtime/Internal/BaseChart.cs @@ -124,9 +124,15 @@ namespace XCharts.Runtime base.InitComponent(); SeriesHelper.UpdateSerieNameList(this, ref m_LegendRealShowName); foreach (var handler in m_ComponentHandlers) + { handler.InitComponent(); + handler.inited = true; + } foreach (var handler in m_SerieHandlers) + { handler.InitComponent(); + handler.inited = true; + } m_DebugInfo.Init(this); } @@ -216,7 +222,15 @@ namespace XCharts.Runtime foreach (var handler in m_SerieHandlers) handler.BeforeUpdate(); foreach (var handler in m_ComponentHandlers) handler.BeforceSerieUpdate(); foreach (var handler in m_SerieHandlers) handler.Update(); - foreach (var handler in m_ComponentHandlers) handler.Update(); + foreach (var handler in m_ComponentHandlers) + { + if (!handler.inited) + { + handler.InitComponent(); + handler.inited = true; + } + handler.Update(); + } foreach (var handler in m_SerieHandlers) handler.AfterUpdate(); m_DebugInfo.Update(); diff --git a/Runtime/Internal/Basic/MainComponent.cs b/Runtime/Internal/Basic/MainComponent.cs index ae7798b7..843b7049 100644 --- a/Runtime/Internal/Basic/MainComponent.cs +++ b/Runtime/Internal/Basic/MainComponent.cs @@ -93,6 +93,7 @@ namespace XCharts.Runtime public int order { get; internal set; } public BaseChart chart { get; internal set; } public ComponentHandlerAttribute attribute { get; internal set; } + public bool inited { get; internal set; } public virtual void InitComponent() { } public virtual void RemoveComponent() { } diff --git a/Runtime/Serie/SerieHandler.cs b/Runtime/Serie/SerieHandler.cs index b750ef6e..e8983309 100644 --- a/Runtime/Serie/SerieHandler.cs +++ b/Runtime/Serie/SerieHandler.cs @@ -10,6 +10,7 @@ namespace XCharts.Runtime { public BaseChart chart { get; internal set; } public SerieHandlerAttribute attribute { get; internal set; } + public bool inited { get; internal set; } public virtual int defaultDimension { get; internal set; } public virtual void InitComponent() { }