Skip to content

Commit

Permalink
bugfix for D3.JS bug in calendar demo: edge around months was drawn i…
Browse files Browse the repository at this point in the history
…ncorrectly; this was apparent at each December month.
  • Loading branch information
GerardHundman committed Dec 20, 2011
1 parent 7d2ce55 commit da76aa2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions examples/calendar/dji.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ d3.csv("dji.csv", function(csv) {
.map(csv);

rect
.attr("class", function(d) { return "day q" + color(data[format(d)]) + "-9"; })
.attr("class", function(d) {
var dv = data[format(d)];
return "day q" + (dv ? color(dv) : "X") + "-9"; })
.append("title")
.text(function(d) { return (d = format(d)) + (d in data ? ": " + percent(data[d]) : ""); });
});

function monthPath(t0) {
var t1 = new Date(t0.getUTCFullYear(), t0.getUTCMonth() + 1, 0),
var t1 = new Date(t0.getUTCFullYear(), t0.getUTCMonth() + 2, 0),
d0 = +day(t0), w0 = +week(t0),
d1 = +day(t1), w1 = +week(t1);
return "M" + (w0 + 1) * z + "," + d0 * z
Expand Down
6 changes: 4 additions & 2 deletions examples/calendar/vix.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ d3.csv("vix.csv", function(csv) {
color.domain(d3.values(data));

rect
.attr("class", function(d) { return "day q" + color(data[format(d)]) + "-9"; })
.attr("class", function(d) {
var dv = data[format(d)];
return "day q" + (dv ? color(dv) : "X") + "-9"; })
.append("title")
.text(function(d) { return (d = format(d)) + (d in data ? ": " + data[d] : ""); });
});

function monthPath(t0) {
var t1 = new Date(t0.getUTCFullYear(), t0.getUTCMonth() + 1, 0),
var t1 = new Date(t0.getUTCFullYear(), t0.getUTCMonth() + 2, 0),
d0 = +day(t0), w0 = +week(t0),
d1 = +day(t1), w1 = +week(t1);
return "M" + (w0 + 1) * z + "," + d0 * z
Expand Down

0 comments on commit da76aa2

Please sign in to comment.