protected override void DrawColumn2D(ChartGraphics graph, Axis vAxis, RectangleF rectSize, DataPoint point, Series ser) { double num = double.Parse(((DataPointAttributes)ser)["CurrentBoxSize"], CultureInfo.InvariantCulture); double logValue = vAxis.GetLogValue(vAxis.GetViewMinimum()); logValue = vAxis.GetLinearPosition(logValue); logValue = Math.Abs(logValue - vAxis.GetLinearPosition(vAxis.GetLogValue(vAxis.GetViewMinimum() + num))); Math.Floor((double)graph.GetAbsoluteSize(new SizeF((float)logValue, (float)logValue)).Height); for (float num2 = rectSize.Y; num2 < rectSize.Bottom - (float)(logValue - logValue / 4.0); num2 += (float)logValue) { RectangleF rectangleF = RectangleF.Empty; rectangleF.X = rectSize.X; rectangleF.Y = num2; rectangleF.Width = rectSize.Width; rectangleF.Height = (float)logValue; rectangleF = graph.GetAbsoluteRectangle(rectangleF); int num3 = 1 + point.BorderWidth / 2; rectangleF.Y += (float)num3; rectangleF.Height -= (float)(2 * num3); RectangleF position = new RectangleF(rectangleF.Location, rectangleF.Size); position.Offset((float)ser.ShadowOffset, (float)ser.ShadowOffset); if (point.IsAttributeSet("PriceUpPoint")) { if (ser.ShadowOffset != 0) { graph.shadowDrawingMode = true; graph.DrawLineAbs(ser.ShadowColor, point.BorderWidth, ChartDashStyle.Solid, new PointF(position.Left, position.Top), new PointF(position.Right, position.Bottom)); graph.DrawLineAbs(ser.ShadowColor, point.BorderWidth, ChartDashStyle.Solid, new PointF(position.Left, position.Bottom), new PointF(position.Right, position.Top)); graph.shadowDrawingMode = false; } graph.DrawLineAbs(point.Color, point.BorderWidth, ChartDashStyle.Solid, new PointF(rectangleF.Left, rectangleF.Top), new PointF(rectangleF.Right, rectangleF.Bottom)); graph.DrawLineAbs(point.Color, point.BorderWidth, ChartDashStyle.Solid, new PointF(rectangleF.Left, rectangleF.Bottom), new PointF(rectangleF.Right, rectangleF.Top)); } else { if (ser.ShadowOffset != 0) { graph.shadowDrawingMode = true; graph.DrawCircleAbs(new Pen(ser.ShadowColor, (float)point.BorderWidth), null, position, 1, false); graph.shadowDrawingMode = false; } graph.DrawCircleAbs(new Pen(point.Color, (float)point.BorderWidth), null, rectangleF, 1, false); } } }
/// <summary> /// Draws 2D column using 'X' or 'O' symbols. /// </summary> /// <param name="graph">Chart graphics.</param> /// <param name="vAxis">Vertical axis.</param> /// <param name="rectSize">Column position and size.</param> /// <param name="point">Column data point.</param> /// <param name="ser">Column series.</param> protected override void DrawColumn2D( ChartGraphics graph, Axis vAxis, RectangleF rectSize, DataPoint point, Series ser) { // Get box size double boxSize = double.Parse(ser["CurrentBoxSize"], CultureInfo.InvariantCulture); double boxSizeRel = vAxis.GetLogValue(vAxis.ViewMinimum); boxSizeRel = vAxis.GetLinearPosition(boxSizeRel); boxSizeRel = Math.Abs(boxSizeRel - vAxis.GetLinearPosition(vAxis.GetLogValue(vAxis.ViewMinimum + boxSize))); // Draw a series of Xs or Os for (float positionY = rectSize.Y; positionY < rectSize.Bottom - (float)(boxSizeRel - boxSizeRel / 4.0); positionY += (float)boxSizeRel) { // Get position of symbol RectangleF position = RectangleF.Empty; position.X = rectSize.X; position.Y = positionY; position.Width = rectSize.Width; position.Height = (float)boxSizeRel; // Get absolute position and add 1 pixel spacing position = graph.GetAbsoluteRectangle(position); int spacing = 1 + point.BorderWidth / 2; position.Y += spacing; position.Height -= 2 * spacing; // Calculate shadow position RectangleF shadowPosition = new RectangleF(position.Location, position.Size); shadowPosition.Offset(ser.ShadowOffset, ser.ShadowOffset); if (point.IsCustomPropertySet("PriceUpPoint")) { // Draw shadow if (ser.ShadowOffset != 0) { graph.DrawLineAbs( ser.ShadowColor, point.BorderWidth, ChartDashStyle.Solid, new PointF(shadowPosition.Left, shadowPosition.Top), new PointF(shadowPosition.Right, shadowPosition.Bottom)); graph.DrawLineAbs( ser.ShadowColor, point.BorderWidth, ChartDashStyle.Solid, new PointF(shadowPosition.Left, shadowPosition.Bottom), new PointF(shadowPosition.Right, shadowPosition.Top)); } // Draw 'X' symbol graph.DrawLineAbs( point.Color, point.BorderWidth, ChartDashStyle.Solid, new PointF(position.Left, position.Top), new PointF(position.Right, position.Bottom)); graph.DrawLineAbs( point.Color, point.BorderWidth, ChartDashStyle.Solid, new PointF(position.Left, position.Bottom), new PointF(position.Right, position.Top)); } else { // Draw circles when price is dropping if (ser.ShadowOffset != 0) { graph.DrawCircleAbs( new Pen(ser.ShadowColor, point.BorderWidth), null, shadowPosition, 1, false); } // Draw 'O' symbol graph.DrawCircleAbs( new Pen(point.Color, point.BorderWidth), null, position, 1, false); } } }