Python Bokeh tooltip text formatting

The tooltip example presented in the reference guide show the following examples of formatting:

hover.tooltips = [
    ("index", "$index"),
    ("(x,y)", "($x, $y)"),
    ("radius", "@radius"),
    ("fill color", "$color[hex, swatch]:fill_color"),
    ("foo", "@foo"),
    ("bar", "@bar"),
    ("baz", "@baz{safe}"),
    ("total", "@total{$0,0.00}"

The 3 examples {safe}, {$0,0.00} and "$color[hex, swatch]:fill_color" are not clear: where can i find some documentation on them?

Basically I would like to understand what is possible and what isn’t.

At the moment (for instance) I have 1 input that us a very long string (its a newspaper article) that I would like to format so it only shows the x first characters.

Other example I have a field @datetime that is retrieving its value from a datetime index. At the moment the tooltip displays that value as a int64 character. How to use a format tool such as Timestamp.strftime("%d-%m-%Y") so that it shows the date time in human readable format?

But I would like to have a clearer overview of what is possible/how that aspect of bokeh works

Hi,

Currently the formats supported are the same ones provided by the NumeralTickFormatter:

  http://bokeh.pydata.org/en/latest/docs/reference/models/formatters.html#bokeh.models.formatters.NumeralTickFormatter

There is a WIP PR to add richer formatting options as well as update and expand the documentation that will be merged soon:

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

Thanks,

Bryan

···

On Apr 13, 2017, at 13:59, Vincent Konaté <[email protected]> wrote:

The tooltip example presented in the reference guide show the following examples of formatting:

hover.tooltips = [

("index", "$index"),

("(x,y)", "($x, $y)"),

("radius", "@radius"),

("fill color", "$color[hex, swatch]:fill_color"),

("foo", "@foo"),

("bar", "@bar"),

("baz", "@baz{safe}"),

("total", "@total{$0,0.00}"
The 3 examples {safe}, {$0,0.00} and "$color[hex, swatch]:fill_color" are not clear: where can i find some documentation on them?

Basically I would like to understand what is possible and what isn't.

At the moment (for instance) I have 1 input that us a very long string (its a newspaper article) that I would like to format so it only shows the x first characters.

Other example I have a field @datetime that is retrieving its value from a datetime index. At the moment the tooltip displays that value as a int64 character. How to use a format tool such as Timestamp.strftime("%d-%m-%Y") so that it shows the date time in human readable format?

But I would like to have a clearer overview of what is possible/how that aspect of bokeh works

--
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/5c4d7a11-10fc-4d62-a99b-1e156c0c8603%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.