Created
October 28, 2016 14:49
-
-
Save aaizemberg/18ab2d026b57c222d83f5f1526998428 to your computer and use it in GitHub Desktop.
Treemap generado con D3plus
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"> | |
<!-- load D3js --> | |
<script src="//d3plus.org/js/d3.js"></script> | |
<!-- load D3plus after D3js --> | |
<script src="//d3plus.org/js/d3plus.js"></script> | |
<!-- create container element for visualization --> | |
<div id="viz"></div> | |
<script> | |
// sample data array | |
var sample_data = [ | |
{"provincia":"Córdoba","poblacion":3308876}, | |
{"provincia":"Santa Fe","poblacion":3194537}, | |
{"provincia":"Ciudad Autónoma de Buenos Aires","poblacion":2890151}, | |
{"provincia":"Mendoza","poblacion":1738929}, | |
{"provincia":"Tucumán","poblacion":1448188}, | |
{"provincia":"Entre Ríos","poblacion":1235994}, | |
{"provincia":"Salta","poblacion":1214441}, | |
{"provincia":"Misiones","poblacion":1101593}, | |
{"provincia":"Chaco","poblacion":1055259}, | |
{"provincia":"Corrientes","poblacion":992595}, | |
{"provincia":"Buenos Aires","poblacion":15625084}, | |
{"provincia":"Santiago del Estero","poblacion":874006}, | |
{"provincia":"San Juan","poblacion":681055}, | |
{"provincia":"Jujuy","poblacion":673307}, | |
{"provincia":"Río Negro","poblacion":638645}, | |
{"provincia":"Neuquén","poblacion":551266}, | |
{"provincia":"Formosa","poblacion":530162}, | |
{"provincia":"Chubut","poblacion":509108}, | |
{"provincia":"San Luis","poblacion":432310}, | |
{"provincia":"Catamarca","poblacion":367828}, | |
{"provincia":"La Rioja","poblacion":333642}, | |
{"provincia":"La Pampa","poblacion":318951}, | |
{"provincia":"Santa Cruz","poblacion":273964}, | |
{"provincia":"Tierra del Fuego, Antártida e Islas del Atlántico Sur","poblacion":127205} | |
] | |
// instantiate d3plus | |
var visualization = d3plus.viz() | |
.container("#viz") // container DIV to hold the visualization | |
.data(sample_data) // data to use with the visualization | |
.type("tree_map") // visualization type | |
.id("provincia") // key for which our data is unique on | |
.size("poblacion") // sizing of blocks | |
.draw() // finally, draw the visualization! | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment