jquery - d3 相当于 jQuery find("*")
问题描述
我目前使用 jQuerys 的 find('*').method 来获取 svg 元素的所有子元素:
$(svg).find("*").each(function(){
//do s.th.
});
我想与 d3 相同,我尝试过:
d3.select(svg).selectAll().each(function() {
//do s.th.
});
但
d3.select(svg).selectAll().size()
尽管 SVG 有多个子元素,但始终返回 1。我究竟做错了什么?
如果 ypu 想查看此问题适用于何处或需要示例:SVG to Image export performance issues (using canvg / XMLSerializer / getComputedStyle)
解决方案
d3.select(svg).selectAll("*")
做到了。多亏了高积云,我可以发誓我已经测试过了……还是谢谢你
推荐阅读
- css - 即使孩子大于屏幕,CSS 也只能垂直居中滚动
- nativescript - naivescript 构建运行但构建发布失败
- python - 如何生成前 n 个排列然后暂停并重新启动?
- laravel - Laravel API 收集资源问题
- matplotlib - 有没有办法在 matplotlib 热图中绘制饼图?
- c - 在 Ubuntu 上安装 CompCert C 编译器时遇到问题
- python-3.x - Beam - 从 Bigquery 中过滤掉记录
- elasticsearch - 使用 ElasticSearch 进行基于规则的定价 - 建议
- python - Django views.py 中的全局变量
- spring-boot - 在 Spring Boot 应用程序中从 Rest API 返回大尺寸响应