devexpress中chartcontrol的swiftplot从左向右添加坐标点
时间: 2023-06-15 19:03:28 浏览: 234
在DevExpress ChartControl中,可以通过以下步骤在SwiftPlot中从左到右添加坐标点:
1. 设置图表的X轴类型为数值轴。
```swift
chartControl1.Diagram.SeriesDataMember = "Series";
chartControl1.Diagram.AxisX.NumericScaleOptions.AutoGrid = false;
chartControl1.Diagram.AxisX.NumericScaleOptions.GridSpacing = 1;
chartControl1.Diagram.AxisX.Label.ResolveOverlappingOptions.AllowRotate = false;
chartControl1.Diagram.AxisX.Label.ResolveOverlappingOptions.AllowStagger = false;
chartControl1.Diagram.AxisX.Label.ResolveOverlappingOptions.AllowHide = false;
chartControl1.Diagram.AxisX.Label.Staggered = false;
chartControl1.Diagram.AxisX.WholeRange.Auto = false;
chartControl1.Diagram.AxisX.WholeRange.SideMarginsValue = 0.5;
chartControl1.Diagram.AxisX.VisualRange.Auto = false;
chartControl1.Diagram.AxisX.VisualRange.AutoSideMargins = false;
chartControl1.Diagram.AxisX.VisualRange.SideMarginsValue = 0;
chartControl1.Diagram.AxisX.VisualRange.MinValue = 0;
```
2. 创建SwiftPlot系列并添加数据点。
```swift
SwiftPlotSeries series = new SwiftPlotSeries();
series.Points.Add(new SwiftPlotPoint(0, 10));
series.Points.Add(new SwiftPlotPoint(1, 20));
series.Points.Add(new SwiftPlotPoint(2, 30));
series.Points.Add(new SwiftPlotPoint(3, 40));
series.Points.Add(new SwiftPlotPoint(4, 50));
chartControl1.Series.Add(series);
```
这将在SwiftPlot中创建一个新的系列并添加数据点。默认情况下,SwiftPlot将从左到右自动添加数据点。如果需要,可以通过在添加数据点时指定数据点的X值来更改数据点的顺序。
阅读全文