Anaconda Enterprise: Documentation

# bokeh.models.callbacks

Client-side interactivity.

class `bokeh.models.callbacks.``Callback`(**kwargs)

  Bases: `bokeh.model.Model`

  Base class for interactive callback.

  Note

  This is an abstract base class used to help organize the hierarchy of Bokeh model types. It is not useful to instantiate on its own.

JSON Prototype

    {
      "id": "53b6eeb0-fb23-45e6-915e-1b8ee77e1f4f",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }

class `bokeh.models.callbacks.``CustomJS`(**kwargs)

  Bases: `bokeh.models.callbacks.Callback`

  Execute a JavaScript function.

  `args`

    property type: `Dict` ( `String` , `Instance` ( `Model` ) )

    A mapping of names to Bokeh plot objects. 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).

    Note

    Use `CustomJS.from_coffeescript()` for CoffeeScript source code.

  classmethod `from_coffeescript`(code, args={})

    Create a `CustomJS` instance from CoffeeScript code.

  classmethod `from_py_func`(func)

    Create a CustomJS instance from a Python function. The function is translated to JavaScript using PyScript.

JSON Prototype

    {
      "args": {},
      "code": "",
      "id": "827c743e-dd21-4f18-bfd8-f93922cd1e62",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }

class `bokeh.models.callbacks.``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.

JSON Prototype

    {
      "id": "ba1dc95b-3d8d-4276-b9f5-52a08296a2af",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": [],
      "url": "http://"
    }