Interactivity between different inputs elements in Bokeh

Hi,

I have the following test data =

{

“prd” : [“a”, “b”, “c”]

“code” : [“1”, “2”, “3”]

}

I have 2 dropdown select elements in my bokeh app. For simplicity sake, let’s call them d1 and d2. d1 shows the all the keys in the above dictionary (prd, code) and d2 should be dynamically reflect what gets selected in d1. For eg. If I select “code” in d1, then d2 dropdown should give me options as (1,2,3)

Is this possible in bokeh? I couldn’t find an example in the repo. Any code examples would be appreciated.

Thank you in advance.

Regards,

V

Try using a callback function. something like that should work

def change_d2(attr,old, new):

d2.options=data[d1.value]

d1.on_change(‘value’,change_d2)

···

On Wed, Jul 27, 2016 at 12:24 PM, Veenit Shah [email protected] wrote:

Hi,

I have the following test data =

{

“prd” : [“a”, “b”, “c”]

“code” : [“1”, “2”, “3”]

}

I have 2 dropdown select elements in my bokeh app. For simplicity sake, let’s call them d1 and d2. d1 shows the all the keys in the above dictionary (prd, code) and d2 should be dynamically reflect what gets selected in d1. For eg. If I select “code” in d1, then d2 dropdown should give me options as (1,2,3)

Is this possible in bokeh? I couldn’t find an example in the repo. Any code examples would be appreciated.

Thank you in advance.

Regards,

V

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/7e241120-7a6e-42aa-9614-88b6858f13ad%40continuum.io.

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

Thank you, George! That really helped

I was missing d2.options=data[d1.value]. I was assigning data[d1.value] to a variable rather than d2.options.

Regards,

V

···

On Wednesday, July 27, 2016 at 3:10:05 PM UTC-5, George Skolianos wrote:

Try using a callback function. something like that should work

def change_d2(attr,old, new):

d2.options=data[d1.value]

d1.on_change(‘value’,change_d2)

On Wed, Jul 27, 2016 at 12:24 PM, Veenit Shah [email protected] wrote:

Hi,

I have the following test data =

{

“prd” : [“a”, “b”, “c”]

“code” : [“1”, “2”, “3”]

}

I have 2 dropdown select elements in my bokeh app. For simplicity sake, let’s call them d1 and d2. d1 shows the all the keys in the above dictionary (prd, code) and d2 should be dynamically reflect what gets selected in d1. For eg. If I select “code” in d1, then d2 dropdown should give me options as (1,2,3)

Is this possible in bokeh? I couldn’t find an example in the repo. Any code examples would be appreciated.

Thank you in advance.

Regards,

V

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/7e241120-7a6e-42aa-9614-88b6858f13ad%40continuum.io.

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