bokeh.models.callbacks

Client-side interactivity.

class Callback(**kwargs)

Bases: bokeh.plot_object.PlotObject

Base class for interactive callback. Callback is generally not useful to instantiate on its own.

[
  {
    "attributes": {
      "doc": null,
      "id": "7167a61f-ce6d-47c5-8623-bd47718a783b",
      "name": null,
      "tags": []
    },
    "id": "7167a61f-ce6d-47c5-8623-bd47718a783b",
    "type": "Callback"
  }
]
class CustomJS(**kwargs)

Bases: bokeh.models.callbacks.Callback

Execute a JavaScript function.

args

property type: Dict(String, Instance(PlotObject))

A mapping of names to Bokeh plot obejcts. These objects are made available to the callback code snippet as the values of named parameters to the callback.

code

property type: String

A snippet of JavaScript code to execute in the browser. The code is made into the body of a function, and all of of the named objects in args are available as parameters that the code can use. Additionally, a cb_obj parameter contains the object that triggered the callback and an optional cb_data parameter that contains any tool-specific data (i.e. mouse coordinates and hovered glyph indices for the HoverTool).

[
  {
    "attributes": {
      "args": {},
      "code": null,
      "doc": null,
      "id": "0ed5fa7e-c2b4-4995-a0ed-9abc0054daf2",
      "name": null,
      "tags": []
    },
    "id": "0ed5fa7e-c2b4-4995-a0ed-9abc0054daf2",
    "type": "CustomJS"
  }
]
class OpenURL(**kwargs)

Bases: bokeh.models.callbacks.Callback

Open a URL in a new tab or window (browser dependent).

url

property type: String

The URL to direct the web browser to. This can be a template string, which will be formatted with data from the data source.

[
  {
    "attributes": {
      "doc": null,
      "id": "4cff06fc-a014-4817-8db1-093a7b9f2c60",
      "name": null,
      "tags": [],
      "url": "http://"
    },
    "id": "4cff06fc-a014-4817-8db1-093a7b9f2c60",
    "type": "OpenURL"
  }
]