Using SVG on Android 2.x (and Kendo UI DataViz):
"Android (2.x)'s native browser may lack SVG, but it does support the HTML5 canvas element. That's good news. With the help of some crafty JavaScript, we can take any SVG, parse it, and then render the results to a canvas. The process may sacrifice some fidelity and interactivity that native SVG provides, but it will deliver a functional result.
There are (at least) two popular polyfills that I found to make the process of converting SVG to a Canvas surprisingly trivial:
canvg.js (~13KB minified, compressed)
Fabric.js (~37KB minified, compressed)
These libraries are open source MIT (which means you can use them anywhere), and both can take SVG and spit-out a canvas rendering. By simply adding one of these JavaScript files to your project, you can easily swap-out the SVG with an identical canvas rendering when a browser lacking SVG visits your page."
No comments:
Post a Comment