Skip to content

Commit

Permalink
Fix #57
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Feb 2, 2014
1 parent 6a97697 commit 8e60b40
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/cal-heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,9 @@ var CalHeatMap = function() {
.attr("y", function(d) { return self.positionSubDomainY(d.t) + options.cellSize/2; })
.attr("text-anchor", "middle")
.attr("dominant-baseline", "central")
.text(function(d){ return self.formatDate(new Date(d.t), options.subDomainTextFormat); })
.text(function(d){
return self.formatDate(new Date(d.t), options.subDomainTextFormat);
})
;
}

Expand Down Expand Up @@ -1400,8 +1402,20 @@ CalHeatMap.prototype = {
.text(function(d) { return parent.getSubDomainTitle(d); })
;

function formatSubDomainText(element) {
if (typeof options.subDomainTextFormat === "function") {
element.text(function(d) { return options.subDomainTextFormat(d.t, d.v); });
}
}

/**
* Change the subDomainText class if necessary
* Also change the text, e.g when text is representing the value
* instead of the date
*/
rect.transition().duration(options.animationDuration).select("text")
.attr("class", function(d) { return "subdomain-text" + parent.getHighlightClassName(d.t); })
.call(formatSubDomainText)
;
},

Expand Down

0 comments on commit 8e60b40

Please sign in to comment.