IEnumerator InitChart() { chart = gameObject.GetComponent <LineChart>(); if (chart == null) { gameObject.AddComponent <LineChart>(); } chart.title.show = true; chart.title.text = "术语解析-组件"; chart.grid.bottom = 30; chart.grid.right = 30; chart.grid.left = 50; chart.grid.top = 80; chart.dataZoom.enable = false; chart.visualMap.enable = false; chart.RemoveData(); chart.AddSerie(SerieType.Bar, "Bar"); chart.AddSerie(SerieType.Line, "Line"); for (int i = 0; i < 8; i++) { chart.AddXAxisData("x" + (i + 1)); chart.AddData(0, Random.Range(10, 100)); chart.AddData(1, Random.Range(30, 100)); } yield return(null); }
void AddData() { chart.series.list[0].ClearData(); chart.series.list[1].ClearData(); for (int i = 0; i < 5; i++) { chart.AddData(0, Random.Range(20, 100)); chart.AddData(1, Random.Range(1, 10)); } }
void Update() { if (angle > 3000) { return; } angle++; float xvalue = Mathf.PI / 180 * angle; float yvalue = Mathf.Sin(xvalue); chart.AddData(0, xvalue, yvalue); }
IEnumerator AddSimpleLine() { chart = gameObject.GetComponent <LineChart>(); if (chart == null) { chart = gameObject.AddComponent <LineChart>(); } chart.title.text = "LineChart - 折线图"; chart.title.subText = "普通折线图"; chart.yAxis0.minMaxType = Axis.AxisMinMaxType.Custom; chart.yAxis0.min = 0; chart.yAxis0.max = 100; chart.RemoveData(); serie = chart.AddSerie(SerieType.Line, "Line"); for (int i = 0; i < m_DataNum; i++) { chart.AddXAxisData("x" + (i + 1)); chart.AddData(0, UnityEngine.Random.Range(30, 90)); } yield return(new WaitForSeconds(1)); }
void Awake() { chart = gameObject.GetComponent <LineChart>(); if (chart != null) { GameObject.DestroyImmediate(chart); } chart = gameObject.AddComponent <LineChart>(); chart.title.show = true; chart.title.text = "Sin Curve"; chart.tooltip.show = true; chart.legend.show = false; chart.xAxises[0].show = true; chart.xAxises[1].show = false; chart.yAxises[0].show = true; chart.yAxises[1].show = false; chart.xAxises[0].type = Axis.AxisType.Value; chart.yAxises[0].type = Axis.AxisType.Value; chart.xAxises[0].boundaryGap = false; chart.xAxises[0].maxCache = 0; chart.series.list[0].maxCache = 0; chart.RemoveData(); var serie = chart.AddSerie(SerieType.Line); serie.symbol.type = SerieSymbolType.None; serie.lineType = LineType.Normal; for (angle = 0; angle < 1080; angle++) { float xvalue = Mathf.PI / 180 * angle; float yvalue = Mathf.Sin(xvalue); chart.AddData(0, xvalue, yvalue); } }