Commit b34bf9c4 authored by Rodrigo Tapia-McClung's avatar Rodrigo Tapia-McClung

Update to arrow functions

parent 9bd35625
...@@ -101,7 +101,8 @@ const summarizeData = (allData, indicator) => { ...@@ -101,7 +101,8 @@ const summarizeData = (allData, indicator) => {
.rollup( v => { return indicator == "costa" || indicator == "df" ? d3.mean(v, v => v.value) : d3.sum(v, v => v.value) }) .rollup( v => { return indicator == "costa" || indicator == "df" ? d3.mean(v, v => v.value) : d3.sum(v, v => v.value) })
.entries(data2) .entries(data2)
// map "key" and "value" from d3.nest().rollup() to date and value // map "key" and "value" from d3.nest().rollup() to date and value
.map( group => { return { .map( group => {
return {
date: new Date(group.key), date: new Date(group.key),
value: group.value value: group.value
} }
...@@ -112,7 +113,7 @@ const summarizeData = (allData, indicator) => { ...@@ -112,7 +113,7 @@ const summarizeData = (allData, indicator) => {
return data; return data;
} }
function makeIndicatorGraph() { const makeIndicatorGraph = () => {
let data = [], let data = [],
width = 450, width = 450,
...@@ -141,7 +142,7 @@ function makeIndicatorGraph() { ...@@ -141,7 +142,7 @@ function makeIndicatorGraph() {
legendContainer = "legendZone", legendContainer = "legendZone",
updateData; updateData;
function chart(selection) { const chart = selection => {
// get data ranges using values from displayName // get data ranges using values from displayName
minDate = d3.min(data[0].values, d => { minDate = d3.min(data[0].values, d => {
return d[displayName]; return d[displayName];
...@@ -152,7 +153,7 @@ function makeIndicatorGraph() { ...@@ -152,7 +153,7 @@ function makeIndicatorGraph() {
}); });
maxDate = d3.timeDay.offset(maxDate, 15) // get next month to get correct x-axis alignment maxDate = d3.timeDay.offset(maxDate, 15) // get next month to get correct x-axis alignment
selection.each(function () { selection.each( () => {
// add graph svg to selected container on webpage // add graph svg to selected container on webpage
let areaSVG = selection let areaSVG = selection
...@@ -303,10 +304,9 @@ function makeIndicatorGraph() { ...@@ -303,10 +304,9 @@ function makeIndicatorGraph() {
}); });
$("#explainIndicatorModal").modal(); $("#explainIndicatorModal").modal();
}); });
//});
// update chart // update chart
updateData = function () { updateData = () => {
let time = map.timeDimension.getCurrentTime(); let time = map.timeDimension.getCurrentTime();
// update data ranges using values from displayName and lineVariables // update data ranges using values from displayName and lineVariables
...@@ -349,7 +349,7 @@ function makeIndicatorGraph() { ...@@ -349,7 +349,7 @@ function makeIndicatorGraph() {
filteredData[i].values.push(v); filteredData[i].values.push(v);
} }
}); });
}) });
// update axes // update axes
let g = selection.select(".lineChart"); let g = selection.select(".lineChart");
...@@ -516,10 +516,8 @@ function makeIndicatorGraph() { ...@@ -516,10 +516,8 @@ function makeIndicatorGraph() {
.attr("cy", d => yLine(d.value)), .attr("cy", d => yLine(d.value)),
exit => exit.remove() exit => exit.remove()
); );
} }
}); });
//});
} }
chart.width = function(value) { chart.width = function(value) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment