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 c7e3a24 + 2f71ce0 commit 807a8b0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "angular-calendar-heatmap",
"version": "0.2.3",
"version": "0.2.4",
"main": [
"calendar-heatmap.js",
"calendar-heatmap.css"
"dist/calendar-heatmap.min.js",
"dist/calendar-heatmap.min.css"
],
"homepage": "https://github.com/g1eb/angular-calendar-heatmap",
"authors": [
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.3",
"version": "0.2.4",
"description": "Angular directive of calendar heatmap graph representing time series data.",
"homepage": "https://github.com/g1eb/calendar-heatmap#readme",
"repository": {
Expand Down
10 changes: 9 additions & 1 deletion src/calendar-heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,20 @@ angular.module('g1b.calendar-heatmap', []).
.attr('class', 'heatmap-tooltip')
.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;
return numWeeks;
}

scope.$watch(function () {
return element[0].clientWidth;
}, function ( w ) {
if ( !w ) { return; }
width = w < 1000 ? 1000 : w;
item_size = ((width - label_padding) / 53 - gutter);
item_size = ((width - label_padding) / getNumberOfWeeks() - gutter);
height = label_padding + 7 * (item_size + gutter);
svg.attr({'width': width, 'height': height});
if ( !!scope.data && !!scope.data[0].summary ) {
Expand Down

0 comments on commit 807a8b0

Please sign in to comment.