Пример #1
0
        /// <summary>
        /// When the HasSmallArc DO is set, all labels should be re-arranged.
        /// </summary>
        private static void HasSmallArcPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            PieChartLabelArea labelArea = obj as PieChartLabelArea;

            if (labelArea != null)
            {
                foreach (PieChartLabel label in labelArea.Children.OfType <PieChartLabel>())
                {
                    label.InvalidateArrange();
                }
            }
        }
        /// <summary>
        /// If at least one arc is small, all labels are displayed connected by a line. Otherwise, they're positioned
        /// in the arc midpoint.
        /// </summary>
        private void PositionAuto()
        {
            Chart chart = TreeHelper.FindAncestor <Chart>(this);

            if (chart != null)
            {
                PieChartLabelArea labelArea = chart.Template.FindName("LabelArea_PART", chart) as PieChartLabelArea;
                if (labelArea != null && labelArea.HasSmallArc)
                {
                    this.PositionConnected();
                }
                else
                {
                    this.PositionArcMidpoint();
                }
            }
        }