C#NET使用DotNetCharting控件生成报表统计图总结

上传人:zhan****gclb 文档编号:57196495 上传时间:2022-02-23 格式:DOCX 页数:9 大小:430.32KB
收藏 版权申诉 举报 下载
C#NET使用DotNetCharting控件生成报表统计图总结_第1页
第1页 / 共9页
C#NET使用DotNetCharting控件生成报表统计图总结_第2页
第2页 / 共9页
C#NET使用DotNetCharting控件生成报表统计图总结_第3页
第3页 / 共9页
资源描述:

《C#NET使用DotNetCharting控件生成报表统计图总结》由会员分享,可在线阅读,更多相关《C#NET使用DotNetCharting控件生成报表统计图总结(9页珍藏版)》请在装配图网上搜索。

1、.NET使用DotNetCharting控件生成报表统计图总结 在做项目时要对数据进行统计分析,所以必须生成一些报表统计图(如柱形图、饼图、曲线图等),网上强烈推荐了使用DotNetCharting控件来实现,于是自己对DotNetCharting控件进行了简单的学习,下面先简单介绍一下DotNetCharting控件及其使用。 DotNetCharting是一个非常棒的.NET图表控件,对中文支持非常好,而且操作方便,开发快速,既有for webform 也有for winform的,而且.net1.1和2.0都有支持。它的官方地址是 本站也提供了DotNetCharting破解版本下载:

2、附件: dotnetCHARTING.rar (下载 36 次) 强烈推荐一下DotNetCharting的demo地址: 这个是所有的 DEMO 演示 这个是 Online Documentation 里面会有详细的说明和用法。 DotNetCharting的简单使用方法: 1.把bindotnetCHARTING.dll添加到工具箱,并且添加引用; 2.把控件拖到你的网页上,然后添加引用using dotnetCHARTING;就可以用了; 3.接下来是自己写的对DotNetCharting操作的封装类,以便于在程序里调用。ShowData.cs1. using System;2. usi

3、ng 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 str

4、ing _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

5、 _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. get

6、return _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_pichig

7、ht=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

8、,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(dotnetC

9、HARTING.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. c

10、hart.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.

11、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._pichig

12、ht;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 = tr

13、ue;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(in

14、t 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.

15、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._p

16、haysicalimagepath; 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

17、.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年各月消费情况统计;

18、215. / show.XTitle =月份;216. / show.YTitle =金额(万元);217. / show.PicHight =300;218. / show.PicWidth =600;219. / show.SeriesName =具体详情;220. / show.PhaysicalImagePath =ChartImages;221. / show.DataSource =this.GetDataSource();222. / show.CreateColumn(this.Chart1); 223. #endregion224.225. 226. 复制代码效果图展示: 1

19、、饼图 2、柱形图 3、曲线图 补充: 帖子发了一天,没人回答我多维统计图的实现方式,只好自己去dotnetcharting的官方网站下载了最新的dotnetcharting控件,在 dotnetcharting控件的使用说明文档中详细地介绍了各种多维统计图的实现方式。现把说明文档贴出来供大家下载 dotnetcharting使用说明文档:附件: dotnetcharting使用说明.rar (下载 38 次) 追加补充新内容: 1、解决“每运行一次DotNetCharting页面,就会生成一个图片,这样图片不是越来越多吗?请问怎样自动删除DotNetCharting生成的图片呢”的问题,参照 ASP.NET删除文件夹里的所有文件 。 2、解决“(1)生成的图片带超链接导向官网,如何处理呀?(2)我使用这个控件后,图形可以显示出来。但是发现一个小问题。就是在图形的左上方和图形的下面都隐含了超链接,鼠标移动到这两个区域后,点击都会链接到 DotnetCharting控件的破解方法 。

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!