更新教程

This commit is contained in:
monitor1394
2020-09-19 17:56:56 +08:00
parent 075b0939e9
commit 9274844548
2 changed files with 3 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ namespace XCharts.Examples
if (chart == null) if (chart == null)
{ {
chart = gameObject.AddComponent<LineChart>(); chart = gameObject.AddComponent<LineChart>();
chart.SetSize(580, 300);//代码动态添加图表需要设置尺寸或直接操作chart.rectTransform
} }
chart.title.show = true; chart.title.show = true;
chart.title.text = "Line Simple"; chart.title.text = "Line Simple";

View File

@@ -49,13 +49,14 @@
## 用代码添加折线图 ## 用代码添加折线图
给`gameObject`挂上`LineChart`脚本: 给`gameObject`挂上`LineChart`脚本,需要调用`SetSize()`接口设置图表尺寸,或者直接操作`chart.rectTransfrom`
```C# ```C#
var chart = gameObject.GetComponent<LineChart>(); var chart = gameObject.GetComponent<LineChart>();
if (chart == null) if (chart == null)
{ {
chart = gameObject.AddComponent<LineChart>(); chart = gameObject.AddComponent<LineChart>();
chart.SetSize(580, 300);//代码动态添加图表需要设置尺寸或直接操作chart.rectTransform
} }
``` ```