版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、C#.net使用DotNetCharting控件生成报表统计图在做项目时要对数据进行统计分析,所以必须生成一些报表统计图(如柱形图、饼图、曲线图等),网上强烈推荐了使用 DotNetCharting控件来实现,于是自己对DotNetCharting控件进行了简单的学习,下面先简单介绍一下 DotNetCharting控件及其使用。 DotNetCharting是一个非常棒的.NET图表控件,对中文支持非常好,而且操作方便,开发快速,既有for webform 也有for winform的,而且. 本站也提供了DotNetC
2、harting破解版本下载: 强烈推荐一下DotNetCharting的demo地址: 这个是所有的 DEMO 演示 这个是 Online Documentation DotNetCharting的简单使用方法: 1.把bindotnetCHARTING.dll添加到工具箱,并且添加引用; 2.把控件拖到你的网页上,然后添加引用using dotnetCHARTI
3、NG;就可以用了; 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、160; private string _title; /图片标题 private string _xtitle;/图片x座标名称 private string _ytitle;/图片y座标名称 private string _seriesname;/图例名称
6、160; private int _picwidth;/图片宽度 private int _pichight;/图片高度 private DataTable _dt;/图片数据源 /*/ <summary> / 图片存放路径
7、160; / </summary> public string PhaysicalImagePath set_phaysicalimagepath=value;
8、60; getreturn _phaysicalimagepath; /*/ <summary> / 图片标题 / </summary>
9、60; public string Title set_title=value; getreturn _title;
10、 /*/ <summary> / 图片标题 / </summary> public string XTitle
11、0; set_xtitle=value; getreturn _xtitle; /*/ <summary> / 图片标题
12、; / </summary> public string YTitle set_ytitle=value;
13、 getreturn _ytitle; /*/ <summary> / 图例名称 / </summary> public string Ser
14、iesName set_seriesname=value; getreturn _seriesname;
15、 /*/ <summary> / 图片宽度 / </summary> public int PicWidth
16、; set_picwidth=value; getreturn _picwidth; /*/ <summary> / 图片高度
17、160; / </summary> public int PicHight set_pichight=value; getretu
18、rn _pichight; /*/ <summary> / 图片数据源 / </summary> public DataTable DataSource&
19、#160; set_dt=value; getreturn _dt; #endregion
20、 构造函数#region 构造函数 public ShowData() / / T
21、ODO: 在此处添加构造函数逻辑 / public ShowData(string PhaysicalImagePath,string Title,string XTitle,string YTitle,stri
22、ng SeriesName) _phaysicalimagepath=PhaysicalImagePath; _title=Title;
23、60; _xtitle=XTitle; _ytitle=YTitle; _seriesname=SeriesName; #endregion
24、 输出柱形图#region 输出柱形图 /*/ <summary> / 柱形图 / </summary> / <returns></ret
25、urns> public void CreateColumn(dotnetCHARTING.Chart chart) chart.Title=this._title;
26、160; chart.XAxis.Label.Text=this._xtitle; chart.YAxis.Label.Text=this._ytitle; chart.TempDirectory =this._phaysicalimagepath;&
27、#160; chart.Width = this._picwidth; chart.Height = this._pichight;
28、; chart.Type = ChartType.Combo ; chart.Series.Type =SeriesType.Cylinder; chart.Series.Name = this._se
29、riesname; chart.Series.Data = this._dt; chart.SeriesC
30、ollection.Add(); chart.DefaultSeries.DefaultElement.ShowValue = true; chart.ShadingEffect = true;
31、160; chart.Use3D = false; chart.Series.DefaultElement.ShowValue =true; #endregion &
32、#160; 输出饼图#region 输出饼图 /*/ <summary> / 饼图 / </summary> / <returns></returns>
33、160; public void CreatePie(dotnetCHARTING.Chart chart) chart.Title=this._title;
34、60; chart.TempDirectory =this._phaysicalimagepath; chart.Width = this._picwidth; chart.Height = this._pichight;
35、160; chart.Type = ChartType.Pie; chart.Series.Type =SeriesType.Cylinder;
36、; chart.Series.Name = this._seriesname; chart.ShadingEffect = tr
37、ue; chart.Use3D = false; chart.DefaultSeries.DefaultElement.Transparency = 20;
38、60; chart.DefaultSeries.DefaultElement.ShowValue = true; chart.PieLabelMode = PieLabelMode.Outside;
39、160; chart.SeriesCollection.Add(getArrayData(); chart.Series.DefaultElement.ShowValue = true; p
40、rivate SeriesCollection getArrayData() SeriesCollection SC = new SeriesCollection(); DataTable dt = this._dt;
41、0; for(int i=0; i < dt.Rows.Count; i+) Series s = new Series();
42、; s.Name = dt.Rowsi0.ToString(); Element
43、 e = new Element(); / 每元素的名称 e.Name = dt.Rowsi0.ToString(); &
44、#160; / 每元素的大小数值 e.YValue=Convert.ToInt32(dt.Rowsi1.ToString();
45、160; s.Elements.Add(e); SC.Add(s); &
46、#160; return SC; #endregion 输出曲线图#region 输出曲线图 /*/ <summary> / 曲线图
47、; / </summary> / <returns></returns> public void CreateLine(dotnetCHARTING.Chart chart)
48、160; chart.Title=this._title; chart.XAxis.Label.Text=this._xtitle;
49、0; chart.YAxis.Label.Text=this._ytitle; chart.TempDirectory =this._phaysicalimagepath; ch
50、art.Width = this._picwidth; chart.Height = this._pichight; chart.Type = ChartType.Combo ;
51、 chart.Series.Type =SeriesType.Line; chart.Series.Name = this._seriesname;
52、0; chart.Series.Data = this._dt; chart.SeriesCollection.Add(); chart.DefaultSeries
53、.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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 安徽省滁州市高中信息技术《第四单元 我的装机历程》教案
- 夸父逐日(微教学设计) 人教版
- Unit 2 Were going to do some research (教学设计)-2023-2024学年湘少版(三起)英语五年级下册
- Module 2 本单元综合 (教学设计)-2023-2024学年外研版(三起)英语六年级下册
- 山西省怀仁第一中学2024-2025学年高三第二次联合调研考试物理试题含解析
- 7上课了 教学设计-2024-2025学年道德与法治一年级上册统编版
- 山东省烟台市芝罘区重点达标名校2024-2025学年普通高中第一次联考初三数学试题含解析
- 幼儿园中班变色龙探究教案
- 幼儿园小班悯农教案
- 民事诉讼法与仲裁制度分类模拟4
- 消毒产品培训课件
- 2024年职称英语-职称英语(综合类)考试历年全考点试卷附带答案
- 教师企业实践报告
- 中医院临床科室绩效考核基本指标及分值表
- 厂房租赁合同续签申请书
- 【北京】《济南的冬天》名师课件(第一课时)
- 第22课《智取生辰纲》公开课一等奖创新教学设计
- 七年级上册第六单元名著导读《西游记》公开课一等奖创新教学设计
- 新生儿复苏流程图
- 施工用电应急预案
- 煤矿主要设备检修资质管理办法
评论
0/150
提交评论