Dynamically changing the bounds of an axes using sliders

Hi everyone. I’m relatively new to Bokeh. Love it so far. At the moment, I’m using it to create simple stock price charts from Yahoo Finance data. The functionality I would like to add is to use widgets somehow (specifically I’m thinking of the slider) to dynamically change the x_range of my plots. More concretely, I’d like to select say ‘5’ on the slider and have the chart show 5 years of historical data and then select ‘3’ on the slider and have the chart update to only show 3 years of historical data. Is this possible? Thanks!

Alternatively, another potential solution would be for me to use the xwheel_zoom tool if I could set it so that the upper bound of the x-axis stayed fixed (e.g. was always the last date) while the lower bound of the x-axis changed dynamically. Is this possible?

···

On Thursday, November 12, 2015 at 3:23:50 PM UTC-6, Brian Myers wrote:

Hi everyone. I’m relatively new to Bokeh. Love it so far. At the moment, I’m using it to create simple stock price charts from Yahoo Finance data. The functionality I would like to add is to use widgets somehow (specifically I’m thinking of the slider) to dynamically change the x_range of my plots. More concretely, I’d like to select say ‘5’ on the slider and have the chart show 5 years of historical data and then select ‘3’ on the slider and have the chart update to only show 3 years of historical data. Is this possible? Thanks!

Seems like a CustomJS callback would do that for you.
See this page of the User Guide:

···

http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html
On 11/12/15 1:23 PM, Brian Myers wrote:

    Hi everyone.  I'm relatively new to Bokeh.  Love it

so far. At the moment, I’m using it to create simple stock
price charts from Yahoo Finance data. The functionality I would
like to add is to use widgets somehow (specifically I’m thinking
of the slider) to dynamically change the x_range of my plots.
More concretely, I’d like to select say ‘5’ on the slider and
have the chart show 5 years of historical data and then select
‘3’ on the slider and have the chart update to only show 3 years
of historical data. Is this possible? Thanks!

  You received this message because you are subscribed to the Google

Groups “Bokeh Discussion - Public” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to [email protected].

  To post to this group, send email to [email protected]

  To view this discussion on the web visit [](https://groups.google.com/a/continuum.io/d/msgid/bokeh/2df5ea69-78f8-4019-bb78-064076042837%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .

https://groups.google.com/a/continuum.io/d/msgid/bokeh/2df5ea69-78f8-4019-bb78-064076042837%40continuum.io
https://groups.google.com/a/continuum.io/d/optout