bokeh.model

class Model(**kwargs)

Bases: bokeh.core.properties.HasProps, bokeh.util.callback_manager.CallbackManager

Base class for all plot-related objects

classmethod collect_models(*input_values)

Iterate over input_values and descend through their structure collecting all nested Models on the go. The resulting list is duplicate-free based on objects’ identifiers.

layout(side, plot)
references()

Returns all Models that this object has references to.

select(selector)

Query this object and all of its references for objects that match the given selector.

Parameters:selector (JSON-like) –
Returns:seq[Model]
select_one(selector)

Query this object and all of its references for objects that match the given selector. Raises an error if more than one object is found. Returns single matching object, or None if nothing is found :param selector:

Returns:Model
set_select(selector, updates)

Update objects that match a given selector with the specified attribute/value updates.

Parameters:
  • selector (JSON-like) –
  • updates (dict) –
Returns:

None

to_json(include_defaults)

Returns a dictionary of the attributes of this object, containing only “JSON types” (string, number, boolean, none, dict, list).

References to other objects are serialized as “refs” (just the object ID and type info), so the deserializer will need to separately have the full attributes of those other objects.

There’s no corresponding from_json() because to deserialize an object is normally done in the context of a Document (since the Document can resolve references).

For most purposes it’s best to serialize and deserialize entire documents.

Parameters:include_defaults (bool) – whether to include attributes that haven’t been changed from the default
to_json_string(include_defaults)

Returns a JSON string encoding the attributes of this object.

References to other objects are serialized as references (just the object ID and type info), so the deserializer will need to separately have the full attributes of those other objects.

There’s no corresponding from_json_string() because to deserialize an object is normally done in the context of a Document (since the Document can resolve references).

For most purposes it’s best to serialize and deserialize entire documents.

Parameters:include_defaults (bool) – whether to include attributes that haven’t been changed from the default
trigger(attr, old, new)
document
name

property type: name:String

ref
tags

property type: tags:List(Any)

JSON Prototype
{
  "id": "8a571399-7656-4615-9c78-8d77200bd573",
  "name": null,
  "tags": []
}
class Viewable(class_name, bases, nmspc)

Any plot object (Data Model) which has its own View Model in the persistence layer.

One thing to keep in mind is that a Viewable should have a single unique representation in the persistence layer, but it might have multiple concurrent client-side Views looking at it. Those may be from different machines altogether.

classmethod get_class(view_model_name)

Given a __view_model__ name, returns the corresponding class object