canvas_framework

class canvas_ux.Canvas(table, id_column='id', data_type=None, instances_per_page=None)[source]

A framework for modular, interactive data science visualizations. Canvas provides a collection of widgets users can use to explore their data both in Jupyter Notebooks and standalone web dashboards.

Parameters:
  • table (Table | DataFrame | str) –

  • id_column (str) –

  • data_type (CanvasDataType | None) –

  • instances_per_page (int | None) –

export(export_path, name=None)[source]

Export the current widgets to a static page. Creates a directory with an index.html file, data folder, and JavaScript files for each widget.

Parameters:
  • export_path (str or Path) – The folder to export the static page to.

  • name (str, optional) – Name of the exported app. By default None, using the export path.

Return type:

None

get_canvas_spec()[source]

Get the Canvas spec for the current Canvas report

Returns:

The spec for the current Canvas report.

Return type:

CanvasSpec

get_filter()[source]

Get the filter string for Canvas.

Returns:

The filter that will be applied to the table.

Return type:

str

get_group_columns()[source]

Get the columns of the table by which to apply grouping.

Parameters:

List[str] – The columns by which to apply grouping.

Return type:

List[str]

get_layout()[source]

Get the current static app layout.

Returns:

Set of pages with their corresponding layout settings.

Return type:

Dict

get_selected()[source]

Get the selected instances for Canvas.

Returns:

List of selected instances to update Canvas with.

Return type:

List

get_table()[source]

Get the table based on which Canvas creates visualizations.

Returns:

The table on which visualizations should be based.

Return type:

pa.Table

set_canvas_spec(spec)[source]

Set the Canvas spec for the current Canvas report.

Parameters:

spec (CanvasSpec or dict) – The new spec to set for the Canvas report.

Return type:

None

set_filter(filter)[source]

Set the filter string for Canvas.

Parameters:

filter (str) – The filter that will be applied to the table.

Return type:

None

set_group_columns(group_columns)[source]

Set the columns of the table by which to apply grouping.

Parameters:

group_columns (List[str]) – The columns by which to apply grouping.

Return type:

None

set_layout(layout)[source]

Set the current static app layout.

Parameters:

layout (Dict) – Set of pages with their corresponding layout settings.

Return type:

None

set_selected(selected)[source]

Set the selected instances for Canvas.

Parameters:

selected (List) – List of selected instances to update Canvas with.

Return type:

None

set_table(table)[source]

Set the table based on which Canvas creates visualizations.

Parameters:

table (Union[pa.Table, pd.DataFrame]) – The table on which visualizations should be based.

Return type:

None

standalone(widgets, export_path, widget_params=[], name=None)[source]

Create a standalone app with the given widgets. Similar to the export() function but does not require the widgets to have been passed to Canvas beforehand.

Parameters:
  • widgets (List[Type[CanvasWidget]]) – List of CanvasWidgets to include in the standalone app.

  • export_path (str or Path) – Where to export the standalone app to.

  • widget_params (List[Dict]) – List of named parameters to pass to each widget. Must be the same length as widgets, and be an empty dict {} for no options. By default an empty list.

  • name (str, optional) – Name of this exported app. By default None, using the export path.

Return type:

None

widget(widget, **kwargs)[source]

Render a CanvasWidget.

Parameters:
  • widget (Type[CanvasWidget]) – The widget to be added to canvas.

  • kwargs (dict) –

Returns:

Notebook container for toolbar and created widget.

Return type:

HBox