Пример #1
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue, double width)
        {
            base.CheckForValidNextX(x);
            PlotDataPointBar plotDataPointBar = (PlotDataPointBar)base.m_Data.AddNew();

            base.DataPointInitializing = true;
            try
            {
                plotDataPointBar.X     = x;
                plotDataPointBar.Y     = y;
                plotDataPointBar.Null  = nullValue;
                plotDataPointBar.Empty = emptyValue;
                plotDataPointBar.Width = width;
            }
            finally
            {
                base.DataPointInitializing = false;
            }
            base.m_Data.UpdateMinMaxMean(plotDataPointBar);
            if (base.SendXAxisTrackingData)
            {
                PlotAxis xAxis = base.XAxis;
                if (xAxis != null)
                {
                    base.XAxis.Tracking.NewData(x - this.Width / 2.0);
                    base.XAxis.Tracking.NewData(x + this.Width / 2.0);
                }
            }
            if (!nullValue && !emptyValue && base.SendYAxisTrackingData)
            {
                PlotAxis yAxis = base.YAxis;
                if (yAxis != null)
                {
                    base.YAxis.Tracking.NewData(y);
                    base.YAxis.Tracking.NewData(this.Reference);
                }
            }
            this.DoDataChange();
            return(base.m_Data.LastNewDataPointIndex);
        }
Пример #2
0
 protected override void Draw(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
     {
         PlotDataPointBar plotDataPointBar = this[i];
         if (!plotDataPointBar.Empty && !plotDataPointBar.Null)
         {
             Rectangle r;
             Point     point;
             if (this.WidthStyle == MagnitudeStyle.Value)
             {
                 int num;
                 int num2;
                 if (this.DrawCustomDataPointAttributes)
                 {
                     num  = xAxis.ScaleDisplay.ValueToPixels(plotDataPointBar.X - plotDataPointBar.Width / 2.0);
                     num2 = xAxis.ScaleDisplay.ValueToPixels(plotDataPointBar.X + plotDataPointBar.Width / 2.0);
                 }
                 else
                 {
                     num  = xAxis.ScaleDisplay.ValueToPixels(plotDataPointBar.X - this.Width / 2.0);
                     num2 = xAxis.ScaleDisplay.ValueToPixels(plotDataPointBar.X + this.Width / 2.0);
                 }
                 int top    = yAxis.ScaleDisplay.ValueToPixels(plotDataPointBar.Y);
                 int bottom = yAxis.ScaleDisplay.ValueToPixels(this.Reference);
                 if (num == num2)
                 {
                     num2++;
                 }
                 r = iRectangle.FromLTRB(base.XYSwapped, num, top, num2, bottom);
             }
             else if (this.WidthStyle == MagnitudeStyle.Pixel)
             {
                 point = base.GetPoint(plotDataPointBar.X, plotDataPointBar.Y);
                 int num3    = (int)(this.Width / 2.0);
                 int bottom2 = yAxis.ScaleDisplay.ValueToPixels(this.Reference);
                 r = iRectangle.FromLTRB(base.XYSwapped, point.X - num3, point.Y, point.X + num3, bottom2);
             }
             else
             {
                 point = base.GetPoint(plotDataPointBar.X, plotDataPointBar.Y);
                 int num3    = xAxis.ScaleDisplay.PercentToSpanPixels(this.Width) / 2;
                 int bottom2 = yAxis.ScaleDisplay.ValueToPixels(this.Reference);
                 int num     = point.X - num3;
                 int num2    = point.X + num3;
                 if (num == num2)
                 {
                     num2++;
                 }
                 r = iRectangle.FromLTRB(base.XYSwapped, num, point.Y, num2, bottom2);
             }
             if (this.DrawCustomDataPointAttributes)
             {
                 ((IPlotFill)plotDataPointBar.Fill).Draw(p, r);
             }
             else
             {
                 this.I_Fill.Draw(p, r);
             }
         }
     }
 }