Created
August 1, 2015 15:45
-
-
Save nachomezzadra/c50bdf9b730502929e7a to your computer and use it in GitHub Desktop.
Provincias Argentinas Tree map (Google)
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> | |
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<meta charset="utf-8"> | |
<title>Tree map Provincias Arg</title> | |
</head> | |
<body> | |
<div id="chart_div" style="width: 900px; height: 500px;"></div> | |
<script id="jsbin-javascript"> | |
var datos = [ | |
{"p":"Capital Federal","h":"2891082"}, | |
{"p":"Buenos Aires","h":"12703346"}, | |
{"p":"Catamarca","h":"367829"}, | |
{"p":"Córdoba","h":"3304825"}, | |
{"p":"Corrientes","h":"993338"}, | |
{"p":"Chaco","h":"1053466"}, | |
{"p":"Chubut","h":"506668"}, | |
{"p":"Entre Ríos","h":"1236300"}, | |
{"p":"Formosa","h":"527000"}, | |
{"p":"Jujuy","h":"672260"}, | |
{"p":"La Pampa","h":"340000"}, | |
{"p":"La Rioja","h":"331847"}, | |
{"p":"Mendoza","h":"1720000"}, | |
{"p":"Misiones","h":"1097829"}, | |
{"p":"Neuquén","h":"550344"}, | |
{"p":"Río Negro","h":"633664"}, | |
{"p":"Salta","h":"1215207"}, | |
{"p":"San Juan","h":"680427"}, | |
{"p":"San Luis","h":"431588"}, | |
{"p":"Santa Cruz","h":"272524"}, | |
{"p":"Santa Fe","h":"3200736"}, | |
{"p":"Santiago del Estero","h":"896461"}, | |
{"p":"Tierra del Fuego","h":"126190"}, | |
{"p":"Tucumán","h":"1448200"} | |
]; | |
var scaler = d3.scale.linear() | |
.domain([0,12703346]) | |
.range([0,1]); | |
google.load("visualization", "1", {packages:["treemap"]}); | |
google.setOnLoadCallback(drawChart); | |
function drawChart() { | |
var data = google.visualization.arrayToDataTable([ | |
['Provincia', 'Pais', 'Poblacion (size)', 'color'], | |
['Argentina', null, 0, 0], | |
['Capital Federal', 'Argentina', 2891082, scaler(2891082)], | |
['Buenos Aires', 'Argentina', 12703346, scaler(12703346)], | |
['Catamarca', 'Argentina', 367829, scaler(367829)], | |
['Cordoba', 'Argentina', 3304825, scaler(3304825)], | |
['Corrientes', 'Argentina', 993338, scaler(993338)], | |
['Chaco', 'Argentina', 1053466, scaler(1053466)], | |
['Chubut', 'Argentina', 506668, scaler(506668)], | |
['Entre Rios', 'Argentina', 1236300, scaler(1236300)], | |
['Formosa', 'Argentina', 527000, scaler(1236300)], | |
['Jujuy', 'Argentina', 672260, scaler(672260)], | |
['La Pampa', 'Argentina', 340000, scaler(340000)], | |
['La Rioja', 'Argentina', 331847, scaler(331847)], | |
['Mendoza', 'Argentina', 1720000, scaler(1720000)], | |
['Misiones', 'Argentina', 1097829, scaler(1097829)], | |
['Neuquen', 'Argentina', 550344, scaler(550344)], | |
['Rio Negro', 'Argentina', 633664, scaler(633664)], | |
['Salta', 'Argentina', 1215207, scaler(1215207)], | |
['San Juan', 'Argentina', 680427, scaler(680427)], | |
['San Luis', 'Argentina', 431588, scaler(431588)], | |
['Santa Cruz', 'Argentina', 272524, scaler(272524)], | |
['Santa Fe', 'Argentina', 3200736, scaler(3200736)], | |
['Santiago del Estero', 'Argentina', 896461, scaler(896461)], | |
['Tierra del Fuego', 'Argentina', 126190, scaler(126190)], | |
['Tucuman', 'Argentina', 1448200, scaler(1448200)] | |
]); | |
tree = new google.visualization.TreeMap(document.getElementById('chart_div')); | |
tree.draw(data, { | |
minColor: '#f00', | |
midColor: '#ddd', | |
maxColor: '#0d0', | |
headerHeight: 15, | |
fontColor: 'black', | |
showScale: true | |
}); | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var datos = [ | |
{"p":"Capital Federal","h":"2891082"}, | |
{"p":"Buenos Aires","h":"12703346"}, | |
{"p":"Catamarca","h":"367829"}, | |
{"p":"Córdoba","h":"3304825"}, | |
{"p":"Corrientes","h":"993338"}, | |
{"p":"Chaco","h":"1053466"}, | |
{"p":"Chubut","h":"506668"}, | |
{"p":"Entre Ríos","h":"1236300"}, | |
{"p":"Formosa","h":"527000"}, | |
{"p":"Jujuy","h":"672260"}, | |
{"p":"La Pampa","h":"340000"}, | |
{"p":"La Rioja","h":"331847"}, | |
{"p":"Mendoza","h":"1720000"}, | |
{"p":"Misiones","h":"1097829"}, | |
{"p":"Neuquén","h":"550344"}, | |
{"p":"Río Negro","h":"633664"}, | |
{"p":"Salta","h":"1215207"}, | |
{"p":"San Juan","h":"680427"}, | |
{"p":"San Luis","h":"431588"}, | |
{"p":"Santa Cruz","h":"272524"}, | |
{"p":"Santa Fe","h":"3200736"}, | |
{"p":"Santiago del Estero","h":"896461"}, | |
{"p":"Tierra del Fuego","h":"126190"}, | |
{"p":"Tucumán","h":"1448200"} | |
]; | |
var scaler = d3.scale.linear() | |
.domain([0,12703346]) | |
.range([0,1]); | |
google.load("visualization", "1", {packages:["treemap"]}); | |
google.setOnLoadCallback(drawChart); | |
function drawChart() { | |
var data = google.visualization.arrayToDataTable([ | |
['Provincia', 'Pais', 'Poblacion (size)', 'color'], | |
['Argentina', null, 0, 0], | |
['Capital Federal', 'Argentina', 2891082, scaler(2891082)], | |
['Buenos Aires', 'Argentina', 12703346, scaler(12703346)], | |
['Catamarca', 'Argentina', 367829, scaler(367829)], | |
['Cordoba', 'Argentina', 3304825, scaler(3304825)], | |
['Corrientes', 'Argentina', 993338, scaler(993338)], | |
['Chaco', 'Argentina', 1053466, scaler(1053466)], | |
['Chubut', 'Argentina', 506668, scaler(506668)], | |
['Entre Rios', 'Argentina', 1236300, scaler(1236300)], | |
['Formosa', 'Argentina', 527000, scaler(1236300)], | |
['Jujuy', 'Argentina', 672260, scaler(672260)], | |
['La Pampa', 'Argentina', 340000, scaler(340000)], | |
['La Rioja', 'Argentina', 331847, scaler(331847)], | |
['Mendoza', 'Argentina', 1720000, scaler(1720000)], | |
['Misiones', 'Argentina', 1097829, scaler(1097829)], | |
['Neuquen', 'Argentina', 550344, scaler(550344)], | |
['Rio Negro', 'Argentina', 633664, scaler(633664)], | |
['Salta', 'Argentina', 1215207, scaler(1215207)], | |
['San Juan', 'Argentina', 680427, scaler(680427)], | |
['San Luis', 'Argentina', 431588, scaler(431588)], | |
['Santa Cruz', 'Argentina', 272524, scaler(272524)], | |
['Santa Fe', 'Argentina', 3200736, scaler(3200736)], | |
['Santiago del Estero', 'Argentina', 896461, scaler(896461)], | |
['Tierra del Fuego', 'Argentina', 126190, scaler(126190)], | |
['Tucuman', 'Argentina', 1448200, scaler(1448200)] | |
]); | |
tree = new google.visualization.TreeMap(document.getElementById('chart_div')); | |
tree.draw(data, { | |
minColor: '#f00', | |
midColor: '#ddd', | |
maxColor: '#0d0', | |
headerHeight: 15, | |
fontColor: 'black', | |
showScale: true | |
}); | |
} | |
</script></body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment