예제 #1
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++)
         {
             PlotDataPointTraceXY plotDataPointTraceXY = this[i];
             if (!plotDataPointTraceXY.Null && !plotDataPointTraceXY.Empty)
             {
                 int num2 = xAxis.ScaleDisplay.ValueToPixels(plotDataPointTraceXY.X);
                 int num3 = yAxis.ScaleDisplay.ValueToPixels(plotDataPointTraceXY.Y);
                 if (base.XYSwapped)
                 {
                     ((IPlotMarker)plotDataPointTraceXY.Marker).Draw(p, num3, num2);
                 }
                 else
                 {
                     ((IPlotMarker)plotDataPointTraceXY.Marker).Draw(p, num2, num3);
                 }
             }
         }
     }
 }
예제 #2
0
 protected override void DrawFocusRectangles(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     if (base.Focused)
     {
         p.Graphics.DrawFocusRectangle(base.Bounds, base.BackColor);
     }
 }
예제 #3
0
        protected override void Draw(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
        {
            Point[] array = new Point[this.m_Points.Count];
            for (int i = 0; i < this.m_Points.Count; i++)
            {
                array[i] = base.GetPoint(this.m_Points[i].X, this.m_Points[i].Y);
            }
            GraphicsPath graphicsPath = new GraphicsPath();

            try
            {
                graphicsPath.AddPolygon(array);
                if (this.m_HitRegion != null)
                {
                    this.m_HitRegion.Dispose();
                }
                this.m_HitRegion = new Region(graphicsPath);
            }
            finally
            {
                graphicsPath.Dispose();
            }
            Rectangle rectangle = Rectangle.Round(this.m_HitRegion.GetBounds(p.Graphics.GraphicsMS));

            base.I_Fill.Draw(p, array, rectangle);
            base.Bounds = rectangle;
        }
예제 #4
0
 protected override void LoadDesignTimeData(PlotXAxis xAxis, PlotYAxis yAxis, Random random, double yMin, double ySpan)
 {
     for (double num = xAxis.Min; num < xAxis.Max; num += ySpan / 5.0)
     {
         this.AddXY(num, this.Reference - ySpan / 2.0 + random.NextDouble() * ySpan);
     }
 }
예제 #5
0
        private void DrawTrace(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
        {
            PlotDataPointTraceXY plotDataPointTraceXY  = null;
            PlotDataPointTraceXY plotDataPointTraceXY2 = null;

            ((IPlotPen)this.Trace).GetPen(p);
            for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
            {
                PlotDataPointTraceXY plotDataPointTraceXY3 = this[i];
                if (plotDataPointTraceXY3.Null)
                {
                    plotDataPointTraceXY  = null;
                    plotDataPointTraceXY2 = null;
                }
                else if (!plotDataPointTraceXY3.Empty)
                {
                    if (plotDataPointTraceXY == null)
                    {
                        plotDataPointTraceXY = plotDataPointTraceXY3;
                    }
                    else
                    {
                        plotDataPointTraceXY2 = plotDataPointTraceXY3;
                        if (plotDataPointTraceXY2.Trace.Visible)
                        {
                            this.DrawLine(p, xAxis, yAxis, ((IPlotPen)plotDataPointTraceXY2.Trace).GetPen(p), plotDataPointTraceXY, plotDataPointTraceXY2);
                        }
                        plotDataPointTraceXY = plotDataPointTraceXY2;
                    }
                }
            }
        }
예제 #6
0
        protected override void Draw(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
        {
            bool flag = true;

            if (!this.Markers.Visible)
            {
                flag = false;
            }
            if (this.IndexDrawStart == -1)
            {
                flag = false;
            }
            if (this.IndexDrawStop == -1)
            {
                flag = false;
            }
            if (this.MarkersTurnOffLimit > 0)
            {
                int num = Math.Abs(this.IndexDrawStop - this.IndexDrawStart) + 1;
                if (num >= this.MarkersTurnOffLimit)
                {
                    flag = false;
                }
            }
            this.DrawFill(p, xAxis, yAxis);
            base.SetClipRect(p);
            if (this.Trace.Visible)
            {
                this.DrawTrace(p, xAxis, yAxis);
            }
            if (flag)
            {
                this.DrawMarkers(p, xAxis, yAxis, this.Markers);
            }
        }
예제 #7
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue)
        {
            base.CheckForValidNextX(x);
            PlotDataPointBiFill plotDataPointBiFill = (PlotDataPointBiFill)base.m_Data.AddNew();

            base.DataPointInitializing = true;
            try
            {
                plotDataPointBiFill.X     = x;
                plotDataPointBiFill.Y     = y;
                plotDataPointBiFill.Null  = nullValue;
                plotDataPointBiFill.Empty = emptyValue;
            }
            finally
            {
                base.DataPointInitializing = false;
            }
            base.m_Data.UpdateMinMaxMean(plotDataPointBiFill);
            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);
        }
예제 #8
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue, double intensity)
        {
            int num  = this.ValueToImageSampleX(x);
            int num2 = this.ValueToImageSampleY(y);

            if (num > this.ImageXSamples - 1)
            {
                throw new Exception("X out of bounds.");
            }
            if (num2 > this.ImageYSamples - 1)
            {
                throw new Exception("Y out of bounds.");
            }
            Color color = (!nullValue) ? this.IntensityGradient.GetColor(intensity) : Color.Empty;

            this.m_Image.SetPixel(num, num2, color);
            base.m_Data.UpdateMinMaxMean(x, y, emptyValue, nullValue);
            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(-1);
        }
예제 #9
0
        protected override void DrawCustom(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
        {
            float num7;

            if (!this.FixedSize)
            {
                float num;
                float num2;
                if (!base.XYSwapped)
                {
                    num  = (float)base.WidthPixels;
                    num2 = (float)base.HeightPixels;
                }
                else
                {
                    num  = (float)base.HeightPixels;
                    num2 = (float)base.WidthPixels;
                }
                float num3 = (float)p.Graphics.MeasureString(this.Text, this.Font).Width;
                float num4 = (float)this.Font.Height;
                float num5 = num / num3;
                float num6 = num2 / num4;
                num7 = ((!(num6 < num5)) ? (num / num3 * this.Font.Size) : (num2 / num4 * this.Font.Size));
            }
            else
            {
                num7 = this.Font.Size;
            }
            if (!(num7 <= 0f))
            {
                Font font;
                if (this.Font.Size != num7)
                {
                    if (this.m_DrawFont == null || this.m_DrawFont.Size != num7)
                    {
                        this.m_DrawFont = new Font(this.Font.Name, num7, this.Font.Style);
                    }
                    font = this.m_DrawFont;
                }
                else
                {
                    font = this.Font;
                }
                Point     pt        = base.XYSwapped ? new Point(base.YPixels, base.XPixels) : new Point(base.XPixels, base.YPixels);
                Rectangle rectangle = this.I_TextLayout.GetRectangle(this.Text, pt, font, p.Graphics);
                if (!base.BoundsClip.IntersectsWith(rectangle))
                {
                    base.ClickRegion = null;
                }
                else
                {
                    DrawStringFormat genericTypographic = DrawStringFormat.GenericTypographic;
                    genericTypographic.Alignment     = this.TextLayout.AlignmentHorizontal.Style;
                    genericTypographic.LineAlignment = this.TextLayout.AlignmentVertical.Style;
                    p.Graphics.DrawString(this.Text, font, p.Graphics.Brush(this.ForeColor), rectangle, genericTypographic);
                    base.ClickRegion = this.ToClickRegion(rectangle);
                    base.UpdateGrabHandles(rectangle);
                }
            }
        }
예제 #10
0
 protected override void LoadDesignTimeData(PlotXAxis xAxis, PlotYAxis yAxis, Random random, double yMin, double ySpan)
 {
     for (double num = xAxis.Min; num < xAxis.Max; num += this.Width * 3.0)
     {
         this.AddXY(num, yMin + random.NextDouble() * ySpan);
     }
 }
예제 #11
0
 protected override void DrawCustom(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     if (this.m_Points.Count >= 2)
     {
         Point[] array = new Point[this.m_Points.Count];
         for (int i = 0; i < this.m_Points.Count; i++)
         {
             if (!base.XYSwapped)
             {
                 array[i] = new Point(base.GetXPixels(this.m_Points[i].X), base.GetYPixels(this.m_Points[i].Y));
             }
             else
             {
                 array[i] = new Point(base.GetYPixels(this.m_Points[i].Y), base.GetXPixels(this.m_Points[i].X));
             }
         }
         Rectangle rectangle = iRectangle.FromLTRB(base.XYSwapped, base.XMinPixels, base.YMinPixels, base.XMaxPixels, base.YMaxPixels);
         if (!base.BoundsClip.IntersectsWith(rectangle))
         {
             base.ClickRegion = null;
         }
         else
         {
             base.ClickRegion = new Region(rectangle);
             base.UpdateGrabHandles(rectangle);
             base.I_Fill.Draw(p, array, rectangle);
         }
     }
 }
예제 #12
0
        protected void DrawTraceCustomAttributes(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
        {
            PlotDataPointTrace plotDataPointTrace  = null;
            PlotDataPointTrace plotDataPointTrace2 = null;
            Brush brush = ((IPlotBrush)this.Fill.Brush).GetBrush(p, base.BoundsClip);

            this.m_FillRefPixel = yAxis.ValueToPixels(this.Reference);
            for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
            {
                PlotDataPointTrace plotDataPointTrace3 = base.m_Data[i] as PlotDataPointTrace;
                if (plotDataPointTrace3.Null)
                {
                    plotDataPointTrace  = null;
                    plotDataPointTrace2 = null;
                }
                else if (!plotDataPointTrace3.Empty)
                {
                    if (plotDataPointTrace == null)
                    {
                        plotDataPointTrace = plotDataPointTrace3;
                    }
                    else
                    {
                        plotDataPointTrace2 = plotDataPointTrace3;
                        if (plotDataPointTrace2.Trace.Visible)
                        {
                            this.DrawLine(p, xAxis, yAxis, ((IPlotPen)plotDataPointTrace2.Trace).GetPen(p), plotDataPointTrace, plotDataPointTrace2, brush);
                        }
                        plotDataPointTrace = plotDataPointTrace2;
                    }
                }
            }
        }
예제 #13
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;
             }
         }
         Brush brush = ((IPlotBrush)markers.Fill.Brush).GetBrush(p, Rectangle.Empty);
         Pen   pen   = ((IPlotPen)markers.Fill.Pen).GetPen(p);
         for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
         {
             if (!this.GetNull(i) && !this.GetEmpty(i))
             {
                 int num2 = xAxis.ScaleDisplay.ValueToPixels(this.GetX(i));
                 int num3 = (this.GetY(i) != 0.0) ? yAxis.ScaleDisplay.ValueToPixels(this.ReferenceHigh) : yAxis.ScaleDisplay.ValueToPixels(this.ReferenceLow);
                 if (base.XYSwapped)
                 {
                     ((IPlotMarker)markers).Draw(p, num3, num2, brush, pen);
                 }
                 else
                 {
                     ((IPlotMarker)markers).Draw(p, num2, num3, brush, pen);
                 }
             }
         }
     }
 }
예제 #14
0
 protected override void LoadDesignTimeData(PlotXAxis xAxis, PlotYAxis yAxis, Random random, double yMin, double ySpan)
 {
     for (double num = xAxis.Min; num < xAxis.Max; num += xAxis.Span / 100.0)
     {
         this.AddXY(num, random.NextDouble() > 0.5);
     }
 }
예제 #15
0
 protected override void LoadDesignTimeData(PlotXAxis xAxis, PlotYAxis yAxis, Random random, double yMin, double ySpan)
 {
     for (int i = 0; i < 101; i++)
     {
         double num = (double)i * 0.062209755516629564 * 2.0;
         this.AddXY(Math.Cos(num) * xAxis.Span * (0.35 + random.NextDouble() * 0.05) + xAxis.Mid, Math.Sin(num) * yAxis.Span * (0.35 + random.NextDouble() * 0.05) + yAxis.Mid);
     }
 }
예제 #16
0
 protected override void Draw(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     if (this.Trace.Visible && this.Count > 1)
     {
         this.DrawTrace(p, xAxis, yAxis);
     }
     this.DrawMarkers(p, xAxis, yAxis, this.Markers);
 }
예제 #17
0
 protected void DrawFill(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     if (!this.FillHigh.Visible && !this.FillLow.Visible)
     {
         return;
     }
     if (this.Count >= 2)
     {
         Point[] array = new Point[base.DrawPointCount + 2];
         int     num   = base.YAxis.ScaleDisplay.ValueToPixels(this.Reference);
         int     num2  = num;
         int     num3  = num;
         int     num4  = xAxis.ScaleDisplay.ValueToPixels(this.GetX(this.IndexDrawStart));
         int     num5  = xAxis.ScaleDisplay.ValueToPixels(this.GetX(this.IndexDrawStop));
         if (base.XYSwapped)
         {
             array[0] = new Point(num, num4);
         }
         else
         {
             array[0] = new Point(num4, num);
         }
         for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
         {
             int num6 = xAxis.ScaleDisplay.ValueToPixels(this.GetX(i));
             int num7 = yAxis.ScaleDisplay.ValueToPixels(this.GetY(i));
             num2 = Math.Min(num2, num7);
             num3 = Math.Max(num3, num7);
             if (base.XYSwapped)
             {
                 array[i - this.IndexDrawStart + 1] = new Point(num7, num6);
             }
             else
             {
                 array[i - this.IndexDrawStart + 1] = new Point(num6, num7);
             }
         }
         if (base.XYSwapped)
         {
             array[array.Length - 1] = new Point(num, num5);
         }
         else
         {
             array[array.Length - 1] = new Point(num5, num);
         }
         Rectangle boundRect = iRectangle.FromLTRB(base.XYSwapped, num4, num2, num5, num3);
         Rectangle rect      = iRectangle.FromLTRB(base.XYSwapped, xAxis.ScaleDisplay.PixelsMin, yAxis.ScaleDisplay.PixelsMax, base.XAxis.ScaleDisplay.PixelsMax, num);
         Region    clip      = new Region(rect);
         p.Graphics.Clip = clip;
         this.I_FillHigh.DrawBiFill(p, array, boundRect);
         rect            = iRectangle.FromLTRB(base.XYSwapped, xAxis.ScaleDisplay.PixelsMin, yAxis.ScaleDisplay.PixelsMin, base.XAxis.ScaleDisplay.PixelsMax, num);
         clip            = new Region(rect);
         p.Graphics.Clip = clip;
         this.I_FillLow.DrawBiFill(p, array, boundRect);
     }
 }
예제 #18
0
        protected override void LoadDesignTimeData(PlotXAxis xAxis, PlotYAxis yAxis, Random random, double yMin, double ySpan)
        {
            double widthBody = this.WidthBody;

            for (double num = xAxis.Min; num < xAxis.Max; num += widthBody * 3.0)
            {
                double num2 = yMin + random.NextDouble() * ySpan;
                this.AddXY(num, num2, false, false, num2 + ySpan * 0.4, num2 - ySpan * 0.4, num2 + ySpan * 0.15, num2 - ySpan * 0.15);
            }
        }
예제 #19
0
 protected override void LoadDesignTimeData(PlotXAxis xAxis, PlotYAxis yAxis, Random random, double yMin, double ySpan)
 {
     for (int i = 0; i < this.ImageXSamples; i++)
     {
         for (int j = 0; j < this.ImageYSamples; j++)
         {
             this.Add(i, j, random.NextDouble() * (this.IntensityGradient.Max - this.IntensityGradient.Min) + this.IntensityGradient.Min);
         }
     }
 }
예제 #20
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue, double high, double low, double open, double close)
        {
            base.CheckForValidNextX(x);
            PlotDataPointCandlestick1 plotDataPointCandlestick = (PlotDataPointCandlestick1)base.m_Data.AddNew();

            base.DataPointInitializing = true;
            try
            {
                plotDataPointCandlestick.X     = x;
                plotDataPointCandlestick.Y     = y;
                plotDataPointCandlestick.Null  = nullValue;
                plotDataPointCandlestick.Empty = emptyValue;
                plotDataPointCandlestick.High  = high;
                plotDataPointCandlestick.Low   = low;
                plotDataPointCandlestick.Open  = open;
                plotDataPointCandlestick.Close = close;
            }
            finally
            {
                base.DataPointInitializing = false;
            }
            base.m_Data.UpdateMinMaxMean(plotDataPointCandlestick);
            if (base.SendXAxisTrackingData)
            {
                PlotXAxis xAxis = base.XAxis;
                if (xAxis != null)
                {
                    double num             = 0.0;
                    double normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthBody, this.WidthStyleBody);
                    if (normalizedWidth > num)
                    {
                        num = normalizedWidth;
                    }
                    normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthShadow, this.WidthStyleShadow);
                    if (normalizedWidth > num)
                    {
                        num = normalizedWidth;
                    }
                    base.XAxis.Tracking.NewData(x - num / 2.0);
                    base.XAxis.Tracking.NewData(x + num / 2.0);
                }
            }
            if (!nullValue && !emptyValue && base.SendYAxisTrackingData)
            {
                PlotYAxis yAxis = base.YAxis;
                if (yAxis != null)
                {
                    base.YAxis.Tracking.NewData(high);
                    base.YAxis.Tracking.NewData(low);
                }
            }
            this.DoDataChange();
            return(base.m_Data.LastNewDataPointIndex);
        }
예제 #21
0
 protected override void Draw(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
     {
         PlotDataPointCandlestick2 plotDataPointCandlestick = this[i];
         if (!plotDataPointCandlestick.Empty && !plotDataPointCandlestick.Null)
         {
             this.DrawOpenClose(p, xAxis, yAxis, plotDataPointCandlestick);
             this.DrawBody(p, xAxis, yAxis, plotDataPointCandlestick);
         }
     }
 }
예제 #22
0
 public override void ObjectRemoved(PlotObject value)
 {
     base.ObjectRemoved(value);
     if (value == this.m_CachedXAxis)
     {
         this.m_CachedXAxis = null;
     }
     else if (value == this.m_CachedYAxis)
     {
         this.m_CachedYAxis = null;
     }
 }
예제 #23
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue)
        {
            this.m_SweepIndex++;
            if (this.m_SweepIndex >= this.SweepCount)
            {
                this.m_SweepIndex = 0;
                if (this.ClearOnRetrace)
                {
                    this.ClearDisplay();
                }
            }
            int sweepIndex = this.m_SweepIndex;

            this.m_LastAddIndex = this.m_SweepIndex;
            PlotDataPointSweepInterval plotDataPointSweepInterval = this[sweepIndex];

            base.DataPointInitializing = true;
            try
            {
                plotDataPointSweepInterval.Y     = y;
                plotDataPointSweepInterval.Null  = nullValue;
                plotDataPointSweepInterval.Empty = emptyValue;
            }
            finally
            {
                base.DataPointInitializing = false;
            }
            if (this.SweepLeadingBreakCount != 0)
            {
                for (int i = 0; i < this.SweepLeadingBreakCount; i++)
                {
                    int num = sweepIndex + i + 1;
                    if (num > this.SweepCount - 1)
                    {
                        num -= this.SweepCount;
                    }
                    this[num].Null = true;
                }
            }
            base.m_Data.UpdateMinMaxMean(plotDataPointSweepInterval);
            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(sweepIndex);
        }
예제 #24
0
 public override void ObjectAdded(PlotObject value)
 {
     base.ObjectAdded(value);
     if (value is PlotXAxis && value.Name == this.m_XAxisName)
     {
         this.m_CachedXAxis = (value as PlotXAxis);
     }
     else if (value is PlotYAxis && value.Name == this.m_YAxisName)
     {
         this.m_CachedYAxis = (value as PlotYAxis);
     }
 }
예제 #25
0
        protected override void DrawCustom(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
        {
            Image image;

            if (this.Image != null)
            {
                image = this.Image;
                goto IL_0054;
            }
            if (this.ImageList != null && this.ImageIndex >= 0 && this.ImageIndex < this.ImageList.Images.Count)
            {
                image = this.ImageList.Images[this.ImageIndex];
                goto IL_0054;
            }
            return;

IL_0054:
            int num;
            int num2;

            if (!this.FixedSize)
            {
                if (!base.XYSwapped)
                {
                    num  = base.WidthPixels;
                    num2 = base.HeightPixels;
                }
                else
                {
                    num  = base.HeightPixels;
                    num2 = base.WidthPixels;
                }
            }
            else
            {
                num2 = image.Height;
                num  = image.Width;
            }
            Point     point     = base.XYSwapped ? new Point(base.YPixels, base.XPixels) : new Point(base.XPixels, base.YPixels);
            Rectangle rectangle = iRectangle.FromLTWH(point.X - num / 2, point.Y - num2 / 2, num + 1, num2 + 1);

            if (!base.BoundsClip.IntersectsWith(rectangle))
            {
                base.ClickRegion = null;
            }
            else
            {
                p.Graphics.DrawImageTransparent(image, rectangle);
                base.ClickRegion = this.ToClickRegion(rectangle);
                base.UpdateGrabHandles(rectangle);
            }
        }
예제 #26
0
 protected override void Draw(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
     {
         PlotDataPointCandlestick3 plotDataPointCandlestick = this[i];
         if (!plotDataPointCandlestick.Empty && !plotDataPointCandlestick.Null)
         {
             double   x = plotDataPointCandlestick.X;
             double   widthMinMax;
             PlotFill fillMinMax;
             if (this.DrawCustomDataPointAttributes)
             {
                 widthMinMax = plotDataPointCandlestick.WidthMinMax;
                 fillMinMax  = plotDataPointCandlestick.FillMinMax;
             }
             else
             {
                 widthMinMax = this.WidthMinMax;
                 fillMinMax  = this.FillMinMax;
             }
             this.DrawBlock(p, xAxis, yAxis, fillMinMax, x, plotDataPointCandlestick.Max, plotDataPointCandlestick.Min, this.WidthStyleMinMax, widthMinMax);
             if (this.DrawCustomDataPointAttributes)
             {
                 widthMinMax = plotDataPointCandlestick.WidthStdDev;
                 fillMinMax  = plotDataPointCandlestick.FillStdDev;
             }
             else
             {
                 widthMinMax = this.WidthStdDev;
                 fillMinMax  = this.FillStdDev;
             }
             this.DrawBlock(p, xAxis, yAxis, fillMinMax, x, plotDataPointCandlestick.StdDevPos, plotDataPointCandlestick.StdDevNeg, this.WidthStyleStdDev, widthMinMax);
             if (this.ShowMean)
             {
                 if (this.DrawCustomDataPointAttributes)
                 {
                     widthMinMax = plotDataPointCandlestick.WidthMean;
                     fillMinMax  = plotDataPointCandlestick.FillMean;
                 }
                 else
                 {
                     widthMinMax = this.WidthMean;
                     fillMinMax  = this.FillMean;
                 }
                 double height           = (!this.DrawCustomDataPointAttributes) ? this.ThicknessMean : plotDataPointCandlestick.ThicknessMean;
                 double normalizedHeight = base.GetNormalizedHeight(yAxis, height, this.ThicknessStyleMean);
                 this.DrawBlock(p, xAxis, yAxis, fillMinMax, x, plotDataPointCandlestick.Y + normalizedHeight / 2.0, plotDataPointCandlestick.Y - normalizedHeight / 2.0, this.WidthStyleMean, widthMinMax);
             }
         }
     }
 }
예제 #27
0
        protected void DrawTraceCustomAttributes(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
        {
            PlotDataPointRational plotDataPointRational  = new PlotDataPointRational(this);
            PlotDataPointRational plotDataPointRational2 = new PlotDataPointRational(this);
            double num  = this.GetX(0);
            double num2 = this.GetX(this.Count - 1);

            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.RationalInterpolation(this.Count, num5, out double num6, out double num7);
            double x = num5;
            double y = num6;

            for (int i = num3; i <= num4; i++)
            {
                num5 = base.XAxis.PixelsToValue(i);
                this.RationalInterpolation(this.Count, num5, out num6, out num7);
                int num8 = i - this.m_XPixelMin;
                if (num8 >= 0 && num8 < this.m_PixelYValues.Length)
                {
                    this.m_PixelYValues[i - this.m_XPixelMin] = num6;
                }
                double num9  = num5;
                double num10 = num6;
                base.DataPointInitializing = true;
                plotDataPointRational.X    = x;
                plotDataPointRational.Y    = y;
                plotDataPointRational2.X   = num9;
                plotDataPointRational2.Y   = num10;
                base.DataPointInitializing = false;
                this.DrawLine(p, xAxis, yAxis, this.I_Trace.GetPen(p), plotDataPointRational, plotDataPointRational2, brush);
                x = num9;
                y = num10;
            }
        }
예제 #28
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;
            }
        }
예제 #29
0
        public double GetNormalizedHeight(PlotYAxis yAxis, double height, MagnitudeStyle heightStyle)
        {
            switch (heightStyle)
            {
            case MagnitudeStyle.Value:
                return(height);

            case MagnitudeStyle.Pixel:
                return(yAxis.ScaleDisplay.PixelSpanToValue((int)height));

            default:
                return(yAxis.ScaleDisplay.PercentSpanToValue(height));
            }
        }
예제 #30
0
 protected override void Draw(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis)
 {
     for (int i = this.IndexDrawStart; i <= this.IndexDrawStop; i++)
     {
         PlotDataPointCandlestick1 plotDataPointCandlestick = this[i];
         if (!plotDataPointCandlestick.Empty && !plotDataPointCandlestick.Null)
         {
             double x = plotDataPointCandlestick.X;
             this.DrawBlock(p, xAxis, yAxis, this.FillShadow, x, plotDataPointCandlestick.High, plotDataPointCandlestick.Low, this.WidthStyleShadow, this.WidthShadow);
             PlotFill fill = (!(plotDataPointCandlestick.Close >= plotDataPointCandlestick.Open)) ? this.FillBodyBearish : this.FillBodyBullish;
             this.DrawBlock(p, xAxis, yAxis, fill, x, plotDataPointCandlestick.Open, plotDataPointCandlestick.Close, this.WidthStyleBody, this.WidthBody);
         }
     }
 }