|
Sparky is a Python module containing a stub class "sparkLine" for the sparkline SOAP service.
|
An instantiated sparkLine object has a number of default attribute values, and an empty dataset, unless a dataset is passed as a list of integers to the constructor. Calling the getSparkLine() method on a newly instantiated object without dataset returns None. Once a dataset has been provided as a list of integers via the setData() method, the getSparkLine() method returns the sparkline as a binary PNG representation.
An interactive session:
>>> import sparky
>>> s = sparky.sparkLine()
>>> s.setData((50,70,60,40,10))
>>> s.getSparkLine()
"\x89PNG\r\n\x1a\n\i...snip....0\x00IEND\xaeB`\x82"
The class documentation is available.
The module itself can be downloaded:
sparky.py
Note that using the getSparkLine() repeatedly is not particularly inefficient, as the sparkline is cached locally and only re-fetched if parameters or the dataset change.