コード例 #1
0
        public static Serie AddDefaultSerie(BaseChart chart, string serieName)
        {
            var serie = chart.AddSerie <Bar>(serieName);

            for (int i = 0; i < 5; i++)
            {
                chart.AddData(serie.index, UnityEngine.Random.Range(10, 90));
            }
            return(serie);
        }
コード例 #2
0
 void OnTestBtn()
 {
     object[][] m_TestData = new object[][]
     {
         new object[] { "01/06/20", 2.2d, 5.6d },
         new object[] { "22/06/20", 2.4d, 5.3d },
         new object[] { "04/08/21", 4.5d, 5.4d },
         new object[] { "05/08/21", 6.3d, 6.4d },
         new object[] { "06/08/21", 3.1d, 6.4d },
         new object[] { "09/08/21", 3.9d, 6.3d },
         new object[] { "10/08/21", 1.9d, 4.6d },
     };
     chart.ClearData();
     foreach (var list in m_TestData)
     {
         chart.AddXAxisData((string)list[0]);
         chart.AddData(0, (double)list[1]);
         chart.AddData(1, (double)list[2]);
     }
 }
コード例 #3
0
        void AddChart()
        {
            chart = gameObject.GetComponent <BaseChart>();
            if (chart == null)
            {
                chart = gameObject.AddComponent <LineChart>();
                chart.Init();
                chart.SetSize(1200, 600);
            }
            var title = chart.GetOrAddChartComponent <Title>();

            title.text    = "Simple LineChart";
            title.subText = "normal line";

            var tooltip = chart.GetOrAddChartComponent <Tooltip>();

            tooltip.show = true;

            var legend = chart.GetOrAddChartComponent <Legend>();

            legend.show = false;

            var xAxis = chart.GetOrAddChartComponent <XAxis>();

            xAxis.splitNumber = 10;
            xAxis.boundaryGap = true;
            xAxis.type        = Axis.AxisType.Category;

            var yAxis = chart.GetOrAddChartComponent <YAxis>();

            yAxis.type = Axis.AxisType.Value;

            chart.RemoveData();
            chart.AddSerie <Line>("line");

            for (int i = 0; i < 5; i++)
            {
                chart.AddXAxisData("x" + i);
                chart.AddData(0, Random.Range(10, 20));
            }
        }
コード例 #4
0
        void AddData()
        {
            chart.RemoveData();
            chart.GetChartComponent <Tooltip>().type = Tooltip.Type.Corss;
            var angleAxis = chart.GetChartComponent <AngleAxis>();

            angleAxis.type       = Axis.AxisType.Value;
            angleAxis.minMaxType = Axis.AxisMinMaxType.Custom;
            angleAxis.min        = 0;
            angleAxis.max        = 360;
            angleAxis.startAngle = Random.Range(0, 90);
            chart.AddSerie <Line>("line1");

            var rate = Random.Range(1, 4);

            for (int i = 0; i <= 360; i++)
            {
                var t = i / 180f * Mathf.PI;
                var r = Mathf.Sin(2 * t) * Mathf.Cos(2 * t) * rate;
                chart.AddData(0, Mathf.Abs(r), i);
            }
        }
コード例 #5
0
        void ModifyComponent()
        {
            var title = chart.GetOrAddChartComponent <Title>();

            title.text    = "Simple LineChart";
            title.subText = "normal line";

            var serie1 = chart.AddSerie <Line>();

            //var serie2 = chart.GetSerie<Line>();

            serie1.AddExtraComponent <AreaStyle>();
            var label = serie1.AddExtraComponent <LabelStyle>();

            label.offset = new Vector3(0, 20, 0);

            var serieData = chart.AddData(0, 20);

            serieData.radius = 10;
            var itemStyle = serieData.GetOrAddComponent <ItemStyle>();

            itemStyle.color = Color.blue;
        }