简要说明
阶梯线图 是由 StepLine3DSeriesView 对象来表示的,此对象属于 点、折线和样条系列视图。 当需要显示相同系列中不同点的取值的变化程度时,这种视图是有用的。 此外,还可以把 StepLine3DSeriesView.InvertedStep 属性设置为 true,从而指定是否反转显示这些阶梯。
在下面的插图中显示了一个阶梯线图。
图表类型特征
下表列出了这种图表类型的主要特征。
特征 |
取值 |
---|---|
系列视图类型 | StepLine3DSeriesView |
图象类型 | XYDiagram3D |
每个数据点的参数个数 | 1 |
每个数据点的取值个数 | 1 |
注意 |
---|
要获得关于哪些图表类型可以与 阶梯线图 组合使用的信息,请参阅 组合使用不同的系列视图 文档。 |
示例
下面的示例演示了在运行时刻如何创建 ChartControl (拥有一个 StepLine3DSeriesView 类型的系列),设置它的常规属性,并把图表添加到窗体中。 在继续本示例之前,首先要在 Visual Studio 中创建一个 Windows 窗体应用程序,并把所有 必需的程序集 包含到项目的“引用”列表中。
然后,把下列代码添加到 Form.Load 事件处理程序。
C# | 复制代码 |
---|---|
using System; using System.Windows.Forms; using DevExpress.XtraCharts; // ... private void Form1_Load(object sender, EventArgs e) { // Create a new chart. ChartControl StepLineChart3D = new ChartControl(); // Add a step line series to it. Series series1 = new Series("Series 1", ViewType.StepLine3D); // Add points to the series. series1.Points.Add(new SeriesPoint("A", 12)); series1.Points.Add(new SeriesPoint("B", 4)); series1.Points.Add(new SeriesPoint("C", 17)); series1.Points.Add(new SeriesPoint("D", 7)); series1.Points.Add(new SeriesPoint("E", 12)); series1.Points.Add(new SeriesPoint("F", 4)); series1.Points.Add(new SeriesPoint("G", 17)); series1.Points.Add(new SeriesPoint("H", 7)); // Add the series to the chart. StepLineChart3D.Series.Add(series1); // Access labels of the series. ((Line3DSeriesLabel)series1.Label).Visible = true; ((Line3DSeriesLabel)series1.Label).ResolveOverlappingMode = ResolveOverlappingMode.Default; // Access the series options. series1.PointOptions.PointView = PointView.ArgumentAndValues; // Customize the view-type-specific properties of the series. StepLine3DSeriesView myView = (StepLine3DSeriesView)series1.View; myView.LineWidth = 5; myView.LineThickness = 4; // Access the diagram's options. ((XYDiagram3D)StepLineChart3D.Diagram).RuntimeRotation = true; ((XYDiagram3D)StepLineChart3D.Diagram).RotationType = RotationType.UseMouseStandard; // Add a title to the chart and hide the legend. ChartTitle chartTitle1 = new ChartTitle(); chartTitle1.Text = "3D Step Line Chart"; StepLineChart3D.Titles.Add(chartTitle1); StepLineChart3D.Legend.Visible = false; // Add the chart to the form. StepLineChart3D.Dock = DockStyle.Fill; this.Controls.Add(StepLineChart3D); } |
Visual Basic | 复制代码 |
---|---|
Imports System Imports System.Windows.Forms Imports DevExpress.XtraCharts ' ... Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load ' Create a new chart. Dim StepLineChart3D As New ChartControl() ' Add a step line series to it. Dim series1 As New Series("Series 1", ViewType.StepLine3D) ' Add points to the series. series1.Points.Add(New SeriesPoint("A", 12)) series1.Points.Add(New SeriesPoint("B", 4)) series1.Points.Add(New SeriesPoint("C", 17)) series1.Points.Add(New SeriesPoint("D", 7)) series1.Points.Add(New SeriesPoint("E", 12)) series1.Points.Add(New SeriesPoint("F", 4)) series1.Points.Add(New SeriesPoint("G", 17)) series1.Points.Add(New SeriesPoint("H", 7)) ' Add the series to the chart. StepLineChart3D.Series.Add(series1) ' Access labels of the series. CType(series1.Label, Line3DSeriesLabel).Visible = True CType(series1.Label, Line3DSeriesLabel).ResolveOverlappingMode = ResolveOverlappingMode.Default ' Access the series options. series1.PointOptions.PointView = PointView.ArgumentAndValues ' Customize the view-type-specific properties of the series. Dim myView As StepLine3DSeriesView = CType(series1.View, StepLine3DSeriesView) myView.LineWidth = 5 myView.LineThickness = 4 ' Access the diagram's options. CType(StepLineChart3D.Diagram, XYDiagram3D).RuntimeRotation = True CType(StepLineChart3D.Diagram, XYDiagram3D).RotationType = RotationType.UseMouseStandard ' Add a title to the chart and hide the legend. Dim chartTitle1 As New ChartTitle() chartTitle1.Text = "3D Step Line Chart" StepLineChart3D.Titles.Add(chartTitle1) StepLineChart3D.Legend.Visible = False ' Add the chart to the form. StepLineChart3D.Dock = DockStyle.Fill Me.Controls.Add(StepLineChart3D) End Sub |
Show Me |
---|
在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E1044。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。 |