Service URI:
Please note that currently, no namespace is needed.
Current services:
hello()
add(val1,val2)
sparkline(type:string,data:array,args:dict)
#!/usr/bin/python
import SOAPpy
import binascii
serv = SOAPpy.SOAPProxy("")
args = {}
# args for all sparklines
args['step'] = '1'
args['height'] = '20'
# args for discrete sparkline
args['upper'] = '50'
args['below-color'] = '#078007'
args['above-color'] = '#f30404'
# args for smooth sparkline
args['min-color'] = '#0000FF'
args['max-color'] = '#00FF00'
args['last-color'] = '#FF0000'
args['min-m'] = 'true' #show min dot
args['max-m'] = 'true' #show max dot
args['last-m'] = 'true' #show last dot
data = (10,20,30,40,30,20,40,80,90,90,70,60,10,40)
base64_sparkline = serv.sparkline('discrete',data,args)
f = open('test.png','w+b')
f.write(binascii.a2b_base64(base64_sparkline))
f.close()
It returns a base64-encoded PNG file (as a string) of a sparkline (as defined by Edward Tufte, similar to or )1. The PNGs are quite small, and so can be embedded directly in HTML using the data: tag (which, as fate would have it, doesn't always work in Internet Explorer), like so:
<img src="data:image/png,%89PNG%0D%0...snip...AEB%60%82"/>
<img src="data:image/png,%89PNG%0D%0...snip...AEB%60%82"/>
which then looks like this: . The sparkline generation code is based on that of Joe Gregorio.
getFeeds(URI:string)
>>> serv.getFeeds('')
['', '']
>>> serv.getFeeds('')
['', '']
toRoman(n:integer)
>>> serv.toRoman(1984)
'MCMLXXXIV'
>>> serv.toRoman(1984)
'MCMLXXXIV'
fromRoman(s:string)
>>> serv.fromRoman('MCM')
1900
>>> serv.fromRoman('MCM')
1900
More to come...
1. A practical example is currencies. While it is interesting to say that the exchange rate between the South African Rand (ZAR) and the Euro varied between 10.6890 in January of 2002 and 8.1537 in July of this year, referring to its development using sparklines says a lot more: The development of the South African Rand since January 2002 from its base value of 10.689...Or: Since January 2002, the Rand has spent a lot of time under its period mean value , especially in the latter half....