Beispiel #1
0
 /// <summary>
 /// Gets the fill color of the given <see cref="HistogramItem"/>.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>The fill color of the item.</returns>
 protected OxyColor GetItemFillColor(HistogramItem item)
 {
     if (!item.Color.IsAutomatic())
     {
         return(item.Color);
     }
     else
     {
         return(this.ColorMapping(item));
     }
 }
Beispiel #2
0
 /// <summary>
 /// Gets the default color for a HistogramItem.
 /// </summary>
 /// <returns>The default color.</returns>
 private OxyColor GetDefaultColor(HistogramItem item)
 {
     return(this.ActualFillColor);
 }
Beispiel #3
0
        /// <summary>
        /// Draws the label.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="clippingRect">The clipping rectangle.</param>
        /// <param name="rect">The column rectangle.</param>
        /// <param name="item">The item.</param>
        protected void RenderLabel(IRenderContext rc, OxyRect clippingRect, OxyRect rect, HistogramItem item)
        {
            var               s = StringHelper.Format(this.ActualCulture, this.LabelFormatString, item, item.Value);
            DataPoint         dp;
            VerticalAlignment va;
            var               ha = HorizontalAlignment.Center;

            var midX = (item.RangeStart + item.RangeEnd) / 2;
            var sign = Math.Sign(item.Value);
            var dy   = sign * this.LabelMargin;

            switch (this.LabelPlacement)
            {
            case LabelPlacement.Inside:
                dp = new DataPoint(midX, item.Value);
                va = (VerticalAlignment)(-sign);
                break;

            case LabelPlacement.Middle:
                var p1 = this.InverseTransform(rect.TopLeft);
                var p2 = this.InverseTransform(rect.BottomRight);
                dp = new DataPoint(midX, (p1.Y + p2.Y) / 2);
                va = VerticalAlignment.Middle;
                break;

            case LabelPlacement.Base:
                dp = new DataPoint(midX, 0);
                dy = -dy;
                va = (VerticalAlignment)sign;
                break;

            case LabelPlacement.Outside:
                dp = new DataPoint(midX, item.Value);
                dy = -dy;
                va = (VerticalAlignment)sign;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            this.Orientate(ref ha, ref va);
            var sp = this.Transform(dp) + this.Orientate(new ScreenVector(0, dy));

            rc.DrawClippedText(
                clippingRect,
                sp,
                s,
                this.ActualTextColor,
                this.ActualFont,
                this.ActualFontSize,
                this.ActualFontWeight,
                0,
                ha,
                va);
        }
Beispiel #4
0
 /// <summary>
 /// Gets the fill color of the given <see cref="HistogramItem"/>.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>The fill color of the item.</returns>
 protected OxyColor GetItemFillColor(HistogramItem item)
 {
     return(item.Color.IsAutomatic() ? this.ColorMapping(item) : item.Color);
 }
Beispiel #5
0
 /// <summary>
 /// The default color mapping.
 /// </summary>
 private OxyColor defaultColorMapping(HistogramItem item) => this.ActualFillColor;