panel-mosaic¶
panel_mosaic
¶
Panel components for Mosaic visualizations.
__all__ = ['__version__', 'Mosaic']
module-attribute
¶
__version__ = importlib.metadata.version('panel-mosaic-viz')
module-attribute
¶
Mosaic
¶
Bases: JSComponent
Render a declarative Mosaic or vgplot specification in Panel.
Mosaic sends SQL generated from spec to this component's DuckDB
connection. The component returns only the query result, allowing linked,
cross-filtered visualizations to operate on data too large to embed in the
browser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
dict[str, Any] | None
|
A Mosaic specification. Marks refer to tables with
|
None
|
con
|
DuckDBPyConnection | None
|
DuckDB connection used to run Mosaic queries. A new in-memory connection is created when omitted. |
None
|
data
|
dict[str, Any] | None
|
Frames to register on |
None
|
Examples:
>>> import duckdb
>>> con = duckdb.connect()
>>> _ = con.execute("CREATE TABLE points AS SELECT 1 AS x, 2 AS y")
>>> pane = Mosaic(
... {"plot": [{"mark": "dot", "data": {"from": "points"}, "x": "x", "y": "y"}]},
... con=con,
... )
>>> pane.connection is con
True
connection
property
¶
DuckDB connection queried by Mosaic.
error = param.String(default='', doc='\n The latest browser-side parsing, rendering, or query error.\n\n An empty string indicates that no error is associated with the current\n specification.\n ')
class-attribute
instance-attribute
¶
params = param.Dict(default={}, doc='\n Live Mosaic parameters and selections, keyed by name. Each selection\n includes its current value and SQL predicate.\n ')
class-attribute
instance-attribute
¶
preagg_schema = param.String(default='', doc="\n Schema where Mosaic may materialize pre-aggregated views. An empty\n value uses Mosaic's default schema.\n ")
class-attribute
instance-attribute
¶
ready = param.Boolean(default=False, doc='\n Whether the current specification rendered successfully in the browser.\n\n This becomes ``False`` while a specification is being rendered and\n remains false when parsing, rendering, or querying fails.\n ')
class-attribute
instance-attribute
¶
responsive = param.Boolean(default=False, doc="\n Whether plots should resize to fill the component's available width\n and height. This is useful with a stretching Panel layout.\n ")
class-attribute
instance-attribute
¶
spec = param.Dict(default={}, doc='\n Mosaic specification to render. Marks reference registered DuckDB\n tables through ``data: {from: <table_name>}``.\n ')
class-attribute
instance-attribute
¶
mosaic
¶
Panel component for interactive Mosaic and vgplot visualizations.
FLECHETTE_VERSION = '2.5.0'
module-attribute
¶
MOSAIC_VERSION = '0.31.0'
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
Mosaic
¶
Bases: JSComponent
Render a declarative Mosaic or vgplot specification in Panel.
Mosaic sends SQL generated from spec to this component's DuckDB
connection. The component returns only the query result, allowing linked,
cross-filtered visualizations to operate on data too large to embed in the
browser.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
dict[str, Any] | None
|
A Mosaic specification. Marks refer to tables with
|
None
|
con
|
DuckDBPyConnection | None
|
DuckDB connection used to run Mosaic queries. A new in-memory connection is created when omitted. |
None
|
data
|
dict[str, Any] | None
|
Frames to register on |
None
|
Examples:
>>> import duckdb
>>> con = duckdb.connect()
>>> _ = con.execute("CREATE TABLE points AS SELECT 1 AS x, 2 AS y")
>>> pane = Mosaic(
... {"plot": [{"mark": "dot", "data": {"from": "points"}, "x": "x", "y": "y"}]},
... con=con,
... )
>>> pane.connection is con
True
connection
property
¶
DuckDB connection queried by Mosaic.