ChartControl myChartControl = new ChartControl();
//图标位置
myChartControl.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;
myChartControl.Legend.AlignmentVertical = LegendAlignmentVertical.Top;
ChartTitle chartTitle = new ChartTitle();
//标题内容
chartTitle.Text = this.Text;
//字体颜色
chartTitle.TextColor = System.Drawing.Color.Black;
//字体类型字号
chartTitle.Font = new Font("Tahoma", 8);
//标题对齐方式
chartTitle.Dock = ChartTitleDockStyle.Bottom;
chartTitle.Alignment = StringAlignment.Far;
//清理标题
myChartControl.Titles.Clear();
//加载标题
myChartControl.Titles.Add(chartTitle);
Series series1 = new Series(this.Text, ViewType.Spline);
//x轴类型
series1.ArgumentScaleType = ScaleType.DateTime;
//y轴类型
series1.ValueScaleType = ScaleType.Numerical;
//X轴的数据字段
series1.ArgumentDataMember = "StatisticsTime";
//Y轴的数据字段 两种方式
series1.ValueDataMembers[0] = "StatisticsSum";
//series1.ValueDataMembers.AddRange(new string[] { "StatisticsSum" });
//定义线条上点的标识形状是否需要
((LineSeriesView)series1.View).MarkerVisibility = DefaultBoolean.True;
//定义线条上点的标识形状
((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Circle;
//不显示X、Y轴上面的交点的值
series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
//线条的类型,虚线,实线
((LineSeriesView)series1.View).LineStyle.DashStyle = DashStyle.Solid;
//先设置Series,之后操作XYDiagram
XYDiagram diagram = (XYDiagram)myChartControl.Diagram;
//X轴刻度单位
diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Day;
// X轴刻度间距
diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Day;
//控制X、Y轴显示
diagram.AxisY.Label.TextPattern = "Axis value = ";
diagram.AxisY.Label.Angle = -30;
diagram.AxisY.Label.EnableAntialiasing = DefaultBoolean.True;
diagram.AxisX.Label.Staggered = true;
diagram.AxisX.Interlaced = true;
diagram.AxisX.NumericScaleOptions.GridSpacing = 10;
diagram.AxisX.Label.Angle = -30;
diagram.AxisX.Label.EnableAntialiasing = DefaultBoolean.True;
diagram.AxisX.WholeRange.Auto = false;
//X轴文字角度
diagram.AxisX.Label.Angle = 10;
//显示X轴间隔数量
diagram.AxisX.MinorCount = 9;
//是否显示X轴间隔
diagram.AxisX.Tickmarks.MinorVisible = true;
//显示Y轴间隔数量
diagram.AxisY.MinorCount = 1;
//是否显示Y轴间隔
diagram.AxisY.Tickmarks.MinorVisible = true;
//是否从X轴原点开始显示
diagram.AxisX.WholeRange.AutoSideMargins = true;
diagram.AxisX.VisualRange.AutoSideMargins= false;
diagram.AxisX.VisibleInPanesSerializable = "-1";
//获取Diagram必须在ChartControl中已经加入了Series之后
diagram.Rotated = false;
//图标位置
myChartControl.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Right;
myChartControl.Legend.AlignmentVertical = LegendAlignmentVertical.Top;
ChartTitle chartTitle = new ChartTitle();
//标题内容
chartTitle.Text = this.Text;
//字体颜色
chartTitle.TextColor = System.Drawing.Color.Black;
//字体类型字号
chartTitle.Font = new Font("Tahoma", 8);
//标题对齐方式
chartTitle.Dock = ChartTitleDockStyle.Bottom;
chartTitle.Alignment = StringAlignment.Far;
//清理标题
myChartControl.Titles.Clear();
//加载标题
myChartControl.Titles.Add(chartTitle);
Series series1 = new Series(this.Text, ViewType.Spline);
//x轴类型
series1.ArgumentScaleType = ScaleType.DateTime;
//y轴类型
series1.ValueScaleType = ScaleType.Numerical;
//X轴的数据字段
series1.ArgumentDataMember = "StatisticsTime";
//Y轴的数据字段 两种方式
series1.ValueDataMembers[0] = "StatisticsSum";
//series1.ValueDataMembers.AddRange(new string[] { "StatisticsSum" });
//定义线条上点的标识形状是否需要
((LineSeriesView)series1.View).MarkerVisibility = DefaultBoolean.True;
//定义线条上点的标识形状
((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Circle;
//不显示X、Y轴上面的交点的值
series1.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
//线条的类型,虚线,实线
((LineSeriesView)series1.View).LineStyle.DashStyle = DashStyle.Solid;
//先设置Series,之后操作XYDiagram
XYDiagram diagram = (XYDiagram)myChartControl.Diagram;
//X轴刻度单位
diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Day;
// X轴刻度间距
diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Day;
//控制X、Y轴显示
diagram.AxisY.Label.TextPattern = "Axis value = ";
diagram.AxisY.Label.Angle = -30;
diagram.AxisY.Label.EnableAntialiasing = DefaultBoolean.True;
diagram.AxisX.Label.Staggered = true;
diagram.AxisX.Interlaced = true;
diagram.AxisX.NumericScaleOptions.GridSpacing = 10;
diagram.AxisX.Label.Angle = -30;
diagram.AxisX.Label.EnableAntialiasing = DefaultBoolean.True;
diagram.AxisX.WholeRange.Auto = false;
//X轴文字角度
diagram.AxisX.Label.Angle = 10;
//显示X轴间隔数量
diagram.AxisX.MinorCount = 9;
//是否显示X轴间隔
diagram.AxisX.Tickmarks.MinorVisible = true;
//显示Y轴间隔数量
diagram.AxisY.MinorCount = 1;
//是否显示Y轴间隔
diagram.AxisY.Tickmarks.MinorVisible = true;
//是否从X轴原点开始显示
diagram.AxisX.WholeRange.AutoSideMargins = true;
diagram.AxisX.VisualRange.AutoSideMargins= false;
diagram.AxisX.VisibleInPanesSerializable = "-1";
//获取Diagram必须在ChartControl中已经加入了Series之后
diagram.Rotated = false;