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:
- 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.
- 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:
- 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