[英]In my d3 chart, Zoom selection disappears when I change the brush and click on not selected range
In my d3 chart, Zoom selection disappears when I change the brush and click on not selected range.在我的 d3 图表中,当我更改画笔并单击未选择的范围时,缩放选择消失了。
This is my working code - https://codesandbox.io/s/eager-shirley-cxq99这是我的工作代码 - https://codesandbox.io/s/eager-shirley-cxq99
When I changed the selection above and clicked on unselected selection zoom selection disappear.当我更改上面的选择并单击未选择的选择时,缩放选择消失了。
Please guide me what is wrong with my code.请指导我的代码有什么问题。
Just un-comment this part in your code to actually produce the zoom rect, which gets used in the brushed
function.只需在您的代码中取消注释这部分以实际生成缩放矩形,该缩放矩形用于
brushed
过的 function。
svg
.append("rect")
.attr("class", "zoom")
.attr("width", containerWidth - 20)
.attr("height", height)
.attr("transform", "translate(0,20)")
.call(zoom);
See working codesandbox.io请参阅工作代码和框。io
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.