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.
Activity
ewellinger commentedon Jun 1, 2023
This might need to be tweaked somewhat, but I created this helper function that roughly follows the logic you're suggesting here:
This assumes you're storing the plot in the same directory as the CSV file containing the data.