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); } if (IsYAxis()) { RefreshYMajorGridInterval(); } } // 如果不强制更新坐标轴Label,在手动配置时经常会出现Label错位的问题 _baseAxis.CustomLabels.Clear(); }
/// <summary> /// Zoom reset definite steps /// </summary> /// <param name="resetTimes">Reset times. Default value: Cancel scale view.</param> public void ZoomReset(int resetTimes = int.MaxValue) { if (!IsZoomed) { return; } // 如果是Y轴取消缩放,则先更新Interval,避免Interval过小导致的Label重叠显示 if (IsYAxis()) { RefreshYMajorGridInterval(true); } _baseAxis.ScaleView.ZoomReset(resetTimes); if (_baseEasyChart.IsPlotting()) { _baseEasyChart.RefreshScaleViewAndSendEvent(_basePlotArea.ChartArea, _baseAxis, false); } }
private void BaseChartOnPostPaint(object sender, ChartPaintEventArgs eventArgs) { // 如果不是绘制Chart或者无需更新位置时将不执行重绘 if (!ReferenceEquals(eventArgs.ChartElement.GetType(), typeof(Chart)) || !_cursors.Any(item => item.Enabled)) { return; } if (_parentChart.IsPlotting() && _plotArea.Enabled) { RefreshAdapterAndCursorBoundry(); } else { foreach (TabCursor cursor in _cursors) { cursor.Control.Visible = false; } } }
internal void RefreshCursor() { if (!_baseEasyChart.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; } }