public override void Plot(Graphics graphics, Rectangle bounds, double min, double max) { if (Bars == null) { return; } byte bRed = (byte)~(ChartControl.BackColor.R); byte bGreen = (byte)~(ChartControl.BackColor.G); byte bBlue = (byte)~(ChartControl.BackColor.B); Color borderColor = Color.FromArgb(bRed, bGreen, bBlue); if (lineWidth > 0) { // draw back lines Pen linePen = new Pen(lineBrush, lineWidth); double lineSpace = 100; { double y = (bounds.Y + bounds.Height) - ((0 - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height; graphics.DrawLine(linePen, ChartControl.CanvasLeft, (int)y, ChartControl.CanvasRight, (int)y); } while (max > lineSpace || min < lineSpace * -1) { double y = (bounds.Y + bounds.Height) - ((lineSpace - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height; graphics.DrawLine(linePen, ChartControl.CanvasLeft, (int)y, ChartControl.CanvasRight, (int)y); y = (bounds.Y + bounds.Height) - (((lineSpace * -1) - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height; graphics.DrawLine(linePen, ChartControl.CanvasLeft, (int)y, ChartControl.CanvasRight, (int)y); lineSpace += 100; } } int bars = ChartControl.BarsPainted; int barPaintWidth = ChartControl.ChartStyle.GetBarPaintWidth(ChartControl.BarWidth); if (ChartControl.LastBarPainted - ChartControl.BarsPainted + 1 + bars - Bars.Count != 0) { bars--; } while (bars >= 0) { int index = ((ChartControl.LastBarPainted - ChartControl.BarsPainted) + 1) + bars; if (ChartControl.ShowBarsRequired || index - Displacement >= BarsRequired) { try { double cciVal = CciPlot.Get(index); int x = (((ChartControl.CanvasRight - ChartControl.BarMarginRight) - (barPaintWidth / 2)) - ((ChartControl.BarsPainted - 1) * ChartControl.BarSpace)) + (bars * ChartControl.BarSpace); int y1 = (bounds.Y + bounds.Height) - ((int)(((cciVal - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height)); double alertVal = dotSeries.Get(index); if (!double.IsNaN(alertVal) && !double.IsNaN(cciVal)) { int y = (bounds.Y + bounds.Height) - ((int)(((0 - min) / ChartControl.MaxMinusMin(max, min)) * bounds.Height)); Color dotColor = Color.Transparent; if (Math.Abs(1 - alertVal) < double.Epsilon) { dotColor = ChartControl.ChartStyle.UpColor; } else if (Math.Abs(-1 - alertVal) < double.Epsilon) { dotColor = ChartControl.ChartStyle.DownColor; } else if (Math.Abs(2 - alertVal) < double.Epsilon) { dotColor = Color.Gray; } if (dotColor != Color.Transparent) { int barOffset = (int)((double)(barWidth - 1) / 2); // draw bars if (y1 - y > 0) { graphics.FillRectangle(new SolidBrush(dotColor), x - barOffset, y, barWidth, y1 - y); } else { graphics.FillRectangle(new SolidBrush(dotColor), x - barOffset, y1, barWidth, y - y1); } if (showDots) { // draw dots SmoothingMode smoothingMode = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.AntiAlias; Pen pen = new Pen(borderColor, 7) { DashStyle = DashStyle.Dot, DashCap = DashCap.Round }; graphics.DrawPie(pen, x - 1, y, 2, 2, 0, 360); pen = new Pen(dotColor, 5) { DashStyle = DashStyle.Dot, DashCap = DashCap.Round }; graphics.DrawRectangle(pen, x - 2, y - 1, 2, 2); graphics.SmoothingMode = smoothingMode; } } } } catch (Exception) { } } bars--; } // Default plotting in base class. base.Plot(graphics, bounds, min, max); }