/// <summary>Отрисовка перекрестья</summary> /// <param name="coord"></param> void PaintCrossLines(Point coord, Candles.DataCandle candle) { if (candle.IsNull()) { return; } string d = candle.Candle.Time.Day.ToString(); string m = candle.Candle.Time.Month.ToString(); string y = candle.Candle.Time.Year.ToString(); string min = candle.Candle.Time.Minute.ToString(); string hour = candle.Candle.Time.Hour.ToString(); string time = (d.Length < 2 ? '0' + d : d) + "." + (m.Length < 2 ? '0' + m : m) + "." + y + " " + (hour.Length < 2 ? '0' + hour : hour) + ":" + (min.Length < 2 ? '0' + min : min) + " (" + candle.Description + ")"; //GraphicShape.PaintLine(this.Canvas, new Point(coord.X, 0), new Point(coord.X, 1000), Color.Black); decimal priceY = GraphicShape.GetValueFromCoordinate(this.RectAllTop.Height, this.MaxPrice, this.MinPrice, coord.Y, this.PanelPrices.CountFloat); GraphicShape.PaintVLine(this.Canvas, this.RectAllTop, time, new Point(coord.X, 0), new Point(coord.X, this.RectAllTop.Height), Color.Black); GraphicShape.PaintHLine(this.Canvas, this.RectAllTop, priceY, this.MaxPrice, this.MinPrice, Color.Black); }
/// <summary> Рисует объемы по активной свечке </summary> private void PaintHorVolByCandle(Graphics canvas, Candles.DataCandle activeCandle, Point crossLines) { if (activeCandle.Candle.HorVolumes.HVolCollection.Count == 0) { return; } Rectangle rectPaint = new Rectangle(); rectPaint.X = activeCandle.TailCoord.High.X + 1; rectPaint.Width = 30 * 2; rectPaint.Y = activeCandle.TailCoord.High.Y; rectPaint.Height = activeCandle.TailCoord.Low.Y - rectPaint.Y; long MaxVol = activeCandle.Candle.HorVolumes.HVolCollection.CollectionArray.Max(e => e.VolBuy + e.VolSell); long MinVol = 0; SolidBrush solidBrush = new SolidBrush(Color.LightGray); canvas.FillRectangle(solidBrush, rectPaint); activeCandle.Candle.HorVolumes.HVolCollection.CollectionArray.ForEach <MarketObject.ChartVol>((hv) => { int y = GraphicShape.GetCoordinate(this.RectAllTop.Height, this.MaxPrice, this.MinPrice, hv.Price); int x2 = (int)GraphicShape.GetCoordinate(rectPaint.Width, MaxVol, MinVol, hv.VolBuy + hv.VolSell); var p1 = new Point(rectPaint.X, y); var p2 = new Point(rectPaint.X + rectPaint.Width - x2, y); if (hv.VolBuy + hv.VolSell == MaxVol) { GraphicShape.PaintText(canvas, MaxVol.ToString(), activeCandle.TailCoord.High.X, activeCandle.TailCoord.High.Y - 11, Color.Blue); } if (crossLines.Y + 5 > y && crossLines.Y - 5 < y) { decimal priceY = GraphicShape.GetValueFromCoordinate(this.RectAllTop.Height, this.MaxPrice, this.MinPrice, crossLines.Y, this.PanelPrices.CountFloat); if (hv.Price == priceY) { activeCandle.Description = (hv.VolBuy + hv.VolSell).ToString(); } } GraphicShape.PaintLine(canvas, p1, p2, Color.Blue, 2); }); }