|
@@ -36,13 +36,13 @@ function curve(interpolator) {
|
36
|
36
|
|
37
|
37
|
var top = data.map(function(d,i){
|
38
|
38
|
|
39
|
|
- return [x(i), baseline - height(d)];
|
|
39
|
+ return [x(i), baseline - height(d[1])];
|
40
|
40
|
|
41
|
41
|
});
|
42
|
42
|
|
43
|
43
|
var bottom = data.map(function(d,i){
|
44
|
44
|
|
45
|
|
- return [x(i), baseline + height(d)];
|
|
45
|
+ return [x(i), baseline + height(-d[0])];
|
46
|
46
|
|
47
|
47
|
}).reverse();
|
48
|
48
|
|
|
@@ -90,16 +90,17 @@ function bars(round) {
|
90
|
90
|
|
91
|
91
|
data.forEach(function(val, i){
|
92
|
92
|
|
93
|
|
- var h = height(val),
|
94
|
|
- x = barX(i);
|
|
93
|
+ var h = height(-val[0]) + height(val[1]),
|
|
94
|
+ x = barX(i),
|
|
95
|
+ y = baseline - height(val[1]);
|
95
|
96
|
|
96
|
|
- context.fillRect(x, baseline - h, barWidth, h * 2);
|
|
97
|
+ context.fillRect(x, y, barWidth, h);
|
97
|
98
|
|
98
|
99
|
if (round) {
|
99
|
100
|
context.beginPath();
|
100
|
|
- context.arc(x + barWidth / 2, baseline - h, barWidth / 2, 0, 2 * Math.PI);
|
101
|
|
- context.moveTo(x + barWidth / 2, baseline + h);
|
102
|
|
- context.arc(x + barWidth / 2, baseline + h, barWidth / 2, 0, 2 * Math.PI);
|
|
101
|
+ context.arc(x + barWidth / 2, y, barWidth / 2, 0, 2 * Math.PI);
|
|
102
|
+ context.moveTo(x + barWidth / 2, y + h);
|
|
103
|
+ context.arc(x + barWidth / 2, y + h, barWidth / 2, 0, 2 * Math.PI);
|
103
|
104
|
context.fill();
|
104
|
105
|
}
|
105
|
106
|
|
|
@@ -132,7 +133,7 @@ function bricks(rainbow) {
|
132
|
133
|
|
133
|
134
|
data.forEach(function(val, i){
|
134
|
135
|
|
135
|
|
- var bricks = Math.max(1, Math.floor(height(val) / (brickHeight + brickGap))),
|
|
136
|
+ var bricks = Math.max(1, Math.floor(height(val[1]) / (brickHeight + brickGap))),
|
136
|
137
|
x = barX(i);
|
137
|
138
|
|
138
|
139
|
d3.range(bricks).forEach(function(b){
|