Created
February 25, 2015 14:57
-
-
Save mariohmol/6c88570d21501bb0c2d2 to your computer and use it in GitHub Desktop.
This file contains 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> | |
<meta charset="utf-8"> | |
<script src="http://www.d3plus.org/js/d3.js"></script> | |
<script src="http://www.d3plus.org/js/d3plus.js"></script> | |
<div id="viz"></div> | |
<script> | |
var sample_data = [ | |
{"year": 1991, "name":"alpha", "value": 15, "parent": "parent 1"}, | |
{"year": 1992, "name":"alpha", "value": 20, "parent": "parent 1"}, | |
{"year": 1993, "name":"alpha", "value": 30, "parent": "parent 1"}, | |
{"year": 1994, "name":"alpha", "value": 60, "parent": "parent 1"}, | |
{"year": 1991, "name":"beta", "value": 10, "parent": "parent 1"}, | |
{"year": 1992, "name":"beta", "value": 10, "parent": "parent 1"}, | |
{"year": 1993, "name":"beta", "value": 40, "parent": "parent 1"}, | |
{"year": 1994, "name":"beta", "value": 60, "parent": "parent 1"}, | |
{"year": 1991, "name":"gamma", "value": 5, "parent": "parent 2"}, | |
{"year": 1992, "name":"gamma", "value": 10, "parent": "parent 2"}, | |
{"year": 1993, "name":"gamma", "value": 20, "parent": "parent 2"}, | |
{"year": 1994, "name":"gamma", "value": 25, "parent": "parent 2"}, | |
{"year": 1991, "name":"delta", "value": 50, "parent": "parent 2"}, | |
{"year": 1992, "name":"delta", "value": 43, "parent": "parent 2"}, | |
{"year": 1993, "name":"delta", "value": 17, "parent": "parent 2"}, | |
{"year": 1994, "name":"delta", "value": 32, "parent": "parent 2"} | |
] | |
var visualization = d3plus.viz() | |
.container("#viz") | |
.data(sample_data) | |
.type("line") | |
.id(["parent","name"]) | |
.y("value") | |
.x("year") | |
.draw() | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment