Esempio n. 1
0
 public MedCurve(MedPointList points, int xaxisindex, int yaxisindex, MedSymbol symbol, System.Drawing.Pen pen, string title, bool hasLine)
 {
     this._points     = points;
     this._XaxisIndex = xaxisindex;
     this._YaxisIndex = yaxisindex;
     if (_pen != null)
     {
         _pen.Dispose();
     }
     this._pen = pen;
     if (_symbol != null)
     {
         _symbol.Dispose();
     }
     if (symbol == null)
     {
         this._symbol = new MedSymbol(MedSymbolType.None);
     }
     else
     {
         this._symbol = symbol;
     }
     _symbol.Pen = _pen;
     _title      = title;
     _hasLine    = hasLine;
 }
Esempio n. 2
0
        public MedCurve addCurve(string title, MedPointList points, Color color)
        {
            MedCurve curve = new MedCurve(points, color);

            curve.Title = title;
            _curveList.Add(curve);
            return(curve);
        }
Esempio n. 3
0
        public MedCurve addCurve(string title, MedPointList points, Image image, Color color, int xaxisindex, int yaxisindex)
        {
            MedCurve curve = new MedCurve(points, xaxisindex, yaxisindex, new MedSymbol(image), new Pen(color));

            curve.Title = title;
            _curveList.Add(curve);
            return(curve);
        }
Esempio n. 4
0
        public MedCurve addCurve(string title, MedPointList points, MedSymbol symbol, Pen pen, int xaxisindex, int yaxisindex)
        {
            MedCurve curve = new MedCurve(points, xaxisindex, yaxisindex, symbol, pen);

            curve.Title = title;
            _curveList.Add(curve);
            return(curve);
        }
Esempio n. 5
0
        public MedCurve addCurve(string title, MedPointList points, Image image)
        {
            MedCurve curve = new MedCurve(points, image);

            curve.Title = title;
            _curveList.Add(curve);
            return(curve);
        }
Esempio n. 6
0
 public MedCurve(MedPointList points, System.Drawing.Pen pen)
     : this(points)
 {
     if (_pen != null)
     {
         _pen.Dispose();
     }
     _pen = pen; _symbol.Pen = _pen;
 }
Esempio n. 7
0
 public MedCurve(MedPointList points, System.Drawing.Image image, System.Drawing.Color color)
     : this(points, image)
 {
     if (_pen != null)
     {
         _pen.Dispose();
     }
     _pen = new System.Drawing.Pen(color); _symbol.Pen = _pen;
 }
Esempio n. 8
0
        /// <summary>
        /// 画图
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            if (this.DesignMode)
            {
                ///Y坐标轴
                _mainPanel.YAxisList.Clear();
                _mainPanel.YAxisList.Add(new MedAxis(this.Font, Brushes.Black, 100, 0, 20));
                _mainPanel.YAxisList.MinSetp   = 1;
                _mainPanel.YAxisList.Pen.Color = Color.Black;

                ///X坐标轴
                _mainPanel.XAxisList.Clear();
                MedAxis axis = new MedAxis(this.Font, Brushes.Black, 10, 1, 1f);
                _mainPanel.XAxisList.Add(axis);
                _mainPanel.XAxisList.MinSetp   = 1;
                _mainPanel.XAxisList.Pen.Color = Color.Black;

                ///其他属性
                _mainPanel.LeftMargin      = 10;
                _mainPanel.BottomMargin    = 20;
                _mainPanel.RectBorderPen   = Pens.Gray;
                _mainPanel.HasAxisGridLine = false;
                _mainPanel.XAxisTitleAtTop = false;

                _mainPanel.CurveList.Clear();
                MedPointList points = new MedPointList();
                points.Add(1, 10);
                points.Add(2, 40);
                points.Add(3, 20);
                points.Add(4, 80);
                points.Add(5, 50);
                points.Add(6, 70);
                points.Add(7, 60);
                points.Add(8, 100);
                points.Add(9, 90);
                points.Add(10, 0);
                MedCurve curve = new MedCurve(points);
                _mainPanel.CurveList.Add(curve);
            }

            ///隐藏滚动条

            ///如果没有坐标轴则不作图
            if ((_mainPanel.XAxisList.Count == 0) || (_mainPanel.YAxisList.Count == 0))
            {
                return;
            }

            _mainPanel.DrawGraph(e.Graphics);

            ///绘制光标位置
            if (_drawcursorpos)
            {
                DrawCursorPos(e.Graphics);
            }
        }
Esempio n. 9
0
        public MedGridRow addRow(string title, Pen pen, int datatype, MedPointList points)
        {
            MedGridRow row = new MedGridRow();

            row.Pen      = pen;
            row.Title    = title;
            row.DataType = datatype;
            row.Points   = points;
            _rowList.Add(row, datatype);
            return(row);
        }
Esempio n. 10
0
        public MedPointList SubPoints(float minvalue, float maxvalue)
        {
            MedPointList points = new MedPointList();

            foreach (MedPoint point in _points)
            {
                if ((point.X >= minvalue) && (point.X < maxvalue))
                {
                    points.Add(point.X, point.Y);
                }
            }
            return(points);
        }
Esempio n. 11
0
 public MedCurve(MedPointList points, System.Drawing.Image image) : this(points) { _symbol = new MedSymbol(image); _symbol.Pen = _pen; }
Esempio n. 12
0
 public MedCurve addCurve(MedPointList points, MedSymbol symbol, Pen pen, int xaxisindex, int yaxisindex)
 {
     return(addCurve("", points, symbol, pen, xaxisindex, yaxisindex));
 }
Esempio n. 13
0
 public MedCurve(MedPointList points, int xaxisindex, int yaxisindex, MedSymbol symbol, System.Drawing.Pen pen) : this(points, xaxisindex, yaxisindex, symbol, pen, null)
 {
 }
Esempio n. 14
0
 public MedCurve(MedPointList points) : this(points, 0, 0, null, new System.Drawing.Pen(System.Drawing.Color.Black))
 {
     _symbol.Pen = _pen;
 }
Esempio n. 15
0
 public MedCurve addCurve(string title, MedPointList points, MedSymbol symbol, Pen pen)
 {
     return(addCurve(title, points, symbol, pen, 0, 0));
 }
Esempio n. 16
0
 public MedCurve(MedPointList points, int xaxisindex, int yaxisindex, MedSymbol symbol, System.Drawing.Pen pen, string title) : this(points, xaxisindex, yaxisindex, symbol, pen, title, true)
 {
 }
Esempio n. 17
0
 public MedCurve addCurve(MedPointList points, MedSymbol symbol, Pen pen)
 {
     return(addCurve("", points, symbol, pen));
 }
Esempio n. 18
0
 public MedCurve addCurve(string title, MedPointList points, string imageFileName, Color color, int xaxisindex, int yaxisindex)
 {
     return(addCurve(title, points, Image.FromFile(imageFileName), color, xaxisindex, yaxisindex));
 }
Esempio n. 19
0
 public MedCurve addCurve(MedPointList points, Image image, Color color, int xaxisindex, int yaxisindex)
 {
     return(addCurve("", points, image, color, xaxisindex, yaxisindex));
 }
Esempio n. 20
0
 public MedCurve addCurve(MedPointList points, Color color)
 {
     return(addCurve("", points, color));
 }
Esempio n. 21
0
 public MedCurve addCurve(MedPointList points, string imageFileName)
 {
     return(addCurve("", points, imageFileName));
 }
Esempio n. 22
0
        private void MedGraph_MouseMove(object sender, MouseEventArgs e)
        {
            ///如果锁定鼠标则不处理
            if (_lockMouseEvent)
            {
                return;
            }

            _cursorPos.X = e.X;
            _cursorPos.Y = e.Y;
            float xx, yy;

            _curveIndex   = -1;
            _pointIndex   = -1;
            _rowtypeIndex = -1;
            _rowIndex     = -1;
            _mainPanel.Legend.ItemRectIndex = -1;
            if (e.X < _mainPanel.MainRect.X || e.X > (_mainPanel.MainRect.X + _mainPanel.MainRect.Width) || (e.Y - _mainPanel.HScrollPos) < _mainPanel.MainRect.Y || (e.Y - _mainPanel.HScrollPos) > (_mainPanel.MainRect.Y + _mainPanel.MainRect.Height + _mainPanel.GridRect.Height))
            {
                return;
            }

            #region 是否是体征数据并保存光标位置

            if (e.X >= _mainPanel.MainRect.X && e.X <= (_mainPanel.MainRect.X + _mainPanel.MainRect.Width) && (e.Y - _mainPanel.HScrollPos) >= _mainPanel.MainRect.Y && (e.Y - _mainPanel.HScrollPos) <= (_mainPanel.MainRect.Y + _mainPanel.MainRect.Height))
            {
                int idx = 0;
                foreach (MedCurve curve in _mainPanel.CurveList)
                {
                    MedPointList points = curve.Points;
                    for (int j = 0; j < points.Count; j++)
                    {
                        xx = _mainPanel.TranslateX(points[j].X, curve.XAxisIndex);
                        yy = _mainPanel.TranslateY(points[j].Y, curve.YAxisIndex);
                        if ((Math.Abs(xx - e.X) < 5) && (Math.Abs(yy - e.Y + _mainPanel.HScrollPos) < 5))
                        {
                            _pointIndex = j; _curveIndex = idx;
                        }
                        if (_pointIndex >= 0)
                        {
                            break;
                        }
                    }
                    if (_pointIndex >= 0)
                    {
                        break;
                    }
                    idx++;
                }
            }

            #endregion 是否是体征数据并保存光标位置

            #region 是否是出入液数据

            if ((_pointIndex < 0) && e.X >= _mainPanel.MainRect.X && e.X <= (_mainPanel.MainRect.X + _mainPanel.MainRect.Width) && (e.Y - _mainPanel.HScrollPos) >= (_mainPanel.MainRect.Y + _mainPanel.MainRect.Height) && (e.Y - _mainPanel.HScrollPos) <= (_mainPanel.MainRect.Y + _mainPanel.MainRect.Height + _mainPanel.GridRect.Height))
            {
                int   _count = (int)((_mainPanel.XAxisList[0].Max - _mainPanel.XAxisList[0].Min) / (_mainPanel.XAxisList[0].Step));
                float _H = _mainPanel.GridRect.Height / _mainPanel.GirdRowCounts, _Y = _mainPanel.GridRect.Y + _H;
                for (int i = 0; i < _mainPanel.RowList.TypeCount; i++)
                {
                    for (int j = 0; j < _mainPanel.RowList.CountOfType(i); j++)
                    {
                        for (int k = 0; k < _count; k++)
                        {
                            for (int kk = 0; kk < _mainPanel.XAxisList.MinSetp; kk++)
                            {
                                if ((e.X >= _mainPanel.MainRect.X + k * _mainPanel.GridRect.Width / _count + kk * _mainPanel.GridRect.Width / _count / _mainPanel.XAxisList.MinSetp) &&
                                    (e.X < _mainPanel.MainRect.X + k * _mainPanel.GridRect.Width / _count + kk * _mainPanel.GridRect.Width / _count / _mainPanel.XAxisList.MinSetp + _mainPanel.GridRect.Width / _count / _mainPanel.XAxisList.MinSetp) &&
                                    ((e.Y - _mainPanel.HScrollPos) >= _Y - _H) && ((e.Y - _mainPanel.HScrollPos) < _Y - _H + _H))
                                {
                                    _pointIndex = k * _mainPanel.XAxisList.MinSetp + kk; _rowtypeIndex = i; _rowIndex = j;
                                    if (_mainPanel.RowList[j, i].Points != null)
                                    {
                                        _currentpoints = _mainPanel.RowList[j, i].SubPoints(_mainPanel.XAxisList[0].Min + k * _mainPanel.XAxisList[0].Step + kk * _mainPanel.XAxisList[0].Step / _mainPanel.XAxisList.MinSetp
                                                                                            , _mainPanel.XAxisList[0].Min + k * _mainPanel.XAxisList[0].Step + (kk + 1) * _mainPanel.XAxisList[0].Step / _mainPanel.XAxisList.MinSetp);
                                    }
                                }
                                if (_pointIndex >= 0)
                                {
                                    break;
                                }
                            }
                            if (_pointIndex >= 0)
                            {
                                break;
                            }
                        }
                        if (_pointIndex >= 0)
                        {
                            break;
                        }
                        _Y += _H;
                    }
                    if (_pointIndex >= 0)
                    {
                        break;
                    }
                    _Y += _H;
                }
            }

            #endregion 是否是出入液数据

            #region 是否是图例并保存光标位置

            //if (_pointIndex<0){
            //    idx = 0;
            //    foreach (Rectangle rect in _mainPanel.Legend.ItemRects)
            //    {
            //        if(rect.Contains((int)e.X,(int)(e.Y - _mainPanel.HScrollPos))){
            //            _mainPanel.Legend.ItemRectIndex = idx;break;
            //        }
            //        idx ++;
            //    }
            //}

            #endregion 是否是图例并保存光标位置

            Invalidate();
        }
Esempio n. 23
0
 public MedCurve addCurve(MedPointList points, Image image)
 {
     return(addCurve("", points, image));
 }
Esempio n. 24
0
 public MedCurve addCurve(MedPointList points)
 {
     return(addCurve("", points));
 }
Esempio n. 25
0
        /// <summary>
        /// 绘制曲线
        /// </summary>
        /// <param name="g">作图对象</param>
        /// <param name="leftOffSet">横向位移</param>
        /// <param name="topOffSet">纵向位移</param>
        public void DrawCurves(Graphics g, int leftOffSet, int topOffSet)
        {
            float xx, yy, xx1 = 0, yy1 = 0, barCount = 0, barIndex = 0, barWidth = 0;

            for (int i = 0; i < _curveList.Count; i++)
            {
                if (((MedCurve)_curveList[i]).IsBar)
                {
                    barCount++;
                    if (barWidth <= 0)
                    {
                        barWidth = ((MedCurve)_curveList[i]).BarWidth;
                    }
                }
            }

            for (int i = 0; i < _curveList.Count; i++)
            {
                MedCurve     curve  = (MedCurve)_curveList[i];
                MedPointList points = curve.Points;

                ///画曲线的每个点
                for (int j = 0; j < points.Count; j++)
                {
                    xx = TranslateX(points[j].X, curve.XAxisIndex);
                    yy = TranslateY(points[j].Y, curve.YAxisIndex);

                    ///图柱状图
                    if (curve.IsBar)
                    {
                        g.DrawRectangle(curve.Pen, xx + leftOffSet - (barWidth * barCount / 2) + barIndex * barWidth, yy + topOffSet, barWidth, MainRect.Bottom - yy - topOffSet);
                        g.FillRectangle(new SolidBrush(curve.Pen.Color), xx + leftOffSet - (barWidth * barCount / 2) + barIndex * barWidth, yy + topOffSet, barWidth, MainRect.Bottom - yy - topOffSet);
                    }

                    ///画折线图
                    else
                    {
                        if (j > 0)
                        {
                            if (curve.hasLine)
                            {
                                ///绘制连线
                                g.DrawLine(curve.Pen, xx1 + leftOffSet, yy1 + topOffSet, xx + leftOffSet, yy + topOffSet);
                            }
                        }
                        if (points[j].Symbol != null)
                        {
                            ///绘制点标识
                            points[j].Symbol.Draw(g, xx + leftOffSet, yy + topOffSet);
                        }
                        else if (curve.Symbol.SymbolType != MedSymbolType.None)
                        {
                            ///绘制曲线点标识
                            curve.Symbol.Draw(g, xx + leftOffSet, yy + topOffSet);
                        }
                        xx1 = xx;
                        yy1 = yy;
                    }
                }///画曲线的每个点

                if (curve.IsBar)
                {
                    barIndex++;
                }
            }
        }
Esempio n. 26
0
 public MedCurve addCurve(string title, MedPointList points, string imageFileName)
 {
     return(addCurve(title, points, Image.FromFile(imageFileName)));
 }
Esempio n. 27
0
 public MedCurve addCurve(MedPointList points, string imageFileName, Color color, int xaxisindex, int yaxisindex)
 {
     return(addCurve("", points, imageFileName, color, xaxisindex, yaxisindex));
 }