2019-10-22 04:09:04 +08:00
|
|
|
|
/******************************************/
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/* Copyright (c) 2018 monitor1394 */
|
|
|
|
|
|
/* https://github.com/monitor1394 */
|
|
|
|
|
|
/* */
|
|
|
|
|
|
/******************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XCharts
|
|
|
|
|
|
{
|
|
|
|
|
|
[DisallowMultipleComponent]
|
|
|
|
|
|
[ExecuteInEditMode]
|
|
|
|
|
|
public class Demo_Test : MonoBehaviour
|
|
|
|
|
|
{
|
2019-11-30 21:24:04 +08:00
|
|
|
|
private float updateTime = 0;
|
2019-12-03 07:49:37 +08:00
|
|
|
|
BaseChart chart;
|
2019-10-22 04:09:04 +08:00
|
|
|
|
void Awake()
|
|
|
|
|
|
{
|
2019-12-03 07:49:37 +08:00
|
|
|
|
chart = gameObject.GetComponent<BaseChart>();
|
2020-03-05 20:25:19 +08:00
|
|
|
|
var btnTrans = transform.parent.Find("Button");
|
|
|
|
|
|
if (btnTrans)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnTrans.gameObject.GetComponent<Button>().onClick.AddListener(OnTestBtn);
|
|
|
|
|
|
}
|
2019-10-22 04:09:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-11-30 21:24:04 +08:00
|
|
|
|
void Update()
|
2019-10-22 04:09:04 +08:00
|
|
|
|
{
|
2020-03-05 20:25:19 +08:00
|
|
|
|
// updateTime += Time.deltaTime;
|
|
|
|
|
|
// if (chart && updateTime > 2)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// updateTime = 0;
|
|
|
|
|
|
// var serie = chart.series.GetSerie(0);
|
|
|
|
|
|
// serie.animation.dataChangeEnable = true;
|
|
|
|
|
|
// var dataCount = serie.dataCount;
|
|
|
|
|
|
// if (chart is HeatmapChart)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var dimension = serie.GetSerieData(0).data.Count - 1;
|
|
|
|
|
|
// for (int i = 0; i < dataCount; i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// chart.UpdateData(0, i, dimension, Random.Range(0, 10));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// chart.UpdateData(0, Random.Range(0, dataCount), Random.Range(10, 90));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OnTestBtn()
|
|
|
|
|
|
{
|
|
|
|
|
|
//chart.series.list[0].lineStyle.width =UnityEngine.Random.Range(1, 5);
|
|
|
|
|
|
chart.series.list[0].lineStyle.width =UnityEngine.Random.Range(1, 5);
|
2019-10-22 04:09:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|