include `formatLocale` and `timeFormatLocale` parameters in options
See original GitHub issueReasoning: I would like to set the formatLocale
and formatTimeLocale
as part of the embed_options
in Altair.
At the vega repo, @jheer did comment once that you will need to invoke the formatLocale
and formatTimeLocale
methods prior instantiation of a Vega View (https://github.com/vega/vega/pull/313#issuecomment-297562302).
Using this approach I can set it in VegaEmbed: https://observablehq.com/@mattijn/usage-of-timeformatlocale-formatlocale-in-vega-embed, but this is prior the invokation of the View constructor.
Basically its just:
embed = require("vega-embed@4")
formatlocale = await (await fetch("https://unpkg.com/d3-format@1/locale/nl-NL.json")).json()
timeformatlocale = await (await fetch("https://unpkg.com/d3-time-format@1/locale/nl-NL.json")).json()
embed.vega.timeFormatLocale(timeformatlocale)
embed.vega.formatLocale(formatlocale)
viewof view = embed({
"$schema": "https://vega.github.io/schema/vega-lite/v3.json",
"description": "Google's stock price over time.",
"width": 700,
"data": {"url": "https://raw.githubusercontent.com/vega/vega-datasets/master/data/stocks.csv"},
"transform": [{"filter": "datum.symbol==='GOOG'"}],
"mark": {
"type": "area",
"color": "lightblue",
"interpolate": "step-after",
"line": true
},
"encoding": {
"x": {"field": "date", "type": "temporal"},
"y": {"field": "price", "type": "quantitative"},
"tooltip": [
{"type": "quantitative", "field": "price", "format": "$,"},
{"type": "temporal", "field": "date"}
],
},
"selection": {
"zoom_x": {"type": "interval", "bind": "scales", "encodings": ["x"]}
},
})
Would it be possible to provide these locale settings as options in the Vega-Embed View?
Other sources of similar requests for Altair:
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Setting Altair FormatLocale isn't working - Stack Overflow
alt.renderers settings only apply to charts being displayed by a renderer, e.g. in Jupyter Notebook: it does not affect charts being saved ...
Read more >VegaEmbedOptions class - vega_embed_flutter library
Represents the VegaEmbed Options like theme, renderer etc. ... formatLocale, TimeFormatLocale timeFormatLocale}): Embed options for VegaLiteEmbedder.
Read more >E-FLUID: Time fields Formatting Does Not Respect the Default ...
Find the Locale Code en-us. 7. Set, for User Option Time Format, Locale Code en-us, the Override Value of M (M = 24...
Read more >Locale API | Vega
To display number and date values, by default Vega uses formatting rules for ... files for a variety of languages, see the d3-time-format...
Read more >Set Agent Locale based on Service Desk System Settings and ...
Can we have Agent's locale (in Agent Panel -> Profile) default to the same as the service desk System ... Date/Time Format: Locale...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed and released in 6.1.0.
@domoritz maybe just delegate the responsibility of handling this to vega itself by considering the following reasoning:
It’s a bit cheating instead of dealing with the problem, but at the same time, think that where this problem can be fixed is at the level of vega itself when it uses d3.