Published
Edited
Jun 19, 2019
Insert cell
md`# Usage of timeFormatLocale & formatLocale in Vega-Embed`
Insert cell
embed = require("vega-embed@4")
Insert cell
formatlocale = await (await fetch("https://unpkg.com/d3-format@1/locale/nl-NL.json")).json()
Insert cell
timeformatlocale = await (await fetch("https://unpkg.com/d3-time-format@1/locale/nl-NL.json")).json()
Insert cell
embed.vega.timeFormatLocale(timeformatlocale)
Insert cell
embed.vega.formatLocale(formatlocale)
Insert cell
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"]}
},
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more