Mod jQuery Sparkline to have a thicker line
9/14/09 - Update: jQuery.sparkline 1.4.3 now supports a lineWidth attribute
I prefer sparklines with a thicker line, something like 2-3px looks better to me than thin 1px lines in charts. I recently needed to use the jQuery sparklines plugin but there was no parameter for how to make the line thicker. After much searching through the source code I found the answer.
First, make sure you have a copy of the non-minified version so you can see what you’re doing.
Find line 796 and change context.lineWidth to however thick you want the line to be. This changes the code for the canvas implementation.
To make it work in IE as well, find line 880 and change strokeWeight to the same # you used above. This changes the code for the VML implementation.
Hope this helps someone out. Perhaps the owner of jQuery Sparkline can make this a built in parameter. It seems like something that many people would want to change.



4 comments
(JavaScript must be enabled to view this email address)
Sep 4, 2009Great suggestion - I’ll add it as an option for a future version of the plugin!
Gareth
Sep 14, 2009Added the lineWidth option to jQuery Sparkline 1.4.3
(JavaScript must be enabled to view this email address)
Sep 14, 2009Thanks Gareth, that’s great news!
webdesign frankfurt
Dec 8, 2009U guys rock! :)