Chartd: responsive, retina-compatible charts with just an img tag
chartd.co
chartd.co
Use: https://quartz.github.io/Chartbuilder/ Source: https://github.com/quartz/Chartbuilder/
Chartd looks super awesome for a variety of use cases though, especially if you've got regularly updated data you want to visualize.
It's funny that you mention Google. Google used to offer a web-based chart API a lot like this one. Well, it looks like they're technically still offering it as Image Charts [1] but it is deprecated. I think it used to be called just Google Charts, but that brand was repurposed to a client-side JavaScript library. I'd say it's virtually certain that they pull the plug on it at some point, given Alphabet and the whole "era of fiscal responsibility".
I've actually written a clone of Google Chart API for private use. It relies on ChartDirector though which isn't free; it's basically a URL skin over that product. If this would be useful open source to anyone I could see if my company is willing to agree to release it. However I had sort of assumed that web-based charting APIs were dead by this point in favor of client-side ones.
Edit: Is this a paid API? StatHat looks like something that's a paid service but I can't tell if the feature in the article is paid.
[1] https://developers.google.com/chart/image/docs/making_charts
"Warning: This API is deprecated. Please use the actively maintained Google Charts API instead. See our deprecation policy for details."
I looked around for a solution like this for a while last year while building a new weekly email for Ramen[1]. I tried a bunch of services but ran up against a bunch of issues mentioned in this thread:
- GET query string character limit
- Stress around unreliability of free alternatives
- Need to be able to handle large spikes of image generation when sending emails
So I ended up building a service and turning it into a freemium product: ChartURL.com[2]
It is:
- Free for low usage w/ branding
- Based on C3.js[3] (for major flexibility)
- Supports datamaps.github.io[4]
- Has an API whereby you can POST huge datasets and get back a short URL that can be used in an img tag
- Supports retina & `srcset` via a `retina=1` option
You need to sign the URLs which means it's not a simple "just drop the data in the URL" but it's close.
I'll hang out in the comments here for a while if any of you want to ask questions about it.
[1] https://ramen.is
Having said that, I would be surprised if there weren't good open-source alternatives (anyone?); maybe the problem is that server-side requirements might get a bit awkward, even if you can find a good solution in the language of your choice.
> All chartd charts look great on retina displays. The SVG charts are vectors and render perfectly. chartd generates all the PNGs @2x the resolution so they scale appropriately.
Is this why when I view an image directly [1] it's twice the size of the requested dimensions? I'm viewing this on a 'retina' screen, in case that affects things. Is this the best way of handling retina displays, to make everyone else's image 4 times bigger than it needs to be, and scaling it in-browser?
[1] e.g. http://chartd.co/a.svg?w=580&h=180&d0=SRWfaZHLHEDABKKTUYgpqq...
You'll also end up needing to do a length check client side, since the degradation is probably not graceful as you approach the request limit (fine, fine, fine, fine, fine, HTTP 414).
That's probably fine for a lot of use cases, but if you adopt this charting library / system and then later want to do more complicated things with it, you're going to end up needing to rip it out and replace it with something else that doesn't have this limitation.
I don't see a way around it, you can't make the browser POST to get the img tags AFAIK.
Still, having it as a hosted service doing image charts can be great, you just need to give folks a backup plan.