Esempio n. 1
0
        private void OnAxisPlacementChanged(IAxisNS obj)
        {
            var axis = obj as UIElement;

            switch (obj.Orientation)
            {
            case AxisType.X:
                Grid.SetColumn(axis, 1);
                switch (obj.Placement)
                {
                case AxisPlacement.Bottom:
                    Grid.SetRow(axis, 2);
                    break;

                case AxisPlacement.Top:
                    Grid.SetRow(axis, 0);
                    break;

                default:
                    throw new NotSupportedException($"XAxis does not support '{obj.Placement}' placement!");
                }
                break;

            case AxisType.Y:
                Grid.SetRow(axis, 1);

                switch (obj.Placement)
                {
                case AxisPlacement.Left:
                    Grid.SetColumn(axis, 0);
                    break;

                case AxisPlacement.Right:
                    Grid.SetColumn(axis, 2);
                    break;

                default:
                    throw new NotSupportedException($"YAxis does not support '{obj.Placement}' placement!");
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 2
0
        private void OnYAxisPropertyChanged(IAxisNS oldValue, IAxisNS newValue)
        {
            if (newValue is ICategoryAxis)
            {
                throw new MvvmChartException("CategoryAxis cannot be used as YAxis!");
            }

            if (this.PART_Root == null)
            {
                return;
            }

            if (oldValue != null)
            {
                this.PART_Root.Children.Remove(oldValue as UIElement);
                oldValue.AxisPlacementChanged -= OnAxisPlacementChanged;
            }

            if (newValue != null)
            {
                if (this.PART_Root.Children.Contains(newValue as UIElement))
                {
                    return;
                }

                if (newValue.Placement == AxisPlacement.None)
                {
                    newValue.Placement = AxisPlacement.Left;
                }


                this.PART_Root.Children.Add(newValue as UIElement);
                newValue.Owner                 = this;
                newValue.Orientation           = AxisType.Y;
                newValue.AxisPlacementChanged += OnAxisPlacementChanged;
                OnAxisPlacementChanged(newValue);
            }
        }
Esempio n. 3
0
        private void OnXAxisPropertyChanged(IAxisNS oldValue, IAxisNS newValue)
        {
            if (this.PART_Root == null)
            {
                return;
            }

            if (oldValue != null)
            {
                this.PART_Root.Children.Remove(oldValue as UIElement);
                oldValue.AxisPlacementChanged -= OnAxisPlacementChanged;
            }

            if (newValue != null)
            {
                if (this.Part_SeriesCollectionControl != null)
                {
                    this.Part_SeriesCollectionControl.IsXAxisCategory = newValue is ICategoryAxis;
                }


                if (this.PART_Root.Children.Contains(newValue as UIElement))
                {
                    return;
                }
                if (newValue.Placement == AxisPlacement.None)
                {
                    newValue.Placement = AxisPlacement.Bottom;
                }

                this.PART_Root.Children.Add(newValue as UIElement);
                newValue.Owner                 = this;
                newValue.Orientation           = AxisType.X;
                newValue.AxisPlacementChanged += OnAxisPlacementChanged;
                OnAxisPlacementChanged(newValue);
            }
        }