コード例 #1
0
ファイル: Program.cs プロジェクト: xiaoxiaozhu5/practice
        public static Chart getChart(String type)
        {
            Chart chart = null;

            if (type.Equals("histogram"))
            {
                chart = new HistogramChart();
            }
            else if (type.Equals("pie"))
            {
                chart = new PieChart();
            }
            else if (type.Equals("line"))
            {
                chart = new LineChart();
            }

            return(chart);
        }
コード例 #2
0
        public static Chart CreateChart(string type)
        {
            Chart chart = null;

            if (type.Equals("histogram"))
            {
                chart = new HistogramChart();
                Console.WriteLine("初始化设置柱状图!");
            }
            else if (type.Equals("pie"))
            {
                chart = new PieChart();
                Console.WriteLine("初始化设置饼状图!");
            }
            else if (type.Equals("Line"))
            {
                chart = new LineChart();
                Console.WriteLine("初始化设置线状图!");
            }

            return(chart);
        }