예제 #1
0
 /// <summary>
 /// Acquire a horizontal category axis and a vertical linear axis.
 /// </summary>
 /// <param name="firstDataPoint">The first data point.</param>
 protected override void GetAxes(DataPoint firstDataPoint)
 {
     GetAxes(
         firstDataPoint,
         (axis) => axis.Orientation == AxisOrientation.X,
         () =>
     {
         ScrollableCategoryAxis categoryAxis = new ScrollableCategoryAxis {
             Orientation = AxisOrientation.X
         };
         categoryAxis.ScrollChanged += ScrollableCategoryAxis_ScrollChanged;
         return(categoryAxis);
     },
         (axis) =>
     {
         IRangeAxis rangeAxis = axis as IRangeAxis;
         return(rangeAxis != null && rangeAxis.Origin != null && axis.Orientation == AxisOrientation.Y);
     },
         () =>
     {
         IRangeAxis rangeAxis  = CreateRangeAxisFromData(firstDataPoint.DependentValue);
         rangeAxis.Orientation = AxisOrientation.Y;
         if (rangeAxis == null || rangeAxis.Origin == null)
         {
             throw new InvalidOperationException("No suitable axis is available for plotting the dependent value.");
         }
         DisplayAxis axis = rangeAxis as DisplayAxis;
         if (axis != null)
         {
             axis.ShowGridLines = true;
         }
         return(rangeAxis);
     });
 }
        /// <summary>
        /// SortOrderProperty property changed handler.
        /// </summary>
        /// <param name="d">CategoryAxis that changed its SortOrder.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnSortOrderPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ScrollableCategoryAxis source = (ScrollableCategoryAxis)d;

            source.OnSortOrderPropertyChanged();
        }