Skip to content

Commit

Permalink
Merge pull request DKirwan#29 from AdSchellevis/master
Browse files Browse the repository at this point in the history
fill() seems to be duplicate and colours seem to be off
  • Loading branch information
DKirwan committed Nov 6, 2017
2 parents 6606618 + 01498c0 commit 7d1b971
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/calendar-heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ function calendarHeatmap() {
var dateRange = d3.time.days(yearAgo, now); // generates an array of date objects within the specified range
var monthRange = d3.time.months(moment(yearAgo).startOf('month').toDate(), now); // it ignores the first month if the 1st date is after the start of the month
var firstDate = moment(dateRange[0]);
if (max === null) { max = d3.max(chart.data(), function (d) { return d.count; }); } // max data value
if (chart.data().length == 0) {
max = 0;
} else if (max === null) {
max = d3.max(chart.data(), function (d) { return d.count; }); // max data value
}

// color range
var color = d3.scale.linear()
Expand Down Expand Up @@ -269,11 +273,6 @@ function calendarHeatmap() {
return day.date.toDateString();
});

dayRects.filter(function (d) {
return daysOfChart.indexOf(d.toDateString()) > -1;
}).attr('fill', function (d, i) {
return color(chart.data()[i].count);
});
}

return chart;
Expand Down

0 comments on commit 7d1b971

Please sign in to comment.