예제 #1
0
        private void UpdateHighlightPath(PieDataPoint dataPoint, PieUpdateContext updateContext)
        {
            DoughnutSegmentData segment = new DoughnutSegmentData()
            {
                Center         = new RadPoint(updateContext.Center.X, updateContext.Center.Y),
                Radius1        = updateContext.Radius,
                Radius2        = updateContext.Radius * this.ParentSeries.HighlightInnerRadiusFactor,
                StartAngle     = updateContext.StartAngle,
                SweepAngle     = dataPoint.SweepAngle,
                SweepDirection = updateContext.SweepDirection
            };

            this.highlightPath.Data = DoughnutSegmentRenderer.Render(dataPoint, segment);
        }
예제 #2
0
        private static Geometry BuildRadialStripe(RadCircle circle, RadCircle previousCircle)
        {
            DoughnutSegmentData segment = new DoughnutSegmentData()
            {
                Center     = new RadPoint(circle.Center.X + 0.5, circle.Center.Y + 0.5),
                Radius1    = circle.Radius + 0.5,
                Radius2    = previousCircle.Radius - 0.5,
                StartAngle = 0,
                SweepAngle = 359.99 // 360 does not render properly
            };

            if (segment.Radius1 < 0)
            {
                segment.Radius1 = 0;
            }
            if (segment.Radius2 < 0)
            {
                segment.Radius2 = 0;
            }

            return(DoughnutSegmentRenderer.RenderArc(segment));
        }
예제 #3
0
        protected override void UpdateCore(PieDataPoint dataPoint, PieUpdateContext context)
        {
            var doughnutContext = context as DoughnutUpdateContext;

            if (doughnutContext != null)
            {
                var segmentData          = DoughnutSegment.GetSegmentData(dataPoint, doughnutContext);
                var highlightSegmentData = DoughnutSegment.GetSegmentData(dataPoint, doughnutContext);
                highlightSegmentData.Radius2 = 0.9 * context.Radius;

                if (context.SweepDirection == SweepDirection.Clockwise)
                {
                    context.StartAngle += dataPoint.SweepAngle;
                }
                else
                {
                    context.StartAngle -= dataPoint.SweepAngle;
                }

                this.Path.Data          = DoughnutSegmentRenderer.Render(dataPoint, segmentData);
                this.HighlightPath.Data = DoughnutSegmentRenderer.Render(dataPoint, highlightSegmentData);

                var doughnutPoint = dataPoint as DoughnutDataPoint;

                if (doughnutPoint != null)
                {
                    doughnutPoint.Radius      = doughnutContext.Radius;
                    doughnutPoint.InnerRadius = doughnutContext.Radius * doughnutContext.InnerRadiusFactor;
                    doughnutPoint.CenterPoint = doughnutContext.Center;
                }
            }
            else
            {
                base.UpdateCore(dataPoint, context);
            }
        }