Hossein Kalbasi
Hossein Kalbasi

Reputation: 1861

Stop zooming at a certain level in Bokeh WheelZoomTool

Is there a way to stop zooming in at a certain x axis level? I am using a xwheel_zoom tool in my dashboard with a datetime x-axis. This is the tick format I'm using:

p.xaxis.formatter=DatetimeTickFormatter(
            microseconds=["%H:%M:%S:%3Nms"],
            milliseconds=["%H:%M:%S:%3Nms"],
            seconds=["%H:%M:%S"],
            minsec=["%H:%M:%S"],
            minutes=["%H:%M:%S"],
            hourmin=["%H:%M:%S"],
            hours=["%H:%M:%S"],
            days = ['%m/%d', '%a%d'],
            months = ['%m/%Y', '%b %Y'],
            years = ['%Y']
            )

Is it possible to just stop the zooming in (like being deactivated when the user scrolls) when the datetime reaches a millisecond scale? My chart makes sense only up to seconds, and I don't want the user to be able to zoom in forever!

Upvotes: 0

Views: 161

Answers (1)

Eugene Pakhomov
Eugene Pakhomov

Reputation: 10697

Zooming is not about formatters, it's about ranges. Try setting the min_interval property:

plot.x_range.min_interval = datetime.timedelta(seconds=1)

Upvotes: 1

Related Questions