arrows = {
const aBins = d3.bin().domain(histogramDomain).thresholds(histogramThresholds)(randomCosts)
const bBins = d3.bin().domain(histogramDomain).thresholds(histogramThresholds)(randomCosts.map(fn))
const arrows = [];
for (let i = 0; i < aBins.length; i++) {
const {x0, x1} = aBins[i];
const y1 = aBins[i].length;
const y2 = bBins[i].length;
arrows.push({x: (x0 + x1) / 2, y1, y2});
}
return arrows;
}