Authors   :  Joe Gregorio, eric casteleijn (eric@infrae.com)

history  :  ZSparklines is basically Joe Gregorio's spark cgi script
            (1.0.0), where the cgi layer was replaced with a Zope layer, so 
            it can be used as a zope product.

            The original cgi version can be found here:

            http://bitworking.org/projects/sparklines/

Except for the logic, which I think is flawless, Joe's had nothing to do
with this product though, so please don't bother him if you have questions,
requests, suggested improvements specifically to do with this Zope product. 

It defines two simple Five views, sparkline_smooth and sparkline_discrete,
and an interface, ISparklinedata, which you need to implement in your
classes to use the sparkline views on them. 

If you want to use sparklines for classes you have no control over, you can
just write an adapter to implement the interface.

The interface has only two methods:

    def getSparklineData():
    
        return a list of integers that will be used to construct the actual
        graph.

    def getSparklineLayout(spark_type):

        return a dictionary with layout options for the specified type
        ('smooth' or 'discrete'). Just pass in the options you want to
        override the rest will default to, ehhh, default values. So 

            return {}

        is prefectly ok.

To use the sparkline views, call them from your page templates as follows:

<img tal:attributes ="src python:model.absolute_url() + '/@@sparkline_smooth'">

TODO: 

- We may want to set the mimetype in the response, and look at whether
anything more is needed to allow optional caching (If the data changes very
often, obviously we wouldn't want caching.)

- I should probably include an example adapter, to show how easy it is to
create one.
