3 ms·
Canvas is bitmap-based, while SVG is vector. If you need to print the chart SVG is going to look a lot better. Also, if you pinch-zoom the chart, SVG is going t
by petilon 12y ago
Canvas is bitmap-based, while SVG is vector. If you need to print the chart SVG is going to look a lot better. Also, if you pinch-zoom the chart, SVG is going to look better. Canvas doesn't support animation -- you have to code it yourself. SVG performance is quite good unless you have thousands of elements, which a chart isn't going to have.
- Kiro 12y ago> Canvas doesn't support animation -- you have to code it yourself. What do you mean?
- coldtea 12y agoThe obvious. That canvas is just a set of pixels with colors (a bitmap image). To get animation, you have to explicitly change them every X milliseconds. Whereas SVG has actual objects, that you can apply items like animateTransform, animateMotion etc to them directly, in a declarative style.
- Kiro 12y agoOk, thanks. I didn't know that. I thought you had to clear/redraw the SVG for animation as well.