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

下載本文檔

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

文檔簡介

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

2、和2.0都有支持。它的官方地址是    本站也提供了DotNetCharting破解版本下載: 附件: dotnetCHARTING.rar (下載 36 次)    強(qiáng)烈推薦一下DotNetCharting的demo地址:    這個是所有的 DEMO 演示      這個是 Online Documentation 里面會有詳細(xì)的說明和用法。    DotNetCharting的簡單使用方法:    1.把bindotnetCHARTING.dll添加到工具箱,

3、并且添加引用;    2.把控件拖到你的網(wǎng)頁上,然后添加引用using dotnetCHARTING;就可以用了;    3.接下來是自己寫的對DotNetCharting操作的封裝類,以便于在程序里調(diào)用。ShowData.cs1. using System;2. using System.Data;3. using System.Text;4. using dotnetCHARTING;5.6. namespace FLX.ComplexQuery7. 8.     /*/ <summary>   

4、9.     / 彭建軍10.     / 根據(jù)數(shù)據(jù)動態(tài)生成圖形(柱形圖、餅圖、曲線圖)11.     / 2008-06-1912.     / </summary>13.     public class ShowData14.     15.16.         屬性#region 屬性17.         private string _phaysicalimagepath

5、;/圖片存放路徑18.         private string _title; /圖片標(biāo)題19.         private string _xtitle;/圖片x座標(biāo)名稱20.         private string _ytitle;/圖片y座標(biāo)名稱21.         private string _seriesname;/圖例名稱22.         private in

6、t _picwidth;/圖片寬度23.         private int _pichight;/圖片高度24.         private DataTable _dt;/圖片數(shù)據(jù)源25.26.         /*/ <summary>27.         / 圖片存放路徑28.         / </summary>29.     &#

7、160;   public string PhaysicalImagePath30.         31.             set_phaysicalimagepath=value;32.             getreturn _phaysicalimagepath;33.         34.         /*/ <s

8、ummary>35.         / 圖片標(biāo)題36.         / </summary>37.         public string Title38.         39.             set_title=value;40.             getreturn _

9、title;41.         42.         /*/ <summary>43.         / 圖片標(biāo)題44.         / </summary>45.         public string XTitle46.         47.          

10、  set_xtitle=value;48.             getreturn _xtitle;49.         50.         /*/ <summary>51.         / 圖片標(biāo)題52.         / </summary>53.         public st

11、ring YTitle54.         55.             set_ytitle=value;56.             getreturn _ytitle;57.         58.59.         /*/ <summary>60.         / 圖例名稱61. &#

12、160;       / </summary>62.         public string SeriesName63.         64.             set_seriesname=value;65.             getreturn _seriesname;66.         6

13、7.         /*/ <summary>68.         / 圖片寬度69.         / </summary>70.         public int PicWidth71.         72.             set_picwidth=value;73.   

14、60;         getreturn _picwidth;74.         75.         /*/ <summary>76.         / 圖片高度77.         / </summary>78.         public int PicHight79.       &

15、#160; 80.             set_pichight=value;81.             getreturn _pichight;82.         83.         /*/ <summary>84.         / 圖片數(shù)據(jù)源85.         / </su

16、mmary>86.         public DataTable DataSource87.         88.             set_dt=value; 89.             getreturn _dt;90.         91.         #endregion92.93.

17、         構(gòu)造函數(shù)#region 構(gòu)造函數(shù)94.         public ShowData()95.         96.             /97.             / TODO: 在此處添加構(gòu)造函數(shù)邏輯98.             /99.   

18、0;     100.         101.         public ShowData(string PhaysicalImagePath,string Title,string XTitle,string YTitle,string SeriesName)102.         103.             _phaysicalimagepath=PhaysicalImagePa

19、th;104.             _title=Title;105.             _xtitle=XTitle;106.             _ytitle=YTitle;107.             _seriesname=SeriesName;  108.         109

20、.         #endregion110.111.         輸出柱形圖#region 輸出柱形圖112.         /*/ <summary>113.         / 柱形圖114.         / </summary>115.         / <returns></returns&g

21、t;116.         public void CreateColumn(dotnetCHARTING.Chart chart)117.         118.             chart.Title=this._title;        119.             chart.XAxis.Label.Text=this._xtitl

22、e;120.             chart.YAxis.Label.Text=this._ytitle;121.             chart.TempDirectory =this._phaysicalimagepath;        122.             chart.Width = this._picwidth;123.    

23、         chart.Height = this._pichight;124.             chart.Type = ChartType.Combo ;            125.             chart.Series.Type =SeriesType.Cylinder;126.         

24、60;   chart.Series.Name = this._seriesname;                    127.             chart.Series.Data = this._dt;128.             chart.SeriesCollection.Add();  129.     

25、0;       chart.DefaultSeries.DefaultElement.ShowValue = true;    130.             chart.ShadingEffect = true;    131.             chart.Use3D = false;    132.           &

26、#160; chart.Series.DefaultElement.ShowValue =true;133.         134.         #endregion135.136.         輸出餅圖#region 輸出餅圖137.         /*/ <summary>138.         / 餅圖139.        

27、 / </summary>140.         / <returns></returns>141.         public void CreatePie(dotnetCHARTING.Chart chart)142.         143.             chart.Title=this._title;    144.   

28、60;         chart.TempDirectory =this._phaysicalimagepath;        145.             chart.Width = this._picwidth;146.             chart.Height = this._pichight;147.           &

29、#160; chart.Type = ChartType.Pie;            148.             chart.Series.Type =SeriesType.Cylinder;149.             chart.Series.Name = this._seriesname;              150. &

30、#160;           151.             chart.ShadingEffect = true;    152.             chart.Use3D = false;            153.             chart.DefaultSe

31、ries.DefaultElement.Transparency = 20; 154.             chart.DefaultSeries.DefaultElement.ShowValue = true;155.             chart.PieLabelMode = PieLabelMode.Outside;            156.        

32、;     chart.SeriesCollection.Add(getArrayData();157.             chart.Series.DefaultElement.ShowValue = true;158.         159.160.         private SeriesCollection getArrayData()161.         162. 

33、60;           SeriesCollection SC = new SeriesCollection();163.             DataTable dt = this._dt;164.165.             for(int i=0; i < dt.Rows.Count; i+)166.             167. 

34、0;               Series s = new Series();168.                 s.Name = dt.Rows0.ToString();    169.                 170.                

35、; Element e = new Element();171.172.                 / 每元素的名稱173.                 e.Name = dt.Rows0.ToString();174.175.                 / 每元素的大小數(shù)值176.         &

36、#160;       e.YValue=Convert.ToInt32(dt.Rows1.ToString();177.                 178.                 s.Elements.Add(e);179.                 SC.Add(s);180.    

37、;         181.             return SC;182.         183.         #endregion184.185.         輸出曲線圖#region 輸出曲線圖186.         /*/ <summary>187.       

38、0; / 曲線圖188.         / </summary>189.         / <returns></returns>190.         public void CreateLine(dotnetCHARTING.Chart chart)191.                     192.    

39、;         chart.Title=this._title;        193.             chart.XAxis.Label.Text=this._xtitle;194.             chart.YAxis.Label.Text=this._ytitle;195.             chart

40、.TempDirectory =this._phaysicalimagepath;        196.             chart.Width = this._picwidth;197.             chart.Height = this._pichight;198.             chart.Type = ChartType.Combo ;&

41、#160;           199.             chart.Series.Type =SeriesType.Line;200.             chart.Series.Name = this._seriesname;                    201.     

42、0;       chart.Series.Data = this._dt;202.             chart.SeriesCollection.Add();  203.             chart.DefaultSeries.DefaultElement.ShowValue = true;    204.             char

43、t.ShadingEffect = true;    205.             chart.Use3D = false;    206.             chart.Series.DefaultElement.ShowValue =true;207.         208.         #endregion209.210.         調(diào)用說明及范例#region 調(diào)用說明及范例21

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論