-
Notifications
You must be signed in to change notification settings - Fork 794
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
docs: Adds Vega-Altair Theme Test #3630
Conversation
Planning to adapt this with changes from `index.html`
**This doesn't work yet**. The url params do work, but calling refresh doesn't
@joelostblom do you have any ideas on how I'd go about integrating this into the User Guide? I'm not sure if https://github.com/vega/sphinxext-altair would make sense here? EditJust spotted these that could be relevant |
Fixed in #3632 |
# Related - #3630 (comment) ``` tests\vegalite\v5\test_renderers.py:14: error: Incompatible types in assignment (expression has type "None", variable has type Module) [assignment] vlc = None ^~~~ tests\vegalite\v5\test_api.py:32: error: Incompatible types in assignment (expression has type "None", variable has type Module) [assignment] vlc = None ^~~~ tests\utils\test_mimebundle.py:10: error: Incompatible types in assignment (expression has type "None", variable has type Module) [assignment] vlc = None ^~~~ tests\utils\test_compiler.py:10: error: Incompatible types in assignment (expression has type "None", variable has type Module) [assignment] vlc = None ^~~~ Found 4 errors in 4 files (checked 332 source files) ```
Very lightweight solution for #3630 (comment) Also related to #3570
Really unsure why `mypy` has suddenly started complaining about this
- Quick & dirty version - Pushing to have something for regression testing while I finalize the directive api
feat(DRAFT): Adds Functional As of the above commit, I've now got a working version in the docs 2024-10-14.15-08-04.WIP.Functional.PyScript.mp4Still needs some cleaning up of the code and fitting the dimensions - but @mattijn your suggestion to use EditSee updated version in description |
Awesome @dangotbanned! Really nice to see that this might be the first pyscript integration of an Altair chart within the documentation. And it actually works! I can imagine we move elements of this into https://github.com/vega/sphinxext-altair. |
Reverts main part of 6e1ca94 Not needed now that `pyscript` is working
- Way less dependent on constants - Similar api to `altair-code-ref` - Leaving the door open for future potential `pyscript` use-cases - This is purely concerned with the theme switching
Both beautiful and really useful! 🙌 |
Thanks x2 @mattijn
Yeah I think some version of this would make sense there in the future. Lines 244 to 245 in 99400d5
I'd probably need to find out some more use cases for In comparison,
These make a lot of sense here from a maintenance perspective (see Code Block in #3630 (comment)). |
#3630 (comment) **Introduces no new behavior**.
Mostly just following up on [notes](#3630 (comment))
Should have been included in 6803368
Feel like it was too easy to miss the `<details>` alone
No longer needed
One thing I think might come up is the choice of I moved the legend for Initially tried EditOh thanks for approving already @mattijn 😄 |
Looks great 👍 |
Related: #3519 (comment)
Description
This PR provides a recreation of Vega Theme Test using
altair
, accessible via the User Guide.The primary benefit is to provide theme authors some sample code that they can use for testing the effects of their theme config.
I mentioned this in #3519 (comment), but I really think it is valuable to have a quick way to experiment across a wide range of chart/mark types.
Additionally, it serves as an example of composing a complex compound chart.
Compared to the existing compound_charts section - this features a range of data sources w/ a mix of shared/unique and local/url.
Video preview
2024-10-17.16-52-37.-.Embedded.redesign.mp4
See #3630 (comment) for initial version w/
pyscript
Screenshots
Code block
Collapsed
Expanded
The addition of this new directive allows directly referencing the contents of a function in the docs.
.. altair-code-ref::
directiveVega-Altair Theme Test
There is also some interesting stuff in https://github.com/vega/altair/blob/3a5801edcbb0536b3031a32bc4984fdfe0d8fb8d/tools/codemod.py that can be adapted to support #3570 (comment).
The short explanation is this supports rewriting & reformatting code to be used elsewhere.
So this would have the benefit of writing in the same style as the rest of
altair
code, but support autoformatting for a possibly different style if agreed upon in #3519.More generally though, a move towards writing code blocks in
.py
vs.rst
has other benefits from a maintenance perspective:ruff
,mypy
to ensure code qualityTasks
altair_theme_test.py
provides a single chart adaptation of https://vega.github.io/vega-themes/vega-altair_theme_test.html
in#chart-themes
ruff
usage (0615228)alt_theme_test
for User Guide templateDeferred
tests.altair_theme_test.py
(thread)mkdocs
, but polars/docs/source/srcOutdated
An earlier version that did not use
pyscript
:Separate html page
Screenshots
Ignore the slightly yellow hue. Seems to be an artifact of the screenshot itself
fivethirtyeight
latimes
vox
default
Current plan is for this link to replace the current link to Vega Theme Test
altair/doc/user_guide/customization.rst
Line 793 in 02ad17d
Notes
Theme Selection (Planning)
My understanding (not a web dev) of how switching between themes works in Vega Theme Test:
<select id="themes">
#themes
theme
theme
to https://github.com/vega/vega-embed