private int AddXY(double x, double y, bool nullValue, bool emptyValue) { base.CheckForValidNextX(x); PlotDataPointDifferential plotDataPointDifferential = (PlotDataPointDifferential)base.m_Data.AddNew(); base.DataPointInitializing = true; try { plotDataPointDifferential.X = x; plotDataPointDifferential.Y = y; plotDataPointDifferential.Null = nullValue; plotDataPointDifferential.Empty = emptyValue; } finally { base.DataPointInitializing = false; } base.m_Data.UpdateMinMaxMean(plotDataPointDifferential); if (base.SendXAxisTrackingData) { PlotXAxis xAxis = base.XAxis; xAxis?.Tracking.NewData(x); } if (!nullValue && !emptyValue && base.SendYAxisTrackingData) { PlotYAxis yAxis = base.YAxis; yAxis?.Tracking.NewData(y); } this.DoDataChange(); return(base.m_Data.LastNewDataPointIndex); }
protected override void InternalOnMouseLeft(MouseEventArgs e, bool shouldFocus) { if (shouldFocus) { base.Focus(); } if (this.UserCanMoveDataPoints && this.m_MouseDownDataPointIndex != -1) { base.IsMouseActive = true; this.m_MouseDownDataPoint = this[this.m_MouseDownDataPointIndex]; this.m_MouseDownDataPointX = this.m_MouseDownDataPoint.X; this.m_MouseDownDataPointY = this.m_MouseDownDataPoint.Y; this.m_MouseDownPosX = base.XAxis.PixelsToValue(e); this.m_MouseDownPosY = base.YAxis.PixelsToValue(e); } }
protected override bool InternalHitTest(MouseEventArgs e) { if (base.LegendRectangle.Contains(e.X, e.Y)) { return(true); } this.m_MouseDownDataPointIndex = -1; if (this.IndexDrawStart == -1) { return(false); } if (this.IndexDrawStop == -1) { return(false); } if (this.Markers.Visible) { PlotXAxis xAxis = base.XAxis; PlotYAxis yAxis = base.YAxis; if (xAxis != null && yAxis != null) { int num = this.IndexDrawStart; while (num <= this.IndexDrawStop) { PlotDataPointDifferential plotDataPointDifferential = this[num]; Point point = base.GetPoint(plotDataPointDifferential.X, plotDataPointDifferential.Y); if (!new Rectangle(point.X - this.Markers.Size, point.Y - this.Markers.Size, this.Markers.Size * 2, this.Markers.Size * 2).Contains(e.X, e.Y)) { num++; continue; } this.m_MouseDownDataPointIndex = num; return(true); } } } return(false); }
private void DrawTrace(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis) { if (this.Count >= 2) { PlotDataPointDifferential plotDataPointDifferential = new PlotDataPointDifferential(this); ((IPlotBrush)this.Fill.Brush).GetBrush(p, base.BoundsClip); this.m_TraceFastDraw.P = p; this.m_TraceFastDraw.XAxis = xAxis; this.m_TraceFastDraw.YAxis = yAxis; this.m_TraceFastDraw.Pen = ((IPlotPen)this.Trace).GetPen(p); this.m_TraceFastDraw.TraceVisible = this.Trace.Visible; this.m_TraceFastDraw.XYSwapped = base.XYSwapped; this.m_TraceFastDraw.FillVisible = (this.Fill.Visible && this.Fill.Brush.Visible); this.m_TraceFastDraw.FillBrush = ((IPlotBrush)this.Fill.Brush).GetBrush(p, base.BoundsClip); this.m_TraceFastDraw.FillRefPixel = yAxis.ValueToPixels(this.Reference); this.m_TraceFastDraw.Reset(); this.m_TraceFastDraw.Reset(); int num = -1; for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++) { if (base.GetValid(i)) { if (num == -1) { this.m_TraceFastDraw.AddDataPoint(this[i]); num = i; } else if (this[num].Y != this[i].Y) { base.DataPointInitializing = true; plotDataPointDifferential.X = this[i].X; plotDataPointDifferential.Y = this[num].Y; base.DataPointInitializing = false; this.m_TraceFastDraw.AddDataPoint(plotDataPointDifferential); this.m_TraceFastDraw.AddDataPoint(this[i]); } else { this.m_TraceFastDraw.AddDataPoint(this[i]); } num = i; } else if (!this.GetEmpty(i) && this.GetNull(i)) { this.m_TraceFastDraw.AddDataPoint(this[i]); num = -1; } } if (num != -1 && !this.Terminated) { base.DataPointInitializing = true; if (base.DataDirection == DataDirection.Increasing) { plotDataPointDifferential.X = base.XAxis.Max; } else { plotDataPointDifferential.X = base.XAxis.Min; } plotDataPointDifferential.Y = this[num].Y; base.DataPointInitializing = false; this.m_TraceFastDraw.AddDataPoint(plotDataPointDifferential); } this.m_TraceFastDraw.DrawFlush(); } }