/// <summary> /// Renders the bar/column item. /// </summary> /// <param name="rc"> /// The render context. /// </param> /// <param name="clippingRect"> /// The clipping rectangle. /// </param> /// <param name="topValue"> /// The end value of the bar. /// </param> /// <param name="categoryValue"> /// The category value. /// </param> /// <param name="actualBarWidth"> /// The actual width of the bar. /// </param> /// <param name="item"> /// The item. /// </param> /// <param name="rect"> /// The rectangle of the bar. /// </param> protected virtual void RenderItem( IRenderContext rc, OxyRect clippingRect, double topValue, double categoryValue, double actualBarWidth, BarItemBase item, OxyRect rect) { // Get the color of the item var actualFillColor = item.Color; if (actualFillColor == null) { actualFillColor = this.ActualFillColor; if (item.Value < 0 && this.NegativeFillColor != null) { actualFillColor = this.NegativeFillColor; } } rc.DrawClippedRectangleAsPolygon( rect, clippingRect, this.GetSelectableFillColor(actualFillColor), this.StrokeColor, this.StrokeThickness); }
/// <summary> /// Renders the bar/column item. /// </summary> /// <param name="rc"> /// The render context. /// </param> /// <param name="clippingRect"> /// The clipping rectangle. /// </param> /// <param name="topValue"> /// The end value of the bar. /// </param> /// <param name="categoryValue"> /// The category value. /// </param> /// <param name="actualBarWidth"> /// The actual width of the bar. /// </param> /// <param name="item"> /// The item. /// </param> /// <param name="rect"> /// The rectangle of the bar. /// </param> protected override void RenderItem( IRenderContext rc, OxyRect clippingRect, double topValue, double categoryValue, double actualBarWidth, BarItemBase item, OxyRect rect) { base.RenderItem(rc, clippingRect, topValue, categoryValue, actualBarWidth, item, rect); var errorItem = item as ErrorColumnItem; if (errorItem == null) { return; } // Render the error var lowerValue = topValue - errorItem.Error; var upperValue = topValue + errorItem.Error; var left = 0.5 - this.ErrorWidth / 2; var right = 0.5 + this.ErrorWidth / 2; var leftValue = categoryValue + (left * actualBarWidth); var middleValue = categoryValue + (0.5 * actualBarWidth); var rightValue = categoryValue + (right * actualBarWidth); var lowerErrorPoint = this.Transform(middleValue, lowerValue); var upperErrorPoint = this.Transform(middleValue, upperValue); rc.DrawClippedLine( new List <ScreenPoint> { lowerErrorPoint, upperErrorPoint }, clippingRect, 0, this.StrokeColor, this.ErrorStrokeThickness, LineStyle.Solid, OxyPenLineJoin.Miter, true); if (this.ErrorWidth > 0) { var lowerLeftErrorPoint = this.Transform(leftValue, lowerValue); var lowerRightErrorPoint = this.Transform(rightValue, lowerValue); rc.DrawClippedLine( new List <ScreenPoint> { lowerLeftErrorPoint, lowerRightErrorPoint }, clippingRect, 0, this.StrokeColor, this.ErrorStrokeThickness, LineStyle.Solid, OxyPenLineJoin.Miter, true); var upperLeftErrorPoint = this.Transform(leftValue, upperValue); var upperRightErrorPoint = this.Transform(rightValue, upperValue); rc.DrawClippedLine( new List <ScreenPoint> { upperLeftErrorPoint, upperRightErrorPoint }, clippingRect, 0, this.StrokeColor, this.ErrorStrokeThickness, LineStyle.Solid, OxyPenLineJoin.Miter, true); } }