Skip to content
v1.0.3

Visualization

T = TypeVar('T', bound=str)
class Visualization(BaseModel, ABC, Generic[T]):

Base class for all frontend visualizations.

A visualization is a JSON-serializable object that a Resource.visualize() method can return so the frontend can render the resource.

Every visualization has a type discriminator. Concrete subclasses set type to a fixed literal value (for example "table" or "plotly").

Attributes:

  • type T — Discriminator used by the frontend to select the renderer.
Source
class Visualization(BaseModel, ABC, Generic[T]):
"""Base class for all frontend visualizations.
A visualization is a JSON-serializable object that a `Resource.visualize()` method
can return so the frontend can render the resource.
Every visualization has a `type` discriminator. Concrete subclasses set `type`
to a fixed literal value (for example `"table"` or `"plotly"`).
Attributes:
type: Discriminator used by the frontend to select the renderer.
"""
type: T