简体   繁体   English

一页上有多个d3图表

[英]Multiple d3 charts on one page

I have a cubism d3 chart on my page. 我的页面上有一个立体图d3图表。 I also want to add more charts to the page. 我也想在页面上添加更多图表。 Is it possible to add more d3 charts in the same page or will i have to use some other libraries? 是否可以在同一页面中添加更多d3图表,还是我必须使用其他一些库?

I am asking this because every visualization in d3 uses .axis and if i give some style to cubism graph then it would affect other graphs as well. 我问这个问题是因为d3中的每个可视化都使用.axis,如果我给立体图指定某种样式,那么它也会影响其他图。

I would recommend wrapping the entire generating code in a function which specifies which DOM element you want to put the chart in as a parameter. 我建议将整个生成的代码包装在一个函数中,该函数指定要将图表放入哪个DOM元素作为参数。 This will leverage javascript closure and everything should work itself out. 这将利用javascript结束功能,并且一切都可以正常进行。

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

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