Skip to content

Instantly share code, notes, and snippets.

@domoritz
Created October 30, 2017 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domoritz/a5707e5d9430c173019583ea8bc5707a to your computer and use it in GitHub Desktop.
Save domoritz/a5707e5d9430c173019583ea8bc5707a to your computer and use it in GitHub Desktop.
Vega-Lite locale example
license: bsd-3-clause

Demonstrate the use of locale.

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega/3.0.7/vega.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.0.0-rc5/vega-lite.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0-rc6/vega-embed.js"></script>
<style>
body {
font-family: sans-serif;
}
.vega-actions a {
padding: 0.2em;
}
</style>
</head>
<body>
<div id="vis"></div>
<script>
// change to German locale
vegaEmbed.vega.formatLocale({
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["", "\u00a0€"]
});
const spec = "scatter.vl.json";
vegaEmbed('#vis', spec).catch(console.warn);
</script>
</body>
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {"url": "https://vega.github.io/editor/data/movies.json"},
"mark": "point",
"encoding": {
"x": {"field": "Worldwide_Gross","type": "quantitative"},
"y": {"field": "US_DVD_Sales","type": "quantitative"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment