Demonstrate the use of locale.
Created
October 30, 2017 17:33
-
-
Save domoritz/a5707e5d9430c173019583ea8bc5707a to your computer and use it in GitHub Desktop.
Vega-Lite locale example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: bsd-3-clause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$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