ITADN

Let altair2fasthtml() accept kwargs to be passed on as options to the eventual vegaEmbed call

#8Closedddanieltan 创建于 2024-09-30
D
ddanieltancommented
vegaEmbed takes in a variety of options [docs](https://github.com/vega/vega-embed?tab=readme-ov-file#options). I suggest adding a kwarg into `altair2fasthtml()` arguments that get passed on to the eventual vegaEmbed call. Rough mock ```python def altair2fasthtml(chart, user_options): jsonstr = chart.to_json() chart_id = f'uniq-{uuid4()}' default_options = {"actions": "false"} options = {**user_options, **default_options} return Div(Script(f"vegaEmbed('#{chart_id}', {jsonstr}, {options});"), id=chart_id) ``` I'd be happy to submit a PR if you like this idea.
关闭于 2024-10-08 4 条评论