In contrast to image charts, which (as their name implies) are displayed as regular images, interactive charts are composed of dynamic graphics that are drawn using various browser facilities such as DHTML, Flash, Canvas, SVG, and VML. Typical interactivity includes scrolling, zooming, sorting, tool tips, and hover effects.
The drawing method employed is mostly transparent to the developer, as a well-written visualization will use the appropriate rendering method for the target browser. This is a great time-saver, allowing the developer to concentrate on the functionality and aesthetics of the charts rather than the minutiae of drawing them.
Interactive charts require the use of an external API, which you
would typically include in the
<head> section of your page, as with any
other external library:
The stages required to draw a chart using the visualizations API are as follows:
Load the general Google AJAX API.
Request the appropriate visualizations API.
When the visualizations API has loaded, prepare the data, and finally draw the chart into an element on the page.
The following code draws a chart using the same bakery sales data used earlier in the chapter: