Created
September 13, 2018 14:16
-
-
Save ijlyttle/335c6dd7bb5711b4772dd14e2070b45c to your computer and use it in GitHub Desktop.
Vega-Lite: workaround to utcday
This file contains hidden or 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: mit | |
| height: 500 | |
| scrolling: yes | |
| border: yes | |
This file contains hidden or 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> | |
| <html> | |
| <head> | |
| <!-- uploaded using vegawidget --> | |
| <script src="https://cdn.jsdelivr.net/npm/vega@4.0.0-rc.3"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/vega-lite@2.6.0"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/vega-embed@3.16.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> |
This file contains hidden or 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": { | |
| "values": [ | |
| { | |
| "date": "2018-09-09", | |
| "value": 1 | |
| }, | |
| { | |
| "date": "2018-09-10", | |
| "value": 2 | |
| }, | |
| { | |
| "date": "2018-09-11", | |
| "value": 3 | |
| }, | |
| { | |
| "date": "2018-09-12", | |
| "value": 4 | |
| }, | |
| { | |
| "date": "2018-09-13", | |
| "value": 5 | |
| }, | |
| { | |
| "date": "2018-09-14", | |
| "value": 6 | |
| }, | |
| { | |
| "date": "2018-09-15", | |
| "value": 7 | |
| }, | |
| { | |
| "date": "2018-09-16", | |
| "value": 1 | |
| }, | |
| { | |
| "date": "2018-09-17", | |
| "value": 2 | |
| }, | |
| { | |
| "date": "2018-09-18", | |
| "value": 3 | |
| }, | |
| { | |
| "date": "2018-09-19", | |
| "value": 4 | |
| }, | |
| { | |
| "date": "2018-09-20", | |
| "value": 5 | |
| }, | |
| { | |
| "date": "2018-09-21", | |
| "value": 6 | |
| }, | |
| { | |
| "date": "2018-09-22", | |
| "value": 7 | |
| } | |
| ], | |
| "format": { | |
| "parse": { | |
| "date": "date:'%Y-%m-%d'" | |
| } | |
| } | |
| }, | |
| "mark": "bar", | |
| "encoding": { | |
| "x": { | |
| "field": "date", | |
| "timeUnit": "day", | |
| "type": "ordinal" | |
| }, | |
| "y": { | |
| "field": "value", | |
| "aggregate": "mean", | |
| "type": "quantitative" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
