void Awake()
        {
            chart = gameObject.GetComponent <GaugeChart>();
            if (chart == null)
            {
                chart = gameObject.AddComponent <GaugeChart>();
            }
            chart.title.text = "GaugeChart";
            chart.RemoveData();

            var serie = chart.AddSerie(SerieType.Gauge, "速度");

            serie.min         = 0;
            serie.max         = 220;
            serie.startAngle  = -125;
            serie.endAngle    = 125;
            serie.center[0]   = 0.5f;
            serie.center[1]   = 0.5f;
            serie.radius[0]   = 80;
            serie.splitNumber = 5;
            serie.animation.dataChangeEnable = true;
            serie.roundCap = true;

            serie.titleStyle.show             = true;
            serie.titleStyle.textStyle.offset = new Vector2(0, 20);

            serie.label.show   = true;
            serie.label.offset = new Vector3(0, -20);

            serie.gaugeAxis.show = true;
            serie.gaugeAxis.axisLine.lineStyle.width = 15;

            serie.gaugePointer.show  = true;
            serie.gaugePointer.width = 15;

            var value = UnityEngine.Random.Range(serie.min, serie.max);

            chart.AddData(0, value, "km/h");
        }
예제 #2
0
 public static Chart CreateChart(ChartType type, ChartModel model)
 {
   Chart chart = null;
   if (type == ChartType.VBAR || 
       type == ChartType.VBAR_STACKED || 
       type == ChartType.BAR_LINE_COMBO ||
       type == ChartType.BAR_AREA_COMBO ||
       type == ChartType.BAR_LINE_AREA_COMBO)
   {
     chart = new BarChart(type, model);
   }
   else if (type == ChartType.HBAR || type == ChartType.HBAR_STACKED)
   {
     chart = new HorizontalBarChart(type, model);
   }
   else if( type == ChartType.CYLINDERBAR)
   {
     chart = new CylinderBarChart(type, model);
   }
   
   else if (type == ChartType.PIE)
   {
     chart = new PieChart(type, model);
   }
   else if (type == ChartType.AREA || type == ChartType.AREA_STACKED)
   {
     chart = new AreaChart(type, model);
   }
   else if (type == ChartType.LINE)
   {
     chart = new LineChart(type, model);
   }
   else if (type == ChartType.SCATTER_PLOT)
   {
     chart = new ScatterPlotChart(type, model);
   }
   else if (type == ChartType.XYLINE)
   {
     chart = new XYLineChart(type, model);
   }
   else if (type == ChartType.RADAR || type == ChartType.RADAR_AREA)
   {
     chart = new RadarChart(type, model);
   }
   else if (type == ChartType.FUNNEL)
   {
     chart = new FunnelChart(type, model);
   }
   else if (type == ChartType.SEMI_CIRCULAR_GAUGE)
   {
     chart = new SemiCircularGaugeChart(type, model);
   }
   else if (type == ChartType.CIRCULAR_GAUGE)
   {
     chart = new GaugeChart(type, model);
   }
   else if (type == ChartType.CANDLE_STICK)
   {
     chart = new CandleStickChart(type, model);
   }
   return chart;
 }