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); }
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); } } }