This page describes some debugging tips when your charts don't seem to be working.
General Debugging Tips
Add the debugging parameter chof=validate
to
your URL and visit in your browser to get list of error messages per parameter
(or an "all OK" message). See if you can tell what's wrong with the following
URLs, then click the link to see the debug error message (or hover for the answer):
- https://chart.googleapis.com/chart?cht=lc&chd=s:cEAELFJHHHKUju9uuXUc&chco=76A4FB&chls=2.0&chxp=1,10,35,75&chxs=3,0000DD,13,2,t&chof=validate
- https://chart.googleapis.com/chart?cht=p3&chs=200x90&chd=t:10,20,30,40,,50&chco=FFFF10,FF0000&chof=validate
- https://chart.googleapis.com/chart?cht=lc&chd=s:zyvneTTOMLIJFHEAECFJGHDBFCERcgnpy45879,INUWUWYswz0479773133zy1246872tnkgcaZQONHCECAAAAEII&chls=3,6,3,5&chs=200x125&chof=validate
Check your syntax against the parameter documentation carefully. Does your chart type support your parameter type and parameter options?
Read the documentation for your chart. Really—read it.
Search the google-chart-api mailing list for similar questions.
Use the chart playground to tweak your parameters individually.
My Chart Isn't Showing!
Here are some tips for figuring out the problem when your chart isn't showing on your web page.
Get the actual chart URL from your page. Be
sure to get the actual URL that is being used by your
page; load up your page and either copy the URL or have the page display it. To
get the URL from the browser, typically you must
right-click the image and choose an option like "Properties." If the browser isn't
even showing a broken image icon, it might be hard
to find where to click, so you might want to give it a style to make it more visible,
something like <img src="some_url..." style="border:red
5px solid; width:100px; height:100px">
.
Try pasting the URL into the chart
playground, and
add the chof=validate
parameter
to the URL.
Is your URL properly formed? Does it start with https://chart.googleapis.com/chart?
followed
by all parameters in the format name=value&name=value&name=value
?
Add the debugging parameter chof=validate
to
your URL and visit in your browser to get list of error messages per parameter
(or a "Valid" message if it's good).
Does your URL have all the parameters required for your chart type? Most
charts require only three parameters: cht
, chd
, and chs
.
But some specialty charts, such as QR codes, don't
use one of those parameters (chd
) or require other parameters (chl
).
Make sure that you are specifying at least all the required parameters.
Find out which parameters are breaking your chart. You can do this either by starting from a broken URL and working backwards, or by starting from a working URL and working forwards:
- From a broken URL - Plug the URL of your chart into the chart playground. Start removing parameters, one at a time, until you get a chart that works. Try adding back the parameters that you removed, individually, until finally you have as many parameters from your original URL as you can get, and still have a working chart. The missing parameters are the broken ones. Read the documentation on those parameters carefully; is your syntax correct? Is your usage correct? You might have missed something in the documentation that explains your problem.
- From a working URL - Cut and paste a working example of your chart type into the playground. Add the parameters from your broken chart one by one until something breaks, and then work on fixing the problem.