Ejemplo n.º 1
0
        protected Brush GetStrokeBySlice(PieSliceVal slice)
        {
            Color c = this.predefinedColors.Length > slice.Index
                ? predefinedColors[slice.Index]
                : Colors.Black;

            return(new SolidColorBrush {
                Color = c
            });
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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
            });
        }
Ejemplo n.º 5
0
 private Style GetStyle(PieSliceVal slice, Path path)
 {
     return(SliceStyleSelector?.SelectStyle(slice.Index, path));
 }
Ejemplo n.º 6
0
 private string GetToolTip(PieSliceVal slice)
 {
     return(!string.IsNullOrEmpty(ToolTipFormattingString) ? string.Format(ToolTipFormattingString, CalcPercentage(slice.Value)) : CalcPercentage(slice.Value).ToString(CultureInfo.InvariantCulture));
 }