CNET使用DotNetCharting控件生成報表統(tǒng)計圖總結(jié)_第1頁
CNET使用DotNetCharting控件生成報表統(tǒng)計圖總結(jié)_第2頁
CNET使用DotNetCharting控件生成報表統(tǒng)計圖總結(jié)_第3頁
CNET使用DotNetCharting控件生成報表統(tǒng)計圖總結(jié)_第4頁
CNET使用DotNetCharting控件生成報表統(tǒng)計圖總結(jié)_第5頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、在做項目時要對數(shù)據(jù)進行統(tǒng)計分析,所以必須生成一些報表統(tǒng)計圖(如柱形圖、餅圖、曲線圖等),網(wǎng)上強烈推薦了使用DotNetCharting控件來實現(xiàn),于是自己對DotNetCharting控件進行了簡單的學(xué)習(xí),下面先簡單介紹一下DotNetCharting控件及其使用。   DotNetCharting是一個非常棒的.NET圖表控件,對中文支持非常好,而且操作方便,開發(fā)快速,既有for webform 也有for winform的,而且.net1.1和2.0都有支持。它的官方地址是http:/.dotnetcharting./   本站也提供了DotNetC

2、harting破解版本下載: 附件: (下載 36 次)   強烈推薦一下DotNetCharting的demo地址:   這個是所有的 DEMO 演示 http:/.dotnetcharting.   這個是 Online Documentation http:/.dotnetcharting. 里面會有詳細的說明和用法。   DotNetCharting的簡單使用方法:   1.把bindotnetCHARTING.dll添加到工具箱,并且添加引用;   2.把

3、控件拖到你的網(wǎng)頁上,然后添加引用using dotnetCHARTING;就可以用了;   3.接下來是自己寫的對DotNetCharting操作的封裝類,以便于在程序里調(diào)用。1. using System;2. using System.Data;3. using System.Text;4. using dotnetCHARTING;5. namespace FLX.plexQuery6. 7.    /*/ <summary>  8.    / 彭建軍9.    / 根據(jù)數(shù)據(jù)動

4、態(tài)生成圖形(柱形圖、餅圖、曲線圖)10.    / 2008-06-1911.    / </summary>12.    public class ShowData13.    14.      屬性#region 屬性15.      private string _phaysicalimagepath;/圖片存放路徑16.      private string _title;

5、/圖片標題17.      private string _xtitle;/圖片x座標名稱18.      private string _ytitle;/圖片y座標名稱19.      private string _seriesname;/圖例名稱20.      private int _picwidth;/圖片寬度21.      private int _pichight;/圖片高度22

6、.      private DataTable _dt;/圖片數(shù)據(jù)源23.      /*/ <summary>24.      / 圖片存放路徑25.      / </summary>26.      public string PhaysicalImagePath27.      28.    &

7、#160;   set_phaysicalimagepath=value;29.        getreturn _phaysicalimagepath;30.      31.      /*/ <summary>32.      / 圖片標題33.      / </summary>34.    &

8、#160; public string Title35.      36.        set_title=value;37.        getreturn _title;38.      39.      /*/ <summary>40.      / 圖片標題41.   

9、60;  / </summary>42.      public string XTitle43.      44.        set_xtitle=value;45.        getreturn _xtitle;46.      47.      /*/ <summary>

10、48.      / 圖片標題49.      / </summary>50.      public string YTitle51.      52.        set_ytitle=value;53.        getreturn _ytitle;54.    &

11、#160; 55.      /*/ <summary>56.      / 圖例名稱57.      / </summary>58.      public string SeriesName59.      60.        set_seriesname=value;61.   

12、0;    getreturn _seriesname;62.      63.      /*/ <summary>64.      / 圖片寬度65.      / </summary>66.      public int PicWidth67.      68.    

13、;    set_picwidth=value;69.        getreturn _picwidth;70.      71.      /*/ <summary>72.      / 圖片高度73.      / </summary>74.      public int P

14、icHight75.      76.        set_pichight=value;77.        getreturn _pichight;78.      79.      /*/ <summary>80.      / 圖片數(shù)據(jù)源81.      /

15、 </summary>82.      public DataTable DataSource83.      84.        set_dt=value; 85.        getreturn _dt;86.      87.      #endregion88.   

16、0;  構(gòu)造函數(shù)#region 構(gòu)造函數(shù)89.      public ShowData()90.      91.        /92.        / TODO: 在此處添加構(gòu)造函數(shù)邏輯93.        /94.      95.     

17、;96.      public ShowData(string PhaysicalImagePath,string Title,string XTitle,string YTitle,string SeriesName)97.      98.        _phaysicalimagepath=PhaysicalImagePath;99.        _title=Title;100. &

18、#160;      _xtitle=XTitle;101.        _ytitle=YTitle;102.        _seriesname=SeriesName; 103.      104.      #endregion105.      輸出柱形圖#region 輸出柱形圖106

19、.      /*/ <summary>107.      / 柱形圖108.      / </summary>109.      / <returns></returns>110.      public void CreateColumn(dotnetCHARTING.Chart chart)111.    

20、60; 112.        chart.Title=this._title;    113.        chart.XAxis.Label.Text=this._xtitle;114.        chart.YAxis.Label.Text=this._ytitle;115.        chart.Te

21、mpDirectory =this._phaysicalimagepath;    116.        chart.Width = this._picwidth;117.        chart.Height = this._pichight;118.        chart.Type = ChartType.bo ;    &#

22、160; 119.        chart.Series.Type =SeriesType.Cylinder;120.        chart.Series.Name = this._seriesname;          121.        chart.Series.Data = this._dt

23、;122.        chart.SeriesCollection.Add(); 123.        chart.DefaultSeries.DefaultElement.ShowValue = true;  124.        chart.ShadingEffect = true;  125.      

24、  chart.Use3D = false;  126.        chart.Series.DefaultElement.ShowValue =true;127.      128.      #endregion129.      輸出餅圖#region 輸出餅圖130.      /*/ <summary>131.  

25、;    / 餅圖132.      / </summary>133.      / <returns></returns>134.      public void CreatePie(dotnetCHARTING.Chart chart)135.      136.        chart.Title=th

26、is._title;  137.        chart.TempDirectory =this._phaysicalimagepath;    138.        chart.Width = this._picwidth;139.        chart.Height = this._pichight;140.    

27、    chart.Type = ChartType.Pie;      141.        chart.Series.Type =SeriesType.Cylinder;142.        chart.Series.Name = this._seriesname;       143.   

28、;    144.        chart.ShadingEffect = true;  145.        chart.Use3D = false;      146.        chart.DefaultSeries.DefaultElement.Transparency = 20;

29、147.        chart.DefaultSeries.DefaultElement.ShowValue = true;148.        chart.PieLabelMode = PieLabelMode.Outside;      149.        chart.SeriesCollection.Add(getArrayData();15

30、0.        chart.Series.DefaultElement.ShowValue = true;151.      152.      private SeriesCollection getArrayData()153.      154.        SeriesCollection SC = new SeriesCollection()

31、;155.        DataTable dt = this._dt;156.        for(int i=0; i < dt.Rows.Count; i+)157.        158.          Series s = new Series();159.     

32、0;    s.Name = dt.Rows0.ToString();  160.         161.          Element e = new Element();162.          / 每元素的名稱163.       &#

33、160;  e.Name = dt.Rows0.ToString();164.          / 每元素的大小數(shù)值165.          e.YValue=Convert.ToInt32(dt.Rows1.ToString();166.         167.       

34、60;  s.Elements.Add(e);168.          SC.Add(s);169.        170.        return SC;171.      172.      #endregion173.      輸出曲線圖#region 輸

35、出曲線圖174.      /*/ <summary>175.      / 曲線圖176.      / </summary>177.      / <returns></returns>178.      public void CreateLine(dotnetCHARTING.Chart chart)179.   

36、0;        180.        chart.Title=this._title;    181.        chart.XAxis.Label.Text=this._xtitle;182.        chart.YAxis.Label.Text=this._ytitle;183. 

37、0;      chart.TempDirectory =this._phaysicalimagepath;    184.        chart.Width = this._picwidth;185.        chart.Height = this._pichight;186.        chart.Type =

38、 ChartType.bo ;      187.        chart.Series.Type =SeriesType.Line;188.        chart.Series.Name = this._seriesname;          189.     

39、0;  chart.Series.Data = this._dt;190.        chart.SeriesCollection.Add(); 191.        chart.DefaultSeries.DefaultElement.ShowValue = true;  192.        chart.ShadingEffect = true; 

40、0;193.        chart.Use3D = false;  194.        chart.Series.DefaultElement.ShowValue =true;195.      196.      #endregion197.      調(diào)用說明及范例#region 調(diào)用說明及范例198.      /   

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論