Ejemplo n.º 1
0
 internal void SetPosition4CircularLabel(CircularAxisLabel label, Boolean isLeft)
 {
     if (isLeft)
     {
         SetPosition4LeftCircularLabel(label);
     }
     else
     {
         SetPosition4RightCircularLabel(label);
     }
 }
Ejemplo n.º 2
0
        private void SetPosition4RightCircularLabel(CircularAxisLabel label)
        {
            Point newPos = new Point(label.Position.X, label.Position.Y);

            if (Math.Round(label.Angle, 1) == Math.Round(Math.PI / 2, 1))
            {
                SetPositionBottom(newPos);
            }
            else if (Math.Round(label.Angle, 1) == Math.Round(3 * Math.PI / 2, 1))
            {
                SetPositionTop(newPos);
            }
            else
            {
                SetPositionRight(newPos);
            }
        }
Ejemplo n.º 3
0
        internal void RearrangeLabelsAtRight(CircularAxisLabel label, Size baseArea, out Point newPos)
        {
            Double left = (Double)Visual.GetValue(Canvas.LeftProperty);
            Double top  = (Double)Visual.GetValue(Canvas.TopProperty);

            if (label.Angle == Math.PI / 2 && top + ActualHeight > baseArea.Height)
            {
                newPos = new Point(label.Position.X, label.Position.Y - (top + ActualHeight - baseArea.Height));
            }
            else if (label.Angle == 3 * Math.PI / 2 && top < 0)
            {
                newPos = new Point(label.Position.X, label.Position.Y + Math.Abs(top));
            }
            else if (left + ActualWidth > baseArea.Width)
            {
                newPos = new Point(label.Position.X - Math.Abs((left + ActualWidth) - baseArea.Width), label.Position.Y);
            }
            else
            {
                newPos = label.Position;
            }
        }
Ejemplo n.º 4
0
 internal void SetPosition4CircularLabel(CircularAxisLabel label, Boolean isLeft)
 {
     if (isLeft)
         SetPosition4LeftCircularLabel(label);
     else
         SetPosition4RightCircularLabel(label);
 }
Ejemplo n.º 5
0
        internal void RearrangeLabelsAtRight(CircularAxisLabel label, Size baseArea, out Point newPos)
        {
            Double left = (Double)Visual.GetValue(Canvas.LeftProperty);
            Double top = (Double)Visual.GetValue(Canvas.TopProperty);

            if (label.Angle == Math.PI / 2 && top + ActualHeight > baseArea.Height)
                newPos = new Point(label.Position.X, label.Position.Y - (top + ActualHeight - baseArea.Height));
            else if (label.Angle == 3 * Math.PI / 2 && top < 0)
                newPos = new Point(label.Position.X, label.Position.Y + Math.Abs(top));
            else if (left + ActualWidth > baseArea.Width)
                newPos = new Point(label.Position.X - Math.Abs((left + ActualWidth) - baseArea.Width), label.Position.Y);
            else
                newPos = label.Position;
        }
Ejemplo n.º 6
0
        private void SetPosition4RightCircularLabel(CircularAxisLabel label)
        {
            Point newPos = new Point(label.Position.X, label.Position.Y);

            if (Math.Round(label.Angle, 1) == Math.Round(Math.PI / 2, 1))
                SetPositionBottom(newPos);
            else if (Math.Round(label.Angle, 1) == Math.Round(3 * Math.PI / 2, 1))
                SetPositionTop(newPos);
            else
                SetPositionRight(newPos);
        }
Ejemplo n.º 7
0
        private void PositionLabelsCircular()
        {
            // set the width of the canvas
            Visual.Width = Width;
            Visual.Height = Height;

            // Calculate Default placement values
            CalculateHorizontalDefaults4CircularAxis(Width, Height);

            List<Point> points = ParentAxis.CircularPlotDetails.ListOfPoints4CircularAxis;

            Double radius = ParentAxis.CircularPlotDetails.Radius;

            Point center = ParentAxis.CircularPlotDetails.Center;

            List<CircularAxisLabel> circularAxisLabels = new List<CircularAxisLabel>();

            for (Int32 i = 0; i < AxisLabelList.Count; i += (ParentAxis.SkipOffset + 1))
            {
                AxisLabel label = AxisLabelList[i];

                CircularAxisLabel clabel = new CircularAxisLabel(points[i], center, radius, radius, label, i);

                label._padding4AxisXLabelInCircularChart = 8;

                if ((clabel.Angle > 3 * Math.PI / 2 && clabel.Angle < 2 * Math.PI - 0.35)
                    || (clabel.Angle > Math.PI + 0.35 && clabel.Angle < 3 * Math.PI / 2))
                {
                    label._padding4AxisYLabelInCircularChart = 4;
                }
                else if ((clabel.Angle > 0.35 && clabel.Angle < Math.PI / 2)
                    || (clabel.Angle > Math.PI / 2 && clabel.Angle < Math.PI - 0.35))
                {
                    label._padding4AxisYLabelInCircularChart = -4;
                }
                
                circularAxisLabels.Add(clabel);
            }

            List<CircularAxisLabel> labelsAtLeft;
            List<CircularAxisLabel> labelsAtRight;

            Axis.GetLeftAndRightLabels(circularAxisLabels, out labelsAtLeft, out labelsAtRight);

            foreach (CircularAxisLabel label in labelsAtLeft)
            {
                label.AxisLabel.SetPosition4CircularLabel(label, true);

                Point newPos;

                label.AxisLabel.RearrangeLabelsAtLeft(label, new Size(Width, Height), out newPos);

                label.NextPosition = newPos;

                Visual.Children.Add(label.AxisLabel.Visual);
            }

            foreach (CircularAxisLabel label in labelsAtRight)
            {
                label.AxisLabel.SetPosition4CircularLabel(label, false);

                Point newPos;

                label.AxisLabel.RearrangeLabelsAtRight(label, new Size(Width, Height), out newPos);

                label.NextPosition = newPos;

                Visual.Children.Add(label.AxisLabel.Visual);
            }

            UpdatePosition4LabelAtMinimumDistance(labelsAtLeft, labelsAtRight);
        }