博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
学习devexpresschartControl控件
阅读量:5750 次
发布时间:2019-06-18

本文共 5634 字,大约阅读时间需要 18 分钟。

devexpress官网chart:


 

层级关系:

 

 

 

 

 


 

1 XYDiagram diagram = chart.Diagram as XYDiagram;2 if (diagram != null) {3     // Access diagram properties, for example, rotate the diagram. 4     diagram.Rotated = true;5     // Access properties of objects that belong to the diagram,  6     // for example, axes and panes. 7     diagram.AxisY.Title.Text = "Population mid-year, millions";8     diagram.DefaultPane.Weight = 2;9 }
给坐标轴加标题

 

pans:

1 using System; 2 using System.Drawing; 3 using System.Windows.Forms; 4 using DevExpress.XtraCharts; 5 // ... 6  7 private void Form1_Load(object sender, EventArgs e) { 8     // Create a new chart. 9     ChartControl chartControl1 = new ChartControl();10 11     // Create two series.12     Series series1 = new Series("Series 1", ViewType.Bar);13     Series series2 = new Series("Series 2", ViewType.Line);14 15     // Add points to them, with their arguments different.16     series1.Points.Add(new SeriesPoint("A", 10));17     series1.Points.Add(new SeriesPoint("B", 12));18     series1.Points.Add(new SeriesPoint("C", 17));19     series1.Points.Add(new SeriesPoint("D", 14));20     series2.Points.Add(new SeriesPoint("I", 2500));21     series2.Points.Add(new SeriesPoint("II", 3800));22     series2.Points.Add(new SeriesPoint("III", 1500));23     series2.Points.Add(new SeriesPoint("IV", 1300));24 25     // Add both series to the chart.26     chartControl1.Series.AddRange(new Series[] { series1, series2 });27 28     // Hide the legend (optional).29     chartControl1.Legend.Visible = false;30 31     // Cast the chart's diagram to the XYDiagram type, 32     // to access its axes and panes.33     XYDiagram diagram = (XYDiagram)chartControl1.Diagram;34 35     // Add secondary axes to the diagram, and adjust their options.36     diagram.SecondaryAxesX.Add(new SecondaryAxisX("My Axis X"));37     diagram.SecondaryAxesY.Add(new SecondaryAxisY("My Axis Y"));38     diagram.SecondaryAxesX[0].Alignment = AxisAlignment.Near;39     diagram.SecondaryAxesY[0].Alignment = AxisAlignment.Near;40 41     // Add a new additional pane to the diagram.42     diagram.Panes.Add(new XYDiagramPane("My Pane"));43 44     // Assign both the additional pane and, if required,45     // the secondary axes to the second series. 46     LineSeriesView myView = (LineSeriesView)series2.View;47     myView.AxisX = diagram.SecondaryAxesX[0];48     myView.AxisY = diagram.SecondaryAxesY[0];49     // Note that the created pane has the zero index in the collection,50     // because the existing Default pane is a separate entity.51     myView.Pane = diagram.Panes[0];52     53     // Customize the layout of the diagram's panes.54     diagram.PaneDistance = 10;55     diagram.PaneLayoutDirection = PaneLayoutDirection.Horizontal;56     diagram.DefaultPane.SizeMode = PaneSizeMode.UseWeight;57     diagram.DefaultPane.Weight = 1.2;58 59     // Add the chart to the form.60     chartControl1.Dock = DockStyle.Fill;61     this.Controls.Add(chartControl1);62 }
add pans

 

 

Adding Panes:

1 using System; 2 using System.Drawing; 3 using System.Windows.Forms; 4 using DevExpress.XtraCharts; 5 // ... 6  7 private void Form1_Load(object sender, EventArgs e) { 8     // Create a new chart. 9     ChartControl chartControl1 = new ChartControl();10 11     // Create two series.12     Series series1 = new Series("Series 1", ViewType.Bar);13     Series series2 = new Series("Series 2", ViewType.Line);14 15     // Add points to them, with their arguments different.16     series1.Points.Add(new SeriesPoint("A", 10));17     series1.Points.Add(new SeriesPoint("B", 12));18     series1.Points.Add(new SeriesPoint("C", 17));19     series1.Points.Add(new SeriesPoint("D", 14));20     series2.Points.Add(new SeriesPoint("I", 2500));21     series2.Points.Add(new SeriesPoint("II", 3800));22     series2.Points.Add(new SeriesPoint("III", 1500));23     series2.Points.Add(new SeriesPoint("IV", 1300));24 25     // Add both series to the chart.26     chartControl1.Series.AddRange(new Series[] { series1, series2 });27 28     // Hide the legend (optional).29     chartControl1.Legend.Visible = false;30 31     // Cast the chart's diagram to the XYDiagram type, 32     // to access its axes and panes.33     XYDiagram diagram = (XYDiagram)chartControl1.Diagram;34 35     // Add secondary axes to the diagram, and adjust their options.36     diagram.SecondaryAxesX.Add(new SecondaryAxisX("My Axis X"));37     diagram.SecondaryAxesY.Add(new SecondaryAxisY("My Axis Y"));38     diagram.SecondaryAxesX[0].Alignment = AxisAlignment.Near;39     diagram.SecondaryAxesY[0].Alignment = AxisAlignment.Near;40 41     // Add a new additional pane to the diagram.42     diagram.Panes.Add(new XYDiagramPane("My Pane"));43 44     // Assign both the additional pane and, if required,45     // the secondary axes to the second series. 46     LineSeriesView myView = (LineSeriesView)series2.View;47     myView.AxisX = diagram.SecondaryAxesX[0];48     myView.AxisY = diagram.SecondaryAxesY[0];49     // Note that the created pane has the zero index in the collection,50     // because the existing Default pane is a separate entity.51     myView.Pane = diagram.Panes[0];52     53     // Customize the layout of the diagram's panes.54     diagram.PaneDistance = 10;55     diagram.PaneLayoutDirection = PaneLayoutDirection.Horizontal;56     diagram.DefaultPane.SizeMode = PaneSizeMode.UseWeight;57     diagram.DefaultPane.Weight = 1.2;58 59     // Add the chart to the form.60     chartControl1.Dock = DockStyle.Fill;61     this.Controls.Add(chartControl1);62 }
How to: Display a Series in an Additional Pane (Runtime Sample)

 

转载于:https://www.cnblogs.com/zhubinglong/p/8418999.html

你可能感兴趣的文章
怎么用sysLinux做U盘双PE+DOS??
查看>>
Spring Transactional
查看>>
shell脚本实例
查看>>
我的友情链接
查看>>
Windows Phone 7 隔离存储空间资源管理器
查看>>
Microsoft Excel 2000/2003修复工具
查看>>
apache安装报错undefined reference ssl
查看>>
关于爱情只有一句忠告
查看>>
CentOS 7下安装部署Oracle11g图文教程
查看>>
F#初学笔记06
查看>>
实战:将企业域名解析委派给企业DNS服务器
查看>>
在Lync 2013环境部署Office Web Apps
查看>>
微软大会Ignite,你准备好了么?
查看>>
读书笔记-高标管事 低调管人
查看>>
Master带给世界的思考:是“失控”还是进化
查看>>
用户和开发者不满苹果iCloud问题多多
查看>>
java.lang.UnsatisfiedLinkError:no dll in java.library.path终极解决之道
查看>>
我的工具:文本转音频文件
查看>>
【许晓笛】从零开始运行EOS系统
查看>>
【跃迁之路】【460天】程序员高效学习方法论探索系列(实验阶段217-2018.05.11)...
查看>>