Example #1
0
 private void BaseChartOnPostPaint(object sender, ChartPaintEventArgs eventArgs)
 {
     // 如果不是绘制Chart或者无需更新位置时将不执行重绘
     if (!ReferenceEquals(eventArgs.ChartElement.GetType(), typeof(Chart)) || !_cursors.Any(item => item.Enabled))
     {
         return;
     }
     if (_parentChart.IsPlotting() && _parentPlotArea.Enabled)
     {
         RefreshAdapterAndCursorBoundry();
     }
     else
     {
         foreach (StripTabCursor cursor in _cursors)
         {
             cursor.Control.Visible = false;
         }
     }
 }
 private void RefreshUserConfigAxisRange()
 {
     // 如果正在绘图,则根据用户的配置和当前的数据更新坐标轴范围
     if (_parentChart.IsPlotting())
     {
         _parentChart.RefreshAxesRange(_parentPlotArea);
         _parentChart.RefreshScaleViewAndSendEvent(_parentPlotArea.ChartArea, this._baseAxis, false);
     }
     else
     {
         // 如果用户配置值非法,则自动计算
         if (_specifiedMax <= _specifiedMin)
         {
             SetAxisRange(_maxData, _minData);
         }
         else
         {
             SetAxisRange(_specifiedMax, _specifiedMin);
         }
         RefreshGridsAndLabels();
     }
 }
        internal void RefreshCursor()
        {
            if (!_parentChart.IsPlotting())
            {
                _baseCursor.LineColor              = Color.Transparent;
                _baseCursor.IsUserEnabled          = false;
                _baseCursor.IsUserSelectionEnabled = false;
//                _baseAxis.ScaleView.Zoomable = false;
                return;
            }
            switch (_mode)
            {
            case CursorMode.Disabled:
                _baseCursor.LineColor              = Color.Transparent;
                _baseCursor.IsUserEnabled          = false;
                _baseCursor.IsUserSelectionEnabled = false;
//                    _baseAxis.ScaleView.Zoomable = false;
                break;

            case CursorMode.Cursor:
                _baseCursor.LineColor              = _color;
                _baseCursor.IsUserEnabled          = true;
                _baseCursor.IsUserSelectionEnabled = false;
//                    _baseAxis.ScaleView.Zoomable = false;
                break;

            case CursorMode.Zoom:
                _baseCursor.LineColor              = _color;
                _baseCursor.IsUserEnabled          = true;
                _baseCursor.IsUserSelectionEnabled = true;
//                    _baseAxis.ScaleView.Zoomable = true;
                break;

            default:
                break;
            }
        }