LogarithmicAxis does not raise AxisChanged Event when zooming

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

WeirdNoise wrote at 2013-08-13 20:38:

Obviously a bug; the overridden ZoomAt-Method in LogarithmicAxis.cs does not raise the Event.

I think you would need to add a RaiseAxisChanged-Method in the base Axis Class to allow the child class to raise the event?

WeirdNoise wrote at 2013-08-13 21:05:

My way of fixing it - and also dealing with another bug, which causes the AxisChanged-Event to fire before the limits are actually updated:
    Public Class LogAxis
        Inherits Axes.LogarithmicAxis

        Public Event ActualAxisChanged(min As Double, max As Double)

        Public Overrides Sub ZoomAt(factor As Double, x As Double)
            MyBase.ZoomAt(factor, x)
            RaiseEvent ActualAxisChanged(ViewMinimum, ViewMaximum)
        End Sub

        Private Sub Axis_Changed() Handles MyBase.AxisChanged
            RaiseEvent ActualAxisChanged(ViewMinimum, ViewMaximum)
        End Sub
    End Class

objo wrote at 2013-08-14 07:02:

Thank you! I have fixed the bug and added an example to verify that it works.

objo wrote at 2013-08-14 07:04:

Note that the UpdateActualMaxMin(); method is called - you should use ActualMaximum and ActualMinimum to get the actual limits.

WeirdNoise wrote at 2013-08-14 08:16:

Wow, that was fast, thanks a lot!