/// <summary> /// Acquire a horizontal linear 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, () => { IAxis axis = CreateRangeAxisFromData(firstDataPoint.IndependentValue); if (axis == null) { axis = new CategoryAxis(); } axis.Orientation = AxisOrientation.X; return(axis); }, (axis) => axis.Orientation == AxisOrientation.Y && axis is IRangeAxis, () => { DisplayAxis axis = (DisplayAxis)CreateRangeAxisFromData(firstDataPoint.DependentValue); if (axis == null) { throw new InvalidOperationException(Properties.Resources.DataPointSeriesWithAxes_NoSuitableAxisAvailableForPlottingDependentValue); } axis.ShowGridLines = true; axis.Orientation = AxisOrientation.Y; return(axis); }); }
/// <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, () => new CategoryAxis { Orientation = AxisOrientation.X }, 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.Origin == null) { throw new InvalidOperationException(Properties.Resources.DataPointSeriesWithAxes_NoSuitableAxisAvailableForPlottingDependentValue); } DisplayAxis axis = rangeAxis as DisplayAxis; if (axis != null) { axis.ShowGridLines = true; } return(rangeAxis); }); }
/// <summary> /// Initializes a new instance of the OrientedAxisGridLines class. /// </summary> /// <param name="displayAxis">The axis to draw grid lines for.</param> public OrientedAxisGridLines(DisplayAxis displayAxis) : base(displayAxis) { _gridLinePool = new ObjectPool <Line>(() => new Line { Style = Axis.GridLineStyle }); }
/// <summary> /// AxisLabelStyleProperty property changed handler. /// </summary> /// <param name="d">DisplayAxis that changed its AxisLabelStyle.</param> /// <param name="e">Event arguments.</param> private static void OnAxisLabelStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DisplayAxis source = (DisplayAxis)d; Style oldValue = (Style)e.OldValue; Style newValue = (Style)e.NewValue; source.OnAxisLabelStylePropertyChanged(oldValue, newValue); }
/// <summary> /// ShowGridLinesProperty property changed handler. /// </summary> /// <param name="d">Axis that changed its ShowGridLines.</param> /// <param name="e">Event arguments.</param> private static void OnShowGridLinesPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DisplayAxis source = (DisplayAxis)d; bool oldValue = (bool)e.OldValue; bool newValue = (bool)e.NewValue; source.OnShowGridLinesPropertyChanged(oldValue, newValue); }
/// <summary> /// TitleProperty property changed handler. /// </summary> /// <param name="d">DisplayAxis that changed its Title.</param> /// <param name="e">Event arguments.</param> private static void OnTitlePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { DisplayAxis source = (DisplayAxis)d; object oldValue = (object)e.OldValue; object newValue = (object)e.NewValue; source.OnTitlePropertyChanged(oldValue, newValue); }
/// <summary> /// AxisProperty property changed handler. /// </summary> /// <param name="oldValue">Old value.</param> /// <param name="newValue">New value.</param> private void OnAxisPropertyChanged(DisplayAxis oldValue, DisplayAxis newValue) { Debug.Assert(newValue != null, "Don't set the axis property to null."); if (newValue != null) { newValue.RegisteredListeners.Add(this); } if (oldValue != null) { oldValue.RegisteredListeners.Remove(this); } }
/// <summary> /// AxisProperty property changed handler. /// </summary> /// <param name="oldValue">Old value.</param> /// <param name="newValue">New value.</param> private void OnAxisPropertyChanged(DisplayAxis oldValue, DisplayAxis newValue) { Debug.Assert(newValue != null, "Don't set the axis property to null."); if (newValue != null) { newValue.RegisteredListeners.Add(this); } if (oldValue != null) { oldValue.RegisteredListeners.Remove(this); } }
/// <summary> /// Instantiates a new instance of the DisplayAxisGridLines class. /// </summary> /// <param name="axis">The axis used by the DisplayAxisGridLines.</param> public DisplayAxisGridLines(DisplayAxis axis) { this.Axis = axis; this.SizeChanged += new SizeChangedEventHandler(OnSizeChanged); }
/// <summary> /// Initializes a new instance of the OrientedAxisGridLines class. /// </summary> /// <param name="displayAxis">The axis to draw grid lines for.</param> public OrientedAxisGridLines(DisplayAxis displayAxis) : base(displayAxis) { _gridLinePool = new ObjectPool<Line>(() => new Line { Style = Axis.GridLineStyle }); }
/// <summary> /// Instantiates a new instance of the DisplayAxisGridLines class. /// </summary> /// <param name="axis">The axis used by the DisplayAxisGridLines.</param> public DisplayAxisGridLines(DisplayAxis axis) { this.Axis = axis; this.SizeChanged += new SizeChangedEventHandler(OnSizeChanged); }