Fixed dynamically creating chart at runtime would be abnormal

This commit is contained in:
monitor1394
2021-04-26 19:37:02 +08:00
parent 0813bbfadd
commit 3933420cf6
6 changed files with 39 additions and 21 deletions

View File

@@ -27,6 +27,9 @@ namespace XCharts
protected override void InitComponent()
{
base.InitComponent();
if (m_Polars.Count == 0) m_Polars = new List<Polar>() { Polar.defaultPolar };
if (m_RadiusAxes.Count == 0) m_RadiusAxes = new List<RadiusAxis>() { RadiusAxis.defaultRadiusAxis };
if (m_AngleAxes.Count == 0) m_AngleAxes = new List<AngleAxis>() { AngleAxis.defaultAngleAxis };
CheckMinMaxValue();
UpdateRuntimeValue();
InitPolars();
@@ -40,9 +43,9 @@ namespace XCharts
protected override void Reset()
{
base.Reset();
m_Polars = new List<Polar>() { Polar.defaultPolar };
m_RadiusAxes = new List<RadiusAxis>() { RadiusAxis.defaultRadiusAxis };
m_AngleAxes = new List<AngleAxis>() { AngleAxis.defaultAngleAxis };
m_Polars.Clear();
m_RadiusAxes.Clear();
m_AngleAxes.Clear();
title.text = "PolarChart";
tooltip.type = Tooltip.Type.Corss;
RemoveData();