Ejemplo n.º 1
0
        IEnumerator RadarAdd()
        {
            chart = gameObject.GetComponent <RadarChart>();
            if (chart == null)
            {
                chart = gameObject.AddComponent <RadarChart>();
            }

            chart.RemoveChartComponents <RadarCoord>();
            chart.RemoveData();

            chart.GetChartComponent <Title>().text    = "RadarChart - 雷达图";
            chart.GetChartComponent <Title>().subText = "";

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

            legend.show           = true;
            legend.location.align = Location.Align.TopLeft;
            legend.location.top   = 60;
            legend.location.left  = 2;
            legend.itemWidth      = 70;
            legend.itemHeight     = 20;
            legend.orient         = Orient.Vertical;

            var radarCoord = chart.AddChartComponent <RadarCoord>();

            radarCoord.shape     = RadarCoord.Shape.Polygon;
            radarCoord.center[0] = 0.5f;
            radarCoord.center[1] = 0.4f;
            radarCoord.radius    = 0.4f;

            radarCoord.AddIndicator("indicator1", 0, 100);
            radarCoord.AddIndicator("indicator2", 0, 100);
            radarCoord.AddIndicator("indicator3", 0, 100);
            radarCoord.AddIndicator("indicator4", 0, 100);
            radarCoord.AddIndicator("indicator5", 0, 100);

            serie            = chart.AddSerie <Radar>("test");
            serie.radarIndex = 0;
            chart.AddData(0, new List <double> {
                10, 20, 60, 40, 20
            }, "data1");
            chart.AddData(0, new List <double> {
                40, 60, 90, 80, 70
            }, "data2");
            yield return(new WaitForSeconds(1));
        }
Ejemplo n.º 2
0
        IEnumerator RadarAdd()
        {
            chart = gameObject.GetComponent <RadarChart>();
            if (chart == null)
            {
                chart = gameObject.AddComponent <RadarChart>();
            }
            chart.RemoveRadar();
            chart.RemoveData();

            chart.title.text    = "RadarChart - 雷达图";
            chart.title.subText = "";

            chart.legend.show           = true;
            chart.legend.location.align = Location.Align.TopLeft;
            chart.legend.location.top   = 60;
            chart.legend.location.left  = 2;
            chart.legend.itemWidth      = 70;
            chart.legend.itemHeight     = 20;
            chart.legend.orient         = Orient.Vertical;

            chart.AddRadar(Radar.Shape.Polygon, new Vector2(0.5f, 0.4f), 0.4f);
            chart.AddIndicator(0, "indicator1", 0, 100);
            chart.AddIndicator(0, "indicator2", 0, 100);
            chart.AddIndicator(0, "indicator3", 0, 100);
            chart.AddIndicator(0, "indicator4", 0, 100);
            chart.AddIndicator(0, "indicator5", 0, 100);

            serie            = chart.AddSerie(SerieType.Radar, "test");
            serie.radarIndex = 0;
            chart.AddData(0, new List <float> {
                10, 20, 60, 40, 20
            }, "data1");
            chart.AddData(0, new List <float> {
                40, 60, 90, 80, 70
            }, "data2");
            yield return(new WaitForSeconds(1));
        }