Commit a03c4c19 authored by David Schnur's avatar David Schnur

Moved other hooks out of the processOptions hook.

In plugins we should never add hooks conditionally; the condition should
remain within individual hooks, so the plugin can be toggled at any
time.

Ideally we should also 'inline' the hook functions, since they're used
nowhere else.  But since that would involve a lot of code changes, we'll
put it off until the broader cleanup effort scheduled for 0.9.0.
parent f294bf19
......@@ -113,20 +113,9 @@ More detail and specific examples can be found in the included HTML file.
} else if (options.series.pie.tilt < 0) {
options.series.pie.tilt = 0;
}
// add processData hook to do transformations on the data
plot.hooks.processDatapoints.push(processDatapoints);
plot.hooks.drawOverlay.push(drawOverlay);
// draw hook
plot.hooks.draw.push(draw);
}
});
// bind hoverable events
plot.hooks.bindEvents.push(function(plot, eventHolder) {
var options = plot.getOptions();
if (options.series.pie.show) {
......@@ -139,6 +128,27 @@ More detail and specific examples can be found in the included HTML file.
}
});
plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
var options = plot.getOptions();
if (options.series.pie.show) {
processDatapoints(plot, series, data, datapoints);
}
});
plot.hooks.drawOverlay.push(function(plot, octx) {
var options = plot.getOptions();
if (options.series.pie.show) {
drawOverlay(plot, octx);
}
});
plot.hooks.draw.push(function(plot, newCtx) {
var options = plot.getOptions();
if (options.series.pie.show) {
draw(plot, newCtx);
}
});
// debugging function that prints out an object
function alertObject(obj) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment