本示例演示了在运行时刻如何在 轴 中创建并定制 刻度分隔线。
C# | 复制代码 |
---|---|
// Cast your diagram object to an appropriate diagram type, // to access its axes. XYDiagram diagram = (XYDiagram)chartControl1.Diagram; // Add scale breaks to the Y-axis collection, // with their Edge1 and Edge2 properties defined in the constructor. diagram.AxisY.ScaleBreaks.Add(new ScaleBreak("Scale Break 1", 10, 100)); diagram.AxisY.ScaleBreaks.Add(new ScaleBreak("Scale Break 2", 110, 2000)); // Define the scale breaks' options. diagram.AxisY.ScaleBreakOptions.Style = ScaleBreakStyle.Ragged; diagram.AxisY.ScaleBreakOptions.SizeInPixels = 20; diagram.AxisY.ScaleBreakOptions.Color = Color.Turquoise; |
Visual Basic | 复制代码 |
---|---|
' Cast your diagram object to an appropriate diagram type, ' to access its axes. Dim diagram As XYDiagram = CType(chartControl1.Diagram, XYDiagram) ' Add scale breaks to the Y-axis collection, ' with their Edge1 and Edge2 properties defined in the constructor. diagram.AxisY.ScaleBreaks.Add(New ScaleBreak("Scale Break 1", 10, 100)) diagram.AxisY.ScaleBreaks.Add(New ScaleBreak("Scale Break 2", 110, 2000)) ' Define the scale breaks' options. diagram.AxisY.ScaleBreakOptions.Style = ScaleBreakStyle.Ragged diagram.AxisY.ScaleBreakOptions.SizeInPixels = 20 diagram.AxisY.ScaleBreakOptions.Color = Color.Turquoise |
Show Me |
---|
在 DevExpress Code Central 数据库中可以找到完整的示例项目,网址是 http://www.devexpress.com/example=E1493。 取决于目标平台类型 (ASP.NET、WinForms 等),可以在线运行本示例,或者下载自动可执行的示例。 |