Skip to content
Browse files

Bring spline example up-to-date

  • Loading branch information...
1 parent d5585fb commit 3fd8ce206025133f449e73693955447f45f8966b @kitmonisit kitmonisit committed Apr 7, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 examples/spline/spline.js
View
18 examples/spline/spline.js
@@ -1,17 +1,17 @@
-var w = 960,
- h = 500,
+var width = 960,
+ height = 500,
line = d3.svg.line(),
- points = d3.range(1, 5).map(function(i) { return [i * w / 5, 50 + Math.random() * (h - 100)]; }),
+ points = d3.range(1, 5).map(function(i) { return [i * width / 5, 50 + Math.random() * (height - 100)]; }),
dragged = null,
selected = points[0];
var vis = d3.select("#chart").append("svg")
- .attr("width", w)
- .attr("height", h);
+ .attr("width", width)
+ .attr("height", height);
vis.append("rect")
- .attr("width", w)
- .attr("height", h)
+ .attr("width", width)
+ .attr("height", height)
.on("mousedown", function() {
points.push(selected = dragged = d3.mouse(vis.node()));
update();
@@ -84,8 +84,8 @@ function update() {
function mousemove() {
if (!dragged) return;
var m = d3.mouse(vis.node());
- dragged[0] = Math.max(0, Math.min(w, m[0]));
- dragged[1] = Math.max(0, Math.min(h, m[1]));
+ dragged[0] = Math.max(0, Math.min(width, m[0]));
+ dragged[1] = Math.max(0, Math.min(height, m[1]));
update();
}

0 comments on commit 3fd8ce2

Please sign in to comment.
Something went wrong with that request. Please try again.