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

Wrap for...in loop bodies with hasOwnProperty.

parent e0413b93
......@@ -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];
}
}
}
......
......@@ -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]);
......
......@@ -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;
}
}
}
}
......
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