☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Questions creating a date slider

Community Support
Eric
Eric

Apologies for the obvious questions; however, I’m trying to create a slider that will slide through dates from January 2015 to July 2016 by months.

The Bokeh Date and RelativeDelta classes are unclear and I can’t find any good examples using them. Bokeh Date class seems to be related to Python’s datetime module.

I tried the following code:

import datetime as dt
from dateutil.relativedelta import relativedelta

crnt_date = dt.datetime.now()

yyyymm_crnt = dt.date(crnt_date.year, crnt_date.month, 01)

yyyymm_init = dt.date(2015, 01, 01)

mnth_step = relativedelta(months=1)

year_slider = DateRangeSlider(

title=“Test”,

bounds=(yyyymm_init, yyyymm_crnt),

value=(yyyymm_crnt),
step=mnth_step

)

``

The only other way I can think to do this is to have separate sliders for year and month and just deal with integers.

Thanks in advance.

⌁   Link to post
Bryan
Bryan

Hi,

The date range slider is currently broken:

  working date slider for discussion by bryevdv · Pull Request #4491 · bokeh/bokeh · GitHub

I'd certainly like it to be fixed. Regrettably, there are currently more requests/things to do thank people to do them. If you have any ability to help look into things, new contributions are valuable, appreciated, and welcome.

Thanks,

Bryan

···

On Aug 1, 2016, at 2:49 PM, Eric <eric.nussbaumer@kimetrica.com> wrote:

Apologies for the obvious questions; however, I'm trying to create a slider that will slide through dates from January 2015 to July 2016 by months.

The Bokeh Date and RelativeDelta classes are unclear and I can't find any good examples using them. Bokeh Date class seems to be related to Python's datetime module.

I tried the following code:

import datetime as dt
from dateutil.relativedelta import relativedelta

crnt_date = dt.datetime.now()
yyyymm_crnt = dt.date(crnt_date.year, crnt_date.month, 01)
yyyymm_init = dt.date(2015, 01, 01)
mnth_step = relativedelta(months=1)

year_slider = DateRangeSlider(
    title="Test",
    bounds=(yyyymm_init, yyyymm_crnt),
    value=(yyyymm_crnt),
    step=mnth_step
)

The only other way I can think to do this is to have separate sliders for year and month and just deal with integers.

Thanks in advance.

--
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/611763eb-899b-4632-9b36-ec560634994d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Bryan
Bryan

Another option, perhaps more approachable than diving into core dev on the main repo, is to create a custom extension to wrap some existing JS date range slider:

  http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html

If you pursue this route I am certain others would be grateful if you could share the code.

Thanks,

Bryan

···

On Aug 3, 2016, at 9:51 AM, Bryan Van de Ven <bryan@bokeh.org> wrote:

Hi,

The date range slider is currently broken:

  working date slider for discussion by bryevdv · Pull Request #4491 · bokeh/bokeh · GitHub

I'd certainly like it to be fixed. Regrettably, there are currently more requests/things to do thank people to do them. If you have any ability to help look into things, new contributions are valuable, appreciated, and welcome.

Thanks,

Bryan

On Aug 1, 2016, at 2:49 PM, Eric <eric.nussbaumer@kimetrica.com> wrote:

Apologies for the obvious questions; however, I'm trying to create a slider that will slide through dates from January 2015 to July 2016 by months.

The Bokeh Date and RelativeDelta classes are unclear and I can't find any good examples using them. Bokeh Date class seems to be related to Python's datetime module.

I tried the following code:

import datetime as dt
from dateutil.relativedelta import relativedelta

crnt_date = dt.datetime.now()
yyyymm_crnt = dt.date(crnt_date.year, crnt_date.month, 01)
yyyymm_init = dt.date(2015, 01, 01)
mnth_step = relativedelta(months=1)

year_slider = DateRangeSlider(
   title="Test",
   bounds=(yyyymm_init, yyyymm_crnt),
   value=(yyyymm_crnt),
   step=mnth_step
)

The only other way I can think to do this is to have separate sliders for year and month and just deal with integers.

Thanks in advance.

--
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 bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/611763eb-899b-4632-9b36-ec560634994d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Eric
Eric

I’ll take a look.

Thanks,

Eric

···

On Wednesday, August 3, 2016 at 8:51:04 AM UTC-6, Bryan Van de ven wrote:

Hi,

The date range slider is currently broken:

    [https://github.com/bokeh/bokeh/pull/4491](https://github.com/bokeh/bokeh/pull/4491)

I’d certainly like it to be fixed. Regrettably, there are currently more requests/things to do thank people to do them. If you have any ability to help look into things, new contributions are valuable, appreciated, and welcome.

Thanks,

Bryan

On Aug 1, 2016, at 2:49 PM, Eric eric.nu...@kimetrica.com wrote:

Apologies for the obvious questions; however, I’m trying to create a slider that will slide through dates from January 2015 to July 2016 by months.

The Bokeh Date and RelativeDelta classes are unclear and I can’t find any good examples using them. Bokeh Date class seems to be related to Python’s datetime module.

I tried the following code:

import datetime as dt

from dateutil.relativedelta import relativedelta

crnt_date = dt.datetime.now()

yyyymm_crnt = dt.date(crnt_date.year, crnt_date.month, 01)

yyyymm_init = dt.date(2015, 01, 01)

mnth_step = relativedelta(months=1)

year_slider = DateRangeSlider(

title="Test",
bounds=(yyyymm_init, yyyymm_crnt),
value=(yyyymm_crnt),
step=mnth_step

)

The only other way I can think to do this is to have separate sliders for year and month and just deal with integers.

Thanks in advance.

–
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 bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/611763eb-899b-4632-9b36-ec560634994d%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
seleniumhalide
seleniumhalide

Hey Eric, I have been trying to understand how Date Range Slider works but as you pointed there are hardly any examples of the same. Have you finally figured how to use this? Can you share your understanding of this widget. Thanks.

···

On Tuesday, August 2, 2016 at 1:19:33 AM UTC+5:30, Eric wrote:

Apologies for the obvious questions; however, I’m trying to create a slider that will slide through dates from January 2015 to July 2016 by months.

The Bokeh Date and RelativeDelta classes are unclear and I can’t find any good examples using them. Bokeh Date class seems to be related to Python’s datetime module.

I tried the following code:

import datetime as dt
from dateutil.relativedelta import relativedelta

crnt_date = dt.datetime.now()

yyyymm_crnt = dt.date(crnt_date.year, crnt_date.month, 01)

yyyymm_init = dt.date(2015, 01, 01)

mnth_step = relativedelta(months=1)

year_slider = DateRangeSlider(

title=“Test”,

bounds=(yyyymm_init, yyyymm_crnt),

value=(yyyymm_crnt),
step=mnth_step

)

``

The only other way I can think to do this is to have separate sliders for year and month and just deal with integers.

Thanks in advance.

⌁   Link to post

End of archived discussion · Replies are disabled