Animated chart GIFs
Add &chan to an Image-Charts URL and the API returns an animated GIF instead of a PNG: the bars grow, the lines draw, the pie slices open, then the GIF stops on the finished chart. A GIF plays where JavaScript cannot run, so the animation still works in emails, Slack and Microsoft Teams messages, chat bots and PDF-free reports.
How do I make an animated chart GIF?
Take a working chart URL and append &chan:
https://image-charts.com/chart?cht=bvg&chs=700x200&chd=t:10,40,25,60&chan
That is the whole change. The response switches to Content-Type: image/gif and uses the default animation: 1200 ms with the default easing. To control it, pass a duration and an easing: &chan=1500,easeOutBounce.
Animated charts are part of every plan, the free one included (the free plan adds the small image-charts.com watermark, as on any chart). See pricing.
Syntax
&chan
&chan=<duration_ms>
&chan=<duration_ms>,<easing>
duration_ms(optional, integer in milliseconds, default1200): how long the bars, lines or slices take to reach their final value. Keep it between10and1500:1500is the documented maximum. The API does not reject a larger number, but do not rely on it.easing(optional, case-sensitive string): the speed curve of the animation. It must be one of these values, written exactly like this:- Quad:
easeInQuad,easeOutQuad,easeInOutQuad - Cubic:
easeInCubic,easeOutCubic,easeInOutCubic - Quart:
easeInQuart,easeOutQuart,easeInOutQuart - Quint:
easeInQuint,easeOutQuint,easeInOutQuint - Sine:
easeInSine,easeOutSine,easeInOutSine - Expo:
easeInExpo,easeOutExpo,easeInOutExpo - Circ:
easeInCirc,easeOutCirc,easeInOutCirc - Elastic:
easeInElastic,easeOutElastic,easeInOutElastic - Back:
easeInBack,easeOutBack,easeInOutBack - Bounce:
easeInBounce,easeOutBounce,easeInOutBounce
- Quad:
easeIn… curves start slowly and speed up, easeOut… curves start fast and slow down at the end, easeInOut… do both. Back overshoots the final value a little, Elastic wobbles around it and Bounce bounces on it.
Examples
A chart GIF plays once and then stays on the final frame. If you missed the animation, open the image in a new tab and reload it to replay it.
Bar chart: default animation
Start with a bar chart and add chan to the URL:
/chart?cht=bvg&...&chan
Bar chart: explicit duration
Write the duration in the URL when you want it fixed in your code rather than relying on the default. Here 1200 ms (1.2 seconds):
/chart?cht=bvg&...&chan=1200
Bar chart: duration and easing
Now change the easing to easeOutBack, so the bars overshoot slightly before settling:
/chart?cht=bvg&...&chan=1200,easeOutBack
Line chart
Lines draw from left to right. Learn more in line charts.
/chart?cht=lc&...&chan
3D pie chart
/chart?cht=p3&...&chan
Doughnut chart with bounce easing
The easeOutBounce easing also applies to the label in the middle of the doughnut. Learn more in pie charts.
/chart?cht=pd&...&chan=1500,easeOutBounce
Polar area chart
Learn more in polar charts.
/chart?cht=pa&...&chan
Bubble chart
Learn more in bubble charts.
/chart?cht=bb&...&chan=1500,easeOutBounce
Which charts can be animated?
- Bar charts (
bvs,bvg,bhs,bhg,bvo): yes - Line charts (
lc,ls,lxy): yes - Pie and doughnut charts (
p,p3,pc,pd): yes - Polar area charts (
pa): yes - Radar charts (
r): yes - Bubble charts (
bb): yes - QR codes (
qr): no,chanis ignored and the output stays a PNG - GraphViz charts (
gv,gv:*): no, see known limitations
How the GIF behaves
- Output format: an animated chart is always a GIF, whatever the value of
chof. See output format. - Plays once: the GIF does not loop. It runs the animation once and then keeps the final chart on screen, so the reader ends on the real numbers.
- Frame delay: frames are 30 ms apart.
- Size: a GIF weighs more than the same chart as a PNG. On a 300×150 bar chart we measured about 200 KB with
&chanagainst under 3 KB for the PNG. Bigger charts and retina output (icretina=1) make bigger files, so pick the smallestchsthat reads well. - Errors: an unknown easing, or one with the wrong case (
easeoutback), returns HTTP400with theIS_VALIDATION_ERRORcode. See errors.
GIF charts in emails and chat
An animated chart is a plain image, so it goes anywhere an HTML image tag goes:
<img alt="Monthly sign-ups, bar chart" width="600" height="250" src="https://image-charts.com/chart?cht=bvg&chs=600x250&chd=t:10,40,25,60&chan=1200,easeOutQuad&chof=.gif">
- Add
&chof=.gifat the end of the URL for email and chat clients that decide whether a link is an image by looking at its extension. It changes nothing on our side, the output is a GIF anyway. - Outlook for Windows: some desktop versions do not play GIF animations and show only the first frame. Since the first frame of a chart animation is close to empty, send the static chart (the same URL without
chan) to audiences that mostly read their mail in desktop Outlook. - Set
width,heightandalton the image tag: email clients that block images then reserve the space and show the text. - Slack, Microsoft Teams and bots: post the URL as an image attachment. See send charts to Slack.
- Signed URLs: on paid plans, sign the URL with
chanincluded, like any other parameter. See enterprise.
Coming from Google Image Charts?
Google Image Charts never had animated output and has been shut down. Once you have switched your URLs to Image-Charts by changing the host (see migrating from Google Image Charts), add &chan to any of them to get the animated version.
FAQ
Is chan available on the free plan?
Yes. Animated GIF charts work on Free, Business and Enterprise. The free plan adds the same watermark as on PNG charts.
Can the GIF loop forever?
No. A chart GIF plays once and stops on the final chart. Reloading the image plays it again.
Can I make the animation longer than 1.5 seconds?
No. 1500 ms is the longest documented duration.
Why is my chart still a PNG?
Check that chan is really in the final query string (if a URL builder in your code drops empty values, write chan=1200 instead of chan), and that the chart type supports animation (QR codes and GraphViz charts do not).