3.0 - bar chart

This commit is contained in:
monitor1394
2022-01-13 21:45:59 +08:00
parent 0282dae582
commit c9addaf02c
22 changed files with 195 additions and 106 deletions

View File

@@ -788,9 +788,9 @@ namespace XCharts
Debug.LogError("Serie no Handler:" + serie.GetType());
return;
}
var attrubte = serie.GetType().GetAttribute<SerieHandlerAttribute>();
var handler = (SerieHandler)Activator.CreateInstance(attrubte.handler);
handler.attribute = attrubte;
var attribute = serie.GetType().GetAttribute<SerieHandlerAttribute>();
var handler = (SerieHandler)Activator.CreateInstance(attribute.handler);
handler.attribute = attribute;
handler.chart = this;
handler.SetSerie(serie);
serie.handler = handler;

View File

@@ -73,16 +73,5 @@ namespace XCharts
if (handler != null)
handler.RefreshLabelNextFrame();
}
#if UNITY_EDITOR
protected virtual void Reset()
{
}
protected virtual void OnValidate()
{
SetAllDirty();
}
#endif
}
}

View File

@@ -653,8 +653,9 @@ namespace XCharts
count++;
intvalue = (int)(max * Mathf.Pow(10, count));
}
if (max > 0) return 1 / Mathf.Pow(10, count - 1);
else return -1 / Mathf.Pow(10, count);
var pow = Mathf.Pow(10, count);
if (max > 0) return (int)((max * pow + 1)) / pow;
else return (int)((max * pow - 1)) / pow;
}
if (ceilRate == 0)
{
@@ -694,8 +695,9 @@ namespace XCharts
count++;
intvalue = (int)(min * Mathf.Pow(10, count));
}
if (min > 0) return 1 / Mathf.Pow(10, count);
else return -1 / Mathf.Pow(10, count - 1);
var pow = Mathf.Pow(10, count);
if (min > 0) return (int)((min * pow + 1)) / pow;
else return (int)((min * pow - 1)) / pow;
}
if (ceilRate == 0)
{
@@ -797,7 +799,7 @@ namespace XCharts
}
public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)
{

View File

@@ -153,6 +153,7 @@ namespace XCharts
public static bool AddCustomTheme(Theme theme)
{
if (theme == null) return false;
if (Instance == null || Instance.m_CustomThemes == null) return false;
if (!Instance.m_CustomThemes.Contains(theme))
{
Instance.m_CustomThemes.Add(theme);