Questions creating a date slider

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.

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 <[email protected]> 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 [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/611763eb-899b-4632-9b36-ec560634994d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

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 <[email protected]> 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 <[email protected]> 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 [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/611763eb-899b-4632-9b36-ec560634994d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

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 [email protected] 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 [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/611763eb-899b-4632-9b36-ec560634994d%40continuum.io.

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

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.