Raphaël and D3.JS - Better Browser Compatibility

只谈情不闲聊 提交于 2019-12-05 06:14:04

问题


Is it possible to use D3 and Raphael together so that visualizations are produced by D3 (using D3's API to produce svg output) and correctly visualized in IE by Raphael ?

I appreciate any example/sample code.


回答1:


Yes you can.

We've improved r2d3 from a compatibility project to an IE fallback for D3. This was achieved by having D3 wrap Raphael elements which we extended with methods such as setAttribute. This enables D3 to work with Raphael elements like they were DOM nodes. The project still needs some work to iron out issues with things like groups, but I encourage you to check it out to see if it meets your needs.

https://github.com/mhemesath/r2d3




回答2:


Short answer: No

But you can use the IE-compatible features of D3 to some extend. Have a look at Jeff Pflueger's discussion. And his conclusion (includes some code).

Here is another discussion, and a good summary from Mike Hemesath. He uses d3 "to do the heavy lifting of handling the scales, generating path data for areas and lines and formatting dates", and he uses Raphael for the rendering.

He is also maintaining a compatibility project for that, named r2d3.



来源:https://stackoverflow.com/questions/9559365/rapha%c3%abl-and-d3-js-better-browser-compatibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!