修复Tooltip在对数轴时指示不准确的问题

This commit is contained in:
monitor1394
2023-11-28 10:04:15 +08:00
parent 7ea260b986
commit 0a19b2a6cc
8 changed files with 81 additions and 22 deletions

View File

@@ -194,6 +194,7 @@ namespace XCharts.Runtime
CheckRefreshChart();
Internal_CheckAnimation();
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_SerieHandlers) handler.AfterUpdate();

View File

@@ -94,6 +94,7 @@ namespace XCharts.Runtime
public virtual void InitComponent() { }
public virtual void RemoveComponent() { }
public virtual void CheckComponent(StringBuilder sb) { }
public virtual void BeforceSerieUpdate() { }
public virtual void Update() { }
public virtual void DrawBase(VertexHelper vh) { }
public virtual void DrawUpper(VertexHelper vh) { }

View File

@@ -22,6 +22,7 @@ namespace XCharts.Runtime
private static Dictionary<double, Dictionary<string, string>> s_NumberToStr = new Dictionary<double, Dictionary<string, string>>();
private static Dictionary<int, Dictionary<string, string>> s_PrecisionToStr = new Dictionary<int, Dictionary<string, string>>();
private static Dictionary<string, Dictionary<int, string>> s_StringIntDict = new Dictionary<string, Dictionary<int, string>>();
public static string FloatToStr(double value, string numericFormatter = "F", int precision = 0)
{
@@ -113,6 +114,19 @@ namespace XCharts.Runtime
}
}
public static string GetString(string prefix, int suffix)
{
if (!s_StringIntDict.ContainsKey(prefix))
{
s_StringIntDict[prefix] = new Dictionary<int, string>();
}
if (!s_StringIntDict[prefix].ContainsKey(suffix))
{
s_StringIntDict[prefix][suffix] = prefix + suffix;
}
return s_StringIntDict[prefix][suffix];
}
internal static string GetComponentObjectName(MainComponent component)
{
Dictionary<int, string> dict;

View File

@@ -438,7 +438,8 @@ namespace XCharts.Runtime
label.color = (!labelStyle.background.autoColor || autoColor == Color.clear) ?
labelStyle.background.color : autoColor;
label.sprite = labelStyle.background.sprite;
label.type = labelStyle.background.type;
if(label.type != labelStyle.background.type)
label.type = labelStyle.background.type;
}
else
{