@@ -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
});
-
-
+
+
+
+
+