HoverTool Decimal Places

Is it possible to specify how many decimal places the HoverTool displays? I have some large float number that need to be shown to 2 decimal places. I don’t want to change the data just limit what the user will see.

Thanks,

Mark

Hi,

···

On Mon, Jul 20, 2015 at 10:15 PM, [email protected] wrote:

Is it possible to specify how many decimal places the HoverTool displays? I have some large float number that need to be shown to 2 decimal places. I don’t want to change the data just limit what the user will see.

Yes, you can specify format in curly brackets after referenced field’s name, e.g. @Time{0.00} will format Time field to two decimal places. See [1] as an example. This feature is not well documented in the context of HoverTool, but in [2] you can find information about possible formats.

[1] https://github.com/bokeh/bokeh/blob/master/examples/glyphs/sprint.py#L96
[2] http://bokeh.pydata.org/en/latest/docs/reference/models.html#bokeh.models.formatters.NumeralTickFormatter

Mateusz

Thanks,

Mark

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/311c21c6-7734-4319-a9ce-90ac5b2763a2%40continuum.io.

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

Mateusz,

Thank you so much, you are a lifesaver!

Mark

···

On Monday, July 20, 2015 at 5:34:30 PM UTC-4, mateusz.paprocki wrote:

Hi,

On Mon, Jul 20, 2015 at 10:15 PM, [email protected] wrote:

Is it possible to specify how many decimal places the HoverTool displays? I have some large float number that need to be shown to 2 decimal places. I don’t want to change the data just limit what the user will see.

Yes, you can specify format in curly brackets after referenced field’s name, e.g. @Time{0.00} will format Time field to two decimal places. See [1] as an example. This feature is not well documented in the context of HoverTool, but in [2] you can find information about possible formats.

[1] https://github.com/bokeh/bokeh/blob/master/examples/glyphs/sprint.py#L96
[2] http://bokeh.pydata.org/en/latest/docs/reference/models.html#bokeh.models.formatters.NumeralTickFormatter

Mateusz

Thanks,

Mark

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/311c21c6-7734-4319-a9ce-90ac5b2763a2%40continuum.io.

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