简体   繁体   English

d3中的带状放大以获取HTML中的两个图形

[英]band zoom in d3 for two graph in html

I am not so familiar with d3 libraries. 我对d3库不是很熟悉。 I am trying to use http://bl.ocks.org/jroetman/9b4c0599a4996edef0ab in addition to draw a graph that the information is taken from a tsv file and be able to zoom in and out. 除了绘制图形表示信息是从tsv文件中提取并能够放大和缩小之外,我还尝试使用http://bl.ocks.org/jroetman/9b4c0599a4996edef0ab This is works good for me. 这对我很好。 The problem is that i am trying to have two different graphs in tehe same html. 问题是我试图在同一个html中有两个不同的图形。 I can draw them in different axis, also can do zoom in and out for each graph, but the red square, the band that sign the area that i want to maximize, is shown only in the first graph. 我可以在不同的轴上绘制它们,也可以对每个图形进行放大和缩小,但是红色正方形(表示我要最大化的区域的带)仅在第一个图形中显示。 For example, if i have graph A and graph B, when i sign the area to do zoom in in graph B, i see the band in graph A but zoom is on graph B. Does anybody know what is the variable that defines this? 例如,如果我有图A和图B,当我在区域进行签名以放大图B时,我看到了图A中的区域,但缩放在图B上。有人知道定义此变量的是什么吗? How can i separate it so for each graph i will have its own band? 我如何分开它,以便每个图都有自己的波段?

Just define another band with variable name as "band2", such as, 只需将另一个带变量名的band定义为“ band2”,例如,

var band2 = svg.append("rect")
    .attr("width", 0)
    .attr("height", 0)
    .attr("x", 0)
    .attr("y", 0)
    .attr("class", "band");

Then use "band2" for graph B. Now, I hope, the zooming will work separately. 然后对图B使用“ band2”。现在,我希望缩放将单独起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM