There are docs for click events for jQuery Sparklines, but I can't find a way how I could find out which element was clicked.
So I display a list of items in a table and with a sparkline (their prices). When the user clicks a sparkline, I'd like to know which "item" he clicked. Is that even possible?
You can define a separate sparkline class for each chart you display. Then you have the possibility to define different functions for each chart.
$('.clickdemo').sparkline();
$('.clickdemo').bind('sparklineClick', function(ev) {
var sparkline = ev.sparklines[0],
region = sparkline.getCurrentRegionFields();
alert("Clicked chart 1 on x="+region.x+" y="+region.y);
});
$('.clickdemo2').sparkline();
$('.clickdemo2').bind('sparklineClick', function(ev) {
var sparkline = ev.sparklines[0],
region = sparkline.getCurrentRegionFields();
alert("Clicked chart 2 on x="+region.x+" y="+region.y);
});
I'm not sure if this was what you wanted to know. But this is my best guess :-)
Hope this helps.