Dynamically Generated Charts

I've always wondered what's behind www.google.com/chart, the strange directory used by Google to dynamically generate charts. They use this charts at Google Video to show stats like this one (if you're brave, look at the image location):



The problem is that Google also adds a hash to the URL so you can't play around with the parameters and create your own charts. But now there's Google Chart API, a way to make these charts available to everyone.

"The Google Chart API returns a PNG-format image in response to a URL. Several types of image can be generated: line, bar, and pie charts for example. For each image type you can specify attributes such as size, colors, and labels. You can include a Chart API image in a webpage by embedding a URL within an <img> tag. When the webpage is displayed in a browser the Chart API renders the image within the page."

All these charts can be created dynamically by building some admittedly complicated URLs.







Let's look at the 3D pie chart's URL:

http://chart.apis.google.com/chart?cht=p3&chd=s:Uf9a&chs=200x100&chl=A|B|C|D

cht indicates the chart type, chd provides the plotted data that's encoded using letters and digits (for example, U represents 20, f - 31, 9 - 61, a - 26), chs is used for chart's size, while chl separates labels using the pipe character.

This is a great way to create simple charts programmatically and I'm sure many web apps will use them. The query limit of 50,000 queries per user per day is more than sufficient.

Update: It seems that the limit is not that generous. "The user is the webpage that links to the chart. We would like to make sure that all users get their charts fast and reliably. Therefore we may temporarily block users (websites) that exceed the limit. A chart request is not counted if the chart image is cached by the browser or by a proxy," clarified Uwe Maurer from Google Zürich.

Labels

Web Search Gmail Google Docs Mobile YouTube Google Maps Google Chrome User interface Tips iGoogle Social Google Reader Traffic Making Devices cpp programming Ads Image Search Google Calendar tips dan trik Google Video Google Translate web programming Picasa Web Albums Blogger Google News Google Earth Yahoo Android Google Talk Google Plus Greasemonkey Security software download info Firefox extensions Google Toolbar Software OneBox Google Apps Google Suggest SEO Traffic tips Book Search API Acquisitions InOut Visualization Web Design Method for Getting Ultimate Traffic Webmasters Google Desktop How to Blogging Music Nostalgia orkut Google Chrome OS Google Contacts Google Notebook SQL programming Google Local Make Money Windows Live GDrive Google Gears April Fools Day Google Analytics Google Co-op visual basic Knowledge java programming Google Checkout Google Instant Google Bookmarks Google Phone Google Trends Web History mp3 download Easter Egg Google Profiles Blog Search Google Buzz Google Services Site Map for Ur Site game download games trick Google Pack Spam cerita hidup Picasa Product's Marketing Universal Search FeedBurner Google Groups Month in review Twitter Traffic AJAX Search Google Dictionary Google Sites Google Update Page Creator Game Google Finance Google Goggles Google Music file download Annoyances Froogle Google Base Google Latitude Google Voice Google Wave Google Health Google Scholar PlusBox SearchMash teknologi unik video download windows Facebook Traffic Social Media Marketing Yahoo Pipes Google Play Google Promos Google TV SketchUp WEB Domain WWW World Wide Service chord Improve Adsence Earning jurnalistik sistem operasi AdWords Traffic App Designing Tips and Tricks WEB Hosting linux How to Get Hosting Linux Kernel WEB Errors Writing Content award business communication ubuntu unik