国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

dotnetcharting 的簡(jiǎn)單使用

2019-11-17 02:48:05
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

dotnetcharting 的簡(jiǎn)單使用

dotnetcharting 是一個(gè)很好用的圖表控件,能畫(huà)出很漂亮的報(bào)表,一般常用到的主要有柱狀圖、餅圖、折線圖三種。dotnetcharting 有web版、winform版多個(gè)版本可供使用,官方網(wǎng)址:http://www.dotnetcharting.com/ ,官網(wǎng)有很多示例(http://www.dotnetcharting.com/gallery/),而且有winform安裝版示例和代碼,如下圖。dotnetcharting 有網(wǎng)上破解版的,去博客園或谷歌一搜一堆。說(shuō)下個(gè)人感受,該控件是國(guó)外開(kāi)發(fā)的,雖然說(shuō)這個(gè)控件挺好用的,但是感覺(jué)這個(gè)控件應(yīng)該在有xp系統(tǒng)的時(shí)候就應(yīng)該有了吧?是國(guó)外剩下的技術(shù),咱們一直在用別人不用的技術(shù),捧為珍寶。有些技術(shù)有些人,有些本事就開(kāi)始自大起來(lái),小有成就的那點(diǎn)技術(shù)還藏著掖著。呵呵。。。接下來(lái)上干貨,前兩天剛使用dotnetcharting 做了個(gè)統(tǒng)計(jì)報(bào)表,代碼如下:using System;using System.Collections.Generic;using System.Data;using System.Drawing;using dotnetCHARTING.WinForms;using StationChart.Model;using StationChart.Utility;using Chart = dotnetCHARTING.WinForms.Chart;using Series = dotnetCHARTING.WinForms.Series;using SeriesCollection = dotnetCHARTING.WinForms.SeriesCollection;namespace ManageSystem{ // <summary> // 作者:薛江濤 // 版本:V1.0.0 // 時(shí)間:2014/10/9 11:49:48 // </summary> public class ShowData { #region 屬性 PRivate string _phaysicalimagepath;//圖片存放路徑 private string _xtitle;//圖片x座標(biāo)名稱 private string _ytitle;//圖片y座標(biāo)名稱 private string _seriesname;//圖例名稱 private int _picwidth;//圖片寬度 private int _pichight;//圖片高度 private DataTable _dt;//圖片數(shù)據(jù)源 private DataSet _ds;//圖片數(shù)據(jù)源 private Color _titleBoxColor;//圖片標(biāo)題背景色 private Font _titleBoxFont;//圖片標(biāo)題字體 private Color _chartAreaBackgroundColor;//圖片背景顏色 private Font _xAxisLabelFont;//X軸柱狀圖值字體 private Font _yAxisLabelFont;//Y軸柱狀圖值字體 private Font _xAxisDefaultTickLabelFont;//X軸刻度字體 private Font _yAxisDefaultTickLabelFont;//Y軸刻度字體 private SeriesType _chartDefaultSeriesType;//圖片類型 private ChartType _chartType;//圖片類型 //private bool _isMonth; //是否是月顯示 private int _staticColumnWidth;//設(shè)置柱狀圖每個(gè)單元格的寬度 private int _numberPercision;//設(shè)置數(shù)值小數(shù)點(diǎn) /// <summary> /// 圖片存放路徑 /// </summary> public string PhaysicalImagePath { set { _phaysicalimagepath = value; } get { return _phaysicalimagepath; } } /// <summary> /// 圖片標(biāo)題 /// </summary> public string Title { get; set; } /// <summary> /// 圖片標(biāo)題 /// </summary> public string XTitle { set { _xtitle = value; } get { return _xtitle; } } /// <summary> /// 圖片標(biāo)題 /// </summary> public string YTitle { set { _ytitle = value; } get { return _ytitle; } } /// <summary> /// 圖例名稱 /// </summary> public string SeriesName { set { _seriesname = value; } get { return _seriesname; } } /// <summary> /// 圖片寬度 /// </summary> public int PicWidth { set { _picwidth = value; } get { return _picwidth; } } /// <summary> /// 圖片高度 /// </summary> public int PicHight { set { _pichight = value; } get { return _pichight; } } /// <summary> /// 圖片數(shù)據(jù)源 /// </summary> public DataTable DataSource { set { _dt = value; } get { return _dt; } } /// <summary> /// 圖片數(shù)據(jù)源 /// </summary> public DataSet DataSetSource { set { _ds = value; } get { return _ds; } } public int NumberPercision { set { _numberPercision = value; } get { return _numberPercision; } } public Color TitleBoxColor { get { return _titleBoxColor; } set { _titleBoxColor = value; } } public Font TitleBoxFont { get { return _titleBoxFont; } set { _titleBoxFont = value; } } public Color ChartAreaBackgroundColor { get { return _chartAreaBackgroundColor; } set { _chartAreaBackgroundColor = value; } } public Font XAxisLabelFont { get { return _xAxisLabelFont; } set { _xAxisLabelFont = value; } } public Font YAxisLabelFont { get { return _yAxisLabelFont; } set { _yAxisLabelFont = value; } } public Font XAxisDefaultTickLabelFont { get { return _xAxisDefaultTickLabelFont; } set { _xAxisDefaultTickLabelFont = value; } } public Font YAxisDefaultTickLabelFont { get { return _yAxisDefaultTickLabelFont; } set { _yAxisDefaultTickLabelFont = value; } } public SeriesType ChartDefaultSeriesType { get { return _chartDefaultSeriesType; } set { _chartDefaultSeriesType = value; } } public ChartType ChartType { get { return _chartType; } set { _chartType = value; } } //public bool IsMonth //{ // get { return _isMonth; } // set { _isMonth = value; } //} public ModelConseme.DateChartEnum SeriesTypeE { get; set; } public int StaticColumnWidth { get { return _staticColumnWidth; } set { _staticColumnWidth = value; } } #endregion #region 構(gòu)造函數(shù) public ShowData() { // // TODO: 在此處添加構(gòu)造函數(shù)邏輯 // NumberPercision = 2; } public ShowData(string phaysicalImagePath, string title, string xTitle, string yTitle, string seriesName) { _phaysicalimagepath = phaysicalImagePath; Title = title; _xtitle = xTitle; _ytitle = yTitle; _seriesname = seriesName; } #endregion private static readonly object ThisLock = new object(); #region 輸出柱形圖 /// <summary> /// 柱形圖 /// </summary> /// <returns></returns> public void CreateColumn(Chart chart) { try { //清空?qǐng)D片 chart.SeriesCollection.Clear(); //標(biāo)題框設(shè)置 //標(biāo)題的顏色 chart.TitleBox.Label.Color = _titleBoxColor; //標(biāo)題字體設(shè)置 chart.TitleBox.Label.Font = _titleBoxFont; //控制柱狀圖顏色 chart.ShadingEffectMode = ShadingEffectMode.One; chart.TitleBox.Position = TitleBoxPosition.None; //圖表背景顏色 chart.ChartArea.Background.Color = ChartAreaBackgroundColor; //1.圖表類型 chart.DefaultSeries.Type = _chartDefaultSeriesType;// SeriesType.Column; //chart.DefaultSeries.Type = SeriesType.Cylinder; //2.圖表類型 //柱狀圖 //chart.Type = ChartType.TreeMap; ////橫向柱狀圖 chart.Type = _chartType;// ChartType.ComboHorizontal ////橫向柱狀圖 //chart.Type =_chartType;// ChartType.Gantt; ////餅狀圖 //chart.Type = ChartType.Pies; //y軸圖表陰影顏色 //chart.YAxis.AlternateGridBackground.Color = Color.FromArgb(255, 250, 250, 250); chart.LegendBox.HeaderLabel = new Label("圖表說(shuō)明", new Font("Microsoft Sans Serif", 10F, FontStyle.Bold, GraphicsUnit.Point, 134)); //chart.LegendBox.HeaderLabel.Font = new Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 134); chart.LegendBox.Label.Font = new Font("Microsoft Sans Serif", 9F, FontStyle.Bold, GraphicsUnit.Point, 134); chart.Palette = new Color[] { Color.FromArgb(0, 156, 255), Color.FromArgb(255, 99, 49), Color.FromArgb(49, 255, 49), Color.FromArgb(255, 255, 0), }; chart.Title = Title; //X軸柱狀圖值字體 chart.XAxis.Label.Text = _xtitle; chart.XAxis.Label.Font = _xAxisLabelFont; //設(shè)置X軸刻度值說(shuō)明字體 chart.XAxis.DefaultTick.Label.Font = _xAxisDefaultTickLabelFont; chart.XAxis.StaticColumnWidth = _staticColumnWidth; //每個(gè)單元格的寬度 //Y軸柱狀圖值字體 chart.YAxis.Label.Text = _ytitle; chart.YAxis.Label.Font = _yAxisLabelFont; //設(shè)置Y軸刻度值說(shuō)明字體 chart.YAxis.DefaultTick.Label.Font = _yAxisDefaultTickLabelFont; //Y軸箭頭標(biāo)示 chart.XAxis.Name = XTitle; if (_chartType == ChartType.ComboHorizontal) { chart.XAxis.TickLabelPadding = 10; chart.XAxis.Line.StartCap = System.Drawing.Drawing2D.LineCap.Square; chart.XAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; chart.XAxis.Line.Width = 5;//箭頭寬度 chart.XAxis.Line.Color = Color.Gray; } else { chart.YAxis.TickLabelPadding = 10; chart.YAxis.Line.StartCap = System.Drawing.Drawing2D.LineCap.Square; chart.YAxis.Line.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; chart.YAxis.Line.Width = 5;//箭頭寬度 chart.YAxis.Line.Color = Color.Gray; //顯示值格式化(小數(shù)
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 普安县| 黄骅市| 阳春市| 三台县| 颍上县| 壶关县| 阜康市| 岳阳县| 东辽县| 阿鲁科尔沁旗| 荣成市| 南开区| 宝应县| 嘉黎县| 崇仁县| 施秉县| 甘泉县| 宝山区| 福安市| 宜章县| 江口县| 屯留县| 余庆县| 修武县| 东莞市| 大石桥市| 武隆县| 安福县| 常州市| 泸溪县| 丰宁| 阿坝县| 宝应县| 天水市| 东安县| 花垣县| 大石桥市| 桓仁| 双牌县| 汪清县| 冀州市|