예제 #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
        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);
            }
        }