Fix hover/click bug, obj might be null

git-svn-id: https://flot.googlecode.com/svn/trunk@287 1e0a6537-2640-0410-bfb7-f154510ff394
pull/1/head
olau@iola.dk 16 years ago
parent 147f940e5b
commit ff812d0430

@ -269,12 +269,16 @@ $(function () {
function pieHover(event, pos, obj) function pieHover(event, pos, obj)
{ {
if (!obj)
return;
percent = parseFloat(obj.series.percent).toFixed(2); percent = parseFloat(obj.series.percent).toFixed(2);
$("#hover").html('<span style="font-weight: bold; color: '+obj.series.color+'">'+obj.series.label+' ('+percent+'%)</span>'); $("#hover").html('<span style="font-weight: bold; color: '+obj.series.color+'">'+obj.series.label+' ('+percent+'%)</span>');
} }
function pieClick(event, pos, obj) function pieClick(event, pos, obj)
{ {
if (!obj)
return;
percent = parseFloat(obj.series.percent).toFixed(2); percent = parseFloat(obj.series.percent).toFixed(2);
alert(''+obj.series.label+': '+percent+'%'); alert(''+obj.series.label+': '+percent+'%');
} }

Loading…
Cancel
Save