DevExpress--XtraCharts动态加载(曲线型)
如何实现:DevExpress--XtraCharts动态加载(备详细说明)
图表初始化需加载代码(放在Form.Designer.cs的this.SuspendLayout();函数后面)#region 图表初始化需加载代码(放在Form.Designer.cs的this.SuspendLayout();函数后面)
DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series();
DevExpress.XtraCharts.Series series2 = new DevExpress.XtraCharts.Series();
DevExpress.XtraCharts.PointSeriesLabel pointSeriesLabel1 = new DevExpress.XtraCharts.PointSeriesLabel();
DevExpress.XtraCharts.LineSeriesView lineView = new DevExpress.XtraCharts.LineSeriesView();
DevExpress.XtraCharts.XYDiagram xyDiagram1 = new DevExpress.XtraCharts.XYDiagram();
//series1.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;//设置显示类型
series1.ArgumentDataMember = "FPeriod";//数据划分依据
series1.View = lineView;//显示为线状还是其他诸如饼图、柱形图
series1.ValueDataMembersSerializable = "FData";//显示数据
ChartPoint.Series.AddRange(new DevExpress.XtraCharts.Series[] { series1 });//Series[] { series1, series2 }
//series1.Name = "分数";
ChartPoint.Series[0].View = lineView;
ChartPoint.Diagram = xyDiagram1;
xyDiagram1.AxisY.Title.Visible = true;
xyDiagram1.AxisY.Title.Text = "分数";//垂直列名称
xyDiagram1.AxisY.GridLines.Visible = true;//显示每项垂直线
xyDiagram1.AxisX.GridLines.Visible = true;
xyDiagram1.AxisX.Title.Visible = true;
xyDiagram1.AxisX.Title.Text = "月份";//水平列名称
ChartPoint.AppearanceName = "Northern Lights";//显示风格
//xyDiagram1.Rotated = false; //是否垂直和水平转换
#endregion
DevExpress.XtraCharts.Series series1 = new DevExpress.XtraCharts.Series();
DevExpress.XtraCharts.Series series2 = new DevExpress.XtraCharts.Series();
DevExpress.XtraCharts.PointSeriesLabel pointSeriesLabel1 = new DevExpress.XtraCharts.PointSeriesLabel();
DevExpress.XtraCharts.LineSeriesView lineView = new DevExpress.XtraCharts.LineSeriesView();
DevExpress.XtraCharts.XYDiagram xyDiagram1 = new DevExpress.XtraCharts.XYDiagram();
//series1.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;//设置显示类型
series1.ArgumentDataMember = "FPeriod";//数据划分依据
series1.View = lineView;//显示为线状还是其他诸如饼图、柱形图
series1.ValueDataMembersSerializable = "FData";//显示数据
ChartPoint.Series.AddRange(new DevExpress.XtraCharts.Series[] { series1 });//Series[] { series1, series2 }
//series1.Name = "分数";
ChartPoint.Series[0].View = lineView;
ChartPoint.Diagram = xyDiagram1;
xyDiagram1.AxisY.Title.Visible = true;
xyDiagram1.AxisY.Title.Text = "分数";//垂直列名称
xyDiagram1.AxisY.GridLines.Visible = true;//显示每项垂直线
xyDiagram1.AxisX.GridLines.Visible = true;
xyDiagram1.AxisX.Title.Visible = true;
xyDiagram1.AxisX.Title.Text = "月份";//水平列名称
ChartPoint.AppearanceName = "Northern Lights";//显示风格
//xyDiagram1.Rotated = false; //是否垂直和水平转换
#endregion
窗体事件执行代码#region 窗体事件执行代码
clsSuppVal SV = new clsSuppVal();
ChartPoint.Series[0].DataSource = SV.GetSuppChart(str1, str2).Tables[0].DefaultView;
ChartPoint.Series[0].Name = TextBox.Text;
#endregion
clsSuppVal SV = new clsSuppVal();
ChartPoint.Series[0].DataSource = SV.GetSuppChart(str1, str2).Tables[0].DefaultView;
ChartPoint.Series[0].Name = TextBox.Text;
#endregion