/// <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); }); }
public void PaintLevels(Graphics canvas, Rectangle rectPaint, decimal MaxPrice, decimal MinPrice) { if (this.CollectionLevels == null) { return; } this.CountLevels = this.CollectionLevels.Count(); if (this.CountLevels == 0) { return; } foreach (var valLevel in this.CollectionLevels) { //***************************** this.PaintOneLevel(canvas, rectPaint, valLevel, MaxPrice, MinPrice); } GraphicShape.PaintLine(canvas, new Point(rectPaint.X, rectPaint.Y), new Point(rectPaint.X, rectPaint.Y + rectPaint.Height), Color.Black); GraphicShape.PaintText(canvas, "min:" + this.Min.ToString(), rectPaint.X, rectPaint.Y + rectPaint.Height - 12, Color.Black); GraphicShape.PaintText(canvas, "max:" + this.Max.ToString(), rectPaint.X, rectPaint.Y + 1, Color.Black); }