0

I would like to use the sparklineClick Event for sparkline barcharts.

It seems that this only works for line charts. When I use the code from the demo I get undefined for the region.

    $('.clickdemo').sparkline('html', {type: 'bar', barColor: 'red'});
    $('.clickdemo').bind('sparklineClick', function(ev) {
        var sparkline = ev.sparklines[0],
            region = sparkline.getCurrentRegionFields();
        alert('Clicked on x=' + region.x + ' y=' + region.y);
    });

Does somebody know a workaround to get to get back at least a correct x value?

Félix Saparelli
  • 8,424
  • 6
  • 52
  • 67
woopi
  • 368
  • 2
  • 9

1 Answers1

1

the code forrowing might be helpful:

$('#chart1').bind('sparklineClick', function(ev){
  var sparkline = ev.sparklines[0],
  region = sparkline.getCurrentRegionFields();
  console.log(region[0]);
  alert('Clicked on x=' + region[0].offset + ' y=' + region[0].value);
})
Manuel
  • 3,828
  • 6
  • 33
  • 48
jake.tse
  • 33
  • 4