• ZedGraph一些代码


    this.zedGraphControl1.GraphPane.CurveList.Clear();
    this.zedGraphControl1.GraphPane.GraphObjList.Clear();
    this.zedGraphControl1.IsShowCursorValues = false;
    this.zedGraphControl1.IsShowPointValues = true;//数据节点
    //this.zedGraphControl1.GraphPane.Y2AxisList.Clear();
    //this.zedGraphControl1.GraphPane.YAxisList.Clear();
    this.zedGraphControl1.IsEnableHZoom = false;
    this.zedGraphControl1.IsEnableVZoom = false;
    this.zedGraphControl1.GraphPane.Title.Text = dtime.Month + "-" + dtime.Day + "至" + dtime.AddDays(1).Month + "-" + dtime.AddDays(1).Day + "整点水位预测";
    //this.zedGraphControl1.GraphPane.XAxis.Type = ZedGraph.AxisType.DateAsOrdinal;
    LineItem curve = this.zedGraphControl1.GraphPane.AddCurve("水位", null,listy, Color.Blue, SymbolType.None);
    //显示数据
    const double offset = 0.0;
    this.zedGraphControl1.GraphPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, Color.ForestGreen), 45.0F);
    for (int i = 0; i < water_height.Length; i++)
    {
    // Get the pointpair
      PointPair pt = curve.Points[i];
    // Create a text label from the Y data value
      TextObj text = new TextObj(pt.Y.ToString(), pt.X, pt.Y + offset, CoordType.AxisXYScale, AlignH.Center, AlignV.Bottom);

    text.ZOrder = ZOrder.A_InFront;
    // Hide the border and the fill
    text.FontSpec.Border.IsVisible = false;
    text.FontSpec.Fill.IsVisible = false;
    text.FontSpec.Angle = 1; //字体倾斜度
    text.FontSpec.Size = 13;
    text.FontSpec.FontColor = Color.Red;
    //myPane.GraphObjList.Add(text);
    this.zedGraphControl1.GraphPane.GraphObjList.Add(text);
    }
    this.zedGraphControl1.GraphPane.XAxis.Scale.TextLabels = labels;
    this.zedGraphControl1.GraphPane.XAxis.Type = AxisType.Text; //X轴类型
    this.zedGraphControl1.AxisChange();
    this.zedGraphControl1.Refresh();

    2.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using ZedGraph;

    namespace DynamicData
    {
    public partial class Form1 : Form
    {
      // Starting time in milliseconds
      int tickStart = 0;

      public Form1()
      {
       InitializeComponent();
      }

      private void Form1_Load( object sender, EventArgs e )
      {
       //获取引用
       GraphPane myPane = zedGraphControl1.GraphPane;
       //设置标题
       myPane.Title.Text = "Test of Dynamic Data Update with ZedGraph " +
       "(After 25 seconds the graph scrolls)";
       //设置X轴说明文字
       myPane.XAxis.Title.Text = "Time, Seconds";
       //设置Y轴文字
       myPane.YAxis.Title.Text = "Sample Potential, Volts";

       // Save 1200 points. At 50 ms sample rate, this is one minute
       // The RollingPointPairList is an efficient storage class that always
       // keeps a rolling set of point data without needing to shift any data values

       //设置1200个点,假设每50毫秒更新一次,刚好检测1分钟
       //一旦构造后将不能更改这个值
       RollingPointPairList list = new RollingPointPairList( 1200 );

       // Initially, a curve is added with no data points (list is empty)
       // Color is blue, and there will be no symbols
       //开始,增加的线是没有数据点的(也就是list为空)
       //增加一条名称:Voltage,颜色Color.Bule,无符号,无数据的空线条
       LineItem curve = myPane.AddCurve( "Voltage", list, Color.Blue, SymbolType.None );

       // Sample at 50ms intervals
       //设置timer控件的间隔为50毫秒
       timer1.Interval = 50;
       //timer可用
       timer1.Enabled = true;
       //开始
       timer1.Start();

       // Just manually control the X axis range so it scrolls continuously
       // instead of discrete step-sized jumps
       //X轴最小值0
       myPane.XAxis.Scale.Min = 0;
       //X轴最大30
       myPane.XAxis.Scale.Max = 30;
       //X轴小步长1,也就是小间隔
       myPane.XAxis.Scale.MinorStep = 1;
       //X轴大步长为5,也就是显示文字的大间隔
       myPane.XAxis.Scale.MajorStep = 5;

       // Scale the axes
       //改变轴的刻度
       zedGraphControl1.AxisChange();
       // Save the beginning time for reference
       //保存开始时间
       tickStart = Environment.TickCount;
      }

      private void timer1_Tick( object sender, EventArgs e )
      {
       // Make sure that the curvelist has at least one curve
       //确保CurveList不为空
       if ( zedGraphControl1.GraphPane.CurveList.Count <= 0 )
       return;

       // Get the first CurveItem in the graph
       //取Graph第一个曲线,也就是第一步:在GraphPane.CurveList集合中查找CurveItem
       LineItem curve = zedGraphControl1.GraphPane.CurveList[0] as LineItem;
       if ( curve == null )
       return;

       // Get the PointPairList
       //第二步:在CurveItem中访问PointPairList(或者其它的IPointList),根据自己的需要增加新数据或修改已存在的数据
       IPointListEdit list = curve.Points as IPointListEdit;
       // If this is null, it means the reference at curve.Points does not
       // support IPointListEdit, so we won't be able to modify it
       if ( list == null )
       return;

       // Time is measured in seconds
       // 时间用秒表示
       double time = (Environment.TickCount - tickStart) / 1000.0;

       // 3 seconds per cycle
       // 3秒循环
       list.Add( time, Math.Sin( 2.0 * Math.PI * time / 3.0 ) );

       // Keep the X scale at a rolling 30 second interval, with one
       // major step between the max X value and the end of the axis
       //保持在一个滚动的X规模30秒的间隔,其中一个主要步骤之间的X值和结束Max的轴
       Scale xScale = zedGraphControl1.GraphPane.XAxis.Scale;
       if ( time > xScale.Max - xScale.MajorStep )
       {
        xScale.Max = time + xScale.MajorStep;
        xScale.Min = xScale.Max - 30.0;
       }

       // Make sure the Y axis is rescaled to accommodate actual data
       //第三步:调用ZedGraphControl.AxisChange()方法更新X和Y轴的范围
       zedGraphControl1.AxisChange();
       // Force a redraw
       //第四步:调用Form.Invalidate()方法更新图表
       zedGraphControl1.Invalidate();
      }

      private void Form1_Resize( object sender, EventArgs e )

      {
       SetSize();
      }

      // Set the size and location of the ZedGraphControl
      //设置ZedGraphControl的大小和位置
      private void SetSize()
      {
       // Control is always 10 pixels inset from the client rectangle of the form
       //控制总是以10像素插图来自客户机的矩形的形式
       Rectangle formRect = this.ClientRectangle;
       formRect.Inflate( -10, -10 );

       if ( zedGraphControl1.Size != formRect.Size )
       {
        zedGraphControl1.Location = formRect.Location;
        zedGraphControl1.Size = formRect.Size;
       }
      }
    }
    }

    ============================================================================================================

    3.

    //---------------------------------------------------------           
    //IsReverse   //X 轴的刻度值从高到低还是从低到高
    //MajorUnit//大刻度步长单位
    //MaxAuto//根据输入数据自动设置刻度最大值
    //MinorStepAuto//是否自动设置小刻度步长
    //MinorUnit//小刻度单位
    //MajorUnit//大刻度步长单位
    //Type//数据显示方式
    //IsPenWidthScaled//图比例变化时候图表上的画笔的粗细是否跟着自动缩放
    //-----------------------------------------------------------
    //附:在vs中使用ZedGraph控件的一些记录(转)
    //
    //几个注意点:1. 图片的保存路径设置:RenderedImagePath 属性中设置,程序对该文件夹应该是有写和修改权限的
    //2.图片的输出格式:OutputFormat 属性中设置,Png 的推荐,比较清晰。
    //
    //Chart
    //ChartBorder//图表区域的边框设置
    //ChartFill//图表区域的背景填充
    //Legend//图表的注释标签显示设置项目,一组数据对应一种颜色的注释
    //IsHStack//当有多个显示项的时候设置 Y 轴数据是叠加的还是分开的
    //Xaxis//图表区域的 X 轴相关信息设置
    //AxisColor/坐标轴颜色
    //Cross//坐标的原点,可以设置坐标的偏移程度
    //CrossAuto//原点自动设置:True 的话 Cross 的设置就无效了。
    //FontSpec//X 轴标题字体相关信息
    //Angle//X 轴标题字体显示时候的角度,0为水平 90为垂直
    //Fill//X 轴标题字体填充信息
    //ColorOpacity//透明度
    //IsScaled//设置 X 轴标题字体显示大小是否根据图的比例放大缩小
    //RangeMax//填充时候的最大倾斜度(有过渡色,没试过)
    //RangeMin//填充时候的最小倾斜度(有过渡色,没试过)
    //StringAlignment//X 轴标题字体排列(不清楚,没试过)
    //IsOmitMag//是否显示指数幂(10次方,没试过,似乎与 IsUseTenPower 有关系)
    //IsPreventLabelOverlap//坐标值显示是否允许重叠,如果False的话,控件会根据坐标值长度自动消除部分坐标值的显示状态
    //IsShowTitle//X 轴标题是否显示
    //IsTicsBetweenLabels//两个坐标值之间是否自动显示分隔标志
    //IsUseTenPower//是否使用10次幂指数
    //IsZeroLine//当数据为0时候是否显示(在饼状图显示的时候有用)
    //IsVisible//是否显示 X 轴
    //MajorGrid//大跨度的 X 轴表格虚线线显示信息
    //DashOff//虚线中孔间距
    //DashOn//虚线单位长度
    //MajorTic//大跨度的 X 轴刻度信息
    //IsInside//在 Chart 内部是否显示
    //IsOutSide//在 Chart 外部是否显示
    //IsOpposite//在对面的轴上是否显示
    //MinorGrid//小跨度的 X 轴表格虚线显示信息
    //MinorTic//小跨度的 x 轴刻度信息
    //MinSpace//刻度和轴之间的距离(没试过)
    //Scale//刻度值的一些设定
    //IsReverse//X 轴的刻度值从高到低还是从低到高
    //MajorStep/大刻度步长
    //MajorStepAuto//是否自动设置大刻度步长
    //MajorUnit//大刻度步长单位
    //Max//刻度最大值
    /MaxAuto//根据输入数据自动设置刻度最大值
    //Min//刻度最小值
    //MinAuto//根据输入数据自动设置刻度最小值
    //MinGrace//不清楚,没试过
    //MinorStep//小刻度步长
    //MinorStepAuto//是否自动设置小刻度步长
    //MinorUnit/小刻度单位
    //Type//数据显示方式
    //Liner//直接现实(自动)
    //Date//按日期方式显示
    //Log//按指数幂方式显示
    //Ordinal//顺序显示
    //Y2Axis//第二个 Y 轴坐标信息显示(具体设置看 X 轴)
    //Yaxis//第一个  轴坐标信息显示(具体设置看 X 轴)
    //BarBase//在生成柱状图的时候设置柱状是基于 X 轴还是其他轴
    //BarType//柱状的类型叠加或其他。
    //IsFontsScaled//图比例变化时候图表上的文字是否跟着自动缩放
    //IsIgnoreInitial//是否忽略初始值
    //IsIgnoreMissing//是否忽略缺省值
    //IsPenWidthScaled//图比例变化时候图表上的画笔的粗细是否跟着自动缩放
    //IsShowTitle//图表标题是否显示
    //PaneFill//Pane 的一些填充信息
    //BaseDimension//缩放比例基数(可以试试效果)
    //IsImageMap//不清楚干吗用的
    //AxisChaneged//是否允许自动绘图(没试过,一般都 true,动态绘图)
    //CacheDuration//Cache 保存时间0
    //OutputFormat//输出格式
    //RenderedImagePath//输出路径
    //RenderMode//输出模式,不太清楚一般都是 ImageTag,另一个输出的是乱码不是图片。对于图表而言,一般是三种表现形式:柱状图、饼状图和点线图。
    /--------------------------------------------------------------------------------------------------
    /myPane.YAxis.MajorGrid.IsZeroLine = false;   // Don't display the Y zero line
    // (填充数据点)
    // myCurve.Symbol.Fill = new Fill(Color.White);

    //声明画笔

    //GraphPane myPane = zgc.GraphPane;

    // 设定坐标组

    //PointPairList list1 = new PointPairList();

    //zgc.PointValueEvent += new ZedGraphControl.PointValueHandler(MyPointValueHandler); //修改右键 

    //先清除
    //zedChart.GraphPane.CurveList.Clear();
    //zedChart.GraphPane.GraphItemList.Clear(); 
    //重新绘制
    //zedChart.AxisChange();
    //zedChart.Refresh();
    //刷新控件

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Text;
    using System.Windows.Forms;
    using ZedGraph;

    namespace zedGraphControl
    {
        /// <summary>丰元自定义图表控件
        /// 丰元自定义图表控件
        /// </summary>
        public partial class zedGraphControl : UserControl
        {
            /// <summary>构造函数
            /// 构造函数
            /// </summary>
            public zedGraphControl()
            {
                InitializeComponent();
            }

            /// <summary>
            /// 控件ZedGraphControl 代理
            /// </summary>
            public GraphPane myPane;

            #region ZedGraph属性设置
            /// <summary>属性设置
            /// 属性设置
            /// </summary>
            public virtual void CreateChartAttribute()
            {
                myPane = zedGraphControl1.GraphPane;
                myPane.Title.Text = Title;
                myPane.Title.FontSpec.FontColor = TitleColor;
                myPane.IsPenWidthScaled = IsPenWidthScaled;
                myPane.TitleGap = TitleGrap;
                myPane.Chart.Fill = new Fill(BackFillColor1, BackFillColor2,BackColorFillAngle);
                //myPane.Y2Axis.IsVisible = ISY2Visble;
                //myPane.X2Axis.IsVisible = ISX2Visble;
                myPane.YAxis.Scale.FontSpec.FontColor = Y1ScaleColor;
                myPane.Y2Axis.Scale.FontSpec.FontColor = Y2ScaleColor;
                myPane.XAxis.Scale.FontSpec.FontColor = X1ScaleColor;
                myPane.X2Axis.Scale.FontSpec.FontColor = X2ScaleColor;
                myPane.Legend.IsVisible = IsLegendVisible;
                myPane.XAxis.MajorGrid.IsVisible = IsXGraidVisble;
                myPane.YAxis.MajorGrid.IsVisible = IsYGraidVisble;

                myPane.XAxis.MajorTic.IsOpposite = IsX2MaxScale;
                myPane.XAxis.MinorTic.IsOpposite = IsX2MinScale;
                myPane.X2Axis.MajorTic.IsOpposite = IsX1MaxScale;
                myPane.X2Axis.MinorTic.IsOpposite = IsX1MinScale;

                myPane.YAxis.MajorTic.IsOpposite = IsY2MaxScale;
                myPane.YAxis.MinorTic.IsOpposite = IsY2MinScale;
                myPane.Y2Axis.MajorTic.IsOpposite = IsY1MaxScale;
                myPane.Y2Axis.MinorTic.IsOpposite = IsY1MinScale;

                myPane.XAxis.Scale.FontSpec.Size = X1ScaleSize;

                myPane.X2Axis.Scale.FontSpec.Size = X2ScaleSize;
                myPane.YAxis.Title.Text = Y1Title;
                myPane.YAxis.Title.FontSpec.FontColor = Y1TitleColor;
                myPane.Y2Axis.Title.Text = Y2Title;
                myPane.Y2Axis.Title.FontSpec.FontColor = Y2TitleColor;
                myPane.XAxis.Title.Text = X1Title;
                myPane.XAxis.Title.FontSpec.FontColor = X1TitleColor;
                myPane.XAxis.Title.IsVisible = IsX1TitleVisble;
                myPane.X2Axis.Title.IsVisible = IsX2TitleVisble;
                myPane.YAxis.Scale.FontSpec.Size = Y1ScaleSize;
                myPane.Y2Axis.Scale.FontSpec.Size = Y2ScaleSize;
                myPane.YAxis.Title.FontSpec.Size = Y1TitleSize;
                myPane.Y2Axis.Title.FontSpec.Size = Y2TitleSize;
                myPane.Legend.FontSpec.Size = LegendSize;
                myPane.Legend.FontSpec.Family = LegendFamily;
                myPane.Legend.FontSpec.IsUnderline = IsUnderLine;
                myPane.Legend.FontSpec.IsItalic = IsItaLinc;
                myPane.Legend.FontSpec.IsBold = IsBold;
                myPane.Legend.FontSpec.FontColor = LegendColor;
                myPane.Legend.Fill = new Fill(LegendBackGroundColor1, LegendBackGroundColor2,LegendBackGroundColor3);
                myPane.Legend.Gap = LegendGap;
                myPane.Legend.IsHStack = IsHStack;
                myPane.Legend.IsReverse = IsReverse;
                myPane.Legend.IsShowLegendSymbols = IsShowLegendSymbols;
                myPane.Legend.FontSpec.IsDropShadow = IsDropShadow;
                myPane.Legend.FontSpec.DropShadowColor = DropShadowColor;
                myPane.Legend.FontSpec.DropShadowOffset = DropShadowOffset;
                myPane.Legend.Position = (ZedGraph.LegendPos)Position;
                myPane.BarSettings.ClusterScaleWidthAuto = CylinderWidthAuto;
                myPane.BarSettings.ClusterScaleWidth = CylinderWidth;
                zedGraphControl1.Y1Y2 = Y1Y2;
                myPane.Legend.Border.IsVisible =BorderVisible;

            }
            private bool _Y1Y2 = false;
            /// <summary>
            /// 显示图表值是y1和x1轴的值或是y1、y2和x1 的值
            /// </summary>
            public bool Y1Y2
            {
                get { return _Y1Y2; }
                set { _Y1Y2 = value; }
            }
            /// <summary>
            /// 显示值针的值
            /// </summary>
            /// <param name="IsShowCursorValues">bool</param>
            public void IsShowCursorValues(bool IsShowCursorValues)
            {

                zedGraphControl1.IsShowCursorValues = IsShowCursorValues;

            }
            /// <summary>
            /// 显示节点的值
            /// </summary>
            /// <param name="IsShowPointValues"></param>
            public void IsShowPointValues(bool IsShowPointValues)
            {

                zedGraphControl1.IsShowPointValues = IsShowPointValues;

            }
            /// <summary>
            /// 隐藏或显示菜单
            /// </summary>
            /// <param name="IsMenu">bool</param>
            public void IsShowContextMenu(bool IsMenu)
            {
                zedGraphControl1.IsEnableHZoom = IsMenu;
                zedGraphControl1.IsEnableVZoom = IsMenu;
                zedGraphControl1.IsShowContextMenu = IsMenu;
            }
            #endregion
            #region 设置X轴的刻度值的大小
            //设置X轴的刻度值的大小
            private float x1scalesize = 8;
            /// <summary>
            /// 设置X轴的刻度值的大小
            /// </summary>
            public float X1ScaleSize
            {
                get { return x1scalesize; }
                set { x1scalesize = value; }
            }
            #endregion

            #region 设置X2轴的刻度值的大小
            //设置X2轴的刻度值的大小
            private float x2scalesize = 8;
            /// <summary>
            /// 设置X2轴的刻度值的大小
            /// </summary>
            public float X2ScaleSize
            {
                get { return x2scalesize; }
                set { x2scalesize = value; }
            }
            #endregion

            #region   图表标题
            //图表标题
            private string title = "丰元科技";
            /// <summary>
            /// 图表标题
            /// </summary>
            public string Title
            {
                get { return title; }
                set { title = value; }
            }
            #endregion
            #region 图表的背景填充颜色
            //图表的背景填充颜色
            private Color backFillColor1 = Color.White;
            /// <summary>
            /// 图表的背景填充颜色
            /// </summary>

            public Color BackFillColor1
            {
                get { return backFillColor1; }
                set { backFillColor1 = value; }
            }
            #endregion
            #region 图表的背景填充颜色
            //图表的背景填充颜色
            private Color backFillColor2 = Color.FromArgb(255, 255, 166);
            /// <summary>
            /// 图表的背景填充颜色
            /// </summary>
            public Color BackFillColor2
            {
                get { return backFillColor2; }
                set { backFillColor2 = value; }
            }
            #endregion
            #region 图表背景填充颜色角度
            //图表背景填充颜色角度
            private float backcolorFillAngle = 45f;
            /// <summary>
            /// 图表背景填充颜色角度
            /// </summary>
            public float BackColorFillAngle
            {
                get { return backcolorFillAngle; }
                set { backcolorFillAngle = value; }
            }
            #endregion
            #region 图表的刻度边框加粗
            //图表的刻度边框加粗
            private bool isPenWidthScaled = false;
            /// <summary>
            /// 图表的刻度边框加粗
            /// </summary>
            public bool IsPenWidthScaled
            {
                get { return isPenWidthScaled; }
                set { isPenWidthScaled = value; }

            }
            #endregion
            #region 图表标题与X2轴的距离
            //图表标题与X2轴的距离
            private float titleGap = 1;
            /// <summary>
            /// 图表标题与X2轴的距离
            /// </summary>
            public float TitleGrap
            {
                get { return titleGap; }
                set { titleGap = value; }
            }
            #endregion
            #region 是否显示Y2轴
            //是否显示Y2轴
            private bool isY2visble = false;
            /// <summary>
            /// 是否显示Y2轴
            /// </summary>
            public bool ISY2Visble
            {
                get { return isY2visble; }
                set { isY2visble = value; }
            }
            #endregion
            #region 是否显示X2轴
            //是否显示X2轴
            private bool isx2visble = false;
            /// <summary>
            /// 是否显示X2轴
            /// </summary>
            public bool ISX2Visble
            {
                get { return isx2visble; }
                set { isx2visble = value; }
            }
            #endregion
            #region 是否显示X1轴的标题
            //是否显示X1轴的标题
            private bool isX1TitleVisble = false;
            /// <summary>
            /// 是否显示X1轴的标题
            /// </summary>
            public bool IsX1TitleVisble
            {
                get { return isX1TitleVisble; }
                set { isX1TitleVisble = value; }
            }
            #endregion
            #region 是否显示X2轴的标题
            //是否显示X2轴的标题
            private bool isX2TitleVisble = false;
            /// <summary>
            /// 是否显示X2轴的标题
            /// </summary>
            public bool IsX2TitleVisble
            {
                get { return isX2TitleVisble; }
                set { isX2TitleVisble = value; }
            }
            #endregion
            #region 设置Y1轴的刻度值的颜色
            private Color Y1scalecolor = Color.Black;
            /// <summary>
            /// 设置Y1轴的刻度值的颜色
            /// </summary>
            public Color Y1ScaleColor
            {
                get { return Y1scalecolor; }
                set { Y1scalecolor = value; }
            }
            #endregion
            #region 设置Y2轴的刻度值颜色
            private Color Y2scalecolor = Color.Black;
            /// <summary>
            /// 设置Y2轴的刻度值颜色
            /// </summary>
            public Color Y2ScaleColor
            {
                get { return Y2scalecolor; }
                set { Y2scalecolor = value; }
            }
            #endregion
            #region 设置X1轴的刻度值颜色
            private Color X1scalecolor = Color.Black;
            /// <summary>
            /// 设置X1轴的刻度值颜色 
            /// </summary>
            public Color X1ScaleColor
            {
                get { return X1scalecolor; }
                set { X1scalecolor = value; }
            }
            #endregion
            #region 设置X2轴的刻度值颜色
            private Color X2scalecolor = Color.Black;
            /// <summary>
            /// 设置X2轴的刻度值颜色
            /// </summary>
            public Color X2ScaleColor
            {
                get { return X2scalecolor; }
                set { X2scalecolor = value; }
            }
            #endregion
            #region 是否显示图例
            //是否显示图例
            private bool Islegendvisible = true;
            /// <summary> 是否显示图例
            ///
            /// </summary>
            public bool IsLegendVisible
            {
                get { return Islegendvisible; }
                set { Islegendvisible = value; }
            }

            #endregion
            #region 显示X轴网格
            //显示X轴网格
            private bool IsXgridvisible = true;
            /// <summary>
            /// 显示X轴网格
            /// </summary>
            public bool IsXGraidVisble
            {
                get { return IsXgridvisible; }
                set { IsXgridvisible = value; }
            }

            #endregion
            #region 显示Y轴网格
            //显示Y轴网格
            private bool IsYgridvisible = true;
            /// <summary>
            /// 显示Y轴网格
            /// </summary>
            public bool IsYGraidVisble
            {
                get { return IsYgridvisible; }
                set { IsYgridvisible = value; }
            }
            #endregion
            #region 图表标题颜色
            //图表标题颜色
            private Color titlecolor = Color.Black;
            /// <summary>
            /// 图表标题颜色
            /// </summary>
            public Color TitleColor
            {
                get { return titlecolor; }
                set { titlecolor = value; }
            }
            #endregion
            #region Y1轴是否显示小刻度
            //Y1轴是否显示小刻度
            private bool isy1minscale = false;
            /// <summary> Y1轴是否显示小刻度
            ///
            /// </summary>
            public bool IsY1MinScale
            {
                get { return isy1minscale; }
                set { isy1minscale = value; }
            }
            #endregion
            #region Y2轴是否显示小刻度
            //Y2轴是否显示小刻度
            private bool isy2minscale = false;
            /// <summary> Y2轴是否显示小刻度
            ///
            /// </summary>
            public bool IsY2MinScale
            {
                get { return isy2minscale; }
                set { isy2minscale = value; }
            }
            #endregion
            #region Y1轴是否显示大刻度
            //Y1轴是否显示大刻度
            private bool isy1maxscale = true;
            /// <summary>
            /// Y1轴是否显示大刻度
            /// </summary>
            public bool IsY1MaxScale
            {
                get { return isy1maxscale; }
                set { isy1maxscale = value; }
            }
            #endregion
            #region Y2轴是否显示大刻度
            //Y2轴是否显示大刻度
            private bool isy2maxscale = true;
            /// <summary> Y2轴是否显示大刻度
            ///
            /// </summary>
            public bool IsY2MaxScale
            {
                get { return isy2maxscale; }
                set { isy2maxscale = value; }
            }
            #endregion
            #region X1轴是否显示小刻度
            //X1轴是否显示小刻度
            private bool isx1minscale = false;
            /// <summary> X1轴是否显示小刻度
            ///
            /// </summary>
            public bool IsX1MinScale
            {
                get { return isx1minscale; }
                set { isx1minscale = value; }
            }
            #endregion
            #region X2轴是否显示小刻度
            //X2轴是否显示小刻度
            private bool isx2minscale = false;
            /// <summary> X2轴是否显示小刻度
            ///
            /// </summary>
            public bool IsX2MinScale
            {
                get { return isx2minscale; }
                set { isx2minscale = value; }
            }
            #endregion
            #region X1轴是否显示大刻度
            //X1轴是否显示大刻度
            private bool isx1maxscale = true;
            /// <summary> X1轴是否显示大刻度
            ///
            /// </summary>
            public bool IsX1MaxScale
            {
                get { return isx1maxscale; }
                set { isx1maxscale = value; }
            }
            #endregion
            #region X2轴是否显示大刻度
            //X2轴是否显示大刻度
            private bool isx2maxscale = true;
            /// <summary> X2轴是否显示大刻度
            ///
            /// </summary>
            public bool IsX2MaxScale
            {
                get { return isx2maxscale; }
                set { isx2maxscale = value; }
            }
            #endregion
            #region 设置Y1轴的标题
            //设置Y1轴的标题
            private string y1Title = "Y轴";
            /// <summary>
            /// 设置Y1轴的标题
            /// </summary>
            public string Y1Title
            {
                get { return y1Title; }
                set { y1Title = value; }
            }
            #endregion
            #region 设置Y2轴的标题
            //设置Y2轴的标题
            private string y2Title = "Y2轴";
            /// <summary>
            /// 设置Y2轴的标题
            /// </summary>
            public string Y2Title
            {
                get { return y2Title; }
                set { y2Title = value; }
            }
            #endregion
            #region 设置Y1轴的标题颜色
            //设置Y1轴的标题颜色
            private Color y1TitleColor = Color.Black;
            /// <summary>
            /// 设置Y1轴的标题颜色
            /// </summary>
            public Color Y1TitleColor
            {
                get { return y1TitleColor; }
                set { y1TitleColor = value; }
            }
            #endregion
            #region 设置Y2轴的标题颜色
            //设置Y2轴的标题颜色
            private Color y2TitleColor = Color.Black;
            /// <summary>
            /// 设置Y2轴的标题颜色
            /// </summary>
            public Color Y2TitleColor
            {
                get { return y2TitleColor; }
                set { y2TitleColor = value; }
            }
            #endregion
            #region 设置X1轴的标题
            //设置X1轴的标题
            private string x1Title = "X轴";
            /// <summary>
            /// 设置X1轴的标题
            /// </summary>
            public string X1Title
            {
                get { return x1Title; }
                set { x1Title = value; }
            }
            #endregion
            #region 设置X1轴的标题颜色
            //设置X1轴的标题颜色
            private Color x1TitleColor = Color.Black;
            /// <summary>
            /// 设置X1轴的标题颜色
            /// </summary>
            public Color X1TitleColor
            {
                get { return x1TitleColor; }
                set { x1TitleColor = value; }
            }
            #endregion
            #region 设置X1轴的值倾斜度
            //设置X1轴的值倾斜度
            private float x1scaleAngle = 70f;
            /// <summary>
            /// 设置X1轴的值倾斜度
            /// </summary>
            public float X1ScaleAngle
            {
                get { return x1scaleAngle; }
                set { x1scaleAngle = value; }
            }
            #endregion
            #region 设置X1轴的标题大小
            //设置X1轴的标题大小
            private float x1titlesize = 8;
            /// <summary>
            /// 设置X1轴的标题大小
            /// </summary>
            public float X1TitleSize
            {
                get { return x1titlesize; }
                set { x1titlesize = value; }
            }
            #endregion
            #region 设置Y1轴刻度值字体的大小
            //设置Y1轴刻度值字体的大小
            private float y1ScaleSize = 8;
            /// <summary>
            /// 设置Y1轴刻度值字体的大小
            /// </summary>
            public float Y1ScaleSize
            {
                get { return y1ScaleSize; }
                set { y1ScaleSize = value; }
            }
            #endregion
            #region 设置Y2轴刻度值字体的大小
            //设置Y2轴刻度值字体的大小
            private float y2ScaleSize = 8;
            /// <summary>
            /// 设置Y2轴刻度值字体的大小
            /// </summary>
            public float Y2ScaleSize
            {
                get { return y2ScaleSize; }
                set { y2ScaleSize = value; }
            }
            #endregion
            #region 设置Y3轴刻度值字体的大小
            //设置Y3轴刻度值字体的大小
            private float y3ScaleSize = 8;
            /// <summary>
            /// 设置Y3轴刻度值字体的大小
            /// </summary>
            public float Y3ScaleSize
            {
                get { return y3ScaleSize; }
                set { y3ScaleSize = value; }
            }
            #endregion
            #region 设置Y1轴标题字体大小
            //设置Y1轴标题字体大小
            private float y1titleSize = 10;
            /// <summary>
            /// 设置Y1轴标题字体大小
            /// </summary>
            public float Y1TitleSize
            {
                get { return y1titleSize; }
                set { y1titleSize = value; }
            }
            #endregion
            #region 设置Y2轴标题字体大小
            //设置Y2轴标题字体大小
            private float y2titleSize = 10;
            /// <summary>
            /// 设置Y2轴标题字体大小
            /// </summary>
            public float Y2TitleSize
            {
                get { return y2titleSize; }
                set { y2titleSize = value; }
            }

            #endregion
            #region 设置Y3轴标题字体大小
            //设置Y3轴标题字体大小
            private float y3titleSize = 10;
            /// <summary>
            /// 设置Y3轴标题字体大小
            /// </summary>
            public float Y3TitleSize
            {
                get { return y3titleSize; }
                set { y3titleSize = value; }
            }
            #endregion
            #region 设置圆柱的宽度
            //设置圆柱的宽度
            private double cylinderWidth = 0.5;
            /// <summary>
            /// 设置圆柱的宽度
            /// </summary>
            public double CylinderWidth
            {
                get { return cylinderWidth; }
                set { cylinderWidth = value; }
            }
            #endregion
            #region 设置圆柱宽度是否是自动更改
            //设置圆柱宽度是否是自动更改
            private bool cylinderwidthauto = false;
            /// <summary>
            /// 设置圆柱宽度是否是自动更改
            /// </summary>
            public bool CylinderWidthAuto
            {
                get { return cylinderwidthauto; }
                set { cylinderwidthauto = value; }
            }
            #endregion
            //以下是图例的属性设置
            #region 设置图例的字体大小
            //设置图例的字体大小
            private float legendsize = 10;
            /// <summary>
            /// 设置图例的字体大小
            /// </summary>
            public float LegendSize
            {
                get { return legendsize; }
                set { legendsize = value; }
            }

            #endregion
            #region 设置图例字体
            //设置图例字体
            private string legendfamily = "宋体";
            /// <summary>
            /// 设置图例字体
            /// </summary>
            public string LegendFamily
            {
                get { return legendfamily; }
                set { legendfamily = value; }
            }
            #endregion
            #region 图例字体是否带下划线
            //图例字体是否带下划线
            private bool isunderline = false;
            /// <summary>
            /// 图例字体是否带下划线
            /// </summary>
            public bool IsUnderLine
            {
                get { return isunderline; }
                set { isunderline = value; }
            }

            #endregion
            #region 图例字体是否倾斜
            //图例字体是否倾斜
            private bool isitalinc = false;
            /// <summary>
            /// 图例字体是否倾斜
            /// </summary>
            public bool IsItaLinc
            {
                get { return isitalinc; }
                set { isitalinc = value; }
            }

            #endregion
            #region 图例字体是否加粗
            //图例字体是否加粗
            private bool isbold = false;
            /// <summary>
            /// 图例字体是否加粗
            /// </summary>
            public bool IsBold
            {
                get { return isbold; }
                set { isbold = value; }
            }

            #endregion
            #region 图例字体颜色
            //图例字体颜色
            private Color legendcolor = Color.Black;
            /// <summary>
            /// 图例字体颜色
            /// </summary>
            public Color LegendColor
            {
                get { return legendcolor; }
                set { legendcolor = value; }
            }

            #endregion
            #region 图例背景填充颜色
            //图例背景填充颜色
            private Color legendbackgroundcolor1 = Color.White;
            /// <summary>
            /// 图例背景填充颜色
            /// </summary>
            public Color LegendBackGroundColor1
            {
                get { return legendbackgroundcolor1; }
                set { legendbackgroundcolor1 = value; }
            }

            #endregion
            #region 图例背景填充颜色
            //图例背景填充颜色
            private Color legendbackgroundcolor2 = Color.White;
            /// <summary>
            /// 图例背景填充颜色
            /// </summary>
            public Color LegendBackGroundColor2
            {
                get { return legendbackgroundcolor2; }
                set { legendbackgroundcolor2 = value; }
            }

            #endregion
            #region 图例背景填充颜色
            //图例背景填充颜色
            private Color legendbackgroundcolor3 = Color.White;
            /// <summary>
            /// 图例背景填充颜色
            /// </summary>
            public Color LegendBackGroundColor3
            {
                get { return legendbackgroundcolor3; }
                set { legendbackgroundcolor3 = value; }
            }

            #endregion
            #region 图例与图表之间的距离
            //图例与图表之间的距离
            private float legendGap = 0.5f;
            /// <summary>
            /// 图例与图表之间的距离
            /// </summary>
            public float LegendGap
            {
                get { return legendGap; }
                set { legendGap = value; }
            }

            #endregion
            #region 图例是否以水平的形式出现
            //图例是否以水平的形式出现
            private bool ishstack = true;
            /// <summary>
            /// 图例是否以水平的形式出现
            /// </summary>
            public bool IsHStack
            {
                get { return ishstack; }
                set { ishstack = value; }
            }

            #endregion
            #region 图例是否降序排列
            //图例是否降序排列
            private bool isreverse = false;
            /// <summary>
            /// 图例是否降序排列
            /// </summary>
            public bool IsReverse
            {
                get { return isreverse; }
                set { isreverse = value; }
            }

            #endregion
            #region 图例是否展示样本
            //图例是否展示样本
            private bool isShowLegendSymbols = true;
            /// <summary>
            /// 图例是否展示样本
            /// </summary>
            public bool IsShowLegendSymbols
            {
                get { return isShowLegendSymbols; }
                set { isShowLegendSymbols = value; }
            }

            #endregion
            #region 图例是否显示阴影
            //图例是否显示阴影
            private bool isDropShadow = false;
            /// <summary>
            /// 图例是否显示阴影
            /// </summary>
            public bool IsDropShadow
            {
                get { return isDropShadow; }
                set { isDropShadow = value; }
            }

            #endregion
            #region 图例阴影颜色
            //图例阴影颜色
            private Color dropShadowColor = Color.Red;
            /// <summary>
            /// 图例阴影颜色
            /// </summary>
            public Color DropShadowColor
            {
                get { return dropShadowColor; }
                set { dropShadowColor = value; }
            }

            #endregion
            #region 图例阴影填充位置
            //图例阴影填充位置
            private float dropShadowOffset = 0.009f;
            /// <summary>
            /// 图例阴影填充位置
            /// </summary>
            public float DropShadowOffset
            {
                get { return dropShadowOffset; }
                set { dropShadowOffset = value; }
            }

            #endregion
            #region 是否显示图例边框
            private bool borervisible = false;
            /// <summary>
            /// 是否显示图例边框
            /// </summary>
            public bool BorderVisible
            {
                get { return borervisible; }
                set { borervisible = value; }
            }
            #endregion
            #region 图例显示的位置
            //图例显示的位置
            private LegendPos legendpos = LegendPos.Top;
            /// <summary>
            /// 图例显示的位置
            /// </summary>
            public LegendPos Position
            {
                get { return legendpos; }
                set { legendpos = value; }
            }

            #endregion
            private void zedGraphControl1_Load(object sender, EventArgs e)
            {

                CreateChartAttribute();
            }
            #region 设置LineItem的SymbolType的类型
            // 设置LineItem的SymbolType的类型
            private SymbolType st = SymbolType.Circle;
            /// <summary>
            /// 设置LineItem的SymbolType的类型
            /// </summary>
            public SymbolType Type
            {
                get { return st; }
                set { st = value; }
            }
            #endregion
            #region 设置LineItem的SymbolTypeSize的大小
            // 设置LineItem的SymbolTypeSized的大小
            private float stsize = 2f;
            /// <summary>
            /// 设置LineItem的SymbolTypeSized的大小
            /// </summary>
            public float SymbolTypeSize
            {
                get { return stsize; }
                set { stsize = value; }
            }
            #endregion
            #region 设置LineItem的LineSize的大小
            // 设置LineItem的LineSize的大小
            private float linesize = 2f;
            /// <summary>
            /// 设置LineItem的LineSize的大小
            /// </summary>
            public float LineSize
            {
                get { return linesize; }
                set { linesize = value; }
            }
            #endregion
            #region 设置LineItem线条是否是圆滑的
            //设置LineItem线条是否是圆滑的
            private bool issmooth = true;
            /// <summary>
            /// 设置LineItem线条是否是圆滑的
            /// </summary>
            public bool IsSmooth
            {
                get { return issmooth; }
                set { issmooth = value; }
            }
            #endregion
            /// <summary>
            /// 设置X轴显示的时间是否为为长格式
            /// </summary>
            private bool longtime = false;
            /// <summary>
            /// 设置X轴显示的时间是否为为长格式
            /// </summary>
            public bool LongTime
            {
                get { return longtime; }
                set { longtime = value; }
            }
            /// <summary>
            /// 设置X轴的步长
            /// </summary>
            private double step_x = 0;
            /// <summary>
            /// 设置X轴的步长
            /// </summary>
            public double Step_X
            {
                get { return step_x; }
                set
                {
                    step_x = value;
                }
            }
            #region 画曲线 参数dt 中必须有2个字段 时间、数值.
            /// <summary>
            /// 画曲线 参数dt 中必须有2个字段 时间、数值.
            /// </summary>
            /// <param name="dt">二维表</param>
            /// <param name="columndatetime">列名为的类型为datetime类型</param>
            /// <param name="columnvalue">列的值必须是数值</param>
            /// <param name="dtbig">设置X轴的最大时间</param>
            /// <param name="dtsmall">设置X轴的最小时间</param>
            /// <param name="LineItemName">曲线名称</param>
            /// <param name="ItemBelongY">曲线所属于哪个Y轴(其值已经值定 1,2)</param>
            /// <param name="LineColor">曲线颜色</param>

            public void DarwLineItem(DataTable dt, string columndatetime, string columnvalue, DateTime dtbig, DateTime dtsmall, string LineItemName, int ItemBelongY, Color LineColor)
            {
                zedGraphControl1_Load(null, null);
                LineItem li;
                double ybig = 0;
                double ysmall = 0;
                double yy =0;
                PointPairList ppl = new PointPairList();//把坐标点放到这里
                if (dt.Rows[0][columnvalue] != DBNull.Value)
                {
                    ybig = double.Parse(dt.Rows[0][columnvalue].ToString());
                }
                if (dt.Rows[0][columnvalue] != DBNull.Value)
                {
                    ysmall = double.Parse(dt.Rows[0][columnvalue].ToString());
                }
                if(dt.Rows.Count>=2)
                foreach(DataRow dr in dt.Rows)
                {
                 if(dr[columnvalue]!=DBNull.Value && dr[columnvalue]>=0)
                 {
                  YY =  double.Parse(dr[columnvalue].ToString());
                 }
                 esle
                 {
                  MessageBox.show("数据库中有非法值");
                 }
                }
                if(YY > 0)
                {
                  foreach (DataRow dr in dt.Rows)
                  {
                      if (dr[columnvalue] != DBNull.Value)
                      {
                          if (ybig < double.Parse(dr[columnvalue].ToString()))
                          {
                              ybig = double.Parse(dr[columnvalue].ToString());
                          }
                          if (ysmall > double.Parse(dr[columnvalue].ToString()))
                          {
                              ysmall = double.Parse(dr[columnvalue].ToString());
                          }
                          XDate xdate = new XDate(Convert.ToDateTime(dr[columndatetime]));
                          ppl.Add(xdate, double.Parse(dr[columnvalue].ToString()));
                      }
                  }
              }
                if (ybig == ysmall)
                {
                 if(Ysmall>1)
                 {
                    ysmall = ysmall-(ysmall-1);   //原代码 ysmall = ysmall-1   2011-04-05 hetao改
                    ybig = ybig + 5;   //源代码 ybig = ybig+1   2011-04-05 hetao改
                  }
                  else
                  {
                   ysmall = ysmmll;
                   Ybig=Ygig+5;
                  }
                }
                ybig = ybig / 5 + ybig;
               //添加曲线

                li = myPane.AddCurve(LineItemName, ppl, LineColor, Type);
                li.Symbol.Fill = new Fill(LineColor);  //填充数据点
                li.Symbol.Size = SymbolTypeSize;
                if ( LongTime == true)
                {
                    myPane.XAxis.Scale.Format = "yyyy-MM-dd HH:mm ";
                }
                else
                {
                    myPane.XAxis.Scale.Format = "yyyy-MM-dd";
                }
                 XDate x = new XDate(dtsmall);
                 myPane.XAxis.Scale.Min = x;
                 myPane.XAxis.Scale.BaseTic = x;  //指明第一个主刻度标签标记的位置

                 x = new XDate(dtbig);
                 myPane.XAxis.Scale.Max = x;        //X 轴上的最大刻度
                 myPane.XAxis.Type = AxisType.Date; //数据显示方式    Date按日期方式显示

                 myPane.XAxis.Scale.MajorStepAuto = false;//是否自动设置大刻度步长
                 if (Step_X != 0)
                 {
                     myPane.XAxis.Scale.MajorStep = Step_X;
                     myPane.XAxis.Scale.MinorStep = Step_X;
                 }

                li.IsOverrideOrdinal = true;//以x轴上的刻度为准,而不是以X轴上的刻度为0的位置开始划  (ture 是从X轴由下向上画,False反之)   
                li.Line.IsSmooth = IsSmooth;
                li.Line.Width = LineSize;
                if (ItemBelongY == 2)
                {
                    li.IsY2Axis = true; 把这个曲线对应Y2轴
                    ISY2Visble = true;
                    myPane.Y2Axis.IsVisible = ISY2Visble;
                    if (ybig == 0 && ysmall == 0)
                    {
                        myPane.Y2Axis.Scale.Max = ybig+1;
                        myPane.Y2Axis.Scale.Min = ysmall;
                        myPane.YAxis.Scale.BaseTic = 0;

                    }
                    else
                    {
                        myPane.Y2Axis.Scale.Max = ybig;
                        myPane.Y2Axis.Scale.Min = ysmall;
                        myPane.YAxis.Scale.BaseTic = 0;//第一个主刻度从哪里开始

                    }
                }
                else if (ItemBelongY == 1)
                {
                    li.IsYAxis = true; 把这个曲线对应Y2轴
                    ISYVisble = true;
                    myPane.YAxis.IsVisible = ISYVisble;
                    if(ybig ==0 && ysmall==0)
                    {
                       myPane.YAxis.Scale.Max = ybig+1;
                       myPane.YAxis.Scale.Min = ysmall;
                       myPane.YAxis.Scale.BaseTic = 0;
                    }else
                    {
                      myPane.YAxis.Scale.Max = ybig;
                       myPane.YAxis.Scale.Min = ysmall;
                       myPane.YAxis.Scale.BaseTic = 0;
                    }

                }
                myPane.XAxis.Scale.FontSpec.Angle = X1ScaleAngle;
                myPane.XAxis.Title.FontSpec.Size = X1TitleSize;
                myPane.AxisChange();// 在数据变化时绘制图形

                this.zedGraphControl1.Refresh();
            }
            #endregion

            #region 清空图表中所有线图和柱状图
            /// <summary>
            /// 清空图表中所有线图和柱状图
            /// </summary>
            public void LineItemList()
            {
                myPane.CurveList.Clear();
            }
            #endregion

            #region  画线段 X轴时间 ,自动获取Y轴的最大值和最小值
            /// <summary>
            ///  画线段 X轴时间,自动获取X轴的大小值,自动获取Y轴的最大值和最小值    
            /// </summary>
            /// <param name="dt">二维表</param>    
            /// <param name="columnXname">二维表中要显示X轴上数据的列名</param>
            /// <param name="columnYname">二维表中要显示Y轴上数据的列名</param>     
            /// <param name="ItemBelongY">依赖于哪个Y轴</param>
            /// <param name="LineName">曲线的名字</param>
            /// <param name="LineColor">曲线颜色</param>
            public void CreateChartLineItem(DataTable dt, string columnXname, string columnYname, int ItemBelongY, string LineName, Color LineColor)
            {
                zedGraphControl1_Load(null, null);
                LineItem li;
                PointPairList ppl = new PointPairList();
                double ybig = 0;
                double ysmall = 0;
                double temp = 0;
                XDate xdate;
                DateTime xmax;
                DateTime xmin;
                if (dt.Rows[0][columnYname] != DBNull.Value)
                {
                    ybig = double.Parse(dt.Rows[0][columnYname].ToString());
                    ysmall = double.Parse(dt.Rows[0][columnYname].ToString());
                    temp = ybig;
                    xmax = DateTime.Parse(dt.Rows[0][columnXname].ToString());
                    xmin = DateTime.Parse(dt.Rows[0][columnXname].ToString());
                }
                else { MessageBox.Show("没有您要的数据记录!"); return; }
                foreach (DataRow dr in dt.Rows)
                {

                    if (dr[columnYname] != DBNull.Value)
                    {

                        if (ybig < double.Parse(dr[columnYname].ToString()))
                        {
                            ybig = double.Parse(dr[columnYname].ToString());
                        }
                        if (ysmall >= double.Parse(dr[columnYname].ToString()))
                        {
                            ysmall = double.Parse(dr[columnYname].ToString());
                        }
                        if (xmax < DateTime.Parse(dr[columnXname].ToString()))
                        {
                            xmax = DateTime.Parse(dr[columnXname].ToString());
                        }
                        if (xmin >= DateTime.Parse(dr[columnXname].ToString()))
                        {
                            xmin = DateTime.Parse(dr[columnXname].ToString());
                        }
                        if (temp == double.Parse(dr[columnYname].ToString()))
                        {
                            xdate = new XDate(DateTime.Parse((dr[columnXname].ToString())));
                            ppl.Add(xdate, double.Parse(dr[columnYname].ToString()));
                        }
                        else
                        {

                            { li = myPane.AddCurve("", ppl, LineColor, Type); }
                            li.Symbol.Fill = new Fill(LineColor);
                            li.Symbol.Size = SymbolTypeSize;
                            li.IsOverrideOrdinal = true;//以x轴上的刻度为准,而不是以X轴上的刻度为0的位置开始划     
                            li.Line.IsSmooth = IsSmooth;
                            li.Line.Width = LineSize;
                            if (ItemBelongY == 2)
                            {
                                li.IsY2Axis = true;
                                ISY2Visble = true;
                                myPane.Y2Axis.IsVisible = ISY2Visble;

                                myPane.Y2Axis.Scale.Max = ybig + 1;
                                if (ysmall != 0)
                                {
                                    myPane.Y2Axis.Scale.Min = ysmall - 1;
                                }
                                else { myPane.Y2Axis.Scale.Min = ysmall; }

                            }
                            else if (ItemBelongY == 1)
                            {
                                myPane.YAxis.Scale.Max = ybig + 1;
                                if (ysmall != 0)
                                {
                                    myPane.YAxis.Scale.Min = ysmall - 1;
                                }
                                else
                                {
                                    myPane.YAxis.Scale.Min = ysmall;
                                }
                            }
                            ppl = new PointPairList();
                            xdate = new XDate(Convert.ToDateTime(dr[columnXname]));
                            ppl.Add(xdate, double.Parse(dr[columnYname].ToString()));
                            temp = double.Parse(dr[columnYname].ToString());

                        }
                    }

                }
                li = myPane.AddCurve(LineName, ppl, LineColor, Type);
                li.Symbol.Fill = new Fill(LineColor);
                li.Symbol.Size = SymbolTypeSize;
                li.IsOverrideOrdinal = true;//以x轴上的刻度为准,而不是以X轴上的刻度为0的位置开始划     
                li.Line.IsSmooth = IsSmooth;
                li.Line.Width = LineSize;
                if (LongTime == true)
                {
                    myPane.XAxis.Scale.Format = "yyyy-MM-dd HH:mm ";
                }
                else
                {
                    myPane.XAxis.Scale.Format = "yyyy-MM-dd";
                }

                XDate x = new XDate(xmin);
                myPane.XAxis.Scale.Min = x;
                myPane.XAxis.Scale.BaseTic = x;
                x = new XDate(xmax);
                myPane.XAxis.Scale.Max = x;
                myPane.XAxis.Type = AxisType.Date;
                myPane.XAxis.Scale.MajorStepAuto = false;
                if (Step_X != 0)
                {
                    myPane.XAxis.Scale.MajorStep = Step_X;
                    myPane.XAxis.Scale.MinorStep = Step_X;
                }

                if (ybig == ysmall)
                {
                    ysmall = ysmall - 1;
                    ybig = ybig + 1;
                }

                myPane.XAxis.Scale.FontSpec.Angle = X1ScaleAngle;
                myPane.XAxis.Title.FontSpec.Size = X1TitleSize;
                myPane.AxisChange();
                this.zedGraphControl1.Refresh();
            }
            #endregion

            #region 枚举信息操作
            public enum LegendPos
            {
                Top,
                Left,
                Right,
                Bottom,
                InsideTopLeft,
                InsideTopRight,
                InsideBotLeft,
                InsideBotRight,
                Float,
                TopCenter,
                BottomCenter,
                TopFlushLeft,
                BottomFlushLeft

            }

            #endregion

        }
    }

  • 相关阅读:
    Python学习札记(十五) 高级特性1 切片
    LeetCode Longest Substring Without Repeating Characters
    Python学习札记(十四) Function4 递归函数 & Hanoi Tower
    single number和变体
    tusen 刷题
    实验室网站
    leetcode 76. Minimum Window Substring
    leetcode 4. Median of Two Sorted Arrays
    leetcode 200. Number of Islands 、694 Number of Distinct Islands 、695. Max Area of Island 、130. Surrounded Regions 、434. Number of Islands II(lintcode) 并查集 、178. Graph Valid Tree(lintcode)
    刷题注意事项
  • 原文地址:https://www.cnblogs.com/gywei/p/3364776.html
Copyright © 2020-2023  润新知