Skip to content

Instantly share code, notes, and snippets.

@ijlyttle
Created August 3, 2018 04:56
Show Gist options
  • Save ijlyttle/b61d20e6f6476f9cdac1254937f7cb6c to your computer and use it in GitHub Desktop.
Save ijlyttle/b61d20e6f6476f9cdac1254937f7cb6c to your computer and use it in GitHub Desktop.
leap-year issue
license: mit
height: 500
scrolling: yes
border: yes
<!DOCTYPE html>
<html>
<head>
<!-- uploaded using vegawidget -->
<script src="https://cdn.jsdelivr.net/npm/vega@4.0.0-rc.2"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@2.5.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@3.14.0"></script>
<link rel="stylesheet" type="text/css" href="vega-embed.css">
</head>
<body>
<div id="vis"></div>
<script type="text/javascript">
const spec = "spec.json";
const opt = {"defaultStyle":true,"renderer":"canvas"};
vegaEmbed('#vis', spec, opt).then(function(result) {
// access view as result.view
}).catch(console.error);
</script>
</body>
</html>
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"width": 300,
"data": {
"values": [
{
"date": "2012-02-27",
"value": 10
},
{
"date": "2012-02-28",
"value": 10
},
{
"date": "2012-02-29",
"value": 10
},
{
"date": "2012-03-01",
"value": 10
},
{
"date": "2012-03-02",
"value": 10
},
{
"date": "2012-03-03",
"value": 10
},
{
"date": "2013-02-27",
"value": 15
},
{
"date": "2013-02-28",
"value": 15
},
{
"date": "2013-03-01",
"value": 15
},
{
"date": "2013-03-02",
"value": 15
},
{
"date": "2013-03-03",
"value": 15
}
]
},
"mark": "point",
"encoding": {
"x": {
"field": "date",
"type": "temporal",
"timeUnit": "utcmonthdate"
},
"y": {
"field": "value",
"type": "quantitative",
"aggregate": "sum"
},
"color": {
"field": "date",
"type": "nominal",
"timeUnit": "utcyear"
},
"tooltip": [
{
"field": "date",
"type": "nominal",
"timeUnit": "utcmonthdate",
"format": "%Y-%m-%d",
"title": "aggregated date"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment