h = 300 - 25,
S=2;
-
- var x = pv.Scale.linear(pv.blend(pv.map(data, function(d) d)), function(d) d.x).range(0, w);
+ var x = pv.Scale.linear(pv.blend(pv.map(data, function(d) {return d;})), function(d) {return d.x}).range(0, w);
var y = new Array(data.length);
for(var i = 0; i < data.length; i++){
- y[i]=pv.Scale.linear(data[i], function(d) d.y).range(0, h)
+ y[i]=pv.Scale.linear(data[i], function(d) {return d.y;}).range(0, h)
}
var interpolate = "linear"; /* cardinal or linear */
var idx = -1;
vis.add(pv.Rule)
.data(y[0].ticks(5))
.bottom(y[0])
- .strokeStyle(function(d) d ? "#eee" : "#000")
+ .strokeStyle(function(d) {return d ? "#eee" : "#000";})
.anchor("left")
.add(pv.Label)
.text(y[0].tickFormat);
/* The line. */
var line = panel.add(pv.Line)
- .data(function(array) array)
- .left(function(d) x(d.x))
- .bottom(function(d) y[this.parent.index](d.y))
- .interpolate(function() interpolate)
+ .data(function(array) {return array;})
+ .left(function(d) {return x(d.x);})
+ .bottom(function(d) {return y[this.parent.index](d.y);})
+ .interpolate(function() {return interpolate;})
.lineWidth(2);
/* The mouseover dots and label. */
line.add(pv.Dot)
- .visible(function() idx >= 0)
- .data(function(d) [d[idx]])
- .fillStyle(function() line.strokeStyle())
+ .visible(function() {return idx >= 0;})
+ .data(function(d) {return [d[idx]];})
+ .fillStyle(function() {return line.strokeStyle();})
.strokeStyle("#000")
.size(20)
.lineWidth(1)
.add(pv.Dot)
.left(10)
- .bottom(function() this.parent.index * 12 + 10)
+ .bottom(function() {return this.parent.index * 12 + 10;})
.anchor("right").add(pv.Label)
- .text(function(d) d.y.toFixed(2));
+ .text(function(d) {return d.y.toFixed(2);});
/* An invisible bar to capture events (without flickering). */
})
.event("mousemove", function() {
var mx = x.invert(vis.mouse().x);
- idx = pv.search(data[0].map(function(d) d.x), mx);
+ idx = pv.search(data[0].map(function(d) {return d.x;}), mx);
idx = idx < 0 ? (-idx - 2) : idx;
return vis;
});
vis.render();
-
-}
\ No newline at end of file
+};
\ No newline at end of file