Problem: How do i use different type of calendar as y instead of default JS calendar system (gregorian)
As example of I need instead of hard coded calendar or formatted i need the standard
:globe_with_meridians:Intl.DateTimeFormat that currently support by many browsers
Here the official vega documentation:
{
"data": {"url": "data/seattle-weather.csv"},
"mark": "bar",
"encoding": {
"x": {
"timeUnit": "month",
"field": "date",
"type": "ordinal",
"axis": {"title": "Month of the year"}
},
"y": {
"aggregate": "count",
"type": "quantitative"
},
"color": {
"field": "weather",
"type": "nominal",
"scale": {
"domain": ["sun", "fog", "drizzle", "rain", "snow"],
"range": ["#e7ba52", "#c7c7c7", "#aec7e8", "#1f77b4", "#9467bd"]
},
"legend": {"title": "Weather type"}
}
}
}
I think it's good to we have a key like:
{
"timeUnit": "month",
"i18n": {
"l": "en-GB",
"ca": "persian",
"nu": "latn"
}
}
new Intl.DateTimeFormat('en-GB-u-nu-latn-ca-persian').format(new Date());
More info https://mhf-ir.github.io/i18nplease/
Thank you for raising the issue. We will need support for internationalization to Vega.
Thanks! For now, Vega provides only the support afforded by the d3-time-format library. It supports a level of internationalization through locale configuration, but is not as comprehensive. Definitely an area for future development.
In addition to Intl.DateTimeFormat, we should also look at Intl.NumberFormat.
Most helpful comment
In addition to Intl.DateTimeFormat, we should also look at Intl.NumberFormat.