Skip to content

Instantly share code, notes, and snippets.

@davelandry
Last active August 22, 2016 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davelandry/a9a9ada6101818be4fdc to your computer and use it in GitHub Desktop.
Save davelandry/a9a9ada6101818be4fdc to your computer and use it in GitHub Desktop.
Advanced Visualization Interface Elements
<!doctype html>
<meta charset="utf-8">
<script src="//d3plus.org/js/d3.js"></script>
<script src="//d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
var sample_data = [
{"value": 100, "name": "alpha", "weight": 80},
{"value": 70, "name": "beta", "weight": 43},
{"value": 40, "name": "gamma", "weight": 64},
{"value": 15, "name": "delta", "weight": 20},
{"value": 5, "name": "epsilon", "weight": 92},
{"value": 1, "name": "zeta", "weight": 35}
];
var visualization = d3plus.viz()
.container("#viz")
.data(sample_data)
.type("tree_map")
.id("name")
.color("name")
.size("value")
.ui([
{
"method" : function(value){
alert(value);
},
"label": "Alert",
"type": "button",
"value" : ["Hello"]
},
{
"method" : "color",
"type": "drop",
"value" : [{"Random": "name"}, {"Weight Value": "weight"}]
}
])
.draw();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment