Commit 5c005f6b authored by David Schnur's avatar David Schnur

Wrap for...in loop bodies with hasOwnProperty.

parent e0413b93
...@@ -110,13 +110,16 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -110,13 +110,16 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
} }
function categoriesTickGenerator(axis) { function categoriesTickGenerator(axis) {
var res = []; var res = [],
for (var label in axis.categories) { categories = axis.categories;
var v = axis.categories[label]; for (var label in categories) {
if (Object.prototype.hasOwnProperty.call(categories, label)) {
var v = categories[label];
if (v >= axis.min && v <= axis.max) { if (v >= axis.min && v <= axis.max) {
res.push([v, label]); res.push([v, label]);
} }
} }
}
res.sort(function (a, b) { return a[0] - b[0]; }); res.sort(function (a, b) { return a[0] - b[0]; });
...@@ -138,9 +141,11 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -138,9 +141,11 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
} }
else { else {
for (var v in o) { for (var v in o) {
if (Object.prototype.hasOwnProperty.call(o, v)) {
c[v] = o[v]; c[v] = o[v];
} }
} }
}
series[axis].categories = c; series[axis].categories = c;
} }
......
...@@ -1552,14 +1552,16 @@ Licensed under the MIT license. ...@@ -1552,14 +1552,16 @@ Licensed under the MIT license.
function setupGrid() { function setupGrid() {
var axes = allAxes(), var axes = allAxes(),
showGrid = options.grid.show, showGrid = options.grid.show,
margin = options.grid.margin || 0,
i, a; i, a;
// Initialize the plot's offset from the edge of the canvas // Initialize the plot's offset from the edge of the canvas
for (a in plotOffset) { for (a in plotOffset) {
var margin = options.grid.margin || 0; if (Object.prototype.hasOwnProperty.call(plotOffset, a)) {
plotOffset[a] = typeof margin === "number" ? margin : margin[a] || 0; plotOffset[a] = typeof margin === "number" ? margin : margin[a] || 0;
} }
}
executeHooks(hooks.processOffset, [plotOffset]); executeHooks(hooks.processOffset, [plotOffset]);
......
...@@ -237,6 +237,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -237,6 +237,7 @@ The plugin allso adds the following methods to the plot object:
var axis, from, to, key, axes = plot.getAxes(); var axis, from, to, key, axes = plot.getAxes();
for (var k in axes) { for (var k in axes) {
if (Object.prototype.hasOwnProperty.call(axes, k)) {
axis = axes[k]; axis = axes[k];
if (axis.direction === coord) { if (axis.direction === coord) {
key = coord + axis.n + "axis"; key = coord + axis.n + "axis";
...@@ -250,6 +251,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -250,6 +251,7 @@ The plugin allso adds the following methods to the plot object:
} }
} }
} }
}
// backwards-compat stuff - to be removed in future // backwards-compat stuff - to be removed in future
if (!ranges[key]) { if (!ranges[key]) {
......
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