mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 01:00:05 +00:00
@@ -613,3 +613,33 @@ function bivariateAreaChart {
|
||||
.text("Temperature (ºF)");
|
||||
});
|
||||
}
|
||||
|
||||
//Example from http://bl.ocks.org/mbostock/1557377
|
||||
function dragMultiples {
|
||||
var width = 238,
|
||||
height = 123,
|
||||
radius = 20;
|
||||
|
||||
var drag = d3.behavior.drag()
|
||||
.origin(Object)
|
||||
.on("drag", dragmove);
|
||||
|
||||
var svg = d3.select("body").selectAll("svg")
|
||||
.data(d3.range(16).map(function () { return { x: width / 2, y: height / 2 }; }))
|
||||
.enter().append("svg")
|
||||
.attr("width", width)
|
||||
.attr("height", height);
|
||||
|
||||
svg.append("circle")
|
||||
.attr("r", radius)
|
||||
.attr("cx", function (d) { return d.x; })
|
||||
.attr("cy", function (d) { return d.y; })
|
||||
.call(drag);
|
||||
|
||||
function dragmove(d) {
|
||||
d3.select(this)
|
||||
.attr("cx", d.x = Math.max(radius, Math.min(width - radius, d3.event.x)))
|
||||
.attr("cy", d.y = Math.max(radius, Math.min(height - radius, d3.event.y)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1741
d3/d3.d.ts
vendored
1741
d3/d3.d.ts
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user