Пример #1
0
        private static void VerifyAxisType(AxisPlacement axisPlacement, AxisType axisType)
        {
            bool result = false;

            switch (axisPlacement)
            {
            case AxisPlacement.Left:
            case AxisPlacement.Right:
                result = axisType == AxisType.Vertical;
                break;

            case AxisPlacement.Top:
            case AxisPlacement.Bottom:
                result = axisType == AxisType.Horizontal;
                break;

            default:
                break;
            }

            if (!result)
            {
                throw new ArgumentException(Properties.Resources.InvalidAxisPlacement);
            }
        }
Пример #2
0
 protected override void ValidatePlacement(AxisPlacement newPlacement)
 {
     if (newPlacement == AxisPlacement.Left || newPlacement == AxisPlacement.Right)
     {
         throw new ArgumentException(Strings.Exceptions.HorizontalAxisCannotBeVertical);
     }
 }
Пример #3
0
 protected override void ValidatePlacement(AxisPlacement newPlacement)
 {
     if (newPlacement == AxisPlacement.Bottom || newPlacement == AxisPlacement.Top)
     {
         throw new ArgumentException();
     }
 }
Пример #4
0
        protected Panel GetPanelByPlacement(AxisPlacement placement)
        {
            Panel panel = null;

            switch (placement)
            {
            case AxisPlacement.Left:
                panel = ParentPlotter.LeftPanel;
                break;

            case AxisPlacement.Right:
                panel = ParentPlotter.RightPanel;
                break;

            case AxisPlacement.Top:
                panel = ParentPlotter.TopPanel;
                break;

            case AxisPlacement.Bottom:
                panel = ParentPlotter.BottomPanel;
                break;

            default:
                break;
            }
            return(panel);
        }
Пример #5
0
 protected override void ValidatePlacement(AxisPlacement newPlacement)
 {
     if (newPlacement == AxisPlacement.Left || newPlacement == AxisPlacement.Right)
     {
         throw new ArgumentException();
     }
 }
 /// <summary>
 /// Validates the placement - e.g., vertical axis should not be placed from top or bottom, etc.
 /// If proposed placement is wrong, throws an ArgumentException.
 /// </summary>
 /// <param name="newPlacement">The new placement.</param>
 protected override void ValidatePlacement(AxisPlacement newPlacement)
 {
     if (newPlacement == AxisPlacement.Bottom || newPlacement == AxisPlacement.Top)
     {
         throw new ArgumentException(Strings.Exceptions.VerticalAxisCannotBeHorizontal);
     }
 }
Пример #7
0
        private void SetListeningPanel()
        {
            if (plotter == null)
            {
                return;
            }

            AxisPlacement placement = Placement;

            switch (placement)
            {
            case AxisPlacement.Left:
                listeningPanel = plotter.LeftPanel;
                break;

            case AxisPlacement.Right:
                listeningPanel = plotter.RightPanel;
                break;

            case AxisPlacement.Top:
                listeningPanel = plotter.TopPanel;
                break;

            case AxisPlacement.Bottom:
                listeningPanel = plotter.BottomPanel;
                break;

            default:
                break;
            }
        }
        private Panel GetPanelByPlacement(AxisPlacement oldPlacement)
        {
            Panel panel = null;

            switch (oldPlacement)
            {
            case AxisPlacement.Left:
                panel = Plotter.LeftPanel;
                break;

            case AxisPlacement.Right:
                panel = Plotter.RightPanel;
                break;

            case AxisPlacement.Top:
                panel = Plotter.TopPanel;
                break;

            case AxisPlacement.Bottom:
                panel = Plotter.BottomPanel;
                break;

            default:
                break;
            }
            return(panel);
        }
 public static ChangeType GetZoomChangeType(this AxisPlacement placement)
 {
     if (placement.IsHorizontal())
     {
         return(ChangeType.ZoomX);
     }
     else
     {
         return(ChangeType.ZoomY);
     }
 }
 public static ChangeType GetPanChangeType(this AxisPlacement placement)
 {
     if (placement.IsHorizontal())
     {
         return(ChangeType.PanX);
     }
     else
     {
         return(ChangeType.PanY);
     }
 }
        private void OnPlacementChanged(AxisPlacement oldPlacement, AxisPlacement newPlacement)
        {
            axisControl.Placement = placement;
            if (plotter != null)
            {
                Panel panel = GetPanelByPlacement(oldPlacement);
                panel.Children.Remove(this);

                Panel newPanel = GetPanelByPlacement(placement);
                newPanel.Children.Add(this);
            }
        }
Пример #12
0
        protected override void OnPlacementChanged(AxisPlacement oldPlacement, AxisPlacement newPlacement)
        {
            axisControl.Placement = Placement;
            if (ParentPlotter != null)
            {
                Panel panel = GetPanelByPlacement(oldPlacement);
                panel.Children.Remove(this);

                Panel newPanel = GetPanelByPlacement(newPlacement);
                int   index    = GetInsertionIndexByPlacement(newPlacement, newPanel);
                newPanel.Children.Insert(index, this);
            }
        }
Пример #13
0
		/// <summary>
		/// This conversion is performed to make horizontal one-string and two-string labels
		/// stay at one height.
		/// </summary>
		/// <param name="placement"></param>
		/// <returns></returns>
		private static AxisPlacement GetBetterPlacement(AxisPlacement placement)
		{
			switch (placement)
			{
				case AxisPlacement.Left:
					return AxisPlacement.Left;
				case AxisPlacement.Right:
					return AxisPlacement.Right;
				case AxisPlacement.Top:
					return AxisPlacement.Top;
				case AxisPlacement.Bottom:
					return AxisPlacement.Bottom;
				default:
					throw new NotSupportedException();
			}
		}
Пример #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DateTimeAxis"/> class.
        /// </summary>
        public RadioBandAxis(AxisPlacement placement)
        {
            Focusable = false;

            Loaded += OnLoaded;

            Placement = placement;

            HorizontalContentAlignment = HorizontalAlignment.Stretch;
            VerticalContentAlignment   = VerticalAlignment.Stretch;

            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Stretch;

            Focusable = false;
            UpdateUIResources();
        }
Пример #15
0
        private int GetInsertionIndexByPlacement(AxisPlacement placement, Panel panel)
        {
            int index = panel.Children.Count;

            switch (placement)
            {
            case AxisPlacement.Left:
                index = 0;
                break;

            case AxisPlacement.Top:
                index = 0;
                break;

            default:
                break;
            }

            return(index);
        }
Пример #16
0
        private void UpdateUIResources()
        {
            ResourceDictionary resources = new ResourceDictionary
            {
                Source = new Uri("/SS2Widget;component/Charts/Axes/AxisControlStyle.xaml", UriKind.Relative)
            };

            AxisPlacement   placement = GetBetterPlacement(this.placement);
            ControlTemplate template  = (ControlTemplate)resources[templateKey + placement.ToString()];

            Verify.AssertNotNull(template);
            var content = (FrameworkElement)template.LoadContent();

            ticksPath = (Path)content.FindName(PART_TicksPath);
            ticksPath.SnapsToDevicePixels = true;
            Verify.AssertNotNull(ticksPath);

            commonLabelsCanvas = (StackCanvas)content.FindName(PART_CommonLabelsCanvas);
            Verify.AssertNotNull(commonLabelsCanvas);
            commonLabelsCanvas.Placement = placement;

            additionalLabelsCanvas = (StackCanvas)content.FindName(PART_AdditionalLabelsCanvas);
            Verify.AssertNotNull(additionalLabelsCanvas);
            additionalLabelsCanvas.Placement = placement;

            mainGrid = (Grid)content.FindName(PART_ContentsGrid);
            Verify.AssertNotNull(mainGrid);

            mainGrid.SetBinding(Control.BackgroundProperty, new Binding {
                Path = new PropertyPath("Background"), Source = this
            });

            Content = mainGrid;

            string transformKey = additionalLabelTransformKey + placement.ToString();

            if (resources.Contains(transformKey))
            {
                additionalLabelTransform = (Transform)resources[transformKey];
            }
        }
Пример #17
0
		protected Panel GetPanelByPlacement(AxisPlacement placement)
		{
			Panel panel = null;
			switch (placement)
			{
				case AxisPlacement.Left:
					panel = ParentPlotter.LeftPanel;
					break;
				case AxisPlacement.Right:
					panel = ParentPlotter.RightPanel;
					break;
				case AxisPlacement.Top:
					panel = ParentPlotter.TopPanel;
					break;
				case AxisPlacement.Bottom:
					panel = ParentPlotter.BottomPanel;
					break;
				default:
					break;
			}
			return panel;
		}
Пример #18
0
 public static bool IsHorizontal(this AxisPlacement placement)
 {
     return(placement == AxisPlacement.Bottom || placement == AxisPlacement.Top);
 }
 protected virtual void ValidatePlacement(AxisPlacement newPlacement)
 {
 }
Пример #20
0
		/// <summary>
		/// Validates the placement - e.g., vertical axis should not be placed from top or bottom, etc.
		/// If proposed placement is wrong, throws an ArgumentException.
		/// </summary>
		/// <param name="newPlacement">The new placement.</param>
		protected virtual void ValidatePlacement(AxisPlacement newPlacement) { }
Пример #21
0
        private void UpdateUIResources()
        {
            ResourceDictionary resources = new ResourceDictionary
            {
                Source = new Uri("/DynamicDataDisplay;component/Charts/Axes/AxisControlStyle.xaml", UriKind.Relative)
            };

            AxisPlacement   placement = GetBetterPlacement(this.placement);
            ControlTemplate template  = (ControlTemplate)resources[templateKey + placement.ToString()];

            Verify.AssertNotNull(template);
            var content = (FrameworkElement)template.LoadContent();

            if (ticksPath != null && ticksPath.Data != null)
            {
                GeometryGroup group = (GeometryGroup)ticksPath.Data;
                foreach (var child in group.Children)
                {
                    LineGeometry geometry = (LineGeometry)child;
                    lineGeomPool.Put(geometry);
                }
                group.Children.Clear();
            }

            ticksPath = (Path)content.FindName(PART_TicksPath);
            ticksPath.SnapsToDevicePixels = true;
            Verify.AssertNotNull(ticksPath);

            // as this method can be called not only on loading of axisControl, but when its placement changes, internal panels
            // can be not empty and their contents should be released
            if (commonLabelsCanvas != null && labelProvider != null)
            {
                foreach (UIElement child in commonLabelsCanvas.Children)
                {
                    if (child != null)
                    {
                        labelProvider.ReleaseLabel(child);
                    }
                }

                labels = null;
                commonLabelsCanvas.Children.Clear();
            }

            commonLabelsCanvas = (StackCanvas)content.FindName(PART_CommonLabelsCanvas);
            Verify.AssertNotNull(commonLabelsCanvas);
            commonLabelsCanvas.Placement = placement;

            if (additionalLabelsCanvas != null && majorLabelProvider != null)
            {
                foreach (UIElement child in additionalLabelsCanvas.Children)
                {
                    if (child != null)
                    {
                        majorLabelProvider.ReleaseLabel(child);
                    }
                }
            }

            additionalLabelsCanvas = (StackCanvas)content.FindName(PART_AdditionalLabelsCanvas);
            Verify.AssertNotNull(additionalLabelsCanvas);
            additionalLabelsCanvas.Placement = placement;

            mainGrid = (Grid)content.FindName(PART_ContentsGrid);
            Verify.AssertNotNull(mainGrid);

            mainGrid.SetBinding(Control.BackgroundProperty, new Binding {
                Path = new PropertyPath("Background"), Source = this
            });
            mainGrid.SizeChanged += new SizeChangedEventHandler(mainGrid_SizeChanged);

            Content = mainGrid;

            string transformKey = additionalLabelTransformKey + placement.ToString();

            if (resources.Contains(transformKey))
            {
                additionalLabelTransform = (Transform)resources[transformKey];
            }
        }
Пример #22
0
 protected virtual void OnPlacementChanged(AxisPlacement oldPlacement, AxisPlacement newPlacement)
 {
 }
 public static bool IsBottomOrTop(this AxisPlacement placement)
 {
     return(placement == AxisPlacement.Bottom || placement == AxisPlacement.Top);
 }
 public static bool IsVertical(this AxisPlacement placement)
 {
     return(placement == AxisPlacement.Left || placement == AxisPlacement.Right);
 }
		protected override void ValidatePlacement(AxisPlacement newPlacement)
		{
			if (newPlacement == AxisPlacement.Left || newPlacement == AxisPlacement.Right)
				throw new ArgumentException(Strings.Exceptions.HorizontalAxisCannotBeVertical);
		}
Пример #26
0
 protected override void ValidatePlacement(AxisPlacement newPlacement)
 {
     if (newPlacement == AxisPlacement.Bottom || newPlacement == AxisPlacement.Top)
         throw new ArgumentException();
 }
Пример #27
0
		protected override void ValidatePlacement(AxisPlacement newPlacement)
		{
			if (newPlacement == AxisPlacement.Bottom || newPlacement == AxisPlacement.Top)
				throw new ArgumentException(Properties.Resources.VerticalAxisCannotBeHorizontal);
		}
 protected override void ValidatePlacement(AxisPlacement newPlacement)
 {
     if (newPlacement == AxisPlacement.Left || newPlacement == AxisPlacement.Right)
         throw new ArgumentException();
 }
Пример #29
0
		protected virtual void OnPlacementChanged(AxisPlacement oldPlacement, AxisPlacement newPlacement) { }
Пример #30
0
        private static void VerifyAxisType(AxisPlacement axisPlacement, AxisType axisType)
        {
            bool result = false;
            switch (axisPlacement)
            {
                case AxisPlacement.Left:
                case AxisPlacement.Right:
                    result = axisType == AxisType.Vertical;
                    break;
                case AxisPlacement.Top:
                case AxisPlacement.Bottom:
                    result = axisType == AxisType.Horizontal;
                    break;
                default:
                    break;
            }

            if (!result)
                throw new ArgumentException();
        }