XQuery/Google Chart Sparkline

Motivation
You want to create an easy-to-use specialized chart using a generic charting service such as Google Charts

Method
The GoogleChart API creates PNG-format charts from data passed in the URL line.

One use of the service would be to generate a Tufte sparkline. This script uses random data to generate a small sparkline-like graphic. With a bit more work, the additional features such as minimum, maximum and normal bands should be able to be added. A line chart (cht=lc) includes axes but these can be removed by using an undocumented feature in which the chart type is specified as lfi

The script uses function overloading in XQuery which allows two functions to have the same name but different numbers of parameters. The more general function has parameters for the sequence of values and the min and max to be used in scaling the values. The second function (with the same name) accepts only the values and calculates the min and max from the data before calling the more general function to complete the task.

[/visualization/random-sparkline.xq Random Sparkline]