Last active
November 3, 2015 14:11
-
-
Save randyzwitch/2c068daee344a1175e96 to your computer and use it in GitHub Desktop.
Aster plot in Vega.js
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
{ | |
"name": "Vega Visualization", | |
"height": 250, | |
"padding": "auto", | |
"marks": [ | |
{ | |
"properties": { | |
"update": {"fillOpacity": {"value": 1}}, | |
"hover": {"fillOpacity": {"value": 0.5}}, | |
"enter": { | |
"innerRadius": {"value": 75}, | |
"stroke": {"value": "white"}, | |
"startAngle": {"field": "layout_start"}, | |
"x": {"mult": 0.5,"group": "width"}, | |
"outerRadius": {"field": "calcOuterRadius"}, | |
"endAngle": {"field": "layout_end"}, | |
"fill": {"field": "x","scale": "color"}, | |
"y": {"mult": 0.5,"group": "height"} | |
} | |
}, | |
"from": { | |
"data": "table", | |
"transform": [ | |
{"field": "y2","type": "pie"}, | |
{ | |
"field": "calcOuterRadius", | |
"expr": "(250 - 75) * (datum.y/100.0) + 75", | |
"type": "formula" | |
} | |
] | |
}, | |
"type": "arc" | |
}, | |
{ | |
"properties": { | |
"enter": { | |
"innerRadius": {"value": 75}, | |
"stroke": {"value": "gray"}, | |
"startAngle": {"field": "layout_start"}, | |
"x": {"mult": 0.5,"group": "width"}, | |
"outerRadius": {"value": 250}, | |
"endAngle": {"field": "layout_end"}, | |
"y": {"mult": 0.5,"group": "height"} | |
} | |
}, | |
"from": { | |
"data": "table", | |
"transform": [ | |
{"field": "y2","type": "pie"}, | |
{ | |
"field": "calcOuterRadius", | |
"expr": "(250 - 75) * (datum.y/100.0) + 75", | |
"type": "formula" | |
} | |
] | |
}, | |
"type": "arc" | |
} | |
], | |
"data": [ | |
{ | |
"name": "table", | |
"values": [ | |
{"x": "FIS","y2": 0.5,"group": 1,"y": 59}, | |
{"x": "MAR","y2": 0.5,"group": 1,"y": 24}, | |
{"x": "AO","y2": 1,"group": 1,"y": 98}, | |
{"x": "NP","y2": 1,"group": 1,"y": 60}, | |
{"x": "CS","y2": 1,"group": 1,"y": 74}, | |
{"x": "CP","y2": 1,"group": 1,"y": 70}, | |
{"x": "TR","y2": 1,"group": 1,"y": 42}, | |
{"x": "LIV","y2": 0.5,"group": 1,"y": 77}, | |
{"x": "ECO","y2": 0.5,"group": 1,"y": 88}, | |
{"x": "ICO","y2": 0.5,"group": 1,"y": 60}, | |
{"x": "LSP","y2": 0.5,"group": 1,"y": 65}, | |
{"x": "CW","y2": 1,"group": 1,"y": 71}, | |
{"x": "HAB","y2": 0.5,"group": 1,"y": 88}, | |
{"x": "SPP","y2": 0.5,"group": 1,"y": 83} | |
] | |
} | |
], | |
"scales": [ | |
{ | |
"name": "color", | |
"range": [ | |
"#9E0041", | |
"#C32F4B", | |
"#E1514B", | |
"#F47245", | |
"#FB9F59", | |
"#FEC574", | |
"#FAE38C", | |
"#EAF195", | |
"#C7E89E", | |
"#9CD6A4", | |
"#6CC4A4", | |
"#4D9DB4", | |
"#4776B4", | |
"#5E4EA1" | |
], | |
"domain": {"data": "table","field": "x"}, | |
"type": "ordinal" | |
} | |
], | |
"width": 250, | |
"legends": [{"title": "group","fill": "color"}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment