diff --git a/altair/vegalite/v5/api.py b/altair/vegalite/v5/api.py index 13be9421f..0f7be420f 100644 --- a/altair/vegalite/v5/api.py +++ b/altair/vegalite/v5/api.py @@ -1123,6 +1123,18 @@ def to_url(self, *, fullscreen: bool = False) -> str: else: return vlc.vegalite_to_url(self.to_dict(), fullscreen=fullscreen) + def open_editor(self, *, fullscreen: bool = False) -> None: + """Opens the chart specification in the Vega chart editor using the default browser. + + Parameters + ---------- + fullscreen : bool + If True, editor will open chart in fullscreen mode. Default False + """ + import webbrowser + + webbrowser.open(self.to_url(fullscreen=fullscreen)) + def save( self, fp: Union[str, IO], diff --git a/doc/releases/changes.rst b/doc/releases/changes.rst index d065b28bf..9f686e886 100644 --- a/doc/releases/changes.rst +++ b/doc/releases/changes.rst @@ -13,6 +13,7 @@ Enhancements for more information. - Docs: Add :ref:`section on dashboards ` which have support for Altair (#3299) - Support restrictive FIPS-compliant environment (#3291) +- Support opening charts in the Vega editor with ``chart.open_editor()`` (#3358) Bug Fixes ~~~~~~~~~