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); }
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); }