




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、C#.net使用DotNetCharting控件生成报表统计图在做项目时要对数据进行统计分析,所以必须生成一些报表统计图(如柱形图、饼图、曲线图等),网上强烈推荐了使用 DotNetCharting控件来实现,于是自己对DotNetCharting控件进行了简单的学习,下面先简单介绍一下 DotNetCharting控件及其使用。 DotNetCharting是一个非常棒的.NET图表控件,对中文支持非常好,而且操作方便,开发快速,既有for webform 也有for winform的,而且.net1.1和2.0都有支持。它的官方地址是
2、0; 本站也提供了DotNetCharting破解版本下载: 强烈推荐一下DotNetCharting的demo地址: 这个是所有的 DEMO 演示 这个是 Online Documentation DotNetCharting的简单使用方法: 1.把bindotnetCHARTING.dll添加到工具箱,并且添加引用; 2.把控件拖到你的网页上,然后
3、添加引用using dotnetCHARTING;就可以用了; 3.接下来是自己写的对DotNetCharting操作的封装类,以便于在程序里调用。ShowData.csusing System;using System.Data;using System.Text;using dotnetCHARTING;namespace FLX.ComplexQuery /*/ <summary> / 彭建军 /
4、 根据数据动态生成图形(柱形图、饼图、曲线图) / 2008-06-19 / </summary> public class ShowData 推荐精选 属性#region 属性 private string _phaysicalimagepath;/图片存放路径
5、 private string _title; /图片标题 private string _xtitle;/图片x座标名称 private string _ytitle;/图片y座标名称 private string _seriesname;/图例名称
6、 private int _picwidth;/图片宽度 private int _pichight;/图片高度 private DataTable _dt;/图片数据源 /*/ <summary>
7、60; / 图片存放路径 / </summary> public string PhaysicalImagePath set_phaysicalimagepath=value; &
8、#160; getreturn _phaysicalimagepath; /*/ <summary> / 图片标题 / </summary>&
9、#160; public string Title set_title=value; getreturn _title;
10、; /*/ <summary> / 图片标题 / </summary> public string XTitle
11、160; set_xtitle=value; getreturn _xtitle; /*/ <summary>
12、0; / 图片标题 / </summary> public string YTitle set_ytitle=value;
13、0; getreturn _ytitle; 推荐精选 /*/ <summary> / 图例名称 / </summary>
14、 public string SeriesName set_seriesname=value; getreturn _seriesname;
15、 /*/ <summary> / 图片宽度 / </summary> public int PicWidth
16、; set_picwidth=value; getreturn _picwidth; /*/ <summary> /
17、图片高度 / </summary> public int PicHight set_pichight=value;
18、160; getreturn _pichight; /*/ <summary> / 图片数据源 / </summary>
19、; public DataTable DataSource set_dt=value; getreturn _dt;
20、; #endregion 构造函数#region 构造函数 public ShowData() /
21、0; / TODO: 在此处添加构造函数逻辑 / public ShowData(string PhaysicalImagePath,string Title,st
22、ring XTitle,string YTitle,string SeriesName) _phaysicalimagepath=PhaysicalImagePath; _title=Title;
23、60; _xtitle=XTitle; _ytitle=YTitle; _seriesname=SeriesName;
24、; #endregion推荐精选 输出柱形图#region 输出柱形图 /*/ <summary> / 柱形图 / </summary>
25、0; / <returns></returns> public void CreateColumn(dotnetCHARTING.Chart chart) chart.Title=this._title;
26、; chart.XAxis.Label.Text=this._xtitle; chart.YAxis.Label.Text=this._ytitle; chart.TempDir
27、ectory =this._phaysicalimagepath; chart.Width = this._picwidth; chart.Height = this._pichight; &
28、#160; chart.Type = ChartType.Combo ; chart.Series.Type =SeriesType.Cylinder; &
29、#160; chart.Series.Name = this._seriesname; chart.Series.Data = this._dt;
30、0; chart.SeriesCollection.Add(); chart.DefaultSeries.DefaultElement.ShowValue = true; chart.ShadingEffect = true;
31、; chart.Use3D = false; chart.Series.DefaultElement.ShowValue =true;
32、160; #endregion 输出饼图#region 输出饼图 /*/ <summary> / 饼图 / </summary> /
33、 <returns></returns> public void CreatePie(dotnetCHARTING.Chart chart) chart.Title=this._title;
34、; chart.TempDirectory =this._phaysicalimagepath; chart.Width = this._picwidth; char
35、t.Height = this._pichight; chart.Type = ChartType.Pie; chart.Series.Type =SeriesType.Cylinder; &
36、#160; chart.Series.Name = this._seriesname;
37、60; chart.ShadingEffect = true; chart.Use3D = false; chart.DefaultSeries.Def
38、aultElement.Transparency = 20; chart.DefaultSeries.DefaultElement.ShowValue = true; chart.PieLabelMode = PieLabelMode.Outside;
39、; chart.SeriesCollection.Add(getArrayData(); chart.Series.DefaultElement.ShowValue = true; 推荐精选
40、 private SeriesCollection getArrayData() SeriesCollection SC = new SeriesCollection(); Da
41、taTable dt = this._dt; for(int i=0; i < dt.Rows.Count; i+) Series s = new
42、Series(); s.Name = dt.Rowsi0.ToString();
43、 Element e = new Element(); / 每元素的名称 e.Name = dt.Rowsi0.ToString();
44、; / 每元素的大小数值 e.YValue=Convert.ToInt32(dt.Rowsi1.ToString(); &
45、#160; s.Elements.Add(e); SC.Add(s);
46、; return SC; #endregion 输出曲线图#region 输出曲线图 /*/ <summary>
47、60; / 曲线图 / </summary> / <returns></returns> public void CreateLine(dotnetCHARTING.Chart chart)
48、 chart.Title=this._title; chart.XAxis.Label.Text=thi
49、s._xtitle; chart.YAxis.Label.Text=this._ytitle; chart.TempDirectory =this._phaysicalimagepath; &
50、#160; chart.Width = this._picwidth; chart.Height = this._pichight; chart.Type = ChartType.Combo ;
51、; chart.Series.Type =SeriesType.Line; chart.Series.Name = this._seriesname;
52、160; chart.Series.Data = this._dt; chart.SeriesCollection.Add();
53、 chart.DefaultSeries.DefaultElement.ShowValue = true; chart.ShadingEffect = true; chart.Use3D = false; chart.Series.DefaultElement.ShowValue =true;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025物联网智能家居系统集成效果实证分析与鉴定报告
- 2025年交通设备制造业数字化转型与智能交通服务模式创新报告
- 2025年直播平台内容监管政策与行业自律实践案例报告
- 机场停机坪租用协议合同
- 门面漏水退租协议书范本
- 汽车代卖废铁协议书范本
- 羊肉烩面店转让合同范本
- 签就业协议不填劳动合同
- 特种车玻璃采购合同范本
- 腻子清包工工程合同范本
- 企业突发事件应急处置工作方案
- 护理人文关怀科室汇报
- 《公路建设项目文件管理规程》
- 国家职业技术技能标准 6-30-99-00 工业机器人系统操作员 人社厅发2020108号
- 盲人医疗按摩从业备案申请表(样表)
- DB42∕T 2234-2024 装配型附着式升降脚手架安全技术规程
- 中等职业技术学校人工智能技术应用专业(三年制)人才培养方案
- YDT 5206-2023宽带光纤接入工程技术规范
- DL-T1474-2021交、直流系统用高压聚合物绝缘子憎水性测量及评估方法
- 2024年4月自考05424现代设计史试题
- 快速入门穿越机-让你迅速懂穿越机
评论
0/150
提交评论