The dataset contains a list of countries and for each country there are the % value of population growth on each year, from 1960 to 2013.
The range in vertical axis is from -25% to +25%
d3.json("CIV.json", function(error, data){ | |
var svg = d3.select('svg') | |
var projection = d3.geo.mercator() | |
.scale(30000) | |
.center([-2,8]); | |
var path = d3.geo.path() | |
.projection(projection); |
svg.selectAll('path') | |
.data(topojson.object(data, data.objects.input_file).geometries) | |
.enter() | |
.append('path') | |
.attr('d', path) | |
.style('fill', '#44cccc') |
*{ | |
-webkit-user-select:none; | |
-moz-user-select:none; | |
user-select:none; | |
} |
// assuming the following angular code | |
function Ctrl($scope){ | |
$scope.thevar = 'SOME'; | |
$scope.something = function(){ | |
$scope.thevar = 'CHANGED'; | |
} | |
} | |
// the html element: | |
/* <p id="el">{{thevar}}</p> */ |
angular.module('myapp', []) | |
.directive('quickTouch', function($parse) { | |
return { | |
restrict: 'A', | |
link: function(scope, elm, attrs) { | |
var fn = $parse(attrs['quickTouch']); | |
$(elm).bind('touchend mousedown', function(evt) { | |
scope.$apply(function() { | |
fn(scope, {$event: evt}); | |
evt.stopPropagation(); |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta name="description" content="TableTop simple example" /> | |
<meta charset="utf-8"> | |
<title>Tabletop.js test</title> | |
<script type="text/javascript" src="https://rawgithub.com/jsoma/tabletop/master/src/tabletop.js"></script> | |
</head> | |
<body> | |
// create directives | |
angular.module('whathever_namespaces', []).directive('myReusableComponent', function($parse){ | |
return { | |
link: function(scope, element, attrs){ | |
$(element).append('<h3>I\'m a reusable component</h3>'); | |
} | |
}; |
var arr = [] | |
$('tbody').children().each(function(i, e){ | |
var td = $(e).children() | |
if(td.length == 3){ | |
var name = $(td[0]).find('a').text(); | |
var link = $(td[0]).find('a').attr('href'); | |
arr.push({name:name, link:link}) | |
} | |
}) |
1,736 food items (each is a sample of 100g) broken down by main nutrients (Energy, Fats, Carbs, Proteins, Fiber, Sugars and Water). It's a first version that allows only comparison between nutrients, no further exploration so far.
You can click over a single chart to sort the dataset by the selected nutrient. The other charts will be updated accordingly.
This dataset has been scraped from valori-alimenti.it.
More info about the motivations behind this work in progress can be found here.