mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-31 13:58:48 +00:00
更新教程
This commit is contained in:
@@ -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";
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user