Created
May 7, 2019 14:11
-
-
Save annibal/0578ae7a9d3463935d618ca2c00680e5 to your computer and use it in GitHub Desktop.
Starting Vega Chart Spec
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/v5.json", | |
"width": 300, | |
"height": 300, | |
"padding": { | |
"top": 20, | |
"left": 80, | |
"bottom": 40, | |
"right": 20 | |
}, | |
"autosize": { "type": "none", "resize": true, "contains": "padding" }, | |
"data": [ | |
{ | |
"name": "table", | |
"values": [] | |
} | |
], | |
"scales": [ | |
{ | |
"name": "nameScale", | |
"type": "band", | |
"domain": { "data": "table", "field": "key" }, | |
"range": "height", | |
"padding": 0.05, | |
"round": true | |
}, | |
{ | |
"name": "barScale", | |
"domain": { "data": "table", "field": "value" }, | |
"nice": true, | |
"range": "width" | |
} | |
], | |
"axes": [ | |
{ | |
"orient": "left", | |
"scale": "nameScale", | |
"ticks": false, | |
"grid": true, | |
"domain": false, | |
"labels": true, | |
"labelAlign": "right", | |
"offset": 10, | |
"labelLimit": 90, | |
"tickRound": false, | |
"labelFlush": false, | |
"title": "X X X", | |
"titleAngle": -90, | |
"titleAnchor": "start", | |
"titleAlign": "center", | |
"titlePadding": 30, | |
"titleBaseline": "top", | |
"titleFontWeight": "normal", | |
"labelAngle": -40, | |
"labelFontSize": 12 | |
}, | |
{ | |
"orient": "bottom", | |
"scale": "barScale", | |
"ticks": true, | |
"domain": true, | |
"labels": true, | |
"offset": 0, | |
"labelLimit": 1000, | |
"titlePadding": 20, | |
"tickRound": false, | |
"title": "Y Y Y", | |
"titleAnchor": "end", | |
"titleBaseline": "bottom", | |
"titleFontWeight": "normal", | |
"labelFlush": false | |
} | |
], | |
"marks": [ | |
{ | |
"type": "rect", | |
"from": { "data": "table" }, | |
"encode": { | |
"enter": { | |
"y": { "scale": "nameScale", "field": "key" }, | |
"height": { "scale": "nameScale", "band": 1 }, | |
"x": { "scale": "barScale", "field": "value" }, | |
"x2": { "scale": "barScale", "value": 0 }, | |
"fill": { "value": "red" } | |
} | |
} | |
}, | |
{ | |
"type": "rect", | |
"encode": { | |
"enter": { | |
"y": { "value": 0 }, | |
"height": { "signal": "height" }, | |
"x": { "scale": "barScale", "value": 0 }, | |
"x2": { "scale": "barScale", "value": 0 }, | |
"stroke": { "value": "#BBB" } | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment