diff --git a/README.md b/README.md index fc65179..35741af 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -supply_dashboard +Supply Dashboard ================ UNHCR Iraq Supply Dashboard + +Linked directly to a Gooogle Spreadsheet + + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/Shelter-Cluster-Iraq/supply_dashboard/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/images/favicon.ico b/images/favicon.ico index a12c053..eea6dfe 100644 Binary files a/images/favicon.ico and b/images/favicon.ico differ diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..9cb1272 Binary files /dev/null and b/images/logo.png differ diff --git a/index.html b/index.html index 91ecedb..32c65bb 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,6 @@
-
@@ -46,7 +45,6 @@ - @@ -56,47 +54,56 @@ -
-

Iraq Supply Pipeline

-
Click on any of those graphs below to filter and slice the data. More Information on Iraq here.
+
+
+ +
+

Shelter / NFI Cluster Dashboard - Iraq.

+
Click on any of the graphs below to filter and slice the data. Note that agreggated quantities might be misleading, start filtering on item first.
+
+ +
+ +
- +
-
NFI Values by Item Group (USD)
-
NFI Quantities
-
NFI Value by Status (USD)
- - + +
+
NFI Quantities by item type +
+ +
+
NFI quantity by organisation
+
-
NFI Value by Target Population (USD)
-
NFI Value by Operation (USD)
- -
- - - - - - - -
Supply Timeline
-
-


-
- -
- -
- +
+
NFI type by Category (number of Item) +
+ +
+
NFI Quantity by Operational area +
+ +
+
Supply Timeline
+
+
@@ -111,7 +118,7 @@

Iraq Supply Pipeline

}); //declaration of chart names and types - var value_chart = dc.rowChart("#item_value"); + // var value_chart = dc.rowChart("#item_value"); var proc_total_status_chart = dc.pieChart("#proc_total_status"); var proc_total_target_chart = dc.rowChart("#proc_total_target"); var proc_total_op = dc.rowChart("#proc_total_op"); @@ -122,7 +129,7 @@

Iraq Supply Pipeline

var ds = new Miso.Dataset({ importer : Miso.Dataset.Importers.GoogleSpreadsheet, parser : Miso.Dataset.Parsers.GoogleSpreadsheet, - key : "12dxOiV7n0r0ANNaAvrXPuJRxS9h8lhGgb7DVVMgh8gA", + key : "1dqTTsaSTST8LgYGShZ4ZtOKx8-fCZqQI5SW1jBRbH6Q", worksheet : "1" }); @@ -144,33 +151,26 @@

Iraq Supply Pipeline

//formatting of numbers, dates var numberFormat = d3.format(",f"); - var dateFormat = d3.time.format("%Y-%m-%d"); + var dateFormat = d3.time.format("%Y-%d-%m"); var monthNameFormat = d3.time.format("%B"); //crossfilter data var cf = crossfilter(spreadsheetdata); //declare crossfilter dimensions to be used in charts - cf.targetpop = cf.dimension(function (d) { - return d.Target_Population; - }); - cf.op = cf.dimension(function (d) { - return d.Operation; - }); - cf.item = cf.dimension(function (d) { - return d.Item; - }); + cf.targetpop = cf.dimension(function (d) { return d.Target_Population; }); - cf.status = cf.dimension(function (d) { - return d.Status; - }); - cf.location = cf.dimension(function (d) { - return d.Location; - }); + cf.op = cf.dimension(function (d) { return d.Operation; }); + + cf.item = cf.dimension(function (d) { return d.Item;}); -//gruop by dimensions + cf.status = cf.dimension(function (d) { return d.Status; }); + + cf.location = cf.dimension(function (d) {return d.Location; }); + +//group by dimensions var targetpop = cf.targetpop.group(); var op = cf.op.group(); - // var date = cf.date.group(); + // var date = cf.date.group(); var item = cf.item.group(); var status = cf.status.group(); var location = cf.location.group(); @@ -203,7 +203,7 @@

Iraq Supply Pipeline

}); //parse date from data array - var parseDate = d3.time.format("%Y-%m-%d").parse; + var parseDate = d3.time.format("%Y-%d-%m").parse; spreadsheetdata.forEach(function(d) { d.date = parseDate(d.Date); d.month = d3.time.month(d.date); @@ -226,7 +226,7 @@

Iraq Supply Pipeline

// Serializing filters values in URL function getFiltersValues() { var filters = [ - { name: 'value', value: value_chart.filters()}, + // { name: 'value', value: value_chart.filters()}, { name: 'proc', value: proc_total_status_chart.filters()}, { name: 'proc2', value: proc_total_target_chart.filters()}, { name: 'itm_qty', value: itm_qty_chart.filters()}, @@ -292,8 +292,11 @@

Iraq Supply Pipeline

return "" + monthNameFormat(d.key) + " : " + numberFormat(d.value) + " USD"; }); -// Item value chart - value_chart.width(400).height(485) + // Item value chart + /* + value_chart + .width(400) + .height(485) .dimension(cf.item) .group(item_total_value = item_total_value || 0) .elasticX(true) @@ -301,9 +304,24 @@

Iraq Supply Pipeline

.renderTitle(false) .on("filtered", getFiltersValues) .xAxis().ticks(6).tickFormat(d3.format("$,s")); + */ + + // Item quantity chart + itm_qty_chart + .width(400) + .height(550) + .dimension(cf.item) + .on("filtered", getFiltersValues) + .group(item_total_quantity = item_total_quantity || 0) + .elasticX(true) + .renderTitle(false) + .renderLabel(true) + .xAxis().ticks(6).tickFormat(d3.format("s")); -// Status chart - proc_total_status_chart.width(300).height(200) + // Status chart + proc_total_status_chart + .width(300) + .height(200) .dimension(cf.status) .group(status_by_total = status_by_total || 0) .radius(100) @@ -315,79 +333,70 @@

Iraq Supply Pipeline

.renderTitle(false) .on("filtered", getFiltersValues); -// Target population chart - proc_total_target_chart.width(300).height(120) + // Target population chart + proc_total_target_chart + .width(300) + .height(100) .dimension(cf.targetpop) .group(targetpop_by_total = targetpop_by_total || 0) .elasticX(false) .renderLabel(true) .renderTitle(false) .on("filtered", getFiltersValues) - .xAxis().ticks(4).tickFormat(d3.format("$,s")); + .xAxis().ticks(4).tickFormat(d3.format(",s")); -// Operation chart - proc_total_op.width(300).height(90) + // Operation chart + proc_total_op + .width(300) + .height(120) .dimension(cf.op) .group(op_by_total = op_by_total || 0) .elasticX(false) .renderLabel(true) .renderTitle(false) .on("filtered", getFiltersValues) - .xAxis().ticks(4).tickFormat(d3.format("$,s")); - -// Item quantity chart - itm_qty_chart.width(400).height(485) - .dimension(cf.item) - .on("filtered", getFiltersValues) - .group(item_total_quantity = item_total_quantity || 0) - .elasticX(true) - .renderTitle(false) - .renderLabel(true) - .xAxis().ticks(6).tickFormat(d3.format("s")); + .xAxis().ticks(4).tickFormat(d3.format(",s")); -// Timeline bar chart + // Timeline bar chart proc_trend_chart - .height(300) - .width(600) + .height(200) + .width(750) .renderHorizontalGridLines(true) .dimension(datedimension) .group(value_by_date) // .renderTitle(true) .title(function (d) { return monthNameFormat(d.key) + ": " + numberFormat(d.value); }) -// define scale based on minimum and maximum dates + // define scale based on minimum and maximum dates .x(d3.time.scale().domain([minDate,maxDate])) .xUnits(d3.time.months) .on("filtered", getFiltersValues) .brushOn(true) // .gap(10) .elasticY(false) - -// rotate and move X axis labels + // rotate and move X axis labels .renderlet(function (chart) { chart.selectAll("g.x text") .attr('dx', '-30') .attr('transform', "rotate(-45)"); }) .margins({left: 70 ,top: 10, bottom: 50, right: 50}) - .yAxis().ticks(7).tickFormat(d3.format("$,s")); - + .yAxis().ticks(7).tickFormat(d3.format(",s")); //Map //Import admin level 1 geojson + /* d3.json("data/admin1.geojson", function(json) { -// extend admin level 1 map geojson features with values, paired by location code that appears on both the map and the dataset + // extend admin level 1 map geojson features with values, + //paired by location code that appears on both the map and the dataset for (var i = 0; i < Location_json.length; i++) { var dist_Location = Location_json[i].A1Code; var dist_Value = parseFloat(Location_json[i].Value); - for (var j = 0; j < json.features.length; j++) { var jsonGov = json.features[j].properties.A1Code; - if (dist_Location == jsonGov) { json.features[j].properties.Value = dist_Value; break; - } } } @@ -487,7 +496,7 @@

Iraq Supply Pipeline

onEachFeature: onEachFeature }).addTo(map); -// legend control (not used) + // legend control (not used) var legend = L.control({position: 'bottomleft'}); legend.onAdd = function (map) { @@ -511,6 +520,7 @@

Iraq Supply Pipeline

}; //legend.addTo(map); }); + */ initFilters(); @@ -533,11 +543,25 @@

Iraq Supply Pipeline

}); - - + + + + +