Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
g1eb committed Jan 2, 2017
2 parents 807a8b0 + 26a6690 commit 96b0b71
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-calendar-heatmap",
"version": "0.2.4",
"version": "0.2.5",
"main": [
"dist/calendar-heatmap.min.js",
"dist/calendar-heatmap.min.css"
Expand Down
2 changes: 1 addition & 1 deletion dist/calendar-heatmap.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-calendar-heatmap",
"version": "0.2.4",
"version": "0.2.5",
"description": "Angular directive of calendar heatmap graph representing time series data.",
"homepage": "https://github.com/g1eb/calendar-heatmap#readme",
"repository": {
Expand Down
12 changes: 6 additions & 6 deletions src/calendar-heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ angular.module('g1b.calendar-heatmap', []).
.style('opacity', 0);

var getNumberOfWeeks = function () {
var dayInMillis = 1000*60*60*24;
var extraDays = ((moment() - moment().subtract(1, 'year').subtract(1, 'day')) / dayInMillis) - 52 * 7;
var currentDay = Math.ceil((moment() - moment().startOf('week')) / dayInMillis);
var numWeeks = currentDay < extraDays ? 54 : 53;
var dayIndex = Math.floor((moment() - moment().subtract(1, 'year').startOf('week')) / 86400000);
var colIndex = Math.trunc(dayIndex / 7);
var numWeeks = colIndex + 1;
return numWeeks;
}

Expand Down Expand Up @@ -149,8 +148,9 @@ angular.module('g1b.calendar-heatmap', []).

var calcItemX = function (d) {
var date = moment(d.date);
var week_num = date.week() - year_ago.week() + (year_ago.weeksInYear() * (date.weekYear() - year_ago.weekYear()));
return week_num * (item_size + gutter) + label_padding;
var dayIndex = Math.floor((date - moment(year_ago).startOf('week')) / 86400000);
var colIndex = Math.trunc(dayIndex / 7);
return colIndex * (item_size + gutter) + label_padding;
};
var calcItemY = function (d) {
return label_padding + moment(d.date).weekday() * (item_size + gutter);
Expand Down

0 comments on commit 96b0b71

Please sign in to comment.