MSChart 曲线标识显示
程序代码:
protected void ViewChart() { double[][] data = new double[4][]; data[0] = new double[3] { 30, 50, 35 }; data[1] = new double[3] { 45, 55, 20 }; data[2] = new double[3] { 32, 59, 19 }; data[3] = new double[3] { 37, 21, 44 }; string[] ms = new string[3] { "C#", "Java", "Object-C" }; #region 样条图(平滑曲线) for (int i = 0; i < data.Length; i++) { Series ser = new Series(i.ToString()+"_1"); ser.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline;//设置图表类型 ser.MarkerStyle = System.Web.UI.DataVisualization.Charting.MarkerStyle.Circle;//设置点的样式,十字形 for (int j = 0; j < data[i].Length; j++) { ser.Points.AddY(data[i][j]); } this.Chart1.Series.Add(ser); ser.IsValueShownAsLabel = true; ser.LegendText = ser.Name; ser.IsVisibleInLegend = true; } Chart1.ChartAreas["ChartArea1"].AxisX.Title = "语言";//X轴标题 Chart1.ChartAreas["ChartArea1"].AxisX.TitleAlignment = StringAlignment.Far;//设置Y轴标题的名称所在位置位远 Chart1.ChartAreas["ChartArea1"].AxisY.Title = "统计";//X轴标题 Chart1.ChartAreas["ChartArea1"].AxisY.TitleAlignment = StringAlignment.Far;//设置Y轴标题的名称所在位置位远 Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;//X轴数据的间距 Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;//不显示竖着的分割线 Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineColor = Color.White; #endregion }