




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
.NET使用DotNetCharting控件生成报表统计图总结 在做项目时要对数据进行统计分析,所以必须生成一些报表统计图(如柱形图、饼图、曲线图等),网上强烈推荐了使用DotNetCharting控件来实现,于是自己对DotNetCharting控件进行了简单的学习,下面先简单介绍一下DotNetCharting控件及其使用。 DotNetCharting是一个非常棒的.NET图表控件,对中文支持非常好,而且操作方便,开发快速,既有for webform 也有for winform的,而且.net1.1和2.0都有支持。它的官方地址是/ 本站也提供了DotNetCharting破解版本下载: 附件: dotnetCHARTING.rar (下载 36 次) 强烈推荐一下DotNetCharting的demo地址: 这个是所有的 DEMO 演示 /demo.aspx 这个是 Online Documentation /documentation/v4_4/webframe.html 里面会有详细的说明和用法。 DotNetCharting的简单使用方法: 1.把bindotnetCHARTING.dll添加到工具箱,并且添加引用; 2.把控件拖到你的网页上,然后添加引用using dotnetCHARTING;就可以用了; 3.接下来是自己写的对DotNetCharting操作的封装类,以便于在程序里调用。ShowData.cs1. using System;2. using System.Data;3. using System.Text;4. using dotnetCHARTING;5.6. namespace FLX.ComplexQuery7. 8. /*/ 9. / 彭建军10. / 根据数据动态生成图形(柱形图、饼图、曲线图)11. / 2008-06-1912. / 13. public class ShowData14. 15.16. 属性#region 属性17. private string _phaysicalimagepath;/图片存放路径18. private string _title; /图片标题19. private string _xtitle;/图片x座标名称20. private string _ytitle;/图片y座标名称21. private string _seriesname;/图例名称22. private int _picwidth;/图片宽度23. private int _pichight;/图片高度24. private DataTable _dt;/图片数据源25.26. /*/ 27. / 图片存放路径28. / 29. public string PhaysicalImagePath30. 31. set_phaysicalimagepath=value;32. getreturn _phaysicalimagepath;33. 34. /*/ 35. / 图片标题36. / 37. public string Title38. 39. set_title=value;40. getreturn _title;41. 42. /*/ 43. / 图片标题44. / 45. public string XTitle46. 47. set_xtitle=value;48. getreturn _xtitle;49. 50. /*/ 51. / 图片标题52. / 53. public string YTitle54. 55. set_ytitle=value;56. getreturn _ytitle;57. 58.59. /*/ 60. / 图例名称61. / 62. public string SeriesName63. 64. set_seriesname=value;65. getreturn _seriesname;66. 67. /*/ 68. / 图片宽度69. / 70. public int PicWidth71. 72. set_picwidth=value;73. getreturn _picwidth;74. 75. /*/ 76. / 图片高度77. / 78. public int PicHight79. 80. set_pichight=value;81. getreturn _pichight;82. 83. /*/ 84. / 图片数据源85. / 86. public DataTable DataSource87. 88. set_dt=value; 89. getreturn _dt;90. 91. #endregion92.93. 构造函数#region 构造函数94. public ShowData()95. 96. /97. / TODO: 在此处添加构造函数逻辑98. /99. 100. 101. public ShowData(string PhaysicalImagePath,string Title,string XTitle,string YTitle,string SeriesName)102. 103. _phaysicalimagepath=PhaysicalImagePath;104. _title=Title;105. _xtitle=XTitle;106. _ytitle=YTitle;107. _seriesname=SeriesName; 108. 109. #endregion110.111. 输出柱形图#region 输出柱形图112. /*/ 113. / 柱形图114. / 115. / 116. public void CreateColumn(dotnetCHARTING.Chart chart)117. 118. chart.Title=this._title; 119. chart.XAxis.Label.Text=this._xtitle;120. chart.YAxis.Label.Text=this._ytitle;121. chart.TempDirectory =this._phaysicalimagepath; 122. chart.Width = this._picwidth;123. chart.Height = this._pichight;124. chart.Type = ChartType.Combo ; 125. chart.Series.Type =SeriesType.Cylinder;126. chart.Series.Name = this._seriesname; 127. chart.Series.Data = this._dt;128. chart.SeriesCollection.Add(); 129. chart.DefaultSeries.DefaultElement.ShowValue = true; 130. chart.ShadingEffect = true; 131. chart.Use3D = false; 132. chart.Series.DefaultElement.ShowValue =true;133. 134. #endregion135.136. 输出饼图#region 输出饼图137. /*/ 138. / 饼图139. / 140. / 141. public void CreatePie(dotnetCHARTING.Chart chart)142. 143. chart.Title=this._title; 144. chart.TempDirectory =this._phaysicalimagepath; 145. chart.Width = this._picwidth;146. chart.Height = this._pichight;147. chart.Type = ChartType.Pie; 148. chart.Series.Type =SeriesType.Cylinder;149. chart.Series.Name = this._seriesname; 150. 151. chart.ShadingEffect = true; 152. chart.Use3D = false; 153. chart.DefaultSeries.DefaultElement.Transparency = 20; 154. chart.DefaultSeries.DefaultElement.ShowValue = true;155. chart.PieLabelMode = PieLabelMode.Outside; 156. chart.SeriesCollection.Add(getArrayData();157. chart.Series.DefaultElement.ShowValue = true;158. 159.160. private SeriesCollection getArrayData()161. 162. SeriesCollection SC = new SeriesCollection();163. DataTable dt = this._dt;164.165. for(int i=0; i dt.Rows.Count; i+)166. 167. Series s = new Series();168. s.Name = dt.Rows0.ToString(); 169. 170. Element e = new Element();171.172. / 每元素的名称173. e.Name = dt.Rows0.ToString();174.175. / 每元素的大小数值176. e.YValue=Convert.ToInt32(dt.Rows1.ToString();177. 178. s.Elements.Add(e);179. SC.Add(s);180. 181. return SC;182. 183. #endregion184.185. 输出曲线图#region 输出曲线图186. /*/ 187. / 曲线图188. / 189. / 190. public void CreateLine(dotnetCHARTING.Chart chart)191. 192. chart.Title=this._title; 193. chart.XAxis.Label.Text=this._xtitle;194. chart.YAxis.Label.Text=this._ytitle;195. chart.TempDirectory =this._phaysicalimagepath; 196. chart.Width = this._picwidth;197. chart.Height = this._pichight;198. chart.Type = ChartType.Combo ; 199. chart.Series.Type =SeriesType.Line;200. chart.Series.Name = this._seriesname; 201. chart.Series.Data = this._dt;202. chart.SeriesCollection.Add(); 203. chart.DefaultSeries.DefaultElement.ShowValue = true; 204. chart.ShadingEffect = true; 205. chart.Use3D = false; 206. chart.Series.DefaultElement.ShowValue =true;207. 208. #endregion209.210. 调用说明及范例#region 调用说明及范例211. / 在要显示统计图的页面代码直接调用,方法类似如下:212. /213. / ShowData show=new ShowData(); 214. / show.Title =2008年各月消费情况统计;215. / show.XTitle =月份;216. / show.YTitle =金额(万元);217. / show.PicHight =300;218. / show.PicWidth =600;219. / show.SeriesName =具体详情;220. / show.PhaysicalImagePath =ChartImages;221. / show.DataSource
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 末日来无迹后会永无期…… 中英互译
- 民政知识、行政法规及社会综合常识试卷真题及答案
- 河南省孟州市2025年上半年事业单位公开遴选试题含答案分析
- 河北省魏县2025年上半年事业单位公开遴选试题含答案分析
- 河北省饶阳县2025年上半年事业单位公开遴选试题含答案分析
- 河北省涞水县2025年上半年公开招聘村务工作者试题含答案分析
- 2025年度城市观光旅游包车运营管理合同
- 2025版山西拓扬人力资源有限责任公司企业人才招聘与选拔服务合同
- 2025版生产车间安全设施承包协议
- 2025版架子工劳务分包合同范本(含安全协议)
- 2025-2026学年湘教版(2024)初中数学八年级上册教学计划及进度表
- GB/T 45763-2025精细陶瓷陶瓷薄板室温弯曲强度试验方法三点弯曲或四点弯曲法
- 全过程工程咨询投标方案(技术方案)
- (高清版)DZT 0388-2021 矿区地下水监测规范
- 胰腺肿瘤影像学课件
- 夹芯彩钢复合板吊顶施工方案
- 高效课堂讲座课件
- 双高专业群电子商务专业群申报书
- 有害物质污染源识别与评价表
- 餐具洗消保洁制度管理办法
- 齿轮的设计计算PPT学习教案
评论
0/150
提交评论