diff --git a/Runtime/Component/Sub/AxisLabel.cs b/Runtime/Component/Sub/AxisLabel.cs index e45bee3f..1751f4dc 100644 --- a/Runtime/Component/Sub/AxisLabel.cs +++ b/Runtime/Component/Sub/AxisLabel.cs @@ -131,7 +131,7 @@ namespace XCharts m_FontSize == other.fontSize && m_FontStyle == other.fontStyle && m_ForceENotation == other.forceENotation && - m_Formatter.Equals(other.formatter) && + ChartHelper.IsValueEqualsString(m_Formatter, other.formatter) && m_TextLimit.Equals(other.textLimit); } @@ -142,7 +142,7 @@ namespace XCharts public void SetRelatedText(Text txt, float labelWidth) { - m_TextLimit.SetRelatedText(txt,labelWidth); + m_TextLimit.SetRelatedText(txt, labelWidth); } public string GetFormatterContent(string category) diff --git a/Runtime/Utility/ChartHelper.cs b/Runtime/Utility/ChartHelper.cs index 091260c5..c123814a 100644 --- a/Runtime/Utility/ChartHelper.cs +++ b/Runtime/Utility/ChartHelper.cs @@ -370,6 +370,13 @@ namespace XCharts color1.r == color2.r; } + public static bool IsValueEqualsString(string str1, string str2) + { + if (str1 == null && str2 == null) return true; + else if (str1 != null && str2 != null) return str1.Equals(str2); + else return false; + } + public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2) { return v1.x == v2.x && v1.y == v2.y;