Search code examples
bokeh

Applying Bokeh Formatter Manually


How do I apply a Bokeh formatter manually, from Python? Not just setting up a formatter or a callback, but doing it explicitly. Ideally it would be something like this:

formatter = bokeh.models.NumeralTickFormatter(format='0.00')
formatter.apply(-123.123) # => -123.12

Solution

  • You don't. Amost all of the actual work of Bokeh is actually done by the runtime JavaScript library BokehJS, in a browser. There is no Python implementation of NumeralTickFormatter or any other Bokeh model. All of the models in bokeh.models on the "Python side" are just thin declarative structs that only exist for the purpose of mirroring the object graph into JavaScript.