Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open charts in the default browser with open_editor method #3358

Merged
merged 4 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
1 change: 1 addition & 0 deletions doc/releases/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Enhancements
for more information.
- Docs: Add :ref:`section on dashboards <display_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
~~~~~~~~~
Expand Down
Loading