• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C#:ZedGraph画图控件(待补充)

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZedGraph;


namespace TestZedGraphControl
{
    /// <summary>
    /// 画图控件操作类(VS显示控件:工具-->添加项-->选择项-->ZedGraph.dll)
    /// </summary>
    public class CtlZedGraphOperate
    {
        private ZedGraphControl m_zedGraphControl = null;

        /// <summary>
        /// 关联ZedGraph画图控件
        /// </summary>
        public ZedGraphControl refZedGraphControl
        {
            set
            {
                m_zedGraphControl = value;
            }
            get
            {
                return m_zedGraphControl;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public CtlZedGraphOperate()
        {

        }

        private static volatile CtlZedGraphOperate zgOpera = null;
        
        /// <summary>
        /// 获取画图控件操作类单一实例
        /// </summary>
        /// <returns></returns>
        public static CtlZedGraphOperate GetInstance()
        {
            if(null == zgOpera)
            {
                zgOpera = new CtlZedGraphOperate();
            }
            return zgOpera;
        }

        /// <summary>
        /// 设置标题
        /// </summary>
        /// <param name="title">图标题</param>
        /// <param name="x_title">X轴标题</param>
        /// <param name="y_title">Y轴标题</param>
        /// <param name="x_type">X轴类型</param>
        /// <param name="y_type">Y轴类型</param>
        public void SetTitles(string title, string x_title, string y_title)
        {
            m_zedGraphControl.GraphPane.Title.Text = title;
            m_zedGraphControl.GraphPane.XAxis.Title.Text = x_title;
            m_zedGraphControl.GraphPane.YAxis.Title.Text = y_title;
        }

        /// <summary>
        /// 设置标题(Linear:线性,Exponent:指数,Log:对数,Date:时间,Text:文本,Ordinal:序数,LinearOrdinal:线性序数,DateOrdinal:时间序数)
        /// </summary>
        /// <param name="title">图标题</param>
        /// <param name="x_title">X轴标题</param>
        /// <param name="y_title">Y轴标题</param>
        /// <param name="x_type">X轴类型</param>
        /// <param name="y_type">Y轴类型</param>
        public void SetTitles(string title, string x_title, string y_title, AxisType x_type, AxisType y_type)
        {
            m_zedGraphControl.GraphPane.Title.Text = title;
            m_zedGraphControl.GraphPane.XAxis.Title.Text = x_title;
            m_zedGraphControl.GraphPane.YAxis.Title.Text = y_title;
            m_zedGraphControl.GraphPane.XAxis.Type = x_type;
            m_zedGraphControl.GraphPane.YAxis.Type = y_type;
        }

        /// <summary>
        /// 依据点集画线
        /// </summary>
        /// <param name="pointList">点集</param>
        public LineItem DrawLines(string label, PointPairList pointList, System.Drawing.Color color, SymbolType symbolType)
        {
            return m_zedGraphControl.GraphPane.AddCurve(label, pointList, color, symbolType);
        }

        /// <summary>
        /// 刷新
        /// </summary>
        public void ReFresh()
        {
            m_zedGraphControl.AxisChange();
            m_zedGraphControl.Refresh();
        }
    }
}

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
c#——WinformDatagridView上显示下拉树发布时间:2022-07-10
下一篇:
[转载]C#控制台应用程序里调用自己写的函数的方法发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap