☰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

Adding click functionality to quads

Community Support
Matthew_Rattray
Matthew_Rattray

Hi Everyone,

I’m pretty new to Bokeh so I’m not entirely sure if the solution I’m looking resides in some functionality to BokehJS. Regardless I’d like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I’m looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

⌁   Link to post
Bryan
Bryan

Hi Matt,

In Bokeh there is a level of indirection. There are various tools that can cause "selections" to happen, and it is the tools and selections that you can have callbacks for. In this case you want a TapTool with a callback. Here is a fully worked example (I've used circles instead of quads for simplicity but hopefully you get the gist):

  from bokeh.plotting import figure, output_file, show
  from bokeh.models import TapTool, CustomJS

  p = figure()
  r = p.circle(x=[1,2,3], y=[4,5,6], size=20)

  callback = CustomJS(code="""
  var inds = cb_obj.get('selected')['1d'].indices;
  window.alert("Selected index:" + inds.toString());
  """)

  tap = TapTool(renderers=[r], callback=callback)
  p.add_tools(tap)

  output_file("foo.html")

  show(p)

Bryan

···

On Dec 10, 2015, at 3:58 PM, 4f.crying@gmail.com wrote:

Hi Everyone,

I'm pretty new to Bokeh so I'm not entirely sure if the solution I'm looking resides in some functionality to BokehJS. Regardless I'd like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I'm looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

--
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/257b0aef-83ba-462c-8672-a7e39c2d9cc3%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Matthew_Rattray
Matthew_Rattray

Thanks Bryan,

What is that cb_obj api exactly. Does it have documentation?

-Matt

···

On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:

Hi Everyone,

I’m pretty new to Bokeh so I’m not entirely sure if the solution I’m looking resides in some functionality to BokehJS. Regardless I’d like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I’m looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

⌁   Link to post
Bryan
Bryan

cb_obj is the "callback object" that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the "args" parameter, and not use cb_obj at all:

  callbacks — Bokeh 3.3.2 Documentation

Several examples of passing "args":

  Interaction — Bokeh 3.3.2 Documentation

Bryan

···

On Dec 11, 2015, at 12:45 PM, 4f.crying@gmail.com wrote:

Thanks Bryan,

What is that cb_obj api exactly. Does it have documentation?

-Matt

On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
Hi Everyone,

I'm pretty new to Bokeh so I'm not entirely sure if the solution I'm looking resides in some functionality to BokehJS. Regardless I'd like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I'm looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

--
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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Matthew_Rattray
Matthew_Rattray

Another question,

This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that’s being executed somehow. I’d like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I’ll have to include it inside the CustomJS object.

···

On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:

cb_obj is the “callback object” that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the “args” parameter, and not use cb_obj at all:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS](http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS)

Several examples of passing “args”:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets)

Bryan

On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:

Thanks Bryan,

What is that cb_obj api exactly. Does it have documentation?

-Matt

On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:

Hi Everyone,

I’m pretty new to Bokeh so I’m not entirely sure if the solution I’m looking resides in some functionality to BokehJS. Regardless I’d like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I’m looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

–
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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.

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

Bryan

···

On Dec 11, 2015, at 1:54 PM, 4f.crying@gmail.com wrote:

Another question,

This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that's being executed somehow. I'd like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I'll have to include it inside the CustomJS object.

On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:
cb_obj is the "callback object" that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the "args" parameter, and not use cb_obj at all:

        callbacks — Bokeh 3.3.2 Documentation

Several examples of passing "args":

        Interaction — Bokeh 3.3.2 Documentation

Bryan

> On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:
>
> Thanks Bryan,
>
> What is that cb_obj api exactly. Does it have documentation?
>
> -Matt
>
> On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
> Hi Everyone,
>
> I'm pretty new to Bokeh so I'm not entirely sure if the solution I'm looking resides in some functionality to BokehJS. Regardless I'd like your help in telling me what I can do.
>
>
>
> I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I'm looking for some ideas on how to implement this with Bokeh.
>
>
>
> Thanks,
>
> Matthew
>
>
> --
> 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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Matthew_Rattray
Matthew_Rattray

Ok so the indices I get back from the callback appear to be empty, and don’t help me know which quad was clicked since I have multiple quads. I tried seeing if any data resided in cb_data, but cb_data appeared to be undefined. How do I know which quad was selected

–Matt

···

On Friday, December 11, 2015 at 1:57:48 PM UTC-6, Bryan Van de ven wrote:

It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html)

Bryan

On Dec 11, 2015, at 1:54 PM, 4f.c...@gmail.com wrote:

Another question,

This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that’s being executed somehow. I’d like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I’ll have to include it inside the CustomJS object.

On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:

cb_obj is the “callback object” that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the “args” parameter, and not use cb_obj at all:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS](http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS)

Several examples of passing “args”:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets)

Bryan

On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:

Thanks Bryan,

What is that cb_obj api exactly. Does it have documentation?

-Matt

On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
Hi Everyone,

I’m pretty new to Bokeh so I’m not entirely sure if the solution I’m looking resides in some functionality to BokehJS. Regardless I’d like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I’m looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

–
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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–
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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io.

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

⌁   Link to post
Matthew_Rattray
Matthew_Rattray

As for calling the thirdparty library, I’m using bokeh within a notebook I don’t think I have that option unfortunately.

···

On Friday, December 11, 2015 at 3:22:21 PM UTC-6, 4f.c...@gmail.com wrote:

Ok so the indices I get back from the callback appear to be empty, and don’t help me know which quad was clicked since I have multiple quads. I tried seeing if any data resided in cb_data, but cb_data appeared to be undefined. How do I know which quad was selected

–Matt

On Friday, December 11, 2015 at 1:57:48 PM UTC-6, Bryan Van de ven wrote:

It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html)

Bryan

On Dec 11, 2015, at 1:54 PM, 4f.c...@gmail.com wrote:

Another question,

This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that’s being executed somehow. I’d like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I’ll have to include it inside the CustomJS object.

On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:

cb_obj is the “callback object” that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the “args” parameter, and not use cb_obj at all:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS](http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS)

Several examples of passing “args”:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets)

Bryan

On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:

Thanks Bryan,

What is that cb_obj api exactly. Does it have documentation?

-Matt

On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
Hi Everyone,

I’m pretty new to Bokeh so I’m not entirely sure if the solution I’m looking resides in some functionality to BokehJS. Regardless I’d like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I’m looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

–
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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–
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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

Should work fine:

  http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/05%20-%20sharing.ipynb#Templating-in-HTML-Documents

Bryan

···

On Dec 11, 2015, at 4:06 PM, 4f.crying@gmail.com wrote:

As for calling the thirdparty library, I'm using bokeh within a notebook I don't think I have that option unfortunately.

On Friday, December 11, 2015 at 3:22:21 PM UTC-6, 4f.c...@gmail.com wrote:
Ok so the indices I get back from the callback appear to be empty, and don't help me know which quad was clicked since I have multiple quads. I tried seeing if any data resided in cb_data, but cb_data appeared to be undefined. How do I know which quad was selected

--Matt

On Friday, December 11, 2015 at 1:57:48 PM UTC-6, Bryan Van de ven wrote:
It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.

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

Bryan

> On Dec 11, 2015, at 1:54 PM, 4f.c...@gmail.com wrote:
>
> Another question,
>
> This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that's being executed somehow. I'd like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I'll have to include it inside the CustomJS object.
>
> On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:
> cb_obj is the "callback object" that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the "args" parameter, and not use cb_obj at all:
>
> callbacks — Bokeh 3.3.2 Documentation
>
> Several examples of passing "args":
>
> Interaction — Bokeh 3.3.2 Documentation
>
> Bryan
>
>
> > On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:
> >
> > Thanks Bryan,
> >
> > What is that cb_obj api exactly. Does it have documentation?
> >
> > -Matt
> >
> > On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
> > Hi Everyone,
> >
> > I'm pretty new to Bokeh so I'm not entirely sure if the solution I'm looking resides in some functionality to BokehJS. Regardless I'd like your help in telling me what I can do.
> >
> >
> >
> > I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I'm looking for some ideas on how to implement this with Bokeh.
> >
> >
> >
> > Thanks,
> >
> > Matthew
> >
> >
> > --
> > 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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/24cf22bc-a1ec-4fd0-a7ed-4512ebfc7eb6%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Matthew_Rattray
Matthew_Rattray

Thanks so much for all the help!

So my indicies were coming out wrong, because I accidently had my top point be my bottom point, and vice versa. Do you know how I could disable highlighitng on the taptool using the plotting api?

-Matt

···

On Friday, December 11, 2015 at 4:13:00 PM UTC-6, Bryan Van de ven wrote:

Should work fine:

    [http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/05%20-%20sharing.ipynb#Templating-in-HTML-Documents](http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/05%20-%20sharing.ipynb#Templating-in-HTML-Documents)

Bryan

On Dec 11, 2015, at 4:06 PM, 4f.c...@gmail.com wrote:

As for calling the thirdparty library, I’m using bokeh within a notebook I don’t think I have that option unfortunately.

On Friday, December 11, 2015 at 3:22:21 PM UTC-6, 4f.c...@gmail.com wrote:

Ok so the indices I get back from the callback appear to be empty, and don’t help me know which quad was clicked since I have multiple quads. I tried seeing if any data resided in cb_data, but cb_data appeared to be undefined. How do I know which quad was selected

–Matt

On Friday, December 11, 2015 at 1:57:48 PM UTC-6, Bryan Van de ven wrote:

It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html)

Bryan

On Dec 11, 2015, at 1:54 PM, 4f.c...@gmail.com wrote:

Another question,

This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that’s being executed somehow. I’d like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I’ll have to include it inside the CustomJS object.

On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:
cb_obj is the “callback object” that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the “args” parameter, and not use cb_obj at all:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS](http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS)

Several examples of passing “args”:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets)

Bryan

On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:

Thanks Bryan,

What is that cb_obj api exactly. Does it have documentation?

-Matt

On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
Hi Everyone,

I’m pretty new to Bokeh so I’m not entirely sure if the solution I’m looking resides in some functionality to BokehJS. Regardless I’d like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I’m looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

–
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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–
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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

–
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/24cf22bc-a1ec-4fd0-a7ed-4512ebfc7eb6%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

Matt,

Yes that's described in the users guide:

  http://bokeh.pydata.org/en/dev/docs/user_guide/styling.html#selected-and-unselected-glyphs

Note: that is a link to the "dev" release docs

Bryan

···

On Dec 15, 2015, at 3:05 PM, Matthew Rattray <4f.crying@gmail.com> wrote:

Thanks so much for all the help!

So my indicies were coming out wrong, because I accidently had my top point be my bottom point, and vice versa. Do you know how I could disable highlighitng on the taptool using the plotting api?

-Matt

On Friday, December 11, 2015 at 4:13:00 PM UTC-6, Bryan Van de ven wrote:
Should work fine:

        http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/05%20-%20sharing.ipynb#Templating-in-HTML-Documents

Bryan

> On Dec 11, 2015, at 4:06 PM, 4f.c...@gmail.com wrote:
>
> As for calling the thirdparty library, I'm using bokeh within a notebook I don't think I have that option unfortunately.
>
> On Friday, December 11, 2015 at 3:22:21 PM UTC-6, 4f.c...@gmail.com wrote:
> Ok so the indices I get back from the callback appear to be empty, and don't help me know which quad was clicked since I have multiple quads. I tried seeing if any data resided in cb_data, but cb_data appeared to be undefined. How do I know which quad was selected
>
> --Matt
>
> On Friday, December 11, 2015 at 1:57:48 PM UTC-6, Bryan Van de ven wrote:
> It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.
>
> http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html
>
> Bryan
>
>
> > On Dec 11, 2015, at 1:54 PM, 4f.c...@gmail.com wrote:
> >
> > Another question,
> >
> > This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that's being executed somehow. I'd like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I'll have to include it inside the CustomJS object.
> >
> > On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:
> > cb_obj is the "callback object" that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the "args" parameter, and not use cb_obj at all:
> >
> > callbacks — Bokeh 3.3.2 Documentation
> >
> > Several examples of passing "args":
> >
> > Interaction — Bokeh 3.3.2 Documentation
> >
> > Bryan
> >
> >
> > > On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:
> > >
> > > Thanks Bryan,
> > >
> > > What is that cb_obj api exactly. Does it have documentation?
> > >
> > > -Matt
> > >
> > > On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
> > > Hi Everyone,
> > >
> > > I'm pretty new to Bokeh so I'm not entirely sure if the solution I'm looking resides in some functionality to BokehJS. Regardless I'd like your help in telling me what I can do.
> > >
> > >
> > >
> > > I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I'm looking for some ideas on how to implement this with Bokeh.
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Matthew
> > >
> > >
> > > --
> > > 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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > 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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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/24cf22bc-a1ec-4fd0-a7ed-4512ebfc7eb6%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
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/14d2fd93-c299-46ed-8bbb-f4f616910c4d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
Matthew_Rattray
Matthew_Rattray

I see so this functionality is not out on the current default bokeh package on pip. Is the dev release avaliable through pip?

···

On Thu, Dec 17, 2015 at 9:38 AM Bryan Van de Ven bryanv@continuum.io wrote:

Matt,

Yes that’s described in the users guide:

    [http://bokeh.pydata.org/en/dev/docs/user_guide/styling.html#selected-and-unselected-glyphs](http://bokeh.pydata.org/en/dev/docs/user_guide/styling.html#selected-and-unselected-glyphs)

Note: that is a link to the “dev” release docs

Bryan

On Dec 15, 2015, at 3:05 PM, Matthew Rattray 4f.crying@gmail.com wrote:

Thanks so much for all the help!

So my indicies were coming out wrong, because I accidently had my top point be my bottom point, and vice versa. Do you know how I could disable highlighitng on the taptool using the plotting api?

-Matt

On Friday, December 11, 2015 at 4:13:00 PM UTC-6, Bryan Van de ven wrote:

Should work fine:

    [http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/05%20-%20sharing.ipynb#Templating-in-HTML-Documents](http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/05%20-%20sharing.ipynb#Templating-in-HTML-Documents)

Bryan

On Dec 11, 2015, at 4:06 PM, 4f.c...@gmail.com wrote:

As for calling the thirdparty library, I’m using bokeh within a notebook I don’t think I have that option unfortunately.

On Friday, December 11, 2015 at 3:22:21 PM UTC-6, 4f.c...@gmail.com wrote:

Ok so the indices I get back from the callback appear to be empty, and don’t help me know which quad was clicked since I have multiple quads. I tried seeing if any data resided in cb_data, but cb_data appeared to be undefined. How do I know which quad was selected

–Matt

On Friday, December 11, 2015 at 1:57:48 PM UTC-6, Bryan Van de ven wrote:

It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html)

Bryan

On Dec 11, 2015, at 1:54 PM, 4f.c...@gmail.com wrote:

Another question,

This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that’s being executed somehow. I’d like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I’ll have to include it inside the CustomJS object.

On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:

cb_obj is the “callback object” that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the “args” parameter, and not use cb_obj at all:

    [http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS](http://bokeh.pydata.org/en/latest/docs/reference/models/callbacks.html#bokeh.models.callbacks.CustomJS)

Several examples of passing “args”:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction.html#customjs-for-widgets)

Bryan

On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:

Thanks Bryan,

What is that cb_obj api exactly. Does it have documentation?

-Matt

On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:

Hi Everyone,

I’m pretty new to Bokeh so I’m not entirely sure if the solution I’m looking resides in some functionality to BokehJS. Regardless I’d like your help in telling me what I can do.

I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I’m looking for some ideas on how to implement this with Bokeh.

Thanks,

Matthew

–

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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io.

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

–

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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io.

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

–

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/24cf22bc-a1ec-4fd0-a7ed-4512ebfc7eb6%40continuum.io.

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

–

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/14d2fd93-c299-46ed-8bbb-f4f616910c4d%40continuum.io.

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

⌁   Link to post
Bryan
Bryan

Yes there is a section on "Dev Builds" in the Installation section of the main docs site bokeh.pydata.org. I should clarify, some of this is in the last release, but there are also nice additions (easily configured hover policy) and so that's why I linked the dev docs.

Bryan

···

On Dec 17, 2015, at 12:34 PM, Matthew Rattray <4f.crying@gmail.com> wrote:

I see so this functionality is not out on the current default bokeh package on pip. Is the dev release avaliable through pip?

On Thu, Dec 17, 2015 at 9:38 AM Bryan Van de Ven <bryan@bokeh.org> wrote:
Matt,

Yes that's described in the users guide:

        http://bokeh.pydata.org/en/dev/docs/user_guide/styling.html#selected-and-unselected-glyphs

Note: that is a link to the "dev" release docs

Bryan

> On Dec 15, 2015, at 3:05 PM, Matthew Rattray <4f.crying@gmail.com> wrote:
>
> Thanks so much for all the help!
>
> So my indicies were coming out wrong, because I accidently had my top point be my bottom point, and vice versa. Do you know how I could disable highlighitng on the taptool using the plotting api?
>
> -Matt
>
> On Friday, December 11, 2015 at 4:13:00 PM UTC-6, Bryan Van de ven wrote:
> Should work fine:
>
> http://nbviewer.ipython.org/github/bokeh/bokeh-notebooks/blob/master/tutorial/05%20-%20sharing.ipynb#Templating-in-HTML-Documents
>
> Bryan
>
> > On Dec 11, 2015, at 4:06 PM, 4f.c...@gmail.com wrote:
> >
> > As for calling the thirdparty library, I'm using bokeh within a notebook I don't think I have that option unfortunately.
> >
> > On Friday, December 11, 2015 at 3:22:21 PM UTC-6, 4f.c...@gmail.com wrote:
> > Ok so the indices I get back from the callback appear to be empty, and don't help me know which quad was clicked since I have multiple quads. I tried seeing if any data resided in cb_data, but cb_data appeared to be undefined. How do I know which quad was selected
> >
> > --Matt
> >
> > On Friday, December 11, 2015 at 1:57:48 PM UTC-6, Bryan Van de ven wrote:
> > It would probably be easier to use some of the different ways to embed bokeh documents into a template that loads the third party library separately, then just use the libraries API in the callback.
> >
> > http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html
> >
> > Bryan
> >
> >
> > > On Dec 11, 2015, at 1:54 PM, 4f.c...@gmail.com wrote:
> > >
> > > Another question,
> > >
> > > This be somewhat offtopic, but is it possible to include thirdparty libraries in the javascript that's being executed somehow. I'd like to be able to make use of some thirdparty implementations of treemap algorithms, but seems like I'll have to include it inside the CustomJS object.
> > >
> > > On Friday, December 11, 2015 at 1:20:03 PM UTC-6, Bryan Van de ven wrote:
> > > cb_obj is the "callback object" that is supplied automatically, and what it is varies depending on what model the callback is added to. The most expicit and clear thing might be to pass in exactly the objects you want available in the callback via the "args" parameter, and not use cb_obj at all:
> > >
> > > callbacks — Bokeh 3.3.2 Documentation
> > >
> > > Several examples of passing "args":
> > >
> > > Interaction — Bokeh 3.3.2 Documentation
> > >
> > > Bryan
> > >
> > >
> > > > On Dec 11, 2015, at 12:45 PM, 4f.c...@gmail.com wrote:
> > > >
> > > > Thanks Bryan,
> > > >
> > > > What is that cb_obj api exactly. Does it have documentation?
> > > >
> > > > -Matt
> > > >
> > > > On Thursday, December 10, 2015 at 4:58:35 PM UTC-6, 4f.c...@gmail.com wrote:
> > > > Hi Everyone,
> > > >
> > > > I'm pretty new to Bokeh so I'm not entirely sure if the solution I'm looking resides in some functionality to BokehJS. Regardless I'd like your help in telling me what I can do.
> > > >
> > > >
> > > >
> > > > I am trying to implement a type of treemap using bokeh in my notebook, and the problem I run into is that I want the quads I use to represent each leaf inside the treemap to be clickable. I'm looking for some ideas on how to implement this with Bokeh.
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > > Matthew
> > > >
> > > >
> > > > --
> > > > 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/b2ecfe41-2a7c-41ed-9f23-f1f065d076e0%40continuum.io\.
> > > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >
> > >
> > > --
> > > 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/558fcfc2-e4d7-4566-bd12-33f58972f741%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > 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/24cf22bc-a1ec-4fd0-a7ed-4512ebfc7eb6%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> 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/14d2fd93-c299-46ed-8bbb-f4f616910c4d%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled