Example #1
0
 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;
     }
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
 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();
     }
 }