Пример #1
0
        protected Brush GetStrokeBySlice(PieSliceVal slice)
        {
            Color c = this.predefinedColors.Length > slice.Index
                ? predefinedColors[slice.Index]
                : Colors.Black;

            return(new SolidColorBrush {
                Color = c
            });
        }
Пример #2
0
        protected ArcSegment GetArc(double radius, double angle, PieSliceVal slice, SweepDirection direction = SweepDirection.Clockwise)
        {
            var arcSegment = new ArcSegment();
            var endOfArc   = ToPoint(angle, radius);

            arcSegment.IsLargeArc     = slice.Value >= 180.0;
            arcSegment.Point          = endOfArc;
            arcSegment.Size           = new Size(radius, radius);
            arcSegment.SweepDirection = direction;
            arcSegment.IsSmoothJoin   = true;
            return(arcSegment);
        }
Пример #3
0
        protected void SetStyle(Path path, PieSliceVal slice)
        {
            var style = GetStyle(slice, path);

            if (style != null)
            {
                path.Style = style;
            }
            else
            {
                path.Stroke = GetStrokeBySlice(slice);
                path.Fill   = GetFillBySlice(slice);
            }
        }
Пример #4
0
        private Brush GetStrokeBySlice(PieSliceVal slice)
        {
            if (this.sliceStrokes.Length > slice.Index)
            {
                return(this.sliceStrokes[slice.Index]);
            }
            if (SliceStroke != null)
            {
                return(SliceStroke);
            }
            Color c = this.predefinedColors.Length > slice.Index
                ? predefinedColors[slice.Index]
                : Colors.Black;

            return(new SolidColorBrush {
                Color = c
            });
        }
Пример #5
0
 private Style GetStyle(PieSliceVal slice, Path path)
 {
     return(SliceStyleSelector?.SelectStyle(slice.Index, path));
 }
Пример #6
0
 private string GetToolTip(PieSliceVal slice)
 {
     return(!string.IsNullOrEmpty(ToolTipFormattingString) ? string.Format(ToolTipFormattingString, CalcPercentage(slice.Value)) : CalcPercentage(slice.Value).ToString(CultureInfo.InvariantCulture));
 }