You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Of course you could just use chart.save('chart.svg') and insert that into a mkdocs page. But you want to want update the data later on and use the same chart.
Manually copy pasting the schema to a file is a hassle. Write a helper function to:
The docs_folders could be auto-detected by traversing upward, finding mkdocs.yml and reading the docs_dir entry (if not present then docs/).
The json_path is relative to the docs_folder and can have a default "docs/assets/charts/"
The data_path is relative to the docs_folder and can have a "docs/assets/charts/data" default. This will only work if we can access the data object in the altair chart instance, which we can then write to .csv.
The text was updated successfully, but these errors were encountered:
altair
has good support for exportingvega
schemas (https://altair-viz.github.io/user_guide/saving_charts.html?highlight=to_).Of course you could just use
chart.save('chart.svg')
and insert that into a mkdocs page. But you want to want update the data later on and use the same chart.Manually copy pasting the schema to a file is a hassle. Write a helper function to:
save_mkdocs_chart(chart, name="", docs_folder="../docs", json_path="docs/assets/charts/", data_path="docs/assets/charts/data")
The
docs_folders
could be auto-detected by traversing upward, findingmkdocs.yml
and reading thedocs_dir
entry (if not present thendocs/
).The
json_path
is relative to thedocs_folder
and can have a default"docs/assets/charts/"
The
data_path
is relative to thedocs_folder
and can have a"docs/assets/charts/data"
default. This will only work if we can access the data object in the altairchart
instance, which we can then write to.csv
.The text was updated successfully, but these errors were encountered: