highlightedPeriods = {
const days = d3.map(filteredData, (d, i) => [d.Date, 0]);
days.forEach(function(values, i, theArray) {
if (filteredData[i][largerYieldChoice] == null || filteredData[i][smallerYieldChoice] == null || filteredData[i][largerYieldChoice] <= filteredData[i][smallerYieldChoice]) {
theArray[i][1] = 0;
} else {
theArray[i][1] = (i > 0 && theArray[i-1][1] > 0) ? (theArray[i-1][1]+1) : 1;
}
});
let periods = []
for (let i = 0; i < days.length; ++i) {
if (i == days.length-1 || days[i][1] > days[i+1][1]) {
periods.push([addDays(days[i][0], 1-days[i][1]), addDays(days[i][0], 1)])
}
}
return periods
}