-
Notifications
You must be signed in to change notification settings - Fork 847
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
It seems like it's not possible to show altair charts when localization is enabled as shown here: https://altair-viz.github.io/user_guide/customization.html#localization
After the alt.renderers.set_embed_options(format_locale="it-IT", time_format_locale="it-IT") is executed, simply outputting the chart (without using mo.ui.altair_chart) doesn't show anything. When I wrap it in the UI method, I get an error message:
t is undefined
PO@http://localhost:2718/assets/index-BR3wLmMq.js:63:22132 Hce@http://localhost:2718/assets/index-BR3wLmMq.js:63:18343 yue@http://localhost:2718/assets/index-BR3wLmMq.js:63:28244 ux@http://localhost:2718/assets/index-BR3wLmMq.js:63:28294 Bn/<@http://localhost:2718/assets/VegaLite-lc7CRpzR.js:189:2511 Bn@http://localhost:2718/assets/VegaLite-lc7CRpzR.js:189:5488
Interestingly, if I apply vegafusion as data transformer before setting the locale, the error message disappears and charts are shown. However, localization is not applied
Will you submit a PR?
- Yes
Environment
Details
{
"marimo": "0.13.11",
"OS": "Darwin",
"OS Version": "24.5.0",
"Processor": "arm",
"Python Version": "3.13.1",
"Binaries": {
"Browser": "136.0.7103.114",
"Node": "v20.18.1"
},
"Dependencies": {
"click": "8.2.1",
"docutils": "0.21.2",
"itsdangerous": "2.2.0",
"jedi": "0.19.2",
"markdown": "3.8",
"narwhals": "1.40.0",
"packaging": "25.0",
"psutil": "7.0.0",
"pygments": "2.19.1",
"pymdown-extensions": "10.15",
"pyyaml": "6.0.2",
"starlette": "0.46.2",
"tomlkit": "0.13.2",
"typing-extensions": "4.13.2",
"uvicorn": "0.34.2",
"websockets": "15.0.1"
},
"Optional Dependencies": {
"altair": "5.5.0",
"duckdb": "1.3.0",
"nbformat": "5.10.4",
"openai": "1.82.0",
"pandas": "2.2.3",
"polars": "1.30.0",
"pyarrow": "20.0.0",
"loro": "1.5.1",
"ruff": "0.11.11",
"sqlglot": "26.19.0"
},
"Experimental Flags": {}
}
Code to reproduce
import marimo
__generated_with = "0.13.11"
app = marimo.App(width="medium")
@app.cell
def _():
import altair as alt
from vega_datasets import data
import marimo as mo
source = data.stocks.url
chart = alt.Chart(source).mark_area().transform_filter('year(datum.date) == 2009').encode(
x='date:T',
y=alt.Y('price:Q', axis=alt.Axis(format="$.0f")),
color='symbol:N'
)
chart
return alt, chart, mo
@app.cell
def _(chart, mo):
mo.ui.altair_chart(chart)
return
@app.cell
def _(alt, chart):
#alt.data_transformers.enable("vegafusion") # uncomment to avoid error message
alt.renderers.set_embed_options(format_locale="it-IT", time_format_locale="it-IT")
chart
return
@app.cell
def _(chart, mo):
mo.ui.altair_chart(chart)
return
if __name__ == "__main__":
app.run()Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working