Pre loader

VisibleRangeChanged event fired twice when trying to zoom extents



I have a simple chart with FastLineRenderableSeries with a DateTime X axis and a numeric Y axis. I’ve also added a RubberBandXyZoomModifier and a ZoomExtentsModifier. In this chart I want to be able to zoom out to previous visible range. E. g. the user use the rubber band to zoom in to range A, then he zooms in a second time to range B, then he should have the opportunity to zoom out from range B and back to range A. Do you have a recommendation for how I can achieve this?

My first thought was to override the ZoomExtensModifier to allow the user to both use the full zoom out functionality, and also, by holding shift or something, zoom out to previous. In addition I can handle the VisibleRangeChanged event to collect the ranges.

Then I noticed that the VisibleRangeChanged event always seems to get fired twice after a user modification of the visible range. For example if I test with a slightly modified version of the line chart in http://, and zoom from X (205,431) to (250,300); the first time VisibleRangeChanged is fired the e.NewVisibleRange is (215,404), the second time it is as expected (250,300). Why is that? Will it always fire two times, or can I also expect it to fire one or three times? Is this something that can or will change in future releases of scichart?

  • Olav
  • You must to post comments
Best Answer

SciChart v3.0 now allows detection of whether VisibleRangeChanged was fired during animation or not. Try this code below:

public void Foo()
    var axis = new NumericAxis();

    axis.VisibleRangeChanged += (s, e) =>
            if (e.IsAnimating)
                // VisibleRangeChanged occurred during animation                        
                // VisibleRangeChanged did not occur during animation
  • You must to post comments

Hi there,

Thanks for reporting that behavior with VisibleRangeChanged event. We logged it in our bug tracker for further investigation. I think it happens because of animation turned on, you could turn it off using IsAnimated property of some modifiers.

Regarding zoom history, there were few similar requests, and one SciChart customer kindly posted theirs implementation in this post. You probably find there something useful for yourself.

Please, feel free to ask if you have any questions,

Best regards,

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies