日期:2014-05-18 浏览次数:21667 次
if (chartControlCar.Series == null) return; chartControlCar.DataSource = null; chartControlCar.SeriesDataMember = null; chartControlCar.Series.Clear(); Series S1 = new Series("",ViewType.Line); //定义该折线的名称和类型 Legend lg = chartControlCar.Legend; //不显示折线名称 lg.Visible = false; S1.ArgumentScaleType = ScaleType.Numerical; //X轴为数值型 S1.ValueScaleType = ScaleType.Numerical; //Y轴为数值型 ((LineSeriesView)S1.View).LineMarkerOptions.Visible = false; //不显示折线节点 PointSeriesLabel label = (PointSeriesLabel)S1.Label; label.Visible = false; //不显示节点数值 switch (strLineStyle) //设置线条类型 { case "DASH": ((LineSeriesView)S1.View).LineStyle.DashStyle = DashStyle.Dash; break; case "DOT": ((LineSeriesView)S1.View).LineStyle.DashStyle = DashStyle.Dot; break; case "DASHDOT": ((LineSeriesView)S1.View).LineStyle.DashStyle = DashStyle.DashDot; break; case "SOLID": ((LineSeriesView)S1.View).LineStyle.DashStyle = DashStyle.Solid; break; default: ((LineSeriesView)S1.View).LineStyle.DashStyle = DashStyle.Solid; break; } S1.PointOptions.PointView = PointView.Argument; for(int i=0;i<strArrayWeights.Length;i++) { //X轴为二次表数值显示变化次数,Y轴为重量值 S1.Points.Add(new SeriesPoint(i + 1, new double[] { double.Parse(strArrayWeights[i]) })); } chartControlCar.Series.Add(S1); XYDiagram diagram = (XYDiagram)chartControlCar.Diagram; diagram.AxisY.Range.MaxValue = intAxisYMaxValue; //设置Y轴显示最大值 diagram.AxisY.Range.MinValue = intAxisYMinValue; //设置Y轴显示最小值