2005.07.16 10:23 AM

Sparklines 2.0

[Updated 8/31/05: Now version 2.3.]

[Updated 8/25/05: Now version 2.2.]

[Updated 8/3/05: Now version 2.1.]

After a night's sleep it's clear to me that BarLines are really just a another kind of sparkline and should have been implemented in the same handler using a new type. Done. I also took the opportunity to add some using statements to enforce disposals in the face of errors and wrapped the plotting routines in try/catch blocks in order to get back error X's in the face of bad parameters.

Here's the source. And here are some IMG elements pointing at the new spark.ashx handler along with their querystrings.

sparkline querystring
type=smooth&d=86,66,82,44,64,66,88,96,26,14,0,0,26,8,6,24,52,36,6,10,30&
height=30&min-color=red&max-color=blue&last-color=green&step=2&
last-m=true&max-m=true&min-m=true
type=discrete&d=66,82,44,64,66,88,96,80,24,36,14,15,26,8,6,66,78,72&
height=15&upper=70&above-color=red&below-color=green
type=smooth&d=40,55,12,75,3,34,65,90,50&height=15&min-color=green&
max-color=red&last-color=blue&step=5&last-m=true&max-m=true&min-m=true
type=discrete&d=40,55,12,75,3,34,65,90,50,66,82,44,64,66,88,96,80,24&height=15&
above-color=purple&below-color=blue&upper=60
type=smooth&d=10,55,12,75,3,34,65,90,50,26,82,44,64,2,96,24&height=10&&step=3
type=bars&d=80,100,25&width=50&bar-height=4&bar-colors=blue,green,purple
type=bars&d=80,100,25&width=50&bar-height=4&bar-colors=blue,green,purple&align-right=true
type=bars&d=80&width=50&bar-height=8&bar-colors=%236699D5
type=bars&d=50,100&width=50&bar-height=5&bar-colors=green,red&shadow-color=white
type=bars&d=50,100&width=50&bar-height=5&bar-colors=green,red&shadow-color=white&align-right=true
type=bars&d=12,45,52,87,99&width=50&bar-height=1&bar-colors=purple
(missing or bad parameters)

By the way, I removed the BarLines handler and source from my site, as I can't imagine anyone is using it yet.


Comments

I love the sparklines shown above I really need to add a threshold variable to the "smooth" type, where a 'grey' rectangle of Max and Min Values are shown in behind the the sparkline generated. Just like the ones shown on the page from ET ... see url above. Could you help me out with the code change?

Curtis Hannah | 2005.08.03 11:56 AM

Curtis - Thanks for bringing this to my attention. I updated the service code to support these. See Sparklines 2.1:

http://ewbi.blogs.com/develops/2005/08/sparklines_21.html

ewbi.develops | 2005.08.03 08:01 PM



Post a Comment

 
  (optional)
  (no html)
 
   


TrackBack

TrackBack URL:  http://www.typepad.com/services/trackback/6a00d8341c7bd453ef00d8349a624d69e2

Listed below are links to weblogs that reference Sparklines 2.0: