An axis class used to determine the plot area coordinate of values.
상속: Windows.UI.Xaml.Controls.Control, IAxis
예제 #1
0
        /// <summary>
        /// Removes an axis from the Chart area.
        /// </summary>
        /// <param name="axis">The axis to remove from the ISeriesHost area.</param>
        private void RemoveAxisFromChartArea(Axis axis)
        {
            axis.LocationChanged -= AxisLocationChanged;
            axis.OrientationChanged -= AxisOrientationChanged;
            IRequireSeriesHost requiresSeriesHost = axis as IRequireSeriesHost;
            if (requiresSeriesHost != null)
            {
                requiresSeriesHost.SeriesHost = null;
            }

            _edgeAxes.Remove(axis);
        }
예제 #2
0
        /// <summary>
        /// Adds an axis to the ISeriesHost area.
        /// </summary>
        /// <param name="axis">The axis to add to the ISeriesHost area.</param>
        private void AddAxisToChartArea(Axis axis)
        {
            IRequireSeriesHost requiresSeriesHost = axis as IRequireSeriesHost;
            if (requiresSeriesHost != null)
            {
                requiresSeriesHost.SeriesHost = this;
            }

            if (axis.Location == AxisLocation.Auto)
            {
                axis.Location = GetAutoAxisLocation(axis);
            }

            SetEdge(axis);

            axis.LocationChanged += AxisLocationChanged;
            axis.OrientationChanged += AxisOrientationChanged;

            if (axis.Location != AxisLocation.Auto)
            {
                _edgeAxes.Add(axis);

                if (this.ChartArea != null &&
                    !this.ChartArea.Children.Contains(axis))
                {
                    this.ChartArea.Children.Add(axis);
                    if (BackgroundElements.Count > 0)
                    {
                        foreach (UIElement element in BackgroundElements)
                        {
                            this.ChartArea.Children.Insert(0, element);
                        }
                    }
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Sets the Edge property of an axis based on its location and
 /// orientation.
 /// </summary>
 /// <param name="axis">The axis to set the edge property of.</param>
 private static void SetEdge(Axis axis)
 {
     switch (axis.Location)
     {
         case AxisLocation.Bottom:
             EdgePanel.SetEdge(axis, Edge.Bottom);
             break;
         case AxisLocation.Top:
             EdgePanel.SetEdge(axis, Edge.Top);
             break;
         case AxisLocation.Left:
             EdgePanel.SetEdge(axis, Edge.Left);
             break;
         case AxisLocation.Right:
             EdgePanel.SetEdge(axis, Edge.Right);
             break;
     }
 }
예제 #4
0
 /// <summary>
 /// Determines the location of an axis based on the existing axes in
 /// the chart.
 /// </summary>
 /// <param name="axis">The axis to determine the location of.</param>
 /// <returns>The location of the axis.</returns>
 private AxisLocation GetAutoAxisLocation(Axis axis)
 {
     if (axis.Orientation == AxisOrientation.X)
     {
         int numberOfTopAxes = this.InternalActualAxes.OfType<Axis>().Count(currentAxis => currentAxis.Location == AxisLocation.Top);
         int numberOfBottomAxes = this.InternalActualAxes.OfType<Axis>().Count(currentAxis => currentAxis.Location == AxisLocation.Bottom);
         return (numberOfBottomAxes > numberOfTopAxes) ? AxisLocation.Top : AxisLocation.Bottom;
     }
     else if (axis.Orientation == AxisOrientation.Y)
     {
         int numberOfLeftAxes = this.InternalActualAxes.OfType<Axis>().Count(currentAxis => currentAxis.Location == AxisLocation.Left);
         int numberOfRightAxes = this.InternalActualAxes.OfType<Axis>().Count(currentAxis => currentAxis.Location == AxisLocation.Right);
         return (numberOfLeftAxes > numberOfRightAxes) ? AxisLocation.Right : AxisLocation.Left;
     }
     else
     {
         return AxisLocation.Auto;
     }
 }