Exemplo n.º 1
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue)
        {
            base.CheckForValidNextX(x);
            PlotDataPointCubicSpline plotDataPointCubicSpline = base.m_Data.AddNew() as PlotDataPointCubicSpline;

            base.DataPointInitializing = true;
            try
            {
                plotDataPointCubicSpline.X     = x;
                plotDataPointCubicSpline.Y     = y;
                plotDataPointCubicSpline.Null  = nullValue;
                plotDataPointCubicSpline.Empty = emptyValue;
            }
            finally
            {
                base.DataPointInitializing = false;
            }
            base.m_Data.UpdateMinMaxMean(plotDataPointCubicSpline);
            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);
        }
Exemplo n.º 2
0
        protected void DrawTraceCustomAttributes(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis, int indexStart, int indexStop)
        {
            PlotDataPointCubicSpline plotDataPointCubicSpline  = new PlotDataPointCubicSpline(this);
            PlotDataPointCubicSpline plotDataPointCubicSpline2 = new PlotDataPointCubicSpline(this);
            double num  = this.GetX(indexStart);
            double num2 = this.GetX(indexStop);

            if (num < xAxis.Min)
            {
                num = base.XAxis.Min;
            }
            if (num2 > xAxis.Max)
            {
                num2 = base.XAxis.Max;
            }
            int num3 = xAxis.ValueToPixels(num);
            int num4 = xAxis.ValueToPixels(num2);

            if (num3 > num4)
            {
                Math2.Switch(ref num3, ref num4);
            }
            Brush  brush = ((IPlotBrush)this.Fill.Brush).GetBrush(p, base.BoundsClip);
            double num5  = xAxis.PixelsToValue(num3);

            this.SplineInterpolation(indexStart, base.IndexLast, num5, out double num6);
            double x = num5;
            double y = num6;

            for (int i = num3; i <= num4; i++)
            {
                num5 = base.XAxis.PixelsToValue(i);
                this.SplineInterpolation(indexStart, base.IndexLast, num5, out num6);
                int num7 = i - this.m_XPixelMin;
                if (num7 >= 0 && num7 < this.m_PixelYValues.Length)
                {
                    this.m_PixelYValues[i - this.m_XPixelMin] = num6;
                }
                double num8 = num5;
                double num9 = num6;
                base.DataPointInitializing  = true;
                plotDataPointCubicSpline.X  = x;
                plotDataPointCubicSpline.Y  = y;
                plotDataPointCubicSpline2.X = num8;
                plotDataPointCubicSpline2.Y = num9;
                base.DataPointInitializing  = false;
                this.DrawLine(p, xAxis, yAxis, this.I_Trace.GetPen(p), plotDataPointCubicSpline, plotDataPointCubicSpline2, brush);
                x = num8;
                y = num9;
            }
        }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 protected override void DrawMarkers(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis, PlotMarker markers)
 {
     if (markers.Visible && this.IndexDrawStart != -1 && this.IndexDrawStop != -1)
     {
         if (this.MarkersTurnOffLimit > 0)
         {
             int num = Math.Abs(this.IndexDrawStop - this.IndexDrawStart) + 1;
             if (num >= this.MarkersTurnOffLimit)
             {
                 return;
             }
         }
         for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
         {
             PlotDataPointCubicSpline plotDataPointCubicSpline = this[i];
             if (!plotDataPointCubicSpline.Null && !plotDataPointCubicSpline.Empty)
             {
                 int num2 = xAxis.ScaleDisplay.ValueToPixels(plotDataPointCubicSpline.X);
                 int num3 = yAxis.ScaleDisplay.ValueToPixels(plotDataPointCubicSpline.Y);
                 if (this.DrawCustomDataPointAttributes)
                 {
                     if (base.XYSwapped)
                     {
                         ((IPlotMarker)plotDataPointCubicSpline.Marker).Draw(p, num3, num2);
                     }
                     else
                     {
                         ((IPlotMarker)plotDataPointCubicSpline.Marker).Draw(p, num2, num3);
                     }
                 }
                 else if (base.XYSwapped)
                 {
                     this.I_Markers.Draw(p, num3, num2);
                 }
                 else
                 {
                     this.I_Markers.Draw(p, num2, num3);
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 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)
             {
                 PlotDataPointCubicSpline plotDataPointCubicSpline = this[num];
                 Point point = base.GetPoint(plotDataPointCubicSpline.X, plotDataPointCubicSpline.Y);
                 int   num2  = (!this.DrawCustomDataPointAttributes) ? this.Markers.Size : plotDataPointCubicSpline.Marker.Size;
                 if (!new Rectangle(point.X - num2, point.Y - num2, num2 * 2, num2 * 2).Contains(e.X, e.Y))
                 {
                     num++;
                     continue;
                 }
                 this.m_MouseDownDataPointIndex = num;
                 return(true);
             }
         }
     }
     return(false);
 }