Пример #1
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);
             }
         }
     }
 }
Пример #2
0
        private int AddXY(double x, double y, bool nullValue, bool emptyValue, double max, double min, double stdDevPos, double stdDevNeg)
        {
            base.CheckForValidNextX(x);
            PlotDataPointCandlestick3 plotDataPointCandlestick = (PlotDataPointCandlestick3)base.m_Data.AddNew();

            base.DataPointInitializing = true;
            try
            {
                plotDataPointCandlestick.X             = x;
                plotDataPointCandlestick.Y             = y;
                plotDataPointCandlestick.Null          = nullValue;
                plotDataPointCandlestick.Empty         = emptyValue;
                plotDataPointCandlestick.Max           = max;
                plotDataPointCandlestick.Min           = min;
                plotDataPointCandlestick.StdDevPos     = stdDevPos;
                plotDataPointCandlestick.StdDevNeg     = stdDevNeg;
                plotDataPointCandlestick.WidthMinMax   = this.WidthMinMax;
                plotDataPointCandlestick.WidthStdDev   = this.WidthStdDev;
                plotDataPointCandlestick.WidthMean     = this.WidthMean;
                plotDataPointCandlestick.ThicknessMean = this.ThicknessMean;
            }
            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.WidthMinMax, this.WidthStyleMinMax);
                    if (normalizedWidth > num)
                    {
                        num = normalizedWidth;
                    }
                    normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthStdDev, this.WidthStyleStdDev);
                    if (normalizedWidth > num)
                    {
                        num = normalizedWidth;
                    }
                    if (this.ShowMean)
                    {
                        normalizedWidth = base.GetNormalizedWidth(xAxis, this.WidthMean, this.WidthStyleMean);
                        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(max);
                    base.YAxis.Tracking.NewData(min);
                }
            }
            this.DoDataChange();
            return(base.m_Data.LastNewDataPointIndex);
        }