예제 #1
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue, double high, double low, double open, double close)
        {
            base.CheckForValidNextX(x);
            PlotDataPointCandlestick2 plotDataPointCandlestick = (PlotDataPointCandlestick2)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 normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthBody, this.WidthStyleBody);
                    base.XAxis.Tracking.NewData(x - normalizedWidth / 2.0);
                    base.XAxis.Tracking.NewData(x + normalizedWidth / 2.0);
                    if (this.ShowOpen)
                    {
                        normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthOpen, this.WidthStyleOpen);
                        base.XAxis.Tracking.NewData(x - normalizedWidth);
                    }
                    if (this.ShowClose)
                    {
                        normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthClose, this.WidthStyleClose);
                        base.XAxis.Tracking.NewData(x + normalizedWidth);
                    }
                }
            }
            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);
        }
예제 #2
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);
         }
     }
 }
예제 #3
0
 protected void DrawBody(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis, PlotDataPointCandlestick2 dataPoint)
 {
     if (!this.FillBody.NotDrawVisible)
     {
         double normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthBody, this.WidthStyleBody);
         int    num             = xAxis.ScaleDisplay.ValueToPixels(dataPoint.X - normalizedWidth / 2.0);
         int    num2            = xAxis.ScaleDisplay.ValueToPixels(dataPoint.X + normalizedWidth / 2.0);
         int    top             = yAxis.ScaleDisplay.ValueToPixels(dataPoint.High);
         int    bottom          = yAxis.ScaleDisplay.ValueToPixels(dataPoint.Low);
         if (num == num2)
         {
             num2++;
         }
         Rectangle r = iRectangle.FromLTRB(base.XYSwapped, num, top, num2, bottom);
         this.I_FillBody.Draw(p, r);
     }
 }
예제 #4
0
 protected void DrawOpenClose(PaintArgs p, PlotXAxis xAxis, PlotYAxis yAxis, PlotDataPointCandlestick2 dataPoint)
 {
     if (this.ShowOpen)
     {
         double normalizedWidth  = base.GetNormalizedWidth(xAxis, this.WidthOpen, this.WidthStyleOpen);
         double normalizedHeight = base.GetNormalizedHeight(yAxis, this.HeightOpen, this.HeightStyleOpen);
         int    num  = xAxis.ScaleDisplay.ValueToPixels(dataPoint.X - normalizedWidth);
         int    num2 = xAxis.ScaleDisplay.ValueToPixels(dataPoint.X);
         int    num3 = yAxis.ScaleDisplay.ValueToPixels(dataPoint.Open - normalizedHeight / 2.0);
         int    num4 = yAxis.ScaleDisplay.ValueToPixels(dataPoint.Open + normalizedHeight / 2.0);
         if (num == num2)
         {
             num2++;
         }
         if (num3 == num4)
         {
             num4++;
         }
         Rectangle r = iRectangle.FromLTRB(base.XYSwapped, num, num3, num2, num4);
         this.I_FillOpen.Draw(p, r);
     }
     if (this.ShowClose)
     {
         double normalizedWidth  = base.GetNormalizedWidth(xAxis, this.WidthClose, this.WidthStyleClose);
         double normalizedHeight = base.GetNormalizedHeight(yAxis, this.HeightClose, this.HeightStyleClose);
         int    num  = xAxis.ScaleDisplay.ValueToPixels(dataPoint.X);
         int    num2 = xAxis.ScaleDisplay.ValueToPixels(dataPoint.X + normalizedWidth);
         int    num3 = yAxis.ScaleDisplay.ValueToPixels(dataPoint.Close - normalizedHeight / 2.0);
         int    num4 = yAxis.ScaleDisplay.ValueToPixels(dataPoint.Close + normalizedHeight / 2.0);
         if (num == num2)
         {
             num2++;
         }
         if (num3 == num4)
         {
             num4++;
         }
         Rectangle r = iRectangle.FromLTRB(base.XYSwapped, num, num3, num2, num4);
         this.I_FillClose.Draw(p, r);
     }
 }