Live data from Hacker News

New Chart.js beta version launched

chartjs.org

41–50 of 64 posts

Re: New Chart.js beta version launched

#44
post #31

Earlier quoted context omitted.

SVG is a good solution too, but it can really suffer performance-wise, especially on mobile, tablet and when animating svg node positions.

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.

> Canvas doesn't support animation -- you have to code it yourself.

What do you mean?

Re: New Chart.js beta version launched

#45
post #21

Earlier quoted context omitted.

Just from a cursory glance, it appears that Chartjs is entirely free and you can do what you want with it, while Highcharts is not.

It would be nice if this distinction was stated unambiguously on the front page here's the license if you were looking for it like I was https://github.com/nnnick/Chart.js/blob/master/LICENSE.md

Took me ages to find the license, I ended up clicking documentation and still having to search for the word license to find it. I wish it was more prominent on the landing page.

Re: New Chart.js beta version launched

#46

I've used Chart.JS for quite a few big projects but I always found it lacking in some crucial features (hover/tap events & legends)

andyhmltn, try FusionCharts or HighCharts instead. I have had good experience with FusionCharts till now and it also has the features(hover/tap events & legends) that you are looking for. Feel free to mail me if you get stuck somewhere. Can't say much about HighCharts as I am yet to experiment with all its features. But everyone here seems to love them, so you can find good support for it as well.

Re: New Chart.js beta version launched

#47
post #27

Earlier quoted context omitted.

Don't forget Highcharts... http://www.highcharts.com

Big fan of Highcharts. Like that you can export charts to a png. Big deal for me, don't think chart.js offers anything like that?

Yep, you can call .toBase64Image() on your chart instance to return a png image encoded as a base 64 data url.

Re: New Chart.js beta version launched

#48
post #44
post #31

Earlier quoted context omitted.

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.

> Canvas doesn't support animation -- you have to code it yourself. What do you mean?

The 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.

Re: New Chart.js beta version launched

#49

At work, we use Google Charts to chart data, then send images of those charts to users via email, inline. We are told that this functionality will be deprecated in the API some time next year. Anyone have an idea of how to mitigate that? Emails dont support javascript so not sure how to get around this. Just for some clarity, if you happen to use Sendgrid, they do the same thing. Google chart images in an email.

Google Charts are rendered through SVG, and fortunately you have two options to reliably convert any SVG to PNG. One options is "Batik Rasterizer"[1] - it is a single .jar file, fast, and accurately renders 99% of our cases. The other options is Wkhtmltopdf[2] - it comes with a companion wkhtmltoimage binary which convert SVG to PNG through a customised webkit engine. It also is fast, and can handle our most complex visualisations.

All we do is grab the SVG source with JS, post it back to the server, and get the image back (after it is scaled/watermarked/optimised). This setup has worked well for us for some years now. Further we can easily interchange charting libraries with on concern about their native exporting options because we handle the rendering ourselves.

[1] https://xmlgraphics.apache.org/batik/tools/rasterizer.html

[2] http://wkhtmltopdf.org/

Re: New Chart.js beta version launched

#50
post #48
post #44

Earlier quoted context omitted.

> Canvas doesn't support animation -- you have to code it yourself. What do you mean?

The 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.

Ok, thanks. I didn't know that. I thought you had to clear/redraw the SVG for animation as well.
Post reply on HN