Skip to content

Commit

Permalink
Cleaned up processOptions and bindEvents hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnschnur committed Feb 3, 2013
1 parent aaf41ea commit f294bf1
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions jquery.flot.pie.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,9 @@ More detail and specific examples can be found in the included HTML file.

// add hook to determine if pie plugin in enabled, and then perform necessary operations

plot.hooks.processOptions.push(checkPieEnabled);
plot.hooks.bindEvents.push(bindEvents);

// check to see if the pie plugin is enabled

function checkPieEnabled(plot, options) {
plot.hooks.processOptions.push(function(plot, options) {
if (options.series.pie.show) {

//disable grid

options.grid.show = false;

// set labels.show
Expand Down Expand Up @@ -130,11 +123,11 @@ More detail and specific examples can be found in the included HTML file.

plot.hooks.draw.push(draw);
}
}
});

// bind hoverable events

function bindEvents(plot, eventHolder) {
plot.hooks.bindEvents.push(function(plot, eventHolder) {
var options = plot.getOptions();
if (options.series.pie.show) {
if (options.grid.hoverable) {
Expand All @@ -144,7 +137,7 @@ More detail and specific examples can be found in the included HTML file.
eventHolder.unbind("click").click(onClick);
}
}
}
});

// debugging function that prints out an object

Expand Down

0 comments on commit f294bf1

Please sign in to comment.