diff --git a/_includes/footer.html b/_includes/footer.html
index ebe700e..b2d0b27 100644
--- a/_includes/footer.html
+++ b/_includes/footer.html
@@ -52,6 +52,9 @@
{% if page.js %}
-
+ {% for file in page.js %}
+
+ {% endfor %}
+
{% endif %}
diff --git a/assets/data-loader.js b/assets/data-loader.js
new file mode 100644
index 0000000..57c6e89
--- /dev/null
+++ b/assets/data-loader.js
@@ -0,0 +1,57 @@
+//Common fnctions for data Loading
+// Base URL
+var version = "v0.05";
+var dataurl = "https://raw.githubusercontent.com/SDG-data/SDGs/"+version+"/";
+//Read Goals, Targets and Indicators
+var sdgs = [];
+var stats = {};
+
+files = ["goals","targets","indicators"];
+var data_loaded = 0;
+function load_data(){
+ //Reset and Read into memory the SDGs
+ sdgs = {};
+ stats = {};
+ files.forEach(function (f) {
+ console.log("Loading "+f);
+ d3.json(dataurl+f+".json", function (error, data) {
+ //for (var attrname in data) { sdgs[attrname] = data[attrname]; }
+ sdgs[data.meta.id]=data;
+ if (Object.keys(sdgs).length == 3) {
+ page_main();
+ data_loaded=1;}
+ });
+});
+}
+
+function append(htype,hookElement,id,classes,value,link){
+ var wrapper = document.createElement("div");
+ var newListItem = document.createElement(htype);
+ wrapper.setAttribute("id", id);
+ newListItem.setAttribute("class", classes);
+ if (typeof link !== 'undefined') {
+ newListItem.setAttribute("href", link);
+ }
+ var ListValue = document.createTextNode(value);
+ newListItem.appendChild(ListValue);
+ hookElement.appendChild(wrapper).appendChild(newListItem);
+}
+
+function append_raw(hookElement,content){
+ var wrapper = document.createElement("div");
+ wrapper.innerHTML=content;
+ hookElement.appendChild(wrapper);
+}
+
+function append_row(hookElement,row){
+ var table = document.getElementById(hookElement);
+ var rowObject = table.insertRow(0);
+ for (var i in row){
+ cell = rowObject.insertCell(i);
+ cell.innerHTML = row[i];
+ }
+}
+
+function array_num(size,num){
+ return Array.apply(null, new Array(size)).map(Number.prototype.valueOf,num);
+}
diff --git a/assets/img/14_clean_waters.jpg b/assets/img/14_clean_waters.jpg
new file mode 100644
index 0000000..c1274f9
Binary files /dev/null and b/assets/img/14_clean_waters.jpg differ
diff --git a/assets/img/6_water_risk.jpg b/assets/img/6_water_risk.jpg
new file mode 100644
index 0000000..c35bcd6
Binary files /dev/null and b/assets/img/6_water_risk.jpg differ
diff --git a/assets/list.js b/assets/list.js
index b629683..3a98c0d 100644
--- a/assets/list.js
+++ b/assets/list.js
@@ -1,32 +1,12 @@
-// Base URL
-var version = "v0.05"
-var dataurl = "https://raw.githubusercontent.com/SDG-data/SDGs/"+version+"/"
-//Read Goals, Targets and Indicators
-var sdgs = [];
-var stats = {};
-
-files = ["goals","targets","indicators"];
-var data_loaded = 0;
-function load_data(){
- //Reset and Read into memory the SDGs
- sdgs = {};
- stats = {};
- files.forEach(function (f) {
- console.log("Loading "+f);
- d3.json(dataurl+f+".json", function (error, data) {
- //for (var attrname in data) { sdgs[attrname] = data[attrname]; }
- sdgs[data.meta.id]=data;
- if (Object.keys(sdgs).length == 3) {
- update_stats();
- load_data_state();
- data_loaded=1;}
- });
-});
-}
//When page loadded, read data and URL state, if any
$( document ).ready(load_data());
+function page_main(){
+ update_stats();
+ load_data_state();
+}
+
function load_data_state(){
var data_state= getURLParameter('data');
switch(data_state) {
@@ -229,29 +209,6 @@ function list_targets(){
}
}
-function append(htype,hookElement,id,classes,value){
- var wrapper = document.createElement("div");
- var newListItem = document.createElement(htype);
- wrapper.setAttribute("id", id);
- newListItem.setAttribute("class", classes);
- var ListValue = document.createTextNode(value);
- newListItem.appendChild(ListValue);
- hookElement.appendChild(wrapper).appendChild(newListItem);
-}
-
-function append_row(hookElement,row){
- var table = document.getElementById(hookElement);
- var rowObject = table.insertRow(0);
- for (var i in row){
- cell = rowObject.insertCell(i);
- cell.innerHTML = row[i];
- }
-}
-
-function array_num(size,num){
- return Array.apply(null, new Array(size)).map(Number.prototype.valueOf,num);
-}
-
function add_goals(){
$('#load-all').addClass("active");
document.getElementById("dashboard-title").innerHTML = "SDG Goals";
diff --git a/assets/viz-101.js b/assets/viz-101.js
new file mode 100644
index 0000000..b8a1ecf
--- /dev/null
+++ b/assets/viz-101.js
@@ -0,0 +1,54 @@
+
+//When page loadded, read data and URL state, if any
+$( document ).ready(load_data());
+
+function page_main(){
+ add_goals_sidebar();
+ add_goals();
+ load_vizrefs();
+}
+
+function add_goals_sidebar(){
+ $('#sidebar').addClass("active");
+ var sdgList = document.getElementById("sidebar");
+ var goals=sdgs.goals.goals;
+ for (var i in goals){
+ var goal= goals[i];
+ append('a',sdgList,"",""," "+goal.goal+": "+goal.short+".","#goal-"+goal.goal,"");
+ }
+}
+
+function add_goals(){
+ var sdgList = document.getElementById("dashboard-content");
+ var goals=sdgs.goals.goals;
+ for (var i in goals){
+ var goal= goals[i];
+ append('div',sdgList,"goal-"+goal.goal,"h3"," "+goal.goal+": "+goal.title+".");
+ }
+}
+
+function append_viz(vizHook,viz){
+ append('div',vizHook,"viz-"+viz.goal,"h4 lead",viz["viz-title"]);
+ append('a',vizHook,"viz-"+viz.goal,"","Relevant target: "+viz.target,"/web/list/?data=list_targets#");
+ append('p',vizHook,"viz-"+viz.goal,"",viz.description);
+ append_raw(vizHook,viz.embed);
+ append('a',vizHook,"viz-"+viz.goal,"","Source: "+viz["source-name"],viz["source-link"]);
+ append('hr',vizHook,"","","");
+}
+
+var visualizations={};
+function load_vizrefs(){
+ // Load Visualizations references from the json file
+ d3.json("/web/assets/viz-101.json", function (error, data) {
+ for ( var i in data.visualizations){
+ var viz=data.visualizations[i];
+ var vizHook = document.getElementById("goal-"+viz.goal);
+ console.log(viz,vizHook);
+ if (vizHook === null){
+ throw new Error("Something went badly wrong!");
+ }
+ //append(htype,hookElement,id,classes,value,link)
+ append_viz(vizHook,viz);
+ }
+ });
+}
diff --git a/assets/viz-101.json b/assets/viz-101.json
new file mode 100644
index 0000000..0a6fd06
--- /dev/null
+++ b/assets/viz-101.json
@@ -0,0 +1,72 @@
+{
+ "visualizations": [
+ {
+ "goal": 1,
+ "target": 1.1,
+ "viz-title": "Extreme poverty IS decreasing",
+ "description":"If developing countries were to grow at the rates they achieved during the 2000’s the global poverty headcount could decline from 14.5% in 2011 to 4.9% in 2030 – short of ‘ending poverty’.",
+ "source-name":"World Bank",
+ "source-link":"http://blogs.worldbank.org/futuredevelopment/poverty-will-only-end-2030-if-growth-shared",
+ "embed": ""
+ },
+ {
+ "goal": 2,
+ "target": 2.2,
+ "viz-title": "World Map of Food Supply (kcal per capita per day), 1961-2009",
+ "description":"",
+ "source-name":"Max Rosner",
+ "source-link":"http://ourworldindata.org/wp-content/uploads/datamaps/kcalPerCapita_since1961_FAO/kcalPerCapita_since1961_FAO.html",
+ "embed": ""
+ },
+ {
+ "goal": 2,
+ "target": 2.3,
+ "viz-title": "Yield Gap for Major Crops",
+ "description":"",
+ "source-name":"Food and Agriculture Organization of the United Nations (FAO)",
+ "source-link":"http://www.fao.org/nr/gaez/about-data-portal/yield-and-production-gaps/en/",
+ "embed": ""
+ },
+ {
+ "goal": 5,
+ "target": "5.1, 5.5, 5.c",
+ "viz-title": "Female Representation in National Parliaments",
+ "description":"",
+ "source-name":"No Ceilings",
+ "source-link":"http://noceilings.org/map/#FEREPNTP&2013",
+ "embed": ""
+ },
+ {
+ "goal": 6,
+ "target": 6.1,
+ "viz-title": "Overall Water Risk - Current Conditions",
+ "description":"",
+ "source-name":"World Resources Institute",
+ "source-link":"http://tinyurl.com/obhrvx3",
+ "embed": ""
+
+ },
+ {
+ "goal": 14,
+ "target": 14.1,
+ "viz-title": "Marine Pollution - Clean Waters Index",
+ "description":"",
+ "source-name":"Ocean Health Index",
+ "source-link":"http://www.oceanhealthindex.org/Goals/Clean_Waters",
+ "embed": ""
+ },
+ {
+ "goal": 16,
+ "target": 6.1,
+ "viz-title": "Homicides per 100,000 per year",
+ "description":"",
+ "source-name":"Max Rosner",
+ "source-link":"http://ourworldindata.org/data/violence-rights/homicides/#world-map-of-homicide-rates-today-max-roserref",
+ "embed": ""
+ }
+ ],
+ "meta": {
+ "id": "Visualization",
+ "description": "One Visualization per goal"
+ }
+}
diff --git a/data-overview.md b/data-overview.md
new file mode 100644
index 0000000..2db48c3
--- /dev/null
+++ b/data-overview.md
@@ -0,0 +1,28 @@
+---
+layout: empty
+title: One Visualization per Goal
+permalink: /data-101/
+js:
+ - data-loader.js
+ - viz-101.js
+---
+
+
+
+
+
+