mappedCrimes = {
const canvas = DOM.canvas(mapWidth, mapHeight);
const context = canvas.getContext('2d');
context.fillStyle = 'steelblue';
let lat, long, x, y, count = 0;
const startDate = daySliderToDate(startMapDaySlider);
const endDate = daySliderToDate(endMapDaySlider);
const dateFilter = arrow.predicate.custom(i => {
const date = toDate(crimes.getColumn('Date').get(i));
return date >= startDate && date <= endDate;
}, b => 1);
crimes.filter(dateFilter)
.scan((index) => {
x = scaleX(long(index));
y = scaleY(lat(index));
context.fillRect(x, y, 1, 1);
count++;
}, (batch) => {
lat = arrow.predicate.col('Latitude').bind(batch);
long = arrow.predicate.col('Longitude').bind(batch);
}
);
return {canvas, count};
}