| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 | using UnityEngine;#if INPUT_SYSTEM_ENABLEDusing Input = XCharts.Runtime.InputHelper;#endifusing XCharts.Runtime;namespace XCharts.Example{    [DisallowMultipleComponent]    [ExecuteInEditMode]    public class Example13_LineSimple : MonoBehaviour    {        void Awake()        {            AddData();        }        void Update()        {            if (Input.GetKeyDown(KeyCode.Space))            {                AddData();            }        }        void AddData()        {            var chart = gameObject.GetComponent<LineChart>();            if (chart == null)            {                chart = gameObject.AddComponent<LineChart>();                chart.Init();            }            chart.EnsureChartComponent<Title>().show = true;            chart.EnsureChartComponent<Title>().text = "Line Simple";            chart.EnsureChartComponent<Tooltip>().show = true;            chart.EnsureChartComponent<Legend>().show = false;            var xAxis = chart.EnsureChartComponent<XAxis>();            var yAxis = chart.EnsureChartComponent<YAxis>();            xAxis.show = true;            yAxis.show = true;            xAxis.type = Axis.AxisType.Category;            yAxis.type = Axis.AxisType.Value;            xAxis.splitNumber = 10;            xAxis.boundaryGap = true;            chart.RemoveData();            chart.AddSerie<Line>();            chart.AddSerie<Line>();            for (int i = 0; i < 20; i++)            {                chart.AddXAxisData("x" + i);                chart.AddData(0, Random.Range(10, 20));                chart.AddData(1, Random.Range(10, 20));            }        }    }}
 |