Anaconda Enterprise: Documentation

# bokeh.models.expressions

Represent array expressions to be computed on the client (browser) side by BokehJS.

Expression models are useful as `DataSpec` values when it is desired that the array values be computed in the browser:

    p.circle(x={'expr': some_expression}, ...)

or using the `expr` convenience function:

    from bokeh.core.properties import expr

    p.circle(x=expr(some_expression), ...)

In this case, the values of the `x` coordinates will be computed in the browser by the JavaScript implementation of `some_expression` using a `ColumnDataSource` as input.

class `bokeh.models.expressions.``Expression`(**kwargs)

  Bases: `bokeh.model.Model`

  Base class for `Expression` models that represent a computation to be carried out on the client-side.

  JavaScript implementations should implement the following methods:

  Note that the result of this call will be automatically saved and re-used for each `source` that is passed in. If a `source` is changed, then the saved value for that source is discarded, and the next call will re-compute (and save) a new value. If you wish to prevent this caching, you may implement `_v_compute: (source)` instead.

  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": "d11b79f9-c7b9-4714-9d87-316a20b9b6fc",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }

class `bokeh.models.expressions.``Stack`(**kwargs)

  Bases: `bokeh.models.expressions.Expression`

  An expression for generating arrays by summing different columns from a `ColumnDataSource`.

  This expression is useful for implementing stacked bar charts at a low level.

  `fields`

    property type: `Seq` ( `String` )

    A sequence of fields from a `ColumnDataSource` to sum (elementwise). For example:

        Stack(fields=['sales', 'marketing'])

    Will compute an array of values (in the browser) by adding the elements of the `'sales'` and `'marketing'` columns of a data source.

JSON Prototype

    {
      "fields": null,
      "id": "cd837252-fc8a-4280-a1bf-3daae660c84d",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }