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
data = [ | |
{"value":100, "group":"alpha", "id":1}, | |
{"value":70, "group":"alpha", "id":2}, | |
{"value":40, "group":"alpha", "id":3}, | |
{"value":15, "group":"beta", "id":4}, | |
{"value":5, "group":"beta", "id":5}, | |
{"value":1, "group":"beta", "id":6} | |
] |
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
attrs = [ | |
{"id": 1, "name": "one"}, | |
{"id": 2, "name": "two"}, | |
{"id": 3, "name": "three"}, | |
{"id": 4, "name": "four"}, | |
{"id": 5, "name": "five"}, | |
{"id": 6, "name": "six"} | |
] |
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
attrs = { | |
1: {"name": "one"}, | |
2: {"name": "two"}, | |
3: {"name": "three"}, | |
4: {"name": "four"}, | |
5: {"name": "five"}, | |
6: {"name": "six"} | |
} |
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
attrs = { | |
"id": [ | |
{"id": 1, "name": "one"}, | |
{"id": 2, "name": "two"}, | |
{"id": 3, "name": "three"}, | |
{"id": 4, "name": "four"}, | |
{"id": 5, "name": "five"}, | |
{"id": 6, "name": "six"} | |
], | |
"group": [ |
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
var container = d3.select("div#container") |
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
function change_id(selection) { | |
selection.attr("id","visualization") | |
} | |
d3.select("div#container").call(change_id) |
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
visualization | |
.type("tree_map") // we're building a tree map | |
.id("name") // the unique key for our data | |
.value("size") // the key used for sizing the squares | |
.dev(true) |
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
var rect = svg.append("rect") |
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
var svg = d3.select("svg#viz") |
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
var arr = [2,3,6,10] | |
rect.data(arr) |
OlderNewer