In this example we are planning to use Google chart, as is evident from
the import statement in the view, we import gchart.LineChart. So we must
also include the google chart javascript in our template.

See, how easy it was to switch from gchart to yui. You did not have to
write or change a single line of javascript to switch from gchart to
yui. All that was taken care of by as_html() of the chart object.

Most of the chart providers support LineChart, BarChart, ColumnChart and
PieChart, and it is very easy to switch from specific chart type of one
provider to other. eg: It is super quick to switch from gchart LineChart
to flot LineChart.

Template

Options

Your rendered chart is contained in a div.

Setting id of chart containing div

You might want to do additional jquery or javascript operations with
your chart containing div. In such case you might want to set an id on
the div. You can do this while instantiating the chart element.

chart = gchart.LineChart(html_id='gchart_div')

Setting width and height of chart containing div

You can control the width and height of chart containing div while
instantiating the chart element.

chart = gchart.LineChart(simple_data_source, height=100, width=100)

Chart specific options

Different chart providers give different options to customise the chart.

Google chart api allows setting title for the rendered chart, see
Gchart
documentation,
using title attribute. You can accomplish this by adding a keyword
argument called options while instantiating the chart element.