Beispiel #1
0
        /// <summary>
        /// Gets the tracker text for the specified item.
        /// </summary>
        /// <param name="barItem">The bar/column item.</param>
        /// <param name="item">The bound item.</param>
        /// <param name="categoryIndex">Category index of the item.</param>
        /// <returns>
        /// The tracker text.
        /// </returns>
        protected virtual string GetTrackerText(BarItemBase barItem, object item, int categoryIndex)
        {
            var categoryAxis = this.GetCategoryAxis();
            var valueAxis    = this.GetValueAxis();

            var text = StringHelper.Format(
                this.ActualCulture,
                this.TrackerFormatString,
                item,
                this.Title,
                categoryAxis.FormatValue(categoryIndex),
                valueAxis.GetValue(barItem.Value));

            return(text);
        }
Beispiel #2
0
        /// <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.IsAutomatic())
            {
                actualFillColor = this.ActualFillColor;
                if (item.Value < 0 && !this.NegativeFillColor.IsUndefined())
                {
                    actualFillColor = this.NegativeFillColor;
                }
            }

            rc.DrawClippedRectangleAsPolygon(clippingRect, rect, 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(
                clippingRect,
                new List<ScreenPoint> { lowerErrorPoint, upperErrorPoint },
                0,
                this.StrokeColor,
                this.ErrorStrokeThickness,
                null,
                OxyPenLineJoin.Miter,
                true);

            if (this.ErrorWidth > 0)
            {
                var lowerLeftErrorPoint = this.Transform(leftValue, lowerValue);
                var lowerRightErrorPoint = this.Transform(rightValue, lowerValue);
                rc.DrawClippedLine(
                    clippingRect,
                    new List<ScreenPoint> { lowerLeftErrorPoint, lowerRightErrorPoint },
                    0,
                    this.StrokeColor,
                    this.ErrorStrokeThickness,
                    null,
                    OxyPenLineJoin.Miter,
                    true);

                var upperLeftErrorPoint = this.Transform(leftValue, upperValue);
                var upperRightErrorPoint = this.Transform(rightValue, upperValue);
                rc.DrawClippedLine(
                    clippingRect,
                    new List<ScreenPoint> { upperLeftErrorPoint, upperRightErrorPoint },
                    0,
                    this.StrokeColor,
                    this.ErrorStrokeThickness,
                    null,
                    OxyPenLineJoin.Miter,
                    true);
            }
        }
        /// <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);
        }
Beispiel #5
0
        /// <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);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Gets the tracker text for the specified item.
        /// </summary>
        /// <param name="barItem">The bar/column item.</param>
        /// <param name="item">The bound item.</param>
        /// <param name="categoryIndex">Category index of the item.</param>
        /// <returns>
        /// The tracker text.
        /// </returns>
        protected virtual string GetTrackerText(BarItemBase barItem, object item, int categoryIndex)
        {
            var categoryAxis = this.GetCategoryAxis();
            var valueAxis = this.GetValueAxis();

            var text = StringHelper.Format(
                this.ActualCulture,
                this.TrackerFormatString,
                item,
                this.Title,
                categoryAxis.FormatValue(categoryIndex),
                valueAxis.GetValue(barItem.Value));
            return text;
        }