Bokeh Tools name displayed when hovering over toolbar

Hello,

I have an app that uses the BoxSelectTool to integrate peaks. I would like it if I change the name that displays when I hover over the tool from Box Select (x-axis) to Integrate.

Hi,

This label is not currently exposed/configurable from the Python side. However, it seems like a reasonable ask, and should also be fairly easy to implement. I'd encourage you to submit a feature request issue on GitHub:

  https://github.com/bokeh/bokeh/issues

If you are interesting in making a PR yourself to add this feature, we are always happy to help with information and guidance.

Currently, to do this, you'd have to use JavaScript to set the "tool_name" attribute on the tool. This could be accomplished in a few ways. One approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value. Information on making extensions is here:

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

Alternatively, you might be able to use an page onload callback or similar to change the tool_name value on a standard tool. There is a feature planned to add CustomJS callbacks to Bokeh document init which would be ideal, but it will not be ready until the 0.12.7 release.

Thanks,

Bryan

···

On Jun 2, 2017, at 13:06, [email protected] wrote:

Hello,

I have an app that uses the BoxSelectTool to integrate peaks. I would like it if I change the name that displays when I hover over the tool from Box Select (x-axis) to Integrate.

--
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/102fad72-473f-4a97-a5c4-ab7ebefc32fc%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

Has either of these items been implemented? In regards to one of your suggestions:

one approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value.

So if I wanted to have three hover tools each with a different name displayed when hovering over the icon in the toolbar, would I have to make three separate custom extensions? Or is there a slicker way of achieving this:

js="""

import {HoverTool} from “models/tools/inspectors/hover_tool”

export class %s extends HoverTool
tool_name: “%s”
“”"

class Hover1(HoverTool):

implementation=js %(“Hover1”,“Hover1”)
pass

class Hover2(HoverTool):…

``

Thanks,

Justin

···

On Sunday, June 4, 2017 at 8:12:39 PM UTC-5, Bryan Van de ven wrote:

Hi,

This label is not currently exposed/configurable from the Python side. However, it seems like a reasonable ask, and should also be fairly easy to implement. I’d encourage you to submit a feature request issue on GitHub:

    [https://github.com/bokeh/bokeh/issues](https://github.com/bokeh/bokeh/issues)

If you are interesting in making a PR yourself to add this feature, we are always happy to help with information and guidance.

Currently, to do this, you’d have to use JavaScript to set the “tool_name” attribute on the tool. This could be accomplished in a few ways. One approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value. Information on making extensions is here:

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

Alternatively, you might be able to use an page onload callback or similar to change the tool_name value on a standard tool. There is a feature planned to add CustomJS callbacks to Bokeh document init which would be ideal, but it will not be ready until the 0.12.7 release.

Thanks,

Bryan

On Jun 2, 2017, at 13:06, [email protected] wrote:

Hello,

I have an app that uses the BoxSelectTool to integrate peaks. I would like it if I change the name that displays when I hover over the tool from Box Select (x-axis) to Integrate.


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/102fad72-473f-4a97-a5c4-ab7ebefc32fc%40continuum.io.

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

For anybody with a similar question:

I decided to hack server/static/js/bokeh.min.js

deleting: e.prototype.tool_name=“Hover”,

adding: tool_name:[p.String,“Hover”],

in the e.define block of the HoverTool

Then I add a ‘tool_name’ property to

models/tools.py

HoverTool class

then point to my local bokeh.min.js file in my html templates.

I chose this route since my application produces >1000 pages, and I observed that compiling my custom tool upon each page creation was very time consuming. 0.5-1s/page exploded to 3s per page. Unfortunately I would have to repeat this hack when I update bokeh.

Justin

···

On Wednesday, December 13, 2017 at 4:53:08 PM UTC-6, griffiths1983 wrote:

Hi Bryan,

Has either of these items been implemented? In regards to one of your suggestions:

one approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value.

So if I wanted to have three hover tools each with a different name displayed when hovering over the icon in the toolbar, would I have to make three separate custom extensions? Or is there a slicker way of achieving this:

implementation=js %(“Hover1”,“Hover1”)
pass

class Hover2(HoverTool):…

js="""

import {HoverTool} from “models/tools/inspectors/hover_tool”

export class %s extends HoverTool
tool_name: “%s”
“”"

class Hover1(HoverTool):

``

Thanks,

Justin

On Sunday, June 4, 2017 at 8:12:39 PM UTC-5, Bryan Van de ven wrote:

Hi,

This label is not currently exposed/configurable from the Python side. However, it seems like a reasonable ask, and should also be fairly easy to implement. I’d encourage you to submit a feature request issue on GitHub:

    [https://github.com/bokeh/bokeh/issues](https://github.com/bokeh/bokeh/issues)

If you are interesting in making a PR yourself to add this feature, we are always happy to help with information and guidance.

Currently, to do this, you’d have to use JavaScript to set the “tool_name” attribute on the tool. This could be accomplished in a few ways. One approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value. Information on making extensions is here:

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

Alternatively, you might be able to use an page onload callback or similar to change the tool_name value on a standard tool. There is a feature planned to add CustomJS callbacks to Bokeh document init which would be ideal, but it will not be ready until the 0.12.7 release.

Thanks,

Bryan

On Jun 2, 2017, at 13:06, [email protected] wrote:

Hello,

I have an app that uses the BoxSelectTool to integrate peaks. I would like it if I change the name that displays when I hover over the tool from Box Select (x-axis) to Integrate.


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/102fad72-473f-4a97-a5c4-ab7ebefc32fc%40continuum.io.

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

Hi,

Two comments:

First, rudimentary caching of custom extension compilations was added in this PR:

  https://github.com/bokeh/bokeh/pull/7137

Second, I'd like to encourage you to consider making contributions directly to the Bokeh project, rather than hacking the released library code. This is both for the benefit of the entire community (so that they also get useful new features), and for your own benefit (so that you don't have to try keep repeating hacky updates on every new release).

Thanks,

Bryan

···

On Dec 13, 2017, at 20:59, griffiths1983 <[email protected]> wrote:

For anybody with a similar question:

I decided to hack server/static/js/bokeh.min.js

deleting: e.prototype.tool_name="Hover",
adding: tool_name:[p.String,"Hover"],

in the e.define block of the HoverTool

Then I add a 'tool_name' property to
models/tools.py
HoverTool class

then point to my local bokeh.min.js file in my html templates.

I chose this route since my application produces >1000 pages, and I observed that compiling my custom tool upon each page creation was very time consuming. 0.5-1s/page exploded to 3s per page. Unfortunately I would have to repeat this hack when I update bokeh.

Justin

On Wednesday, December 13, 2017 at 4:53:08 PM UTC-6, griffiths1983 wrote:
Hi Bryan,

Has either of these items been implemented? In regards to one of your suggestions:

one approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value.

So if I wanted to have three hover tools each with a different name displayed when hovering over the icon in the toolbar, would I have to make three separate custom extensions? Or is there a slicker way of achieving this:

js="""

import {HoverTool} from "models/tools/inspectors/hover_tool"
                                                                                                                                                                                                            
export class %s extends HoverTool
  tool_name: "%s"
"""

class Hover1(HoverTool):
   
   __implementation__=js %("Hover1","Hover1")
   pass

class Hover2(HoverTool):...

Thanks,
Justin

On Sunday, June 4, 2017 at 8:12:39 PM UTC-5, Bryan Van de ven wrote:
Hi,

This label is not currently exposed/configurable from the Python side. However, it seems like a reasonable ask, and should also be fairly easy to implement. I'd encourage you to submit a feature request issue on GitHub:

        https://github.com/bokeh/bokeh/issues

If you are interesting in making a PR yourself to add this feature, we are always happy to help with information and guidance.

Currently, to do this, you'd have to use JavaScript to set the "tool_name" attribute on the tool. This could be accomplished in a few ways. One approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value. Information on making extensions is here:

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

Alternatively, you might be able to use an page onload callback or similar to change the tool_name value on a standard tool. There is a feature planned to add CustomJS callbacks to Bokeh document init which would be ideal, but it will not be ready until the 0.12.7 release.

Thanks,

Bryan

> On Jun 2, 2017, at 13:06, [email protected] wrote:
>
> Hello,
>
> I have an app that uses the BoxSelectTool to integrate peaks. I would like it if I change the name that displays when I hover over the tool from Box Select (x-axis) to Integrate.
>
>
>
> --
> 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/102fad72-473f-4a97-a5c4-ab7ebefc32fc%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 [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/649dc6ee-7662-437f-9f77-c11c26dabf2a%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

Glad to see the caching is now available, will be extremely useful!

About contributing, I’d like to, need to learn a bit more about the JS side and JS in general first.

Thanks,

Justin

···

On Thursday, December 14, 2017 at 12:05:38 PM UTC-6, Bryan Van de ven wrote:

Hi,

Two comments:

First, rudimentary caching of custom extension compilations was added in this PR:

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

Second, I’d like to encourage you to consider making contributions directly to the Bokeh project, rather than hacking the released library code. This is both for the benefit of the entire community (so that they also get useful new features), and for your own benefit (so that you don’t have to try keep repeating hacky updates on every new release).

Thanks,

Bryan

On Dec 13, 2017, at 20:59, griffiths1983 [email protected] wrote:

For anybody with a similar question:

I decided to hack server/static/js/bokeh.min.js

deleting: e.prototype.tool_name=“Hover”,

adding: tool_name:[p.String,“Hover”],

in the e.define block of the HoverTool

Then I add a ‘tool_name’ property to

models/tools.py

HoverTool class

then point to my local bokeh.min.js file in my html templates.

I chose this route since my application produces >1000 pages, and I observed that compiling my custom tool upon each page creation was very time consuming. 0.5-1s/page exploded to 3s per page. Unfortunately I would have to repeat this hack when I update bokeh.

Justin

On Wednesday, December 13, 2017 at 4:53:08 PM UTC-6, griffiths1983 wrote:

Hi Bryan,

Has either of these items been implemented? In regards to one of your suggestions:

one approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value.

So if I wanted to have three hover tools each with a different name displayed when hovering over the icon in the toolbar, would I have to make three separate custom extensions? Or is there a slicker way of achieving this:

js="""

import {HoverTool} from “models/tools/inspectors/hover_tool”

export class %s extends HoverTool
tool_name: “%s”
“”"

class Hover1(HoverTool):

implementation=js %(“Hover1”,“Hover1”)

pass

class Hover2(HoverTool):…

Thanks,

Justin

On Sunday, June 4, 2017 at 8:12:39 PM UTC-5, Bryan Van de ven wrote:

Hi,

This label is not currently exposed/configurable from the Python side. However, it seems like a reasonable ask, and should also be fairly easy to implement. I’d encourage you to submit a feature request issue on GitHub:

    [https://github.com/bokeh/bokeh/issues](https://github.com/bokeh/bokeh/issues)

If you are interesting in making a PR yourself to add this feature, we are always happy to help with information and guidance.

Currently, to do this, you’d have to use JavaScript to set the “tool_name” attribute on the tool. This could be accomplished in a few ways. One approach would be to make a custom extension that subclasses he current BoxSelectionTool, and changes nothing on the JS side except the tool_name value. Information on making extensions is here:

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

Alternatively, you might be able to use an page onload callback or similar to change the tool_name value on a standard tool. There is a feature planned to add CustomJS callbacks to Bokeh document init which would be ideal, but it will not be ready until the 0.12.7 release.

Thanks,

Bryan

On Jun 2, 2017, at 13:06, [email protected] wrote:

Hello,

I have an app that uses the BoxSelectTool to integrate peaks. I would like it if I change the name that displays when I hover over the tool from Box Select (x-axis) to Integrate.


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/102fad72-473f-4a97-a5c4-ab7ebefc32fc%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 [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/649dc6ee-7662-437f-9f77-c11c26dabf2a%40continuum.io.

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