Anaconda Enterprise: Documentation

# bokeh.models.filters

class `bokeh.models.filters.``BooleanFilter`(*args, **kw)

  Bases: `bokeh.models.filters.Filter`

  A BooleanFilter filters data by returning the subset of data corresponding to indices where the values of the booleans array is True.

  `booleans`

    property type: `Seq` ( `Bool` )

    A list of booleans indicating which rows of data to select.

JSON Prototype

    {
      "booleans": null,
      "filter": null,
      "id": "690b9364-d103-4d0e-a05f-bc0927ac9525",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }

class `bokeh.models.filters.``CustomJSFilter`(*args, **kw)

  Bases: `bokeh.models.filters.Filter`

  Filter data sources with a custom defined 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 filter data contained in a columnar data source. 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. The variable `source` will contain the data source that is associated with the CDSView this filter is added to.

    The code should either return the indices of the subset or an array of booleans to use to subset data source rows.

    Example:

    >     code = '''
    >     var indices = [];
    >     for (var i = 0; i <= source.data['some_column'].length; i++){
    >         if (source.data['some_column'][i] == 'some_value') {
    >             indices.push(i)
    >         }
    >     }
    >     return indices;
    >     '''

    Note

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

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

    Create a CustomJSFilter instance from CoffeeScript snippets. The function bodies are translated to JavaScript functions using node and therefore require return statements.

    The `code` function namespace will contain the variable `source` at render time. This will be the data source associated with the CDSView that this filter is added to.

  classmethod `from_py_func`(func)

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

    The `func` function namespace will contain the variable `source` at render time. This will be the data source associated with the CDSView that this filter is added to.

JSON Prototype

    {
      "args": {},
      "code": "",
      "filter": null,
      "id": "ffe40dcb-5e28-469e-8c62-051830ae3fca",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }

class `bokeh.models.filters.``Filter`(*args, **kw)

  Bases: `bokeh.model.Model`

  A Filter model represents a filtering operation that returns a row-wise subset of data when applied to a ColumnDataSource.

  `filter`

    property type: `Either` ( `Seq` ( `Int` ), `Seq` ( `Bool` ) )

    A list that can be either integer indices or booleans representing a row-wise subset of data.

JSON Prototype

    {
      "filter": null,
      "id": "7b182f34-172a-4e77-a833-34bfc8a30aea",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }

class `bokeh.models.filters.``GroupFilter`(*args, **kw)

  Bases: `bokeh.models.filters.Filter`

  A GroupFilter represents the rows of a ColumnDataSource where the values of the categorical column column_name match the group variable.

  `column_name`

    property type: `String`

    The name of the column to perform the group filtering operation on.

  `group`

    property type: `String`

    The value of the column indicating the rows of data to keep.

JSON Prototype

    {
      "column_name": null,
      "filter": null,
      "group": null,
      "id": "c7b5802e-53a0-4773-8229-d8e5a98a0eb6",
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }

class `bokeh.models.filters.``IndexFilter`(*args, **kw)

  Bases: `bokeh.models.filters.Filter`

  An IndexFilter filters data by returning the subset of data at a given set of indices.

  `indices`

    property type: `Seq` ( `Int` )

    A list of integer indices representing the subset of data to select.

JSON Prototype

    {
      "filter": null,
      "id": "fc5c7b95-636d-46db-b115-ffc911d59d48",
      "indices": null,
      "js_event_callbacks": {},
      "js_property_callbacks": {},
      "name": null,
      "subscribed_events": [],
      "tags": []
    }