This commit is contained in:
monitor1394
2024-01-21 22:33:45 +08:00
parent e68e41a939
commit 653b81cc48
17 changed files with 41 additions and 11 deletions

View File

@@ -15,6 +15,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<BarChart>();
chart.Init();
}
var serie = chart.GetSerie(0);
serie.animation.enable = true;

View File

@@ -40,7 +40,10 @@ namespace XCharts.Example
IEnumerator AddSimpleLine()
{
chart = gameObject.GetComponent<LineChart>();
if (chart == null) chart = gameObject.AddComponent<LineChart>();
if (chart == null){
chart = gameObject.AddComponent<LineChart>();
chart.Init();
}
chart.GetChartComponent<Title>().text = "LineChart - 折线图";
chart.GetChartComponent<Title>().subText = "普通折线图";

View File

@@ -16,6 +16,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<LineChart>();
chart.Init();
}
chart.EnsureChartComponent<Title>().show = true;
chart.EnsureChartComponent<Title>().text = "Sin Curve";

View File

@@ -29,7 +29,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<LineChart>();
chart.SetSize(580, 300);
chart.Init();
}
chart.EnsureChartComponent<Title>().show = true;
chart.EnsureChartComponent<Title>().text = "Line Simple";

View File

@@ -38,7 +38,11 @@ namespace XCharts.Example
IEnumerator AddSimpleBar()
{
chart = gameObject.GetComponent<BarChart>();
if (chart == null) chart = gameObject.AddComponent<BarChart>();
if (chart == null)
{
chart = gameObject.AddComponent<BarChart>();
chart.Init();
}
chart.EnsureChartComponent<Title>().text = "BarChart - 柱状图";
chart.EnsureChartComponent<Title>().subText = "普通柱状图";

View File

@@ -38,7 +38,11 @@ namespace XCharts.Example
IEnumerator PieAdd()
{
chart = gameObject.GetComponent<PieChart>();
if (chart == null) chart = gameObject.AddComponent<PieChart>();
if (chart == null)
{
chart = gameObject.AddComponent<PieChart>();
chart.Init();
}
yield return null;
chart.GetChartComponent<Title>().text = "PieChart - 饼图";
chart.GetChartComponent<Title>().subText = "基础饼图";

View File

@@ -17,6 +17,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<PieChart>();
chart.Init();
}
var serieIndex = 0;
var serie = chart.GetSerie(serieIndex);

View File

@@ -40,7 +40,11 @@ namespace XCharts.Example
IEnumerator RadarAdd()
{
chart = gameObject.GetComponent<RadarChart>();
if (chart == null) chart = gameObject.AddComponent<RadarChart>();
if (chart == null)
{
chart = gameObject.AddComponent<RadarChart>();
chart.Init();
}
chart.RemoveChartComponents<RadarCoord>();
chart.RemoveData();

View File

@@ -19,6 +19,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<RadarChart>();
chart.Init();
}
}

View File

@@ -16,6 +16,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<HeatmapChart>();
chart.Init();
}
chart.GetChartComponent<Title>().text = "HeatmapChart";
chart.GetChartComponent<Tooltip>().type = Tooltip.Type.None;

View File

@@ -18,6 +18,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<BaseChart>();
chart.Init();
}
chart.EnsureChartComponent<PolarCoord>();
}

View File

@@ -19,6 +19,7 @@ namespace XCharts.Example
if (chart == null)
{
chart = gameObject.AddComponent<CandlestickChart>();
chart.Init();
}
AddData();
}