C#.net使用DotNetCharting控件生成报表统计图_第1页
C#.net使用DotNetCharting控件生成报表统计图_第2页
C#.net使用DotNetCharting控件生成报表统计图_第3页
C#.net使用DotNetCharting控件生成报表统计图_第4页
C#.net使用DotNetCharting控件生成报表统计图_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

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

文档简介

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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论