mschart 实现统计图表绘制.docx_第1页
mschart 实现统计图表绘制.docx_第2页
mschart 实现统计图表绘制.docx_第3页
mschart 实现统计图表绘制.docx_第4页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

mschart 实现统计图表绘制最近要实现查询统计功能,综合比较了MSChart,OWC11和GDI+等实现工具,觉得MSChart能比较方便地实现所需功能。在做该部分的时候,开始觉得没思路,很困难。后来请教了LYJ,他提出两点,一是确定用什么工具进行查询,二是确定要展现给用户的是什么,也就是要统计的内容。确定这两点,就可以写查询语句了。因为自己水平也比较菜,所以到今天大致实现还是花了挺长的时间的。一部分是考虑统计指标,之前想的可能太复杂,想要统计的很多。后来还是省事直接用WHB写的查询controller,当然大框架搭好后还是得修改下。还有一部分时间是用来熟悉MSCHART,看了微软提供的例子,看网上找的文档和博客,看帮助文档。发现自己的一个问题是,静不下心来先看别人的例子,好像不习惯先打基础。总要自己写不出来的时候,才去搜索,才能认真看别人是如何实现的。应该好好改进这个问题。从一定意义上说,这是我自己写程序的开端。因为之前做的几个功能,没有真正去深入地写和思考,大部分都是在他人实现的基础上改写的。好的开始是成功的一半,加油!程序中主要实现的代码如下#region 画柱状图 public void DrawBar(int All, int Done) IStatisticHelper helper = new StatisticHelper(); List CList = new List(); Compare _com = new Compare(); Detail _detail = new Detail(); _detail._value_remark = 记录总数; _detail._compare_value_remark = 记录处理数; UserstatisticFilter filter = Filter; /记录处理数统计 Series series = new Series(series); series.ChartType = SeriesChartType.Column; for (int pointIndex = 0; pointIndex All.Length; pointIndex+) _com._value = AllpointIndex; _com._compare_value = DonepointIndex; series.Points.AddY(DonepointIndex); series.LegendText = _detail._compare_value_remark; Chart1.Series.Add(series); Chart1.ChartAreasChartArea1.AxisX.ArrowStyle = AxisArrowStyle.Triangle; Chart1.ChartAreas0.AxisY.ArrowStyle = AxisArrowStyle.Triangle; Chart1.ChartAreas0.AxisX.Title = 时间; Chart1.ChartAreas0.AxisY.Title = 记录数; Chart1.ChartAreas0.AxisX.MajorTickMark.Enabled = false; Chart1.ChartAreas0.AxisY.MajorTickMark.Enabled = false; Chart1.Legends0.Font = new Font(宋体, 10); Chart1.ChartAreas0.AxisX.TitleFont = new Font(宋体, 10f); Chart1.ChartAreas0.AxisY.TitleFont = new Font(宋体, 10f); Chart1.ChartAreas0.AxisX.Interval = 1; Chart1.ChartAreas0.AxisX.IsLabelAutoFit = true; Chart1.ChartAreas0.AxisX.LabelStyle.Format = #月 ; Series series1 = new Series(series1); series1.ChartType = SeriesChartType.Column; for (int pointIndex = 0; pointIndex All.Length; pointIndex+) series1.Points.AddY(AllpointIndex); series1.LegendText = _detail._value_remark; Chart1.Series.Add(series1); #endregion运行后的结果图参考的一些属性设置,来自/ashou706/archive/2010/06/01/1749257.html,感谢作者/ / 设置mschart样式/ private void SetMSChartStyle()/绘图前期处理chartCWPBestMode.Titles.Clear(); /标题设置Title title = new Title();title.Text = 循环水泵最佳运行方式;title.Font = new Font(宋体, 16f, FontStyle.Bold);/标题chartCWPBestMode.Titles.Add(title);/ 坐标轴设置chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.IsMarginVisible = false;/X 轴坐标最大最小值chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.Minimum = 5;chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.Maximum = 35;/ 坐标轴刻度线不延长出来设置chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.MajorTickMark.Enabled = false;chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.MajorTickMark.Enabled = false;/X 次要辅助线设置chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.MinorGrid.Enabled = true;/X 次要辅助线间距chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.MinorGrid.Interval = 1;/X 次要辅助线颜色chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.MinorGrid.LineColor = Color.LightGray;/Y 次要辅助线设置chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.MinorGrid.Enabled = true;/Y 次要辅助线间距chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.MinorGrid.Interval = 10;/Y 次要辅助线颜色chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.MinorGrid.LineColor = Color.LightGray;/X 主要辅助线设置chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.MajorGrid.Enabled = true;/X 主要辅助线间距chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.MajorGrid.Interval = 5;/X 主要辅助线颜色chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.MajorGrid.LineColor = Color.Black;/Y 主要辅助线设置chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.MajorGrid.Enabled = true;/Y 主要辅助线间距chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.MajorGrid.Interval = 30;/Y 主要辅助线颜色chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.MajorGrid.LineColor = Color.Black;/坐标主要辅助线刻度间距chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.Interval = 5;chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.Interval = 30;/坐标轴说明chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.Title = 凝汽器冷却水进口温度();chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.Title = 机组负荷(MW);chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.TitleFont = new Font(宋体, 10f, FontStyle.Bold);chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.TitleFont = new Font(宋体, 10f, FontStyle.Bold);chartCWPBestMode.ChartAreasChartAreaCWP.AxisX.TitleAlignment = StringAlignment.Far;chartCWPBestMode.ChartAreasChartAreaCWP.AxisY.TitleAlignment = StringAlignment.Far;/边框样式设置chartCWPBestMode.ChartAreasChartAreaCWP.BorderColor = Color.Black;chartCWPBestMode.ChartAreasChartAreaCWP.BorderDashStyle = ChartDashStyle.Solid;chartCWPBestMode.ChartAreasChartAreaCWP.BorderWidth = 2;/图例文字chartCWPBestMode.SeriesSeriesCurrentMode.LegendText = 当前运行方式;chartCWPBestMode.SeriesSeriesTRAN1.LegendText = 单泵高速切换曲线;chartCWPBestMode.SeriesSeriesTRAN2.LegendText = 两机三泵切换曲线;chartCWPBestMode.SeriesSeriesTRAN3.LegendText = 一高一低切换曲线;chartCWPBestMode.SeriesSeries

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论