It's reasonably straightforward to generate graphics on the fly in python using the reportlab library http://www.reportlab.com/software/opensource/. It includes functionality to create bar, line, pie, etc. charts from lists of data. Don't be misled by the emphasis on generating PDFs, the library also can create just PNG or GIF images. Also, the official documentation is very verbose and intimidating, but it's quite accessible once you actually start coding.
The following page explains the whole process for Django, but the same approach would be applicable to any framework: http://code.djangoproject.com/wiki/Charts.
In particular, note that you can build a graphic in-memory and return it as an HttpResponse. It's quite fast. I use something like the following in one of my apps:
def my_chart(request):
response = HttpResponse(
my_function_to_make_a_chart().asString('png'),
'image/png',
)
return response
That django view would be associated with a URL that you would embed directly into your HTML document as an tag:
<img src="/my_site/my_chart/" alt="A cool chart" />