private void PrepareOppositeAxisLine() { if (this.OppositeAxisLine == null || this.Axis == null || this.Axis.Scale == null) { return; } this.OppositeAxisLine.X2 = this.OppositeAxisLine.Y2 = 0.0; if (this.Orientation == Orientation.Horizontal) { this.OppositeAxisLine.Y2 = 1.0; } else { this.OppositeAxisLine.X2 = 1.0; } double num = this.Axis.Scale.ProjectDataValue(this.Axis.Scale.ActualCrossingPosition); if (DoubleHelper.GreaterOrEqualWithPrecision(num, 0.0) && DoubleHelper.LessOrEqualWithPrecision(num, 1.0)) { this.UpdateAxisLineVisibility(); XYAxisElementsPanel.SetCoordinate((UIElement)this.OppositeAxisLine, num); } else { this.OppositeAxisLine.Visibility = Visibility.Collapsed; } }
private bool IsTakeSpace(UIElement child) { XYAxisElementsPanel axisElementsPanel = child as XYAxisElementsPanel; if (axisElementsPanel != null) { if (child is XYLabelsPanel) { return(axisElementsPanel.Axis.ShowLabels); } if (child is XYAxisTickMarksPanel) { if (!axisElementsPanel.Axis.ShowMajorTickMarks && !axisElementsPanel.Presenter.IsMinorTickMarksVisible) { return(axisElementsPanel.Axis.ActualShowScrollZoomBar); } return(true); } } if (child is XYAxisTitle) { return(((Title)child).ActualContent != null); } return(true); }
private void PrepareScrollBar() { XYAxisElementsPanel.SetPosition((UIElement)this._scrollBar, AxisElementPosition.Outside); this._scrollBar.Orientation = this.Orientation; if (this.Orientation == Orientation.Horizontal) { this._scrollBar.VerticalAlignment = this.Presenter.ActualLocation == Edge.Top ? VerticalAlignment.Top : VerticalAlignment.Bottom; this._scrollBar.HorizontalAlignment = HorizontalAlignment.Stretch; } else { this._scrollBar.HorizontalAlignment = this.Presenter.ActualLocation == Edge.Left ? HorizontalAlignment.Left : HorizontalAlignment.Right; this._scrollBar.VerticalAlignment = VerticalAlignment.Stretch; } if (this.Presenter.Axis.ActualShowScrollZoomBar && this._scrollBar.Visibility == Visibility.Collapsed) { this._scrollBar.Visibility = Visibility.Visible; } else { if (this.Presenter.Axis.ActualShowScrollZoomBar || this._scrollBar.Visibility != Visibility.Visible) { return; } this._scrollBar.Visibility = Visibility.Collapsed; } }
protected override double ElementOffset(UIElement element) { double num = base.ElementOffset(element); if (XYAxisElementsPanel.GetPosition(element) == AxisElementPosition.Outside && element != this._scrollBar) { num += this.ElementHeight(this._scrollBar.DesiredSize); } return(num); }
public static void OnPositionPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) { UIElement uiElement = dependencyObject as UIElement; if (uiElement == null) { throw new ArgumentNullException("dependencyObject"); } XYAxisElementsPanel axisElementsPanel = VisualTreeHelper.GetParent((DependencyObject)uiElement) as XYAxisElementsPanel; if (axisElementsPanel == null) { return; } axisElementsPanel.InvalidateMeasure(); }
private void PrepareAxisLine() { Line line = this._axisLine; line.X1 = line.X2 = line.Y1 = line.Y2 = 0.0; if (this.Orientation == Orientation.Horizontal) { line.X2 = 1.0; } else { line.Y2 = 1.0; } this.UpdateAxisLineVisibility(); XYAxisElementsPanel.SetPosition((UIElement)this._axisLine, AxisElementPosition.Cross); }
protected override void Populate(double availableLength) { this._majorGridLinePool.ReleaseAll(); this._minorGridLinePool.ReleaseAll(); if (this.Presenter.IsMinorGridlinesVisible) { this._majorGridLinePool.AdjustPoolSize(); } try { this.PrepareOppositeAxisLine(); foreach (ScaleElementDefinition elementDefinition in (IEnumerable <ScaleElementDefinition>) new List <ScaleElementDefinition>((IEnumerable <ScaleElementDefinition>)Enumerable.OrderBy <ScaleElementDefinition, int>(Enumerable.Where <ScaleElementDefinition>(this.Presenter.GetScaleElements(), (Func <ScaleElementDefinition, bool>)(p => p.Kind == ScaleElementKind.Tickmark)), (Func <ScaleElementDefinition, int>)(p => p.Group != ScaleElementGroup.Major ? 0 : 1)))) { if (elementDefinition.Group == ScaleElementGroup.Major && this.Axis.ShowMajorGridlines) { EnumerableFunctions.ForEachWithIndex <ScalePosition>(Enumerable.Where <ScalePosition>(elementDefinition.Positions, (Func <ScalePosition, bool>)(p => { if (p.Position >= 0.0) { return(p.Position <= 1.0); } return(false); })), (Action <ScalePosition, int>)((position, index) => XYAxisElementsPanel.SetCoordinate((UIElement)this._majorGridLinePool.Get(this.Axis), position.Position))); } if (elementDefinition.Group == ScaleElementGroup.Minor && this.Presenter.IsMinorGridlinesVisible) { EnumerableFunctions.ForEachWithIndex <ScalePosition>(Enumerable.Where <ScalePosition>(elementDefinition.Positions, (Func <ScalePosition, bool>)(p => { if (p.Position >= 0.0) { return(p.Position <= 1.0); } return(false); })), (Action <ScalePosition, int>)((position, index) => XYAxisElementsPanel.SetCoordinate((UIElement)this._minorGridLinePool.Get(this.Axis), position.Position))); } } } finally { if (!this.Presenter.IsMinorGridlinesVisible) { this._majorGridLinePool.AdjustPoolSize(); } this._minorGridLinePool.AdjustPoolSize(); } }
private RotatableControl CreateTickMark(bool major) { RotatableControl result = new RotatableControl(); TickMark tickMark = new TickMark(); tickMark.SetBinding(FrameworkElement.StyleProperty, (BindingBase) new Binding(major ? "MajorTickMarkStyle" : "MinorTickMarkStyle") { Source = (object)this.Axis }); result.Child = (FrameworkElement)tickMark; tickMark.PositionChanged += (EventHandler)((s, e) => { this.PrepareTickMark(result); XYAxisElementsPanel.SetPosition((UIElement)result, ((TickMark)s).Position); }); return(result); }
protected override double ElementOffset(UIElement element) { Size desiredSize = XYAxisBasePanel.GetDesiredSize(element); double num = 0.0; switch (XYAxisElementsPanel.GetPosition(element)) { case AxisElementPosition.Inside: case AxisElementPosition.None: num = this.ElementHeight(desiredSize); break; case AxisElementPosition.Cross: num = this.ElementHeight(desiredSize) / 2.0; break; } return(-num); }
protected override double GetCenterCoordinate(UIElement element) { return(XYAxisElementsPanel.GetCoordinate(element)); }
protected override void Populate(double availableLength) { this._majorTickMarkPool.ReleaseAll(); this._minorTickMarkPool.ReleaseAll(); if (this.Presenter.IsMinorTickMarksVisible) { this._majorTickMarkPool.AdjustPoolSize(); } try { this.PrepareAxisLine(); this.PrepareScrollBar(); if (!this.Axis.ShowMajorTickMarks && !this.Presenter.IsMinorTickMarksVisible) { return; } foreach (ScaleElementDefinition elementDefinition in (IEnumerable <ScaleElementDefinition>) new List <ScaleElementDefinition>((IEnumerable <ScaleElementDefinition>)Enumerable.OrderBy <ScaleElementDefinition, int>(Enumerable.Where <ScaleElementDefinition>(this.Presenter.GetScaleElements(), (Func <ScaleElementDefinition, bool>)(p => p.Kind == ScaleElementKind.Tickmark)), (Func <ScaleElementDefinition, int>)(p => p.Group != ScaleElementGroup.Major ? 0 : 1)))) { if (elementDefinition.Group == ScaleElementGroup.Major && this.Axis.ShowMajorTickMarks && !this.LabelsUseCategoryTickmarks) { EnumerableFunctions.ForEachWithIndex <ScalePosition>(Enumerable.Where <ScalePosition>(elementDefinition.Positions, (Func <ScalePosition, bool>)(p => { if (p.Position >= 0.0) { return(p.Position <= 1.0); } return(false); })), (Action <ScalePosition, int>)((position, index) => { RotatableControl rotatableControl = this._majorTickMarkPool.Get(this.Axis); XYAxisElementsPanel.SetCoordinate((UIElement)rotatableControl, position.Position); XYAxisElementsPanel.SetPosition((UIElement)rotatableControl, ((TickMark)rotatableControl.Child).Position); })); } if (elementDefinition.Group == ScaleElementGroup.Minor && this.Presenter.IsMinorTickMarksVisible) { EnumerableFunctions.ForEachWithIndex <ScalePosition>(Enumerable.Where <ScalePosition>(elementDefinition.Positions, (Func <ScalePosition, bool>)(p => { if (DoubleHelper.GreaterOrEqualWithPrecision(p.Position, 0.0)) { return(DoubleHelper.LessOrEqualWithPrecision(p.Position, 1.0)); } return(false); })), (Action <ScalePosition, int>)((position, index) => { RotatableControl rotatableControl = this._minorTickMarkPool.Get(this.Axis); XYAxisElementsPanel.SetCoordinate((UIElement)rotatableControl, position.Position); XYAxisElementsPanel.SetPosition((UIElement)rotatableControl, ((TickMark)rotatableControl.Child).Position); })); } } } finally { if (!this.Presenter.IsMinorTickMarksVisible) { this._majorTickMarkPool.AdjustPoolSize(); } this._minorTickMarkPool.AdjustPoolSize(); } }