Skip to content

Commit

Permalink
Add "jupyter" renderer based on JupyterChart
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Dec 14, 2023
1 parent 406ad99 commit 623ff97
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions altair/vegalite/v5/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ def svg_renderer(spec: dict, **metadata) -> Dict[str, str]:
)


def render_jupyter(spec):
"""Render chart using the JupyterChart Jupyter Widget"""
from altair import Chart, JupyterChart

return JupyterChart(chart=Chart.from_dict(spec))._repr_mimebundle_()


html_renderer = HTMLRenderer(
mode="vega-lite",
template="universal",
Expand All @@ -105,6 +112,7 @@ def svg_renderer(spec: dict, **metadata) -> Dict[str, str]:
renderers.register("json", json_renderer)
renderers.register("png", png_renderer)
renderers.register("svg", svg_renderer)
renderers.register("jupyter", render_jupyter)
renderers.enable("default")


Expand Down

0 comments on commit 623ff97

Please sign in to comment.