Sunday, May 08, 2011

Sparklines in WPF and Silverlight

image

One seemingly-trivial-yet-recurring problem in financial software is the need for a live-updating line-chart. However, from multiple conversations with Lab49 folks, as well as from experience during my first project, I’ve learned that most WPF/Silverlight charting packages suck in various ways, especially if you’re updating their data frequently. Seems like everyone just rolls their own line chart and tailors it to each project, but doesn’t share it for some reason. I’d like to break that trend by sharing and early version of my own sparkline control for WPF and Silverlight.

http://github.com/jschementi/sparkline

Sample Usage:

It’s implementation is very basic; Sparkline.AddTimeValue constructs a point at the next time interval and adds it to a Polyline. You can control the sparkline’s visuals, including adding visible points along the line and showing horizontal lines for the latest/highest/lowest values. The source builds assemblies for both .NET 4.0 and Silverlight 4.

There are obvious features missing like rendered axis or variable x-axis (time) values, but hopefully this provides a simple starting place for anyone else needing a very simple updating line graph.

By the way, Andre de Cavaignac, a colleague of mine at Lab49, and Daniel Simon shared their own a while back: Live Updating Line Graph in WPF. Let me know if there are any others out there.

Anyways, Happy Mother’s Day!

13 comments:

Anuj Seth said...

Umm no they don't all suck. Try this http://www.youtube.com/watch?v=wPblKVjx14o

what all do you think we lack ?

ps: We're at version 1.0 and only about a month old.

Vladimir said...

Actually there is a pretty nice and much more feature complete (althogh not free) sparklines package from Telerik. Check this out: http://www.telerik.com/products/silverlight/sparklines.aspx

myBlog said...

It's a good program.
I'll Try next time.
now I rewrote program.
It is myBlog: IronPython Snow Gastalt...
http://softgarden.blog.ocn.ne.jp/blog/2011/07/ironpythonsnow_.html
thanks.

Mike said...

Sparklines in Silverlight have been problem for my colleagues and each time someone asks if you can do this, they almost fall down from chair. Looks like there is more simple solution than most thought.

Thanks for sharing!

Magento Development said...

I have seen a very informative blog. Really I like this blog. This blog gives us very good knowledge about Sparklines in WPF and Silverlight.

printer ink said...

You have written such a good coding that how to implement a program or how to run a program. I like it.
good job man

Indiska kläder said...

Nice blog with the nice information about the topic

Magento developer said...

Great post. .thanks for sharing.

Art Valdivia said...

nice thought you have written, i will take a print out from my inkjet printer ink

Indiska kläder said...

This blog is very important for me and I get very important information on this blog

cheap ink cartridges said...

Thanks for sharing this program. check my latest blog about printer and ink used in printers.

saree said...

Hi,

Nice blog and its good and thanks for share your knowledge with us.

Regards

Indiska kläder

inkjet UK said...

Check best quality Inkjet for U.K users with very economical prices. makes sure to visit by clicking my name.