基于第一个窗口中的刷子更新第二个窗口中的域

时间:2014-04-01 02:06:53

标签: javascript d3.js

我知道这对我们新手来说是一个常见的问题,但是我所研究的SO或实例的答案都没有帮助澄清我的想法(大多数例子涉及时间序列或分类变量,我的数据在每个轴上都是连续的)。

我的完整代码在jsfiddle上(注意拉丝区域是黑色的,但它有效)。我在一个窗口刷(地图),返回值是正确的。我想将brush.extent应用于第二个窗口(轮廓)中的域作为缩放方式。我只是不能在第二个窗口中获得更新域的范围值 - 我不知道如何让它刷新。问题在于这个功能:

// V2: trying to pass the brush extent to update the domain in the contour region
function brushed() { // trying to update contour region using the extent
var extent = brush.extent();
//  xCon.domain(brush.empty() ? xMap.domain() : [ extent[0][0], extent[1][0] ]);
//  yCon.domain(brush.empty() ? yMap.domain() : [ extent[0][1], extent[1][1] ]);
yCon.domain([0, 0.5]); // hard-wired for testing; value changes but doesn't update display
// ????
return extent
}

0 个答案:

没有答案