public void CutOff(ChartRect rect) { X.Min = Math.Max(X.Min, rect.X.Min); X.Max = Math.Min(X.Max, rect.X.Max); Y.Min = Math.Max(Y.Min, rect.Y.Min); Y.Max = Math.Min(Y.Max, rect.Y.Max); }
public override void OnScaleViewChanged(object sender, ChartRect e) { if (!this.Equals(sender)) { UpdateAxis(e); } }
public void RefreshData(DateTime?newTime = null) { IsValid = _pointsList.Count > 1; _ptrSeries.Points.Clear(); _xList.Clear(); Border = new ChartRect(); TimeSpan deltaTime = new TimeSpan(); if (!IsValid) { IsEnable = false; base.UpdateControls(); return; } if (newTime != null) { deltaTime = newTime.Value.Subtract(_pointsList[0].Time); } for (int i = 0; i < _pointsList.Count; i++) { var point = _pointsList[i]; if (newTime != null) { point.Time = point.Time.Add(deltaTime); } var pix = point.GetPixel(); _ptrSeries.Points.Add(pix); _xList.Add(new KeyValueHolder <double, int>(point.GetRoundTime(), i)); Border.Union(pix.XValue, pix.YValues.First()); } dtpDate.Value = _pointsList[0].Time; dtpTime.Value = _pointsList[0].Time; }
protected void OnScaleViewChanged(ChartRect e = null) { if (e == null) { e = new ChartRect(_ptrChartArea); } ScaleViewChanged?.Invoke(this, e); }
public void ChartControl_MouseWheel(int delta) { ChartRect newZoom = new ChartRect(_ptrChartArea); ScaleViewZoom(delta, ref newZoom.X); ScaleViewZoom(delta, ref newZoom.Y); UpdateAxis(newZoom, true); ViewChanged(); }
private void ChartForm_ScaleViewChanged(object sender, ChartRect e) { if (!((ChartForm)sender).IsEnable) { return; } foreach (ChartForm chartForm in tlbContent.Controls) { chartForm.OnScaleViewChanged(sender, e); } }
protected void UpdateAxis(ChartRect newView = null, bool isUpdateY = false, bool isResetZoom = false, bool isUpdateBorder = false) { var curView = new ChartRect(_ptrChartArea); var globalBorder = new ChartRect(_ptrChartArea, true); if (isUpdateBorder) { globalBorder = new ChartRect(Config.GlobalBorder); globalBorder.Y.Min -= 2; globalBorder.Y.Max += YMinZoom * 10.0; _ptrAxisX.Minimum = globalBorder.X.Min; _ptrAxisX.Maximum = globalBorder.X.Max; _ptrAxisY.Minimum = globalBorder.Y.Min; _ptrAxisY.Maximum = globalBorder.Y.Max; } if (isResetZoom) { curView.X = globalBorder.X; curView.Y = Border.Y; } else { if (newView != null) { //X curView.X = newView.X; //Y if (isUpdateY) { curView.Y = newView.Y; } } } var oldView = new ChartRect(_ptrChartArea); if (curView.X.Check(oldView.X, XMinZoom, globalBorder.X)) { _ptrAxisX.ScaleView.Zoom(curView.X.Min, curView.X.Max); } if (curView.Y.Check(oldView.Y, YMinZoom, globalBorder.Y)) { _ptrAxisY.ScaleView.Zoom(curView.Y.Min, curView.Y.Max); } }
public virtual void OnScaleViewChanged(object sender, ChartRect e) { }
public ChartRect(ChartRect other) { X = other.X; Y = other.Y; }