Commit cca37aa9 authored by olau@iola.dk's avatar olau@iola.dk

Updated to match the latest API


git-svn-id: https://flot.googlecode.com/svn/trunk@184 1e0a6537-2640-0410-bfb7-f154510ff394
parent a7355c21
...@@ -32,16 +32,15 @@ how much info to output: ...@@ -32,16 +32,15 @@ how much info to output:
function init(plot) { function init(plot) {
var debugLevel = 1; var debugLevel = 1;
function checkDebugEnabled(args) { function checkDebugEnabled(plot, options) {
if (args.options.debug) { if (options.debug) {
debugLevel = args.options.debug; debugLevel = options.debug;
plot.hooks.processDatapoints.push(alertSeries); plot.hooks.processDatapoints.push(alertSeries);
} }
} }
function alertSeries(args) { function alertSeries(plot, series, datapoints) {
var series = args.series;
var msg = "series " + series.label; var msg = "series " + series.label;
if (debugLevel > 1) if (debugLevel > 1)
msg += " with " + series.data.length + " points"; msg += " with " + series.data.length + " points";
...@@ -71,7 +70,7 @@ HTML page and then it can be used with: ...@@ -71,7 +70,7 @@ HTML page and then it can be used with:
This simple plugin illustrates a couple of points: This simple plugin illustrates a couple of points:
- It uses the anonymous function trick to ensure no namespace pollution. - It uses the anonymous function trick to avoid name pollution.
- It can be enabled/disabled through an option. - It can be enabled/disabled through an option.
- Variables in the init function can be used to store plot-specific - Variables in the init function can be used to store plot-specific
state between the hooks. state between the hooks.
...@@ -103,4 +102,4 @@ than on per default, just like most of the powerful features in Flot. ...@@ -103,4 +102,4 @@ than on per default, just like most of the powerful features in Flot.
Think hard and long about naming the options. These names are going to Think hard and long about naming the options. These names are going to
be public API, and code is going to depend on them if the plugin is be public API, and code is going to depend on them if the plugin is
succesful. successful.
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