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

首頁 > 編程 > C# > 正文

C#中dotnetcharting的用法實例詳解

2019-10-29 21:44:25
字體:
供稿:網(wǎng)友
這篇文章主要介紹了C#中dotnetcharting的用法,以實例形式詳細分析了基于dotnetcharting的圖表繪制的各種常用方法,是非常實用的技巧,需要的朋友可以參考下
 

本文以實例形式詳細講述了dotnetcharting控件的用法。分享給大家供大家參考。具體用法分析如下:

dotnetcharting 是一個很好用的圖表控件,能畫出很漂亮的報表,一般常用到的主要有柱狀圖、餅圖、折線圖三種。
dotnetcharting 有web版、winform版多個版本可供使用,官方網(wǎng)址:http://www.dotnetcharting.com/ ,官網(wǎng)有很多示例(http://www.dotnetcharting.com/gallery/),而且有winform安裝版示例和代碼,如下圖。
dotnetcharting 有網(wǎng)上破解版的,去百度或谷歌一搜一堆。
說下個人感受,該控件是國外開發(fā)的,雖然說這個控件挺好用的,但是感覺這個控件應(yīng)該在有xp系統(tǒng)的時候就應(yīng)該有了吧?是國外剩下的技術(shù),咱們一直在用別人不用的技術(shù),捧為珍寶。
有些技術(shù)有些人,有些本事就開始自大起來,小有成就的那點技術(shù)還藏著掖著。 呵呵。。。

C#中dotnetcharting的用法實例詳解

接下來上干貨,前兩天剛使用dotnetcharting 做了個統(tǒng)計報表,代碼如下:
 

復(fù)制代碼代碼如下:
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
    // 時間: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è)置柱狀圖每個單元格的寬度
        private int _numberPercision;//設(shè)置數(shù)值小數(shù)點
 
        /// <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;
            style="border-left-color: rgb(0, 153, 204); border-left-width: 1px; border-left-style: solid; padding: 0px 3px; margin: 3px auto 0px; width: 640px; background-color: rgb(242, 246, 251); clear: both; border-top-color: rgb(0, 153, 204); border-top-width: 1px; border-top-style: solid; border-right-color: rgb(0, 153, 204); border-right-width: 1px; border-right-style: solid;"> 復(fù)制代碼代碼如下:
ShowData show = new ShowData();
//show.PicHight = 494;
//show.PicWidth = 1336;
show.SeriesName = "具體詳情";
show.PhaysicalImagePath = "ChartImages";
show.TitleBoxColor = Color.Blue;
show.TitleBoxFont = new Font("Arial", 10, FontStyle.Bold);
show.ChartAreaBackgroundColor = Color.Honeydew;
show.XAxisLabelFont = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
show.YAxisLabelFont = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
show.XAxisDefaultTickLabelFont = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
show.YAxisDefaultTickLabelFont = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
show.ChartDefaultSeriesType = SeriesType.Column;
show.DataSetSource = dsSet;
show.SeriesTypeE = modelConseme.DateChart;

 

//餅圖
show.YTitle = "油量(升)";
//show.Title = strOils + strDate + strConsume + "銷售油量報表統(tǒng)計圖";  
show.XTitle = "";
show.DataSource = dsSet.Tables[0];
show.CreatePie(this.chart1);

//柱狀圖(兩條柱子對比)
 show.YTitle = "油量(升)";
label2.Text = strDate + strOils + strConsume + @"油品對比圖";
show.XTitle = "油品";
//show.DataSource = dsSet.Tables[2];
show.StaticColumnWidth = 0;
show.CreateColumn(chart2, new List<int>()
{
0,
1
});

//曲線圖
show.YTitle = "油量(升)";
label5.Text = strDate + strOils + strConsume + @"油量環(huán)比圖";
show.XTitle = "時間";
show.DataSource = dsSet.Tables[4];
show.CreateLine(this.chart5);

//單個柱子
var show = new ShowData
{
    src="/uploads/allimg/150116/124253L45-1.png?201492991845" style="border: 1px solid rgb(204, 204, 204); padding: 3px; max-width: 620px; overflow: hidden;" />

C#中dotnetcharting的用法實例詳解

C#中dotnetcharting的用法實例詳解

希望本文所述對大家的C#程序設(shè)計有所幫助。


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 浠水县| 新邵县| 贵溪市| 佛冈县| 台湾省| 金溪县| 根河市| 宕昌县| 赤城县| 江门市| 石景山区| 邻水| 扎兰屯市| 潢川县| 正宁县| 延津县| 德钦县| 富民县| 时尚| 连南| 杭锦后旗| 和龙市| 梁平县| 嘉鱼县| 武清区| 双流县| 长白| 仪征市| 渭南市| 阳新县| 吉木乃县| 屯昌县| 游戏| 巴彦淖尔市| 西青区| 峨山| 东阿县| 石台县| 巴马| 长乐市| 深水埗区|