4
嗨我想用Fisheye Distortion plugin作爲我的力量指向圖d3.js,但是當我想應用這個插件時,圖的行爲很奇怪。我在d3.js新,並不擅長計算機圖形學。魚眼失真插件的奇怪行爲
var fisheye = d3.fisheye.circular()
.radius(200)
.distortion(2);
// graph - variable which represents whole graph
graph.svg.on("mousemove", function() {
fisheye.focus(d3.mouse(this));
d3.select("svg").selectAll("circle").each(function(d) { d.fisheye = fisheye(d); })
.attr("cx", function(d) { return d.fisheye.x; })
.attr("cy", function(d) { return d.fisheye.y; })
.attr("r", function(d) { return d.fisheye.z * 4.5; });
d3.select("svg").selectAll("line").attr("x1", function(d) { return d.source.fisheye.x; })
.attr("y1", function(d) { return d.source.fisheye.y; })
.attr("x2", function(d) { return d.target.fisheye.x; })
.attr("y2", function(d) { return d.target.fisheye.y; });
});
怪異的行爲我的意思是圖的節點消失(被隱藏)鼠標懸停動作之後。
你見過[該工作示例(http://bost.ocks.org/mike/fisheye/)? – 2014-11-04 19:00:25
是的,我看過那個例子 – Matt 2014-11-04 19:13:08
看起來它在你的圖上工作正常。它與你的預期有什麼不同? – 2014-11-06 21:05:03