diff --git a/jquery.flot.categories.js b/jquery.flot.categories.js index 1716584..3003752 100644 --- a/jquery.flot.categories.js +++ b/jquery.flot.categories.js @@ -110,11 +110,14 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. } function categoriesTickGenerator(axis) { - var res = []; - for (var label in axis.categories) { - var v = axis.categories[label]; - if (v >= axis.min && v <= axis.max) { - res.push([v, label]); + var res = [], + categories = axis.categories; + for (var label in categories) { + if (Object.prototype.hasOwnProperty.call(categories, label)) { + var v = categories[label]; + if (v >= axis.min && v <= axis.max) { + res.push([v, label]); + } } } @@ -138,7 +141,9 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. } else { for (var v in o) { - c[v] = o[v]; + if (Object.prototype.hasOwnProperty.call(o, v)) { + c[v] = o[v]; + } } } diff --git a/jquery.flot.js b/jquery.flot.js index 1a4e261..4f577b0 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1552,13 +1552,15 @@ Licensed under the MIT license. function setupGrid() { var axes = allAxes(), showGrid = options.grid.show, + margin = options.grid.margin || 0, i, a; // Initialize the plot's offset from the edge of the canvas for (a in plotOffset) { - var margin = options.grid.margin || 0; - plotOffset[a] = typeof margin === "number" ? margin : margin[a] || 0; + if (Object.prototype.hasOwnProperty.call(plotOffset, a)) { + plotOffset[a] = typeof margin === "number" ? margin : margin[a] || 0; + } } executeHooks(hooks.processOffset, [plotOffset]); diff --git a/jquery.flot.selection.js b/jquery.flot.selection.js index 1d89ace..1fc33dc 100644 --- a/jquery.flot.selection.js +++ b/jquery.flot.selection.js @@ -237,16 +237,18 @@ The plugin allso adds the following methods to the plot object: var axis, from, to, key, axes = plot.getAxes(); for (var k in axes) { - axis = axes[k]; - if (axis.direction === coord) { - key = coord + axis.n + "axis"; - if (!ranges[key] && axis.n === 1) { - key = coord + "axis"; // support x1axis as xaxis - } - if (ranges[key]) { - from = ranges[key].from; - to = ranges[key].to; - break; + if (Object.prototype.hasOwnProperty.call(axes, k)) { + axis = axes[k]; + if (axis.direction === coord) { + key = coord + axis.n + "axis"; + if (!ranges[key] && axis.n === 1) { + key = coord + "axis"; // support x1axis as xaxis + } + if (ranges[key]) { + from = ranges[key].from; + to = ranges[key].to; + break; + } } } }