Skip to content

Conversation

@ahuang11
Copy link
Contributor

@ahuang11 ahuang11 commented Oct 27, 2025

Export vega lite to formats

import panel as pn
pn.extension('vega')

vegalite = {
    "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
    "data": {"url": "https://raw.githubusercontent.com/vega/vega/master/docs/data/barley.json"},
    "mark": "bar",
    "encoding": {
        "x": {"aggregate": "sum", "field": "yield", "type": "quantitative"},
        "y": {"field": "variety", "type": "nominal"},
        "color": {"field": "site", "type": "nominal"},
    },
    "width": 800
}
vega = pn.pane.Vega(vegalite, width=800)
pn.pane.PNG(vega.export("png"), width=400, height=200).show()
image

Todo:

  • Update reference guide

@ahuang11 ahuang11 requested a review from philippjfr October 27, 2025 18:28
@ahuang11 ahuang11 marked this pull request as ready for review October 27, 2025 18:28
@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 84.51327% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.02%. Comparing base (7022916) to head (7c97d82).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
panel/pane/vega.py 61.95% 35 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8266      +/-   ##
==========================================
+ Coverage   85.40%   86.02%   +0.62%     
==========================================
  Files         348      348              
  Lines       54152    54374     +222     
==========================================
+ Hits        46246    46773     +527     
+ Misses       7906     7601     -305     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ahuang11 ahuang11 changed the title Export vega lite Add export method to Vega pane Oct 27, 2025
@ahuang11 ahuang11 added the type: enhancement Minor feature or improvement to an existing feature label Oct 27, 2025
@philippjfr
Copy link
Member

Let's maybe support as_pane: bool = False and then automatically wrap the returned type in the appropriate pane.

Co-authored-by: Simon Høxbro Hansen <[email protected]>
@philippjfr
Copy link
Member

@ahuang11 if you could, please parameterize the tests and add docs.

@philippjfr philippjfr added this to the v1.9.0 milestone Oct 29, 2025
@ahuang11 ahuang11 requested review from hoxbro and philippjfr October 29, 2025 15:58
@philippjfr philippjfr merged commit b749842 into main Oct 29, 2025
19 of 21 checks passed
@philippjfr philippjfr deleted the export_vega_lite branch October 29, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Minor feature or improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants