Commit 9fc03e53 authored by David Schnur's avatar David Schnur

Switch to === and !== for safer equality testing.

parent 49c312c3
...@@ -80,14 +80,14 @@ ...@@ -80,14 +80,14 @@
c = elem.css(css).toLowerCase(); c = elem.css(css).toLowerCase();
// keep going until we find an element that has color, or // keep going until we find an element that has color, or
// we hit the body // we hit the body
if (c !== "" && c != "transparent") { if (c !== "" && c !== "transparent") {
break; break;
} }
elem = elem.parent(); elem = elem.parent();
} while (!$.nodeName(elem.get(0), "body")); } while (!$.nodeName(elem.get(0), "body"));
// catch Safari's way of signalling transparent // catch Safari's way of signalling transparent
if (c == "rgba(0, 0, 0, 0)") { if (c === "rgba(0, 0, 0, 0)") {
c = "transparent"; c = "transparent";
} }
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
// Otherwise, we're most likely dealing with a named color // Otherwise, we're most likely dealing with a named color
var name = $.trim(str).toLowerCase(); var name = $.trim(str).toLowerCase();
if (name == "transparent") { if (name === "transparent") {
return m(255, 255, 255, 0); return m(255, 255, 255, 0);
} else { } else {
// default to black // default to black
......
...@@ -103,7 +103,7 @@ browser, but needs to redraw with canvas text when exporting as an image. ...@@ -103,7 +103,7 @@ browser, but needs to redraw with canvas text when exporting as an image.
} }
} }
if (positions.length == 0) { if (positions.length === 0) {
delete styleCache[key]; delete styleCache[key];
} }
} }
...@@ -280,9 +280,9 @@ browser, but needs to redraw with canvas text when exporting as an image. ...@@ -280,9 +280,9 @@ browser, but needs to redraw with canvas text when exporting as an image.
// Tweak the initial y-position to match vertical alignment // Tweak the initial y-position to match vertical alignment
if (valign == "middle") { if (valign === "middle") {
y = Math.round(y - info.height / 2); y = Math.round(y - info.height / 2);
} else if (valign == "bottom") { } else if (valign === "bottom") {
y = Math.round(y - info.height); y = Math.round(y - info.height);
} else { } else {
y = Math.round(y); y = Math.round(y);
...@@ -302,7 +302,7 @@ browser, but needs to redraw with canvas text when exporting as an image. ...@@ -302,7 +302,7 @@ browser, but needs to redraw with canvas text when exporting as an image.
// If so, mark it for inclusion in the next render pass. // If so, mark it for inclusion in the next render pass.
for (var i = 0, position; position = positions[i]; i++) { for (var i = 0, position; position = positions[i]; i++) {
if (position.x == x && position.y == y) { if (position.x === x && position.y === y) {
position.active = true; position.active = true;
return; return;
} }
...@@ -323,9 +323,9 @@ browser, but needs to redraw with canvas text when exporting as an image. ...@@ -323,9 +323,9 @@ browser, but needs to redraw with canvas text when exporting as an image.
// individually for horizontal alignment. // individually for horizontal alignment.
for (var i = 0, line; line = lines[i]; i++) { for (var i = 0, line; line = lines[i]; i++) {
if (halign == "center") { if (halign === "center") {
position.lines.push([Math.round(x - line.width / 2), y]); position.lines.push([Math.round(x - line.width / 2), y]);
} else if (halign == "right") { } else if (halign === "right") {
position.lines.push([Math.round(x - line.width), y]); position.lines.push([Math.round(x - line.width), y]);
} else { } else {
position.lines.push([Math.round(x), y]); position.lines.push([Math.round(x), y]);
......
...@@ -58,8 +58,8 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -58,8 +58,8 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
// auto-transformation to numbers so the strings are intact // auto-transformation to numbers so the strings are intact
// for later processing // for later processing
var xCategories = series.xaxis.options.mode == "categories", var xCategories = series.xaxis.options.mode === "categories",
yCategories = series.yaxis.options.mode == "categories"; yCategories = series.yaxis.options.mode === "categories";
if (!(xCategories || yCategories)) { if (!(xCategories || yCategories)) {
return; return;
...@@ -124,7 +124,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -124,7 +124,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
} }
function setupCategoriesForAxis(series, axis, datapoints) { function setupCategoriesForAxis(series, axis, datapoints) {
if (series[axis].options.mode != "categories") { if (series[axis].options.mode !== "categories") {
return; return;
} }
......
...@@ -101,7 +101,7 @@ The plugin also adds four public methods: ...@@ -101,7 +101,7 @@ The plugin also adds four public methods:
return; return;
} }
if (crosshair.x != -1) { if (crosshair.x !== -1) {
crosshair.x = -1; crosshair.x = -1;
plot.triggerRedrawOverlay(); plot.triggerRedrawOverlay();
} }
...@@ -143,7 +143,7 @@ The plugin also adds four public methods: ...@@ -143,7 +143,7 @@ The plugin also adds four public methods:
ctx.save(); ctx.save();
ctx.translate(plotOffset.left, plotOffset.top); ctx.translate(plotOffset.left, plotOffset.top);
if (crosshair.x != -1) { if (crosshair.x !== -1) {
var adj = plot.getOptions().crosshair.lineWidth % 2 === 0 ? 0 : 0.5; var adj = plot.getOptions().crosshair.lineWidth % 2 === 0 ? 0 : 0.5;
ctx.strokeStyle = c.color; ctx.strokeStyle = c.color;
...@@ -151,12 +151,12 @@ The plugin also adds four public methods: ...@@ -151,12 +151,12 @@ The plugin also adds four public methods:
ctx.lineJoin = "round"; ctx.lineJoin = "round";
ctx.beginPath(); ctx.beginPath();
if (c.mode.indexOf("x") != -1) { if (c.mode.indexOf("x") !== -1) {
var drawX = Math.round(crosshair.x) + adj; var drawX = Math.round(crosshair.x) + adj;
ctx.moveTo(drawX, 0); ctx.moveTo(drawX, 0);
ctx.lineTo(drawX, plot.height()); ctx.lineTo(drawX, plot.height());
} }
if (c.mode.indexOf("y") != -1) { if (c.mode.indexOf("y") !== -1) {
var drawY = Math.round(crosshair.y) + adj; var drawY = Math.round(crosshair.y) + adj;
ctx.moveTo(0, drawY); ctx.moveTo(0, drawY);
ctx.lineTo(plot.width(), drawY); ctx.lineTo(plot.width(), drawY);
......
...@@ -86,7 +86,7 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -86,7 +86,7 @@ shadowSize and lineWidth are derived as well from the points series.
var errors = series.points.errorbars; var errors = series.points.errorbars;
// error bars - first X then Y // error bars - first X then Y
if (errors == "x" || errors == "xy") { if (errors === "x" || errors === "xy") {
// lower / upper error // lower / upper error
if (series.points.xerr.asymmetric) { if (series.points.xerr.asymmetric) {
format.push({ x: true, number: true, required: true }); format.push({ x: true, number: true, required: true });
...@@ -95,7 +95,7 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -95,7 +95,7 @@ shadowSize and lineWidth are derived as well from the points series.
format.push({ x: true, number: true, required: true }); format.push({ x: true, number: true, required: true });
} }
} }
if (errors == "y" || errors == "xy") { if (errors === "y" || errors === "xy") {
// lower / upper error // lower / upper error
if (series.points.yerr.asymmetric) { if (series.points.yerr.asymmetric) {
format.push({ y: true, number: true, required: true }); format.push({ y: true, number: true, required: true });
...@@ -121,11 +121,11 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -121,11 +121,11 @@ shadowSize and lineWidth are derived as well from the points series.
var eb = series.points.errorbars; var eb = series.points.errorbars;
// error bars - first X // error bars - first X
if (eb == "x" || eb == "xy") { if (eb === "x" || eb === "xy") {
if (xerr.asymmetric) { if (xerr.asymmetric) {
exl = points[i + 2]; exl = points[i + 2];
exu = points[i + 3]; exu = points[i + 3];
if (eb == "xy") { if (eb === "xy") {
if (yerr.asymmetric){ if (yerr.asymmetric){
eyl = points[i + 4]; eyl = points[i + 4];
eyu = points[i + 5]; eyu = points[i + 5];
...@@ -135,7 +135,7 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -135,7 +135,7 @@ shadowSize and lineWidth are derived as well from the points series.
} }
} else { } else {
exl = points[i + 2]; exl = points[i + 2];
if (eb == "xy") { if (eb === "xy") {
if (yerr.asymmetric) { if (yerr.asymmetric) {
eyl = points[i + 3]; eyl = points[i + 3];
eyu = points[i + 4]; eyu = points[i + 4];
...@@ -145,7 +145,7 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -145,7 +145,7 @@ shadowSize and lineWidth are derived as well from the points series.
} }
} }
// only Y // only Y
} else if (eb == "y") { } else if (eb === "y") {
if (yerr.asymmetric) { if (yerr.asymmetric) {
eyl = points[i + 2]; eyl = points[i + 2];
eyu = points[i + 3]; eyu = points[i + 3];
...@@ -222,12 +222,12 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -222,12 +222,12 @@ shadowSize and lineWidth are derived as well from the points series.
lower = [x, y][e] - errRanges[e * err.length]; lower = [x, y][e] - errRanges[e * err.length];
//points outside of the canvas //points outside of the canvas
if (err[e].err == "x") { if (err[e].err === "x") {
if (y > ax[1].max || y < ax[1].min || upper < ax[0].min || lower > ax[0].max) { if (y > ax[1].max || y < ax[1].min || upper < ax[0].min || lower > ax[0].max) {
continue; continue;
} }
} }
if (err[e].err == "y") { if (err[e].err === "y") {
if (x > ax[0].max || x < ax[0].min || upper < ax[1].min || lower > ax[1].max) { if (x > ax[0].max || x < ax[0].min || upper < ax[1].min || lower > ax[1].max) {
continue; continue;
} }
...@@ -247,7 +247,7 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -247,7 +247,7 @@ shadowSize and lineWidth are derived as well from the points series.
} }
//sanity check, in case some inverted axis hack is applied to flot //sanity check, in case some inverted axis hack is applied to flot
if ((err[e].err == "x" && invertX) || (err[e].err == "y" && invertY)) { if ((err[e].err === "x" && invertX) || (err[e].err === "y" && invertY)) {
//swap coordinates //swap coordinates
var tmp = lower; var tmp = lower;
lower = upper; lower = upper;
...@@ -300,7 +300,7 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -300,7 +300,7 @@ shadowSize and lineWidth are derived as well from the points series.
lower += offset; lower += offset;
// error bar - avoid plotting over circles // error bar - avoid plotting over circles
if (err.err == "x"){ if (err.err === "x"){
if (upper > x + radius) { if (upper > x + radius) {
drawPath(ctx, [[upper,y],[Math.max(x + radius,minmax[0]),y]]); drawPath(ctx, [[upper,y],[Math.max(x + radius,minmax[0]),y]]);
} else { } else {
...@@ -330,14 +330,14 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -330,14 +330,14 @@ shadowSize and lineWidth are derived as well from the points series.
// upper cap // upper cap
if (drawUpper) { if (drawUpper) {
if (err.upperCap == "-"){ if (err.upperCap === "-"){
if (err.err=="x") { if (err.err === "x") {
drawPath(ctx, [[upper,y - radius],[upper,y + radius]] ); drawPath(ctx, [[upper,y - radius],[upper,y + radius]] );
} else { } else {
drawPath(ctx, [[x - radius,upper],[x + radius,upper]] ); drawPath(ctx, [[x - radius,upper],[x + radius,upper]] );
} }
} else if ($.isFunction(err.upperCap)){ } else if ($.isFunction(err.upperCap)){
if (err.err=="x") { if (err.err === "x") {
err.upperCap(ctx, upper, y, radius); err.upperCap(ctx, upper, y, radius);
} else { } else {
err.upperCap(ctx, x, upper, radius); err.upperCap(ctx, x, upper, radius);
...@@ -346,14 +346,14 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -346,14 +346,14 @@ shadowSize and lineWidth are derived as well from the points series.
} }
// lower cap // lower cap
if (drawLower) { if (drawLower) {
if (err.lowerCap == "-"){ if (err.lowerCap === "-"){
if (err.err=="x") { if (err.err === "x") {
drawPath(ctx, [[lower,y - radius],[lower,y + radius]] ); drawPath(ctx, [[lower,y - radius],[lower,y + radius]] );
} else { } else {
drawPath(ctx, [[x - radius,lower],[x + radius,lower]] ); drawPath(ctx, [[x - radius,lower],[x + radius,lower]] );
} }
} else if ($.isFunction(err.lowerCap)){ } else if ($.isFunction(err.lowerCap)){
if (err.err=="x") { if (err.err === "x") {
err.lowerCap(ctx, lower, y, radius); err.lowerCap(ctx, lower, y, radius);
} else { } else {
err.lowerCap(ctx, x, lower, radius); err.lowerCap(ctx, x, lower, radius);
......
...@@ -80,7 +80,7 @@ Google Maps). ...@@ -80,7 +80,7 @@ Google Maps).
} }
$.each(s, function (i, p) { $.each(s, function (i, p) {
if (typeof p[0] == "string") { if (typeof p[0] === "string") {
urls.push(p[0]); urls.push(p[0]);
points.push(p); points.push(p);
} }
...@@ -101,7 +101,7 @@ Google Maps). ...@@ -101,7 +101,7 @@ Google Maps).
$.plot.image.load = function (urls, callback) { $.plot.image.load = function (urls, callback) {
var missing = urls.length, loaded = {}; var missing = urls.length, loaded = {};
if (missing == 0) { if (missing === 0) {
callback({}); callback({});
} }
...@@ -111,7 +111,7 @@ Google Maps). ...@@ -111,7 +111,7 @@ Google Maps).
loaded[url] = this; loaded[url] = this;
if (missing == 0) { if (missing === 0) {
callback(loaded); callback(loaded);
} }
}; };
...@@ -157,7 +157,7 @@ Google Maps). ...@@ -157,7 +157,7 @@ Google Maps).
// if the anchor is at the center of the pixel, expand the // if the anchor is at the center of the pixel, expand the
// image by 1/2 pixel in each direction // image by 1/2 pixel in each direction
if (series.images.anchor == "center") { if (series.images.anchor === "center") {
tmp = 0.5 * (x2-x1) / (img.width - 1); tmp = 0.5 * (x2-x1) / (img.width - 1);
x1 -= tmp; x1 -= tmp;
x2 += tmp; x2 += tmp;
...@@ -167,7 +167,7 @@ Google Maps). ...@@ -167,7 +167,7 @@ Google Maps).
} }
// clip // clip
if (x1 == x2 || y1 == y2 || if (x1 === x2 || y1 === y2 ||
x1 >= xaxis.max || x2 <= xaxis.min || x1 >= xaxis.max || x2 <= xaxis.min ||
y1 >= yaxis.max || y2 <= yaxis.min) { y1 >= yaxis.max || y2 <= yaxis.min) {
continue; continue;
......
...@@ -130,13 +130,13 @@ Licensed under the MIT license. ...@@ -130,13 +130,13 @@ Licensed under the MIT license.
// Resizing should reset the state (excanvas seems to be buggy though) // Resizing should reset the state (excanvas seems to be buggy though)
if (this.width != width) { if (this.width !== width) {
element.width = width * pixelRatio; element.width = width * pixelRatio;
element.style.width = width + "px"; element.style.width = width + "px";
this.width = width; this.width = width;
} }
if (this.height != height) { if (this.height !== height) {
element.height = height * pixelRatio; element.height = height * pixelRatio;
element.style.height = height + "px"; element.style.height = height + "px";
this.height = height; this.height = height;
...@@ -201,7 +201,7 @@ Licensed under the MIT license. ...@@ -201,7 +201,7 @@ Licensed under the MIT license.
} }
} }
if (positions.length == 0) { if (positions.length === 0) {
delete styleCache[key]; delete styleCache[key];
} }
} }
...@@ -392,15 +392,15 @@ Licensed under the MIT license. ...@@ -392,15 +392,15 @@ Licensed under the MIT license.
// Tweak the div's position to match the text's alignment // Tweak the div's position to match the text's alignment
if (halign == "center") { if (halign === "center") {
x -= info.width / 2; x -= info.width / 2;
} else if (halign == "right") { } else if (halign === "right") {
x -= info.width; x -= info.width;
} }
if (valign == "middle") { if (valign === "middle") {
y -= info.height / 2; y -= info.height / 2;
} else if (valign == "bottom") { } else if (valign === "bottom") {
y -= info.height; y -= info.height;
} }
...@@ -408,7 +408,7 @@ Licensed under the MIT license. ...@@ -408,7 +408,7 @@ Licensed under the MIT license.
// If so, mark it for inclusion in the next render pass. // If so, mark it for inclusion in the next render pass.
for (var i = 0, position; position = positions[i]; i++) { for (var i = 0, position; position = positions[i]; i++) {
if (position.x == x && position.y == y) { if (position.x === x && position.y === y) {
position.active = true; position.active = true;
return; return;
} }
...@@ -479,7 +479,7 @@ Licensed under the MIT license. ...@@ -479,7 +479,7 @@ Licensed under the MIT license.
} else { } else {
var positions = this.getTextInfo(layer, text, font, angle).positions; var positions = this.getTextInfo(layer, text, font, angle).positions;
for (var i = 0, position; position = positions[i]; i++) { for (var i = 0, position; position = positions[i]; i++) {
if (position.x == x && position.y == y) { if (position.x === x && position.y === y) {
position.active = false; position.active = false;
} }
} }
...@@ -639,7 +639,7 @@ Licensed under the MIT license. ...@@ -639,7 +639,7 @@ Licensed under the MIT license.
var res = {}, i; var res = {}, i;
$.each(xaxes.concat(yaxes), function (_, axis) { $.each(xaxes.concat(yaxes), function (_, axis) {
if (axis) { if (axis) {
res[axis.direction + (axis.n != 1 ? axis.n : "") + "axis"] = axis; res[axis.direction + (axis.n !== 1 ? axis.n : "") + "axis"] = axis;
} }
}); });
return res; return res;
...@@ -876,10 +876,10 @@ Licensed under the MIT license. ...@@ -876,10 +876,10 @@ Licensed under the MIT license.
function axisNumber(obj, coord) { function axisNumber(obj, coord) {
var a = obj[coord + "axis"]; var a = obj[coord + "axis"];
if (typeof a == "object") { // if we got a real axis, extract number if (typeof a === "object") { // if we got a real axis, extract number
a = a.n; a = a.n;
} }
if (typeof a != "number") { if (typeof a !== "number") {
a = 1; // default to first axis a = 1; // default to first axis
} }
return a; return a;
...@@ -925,7 +925,7 @@ Licensed under the MIT license. ...@@ -925,7 +925,7 @@ Licensed under the MIT license.
axis = xaxes[i]; axis = xaxes[i];
if (axis && axis.used) { if (axis && axis.used) {
key = "x" + axis.n; key = "x" + axis.n;
if (pos[key] == null && axis.n == 1) { if (pos[key] == null && axis.n === 1) {
key = "x"; key = "x";
} }
...@@ -940,7 +940,7 @@ Licensed under the MIT license. ...@@ -940,7 +940,7 @@ Licensed under the MIT license.
axis = yaxes[i]; axis = yaxes[i];
if (axis && axis.used) { if (axis && axis.used) {
key = "y" + axis.n; key = "y" + axis.n;
if (pos[key] == null && axis.n == 1) { if (pos[key] == null && axis.n === 1) {
key = "y"; key = "y";
} }
...@@ -958,8 +958,8 @@ Licensed under the MIT license. ...@@ -958,8 +958,8 @@ Licensed under the MIT license.
if (!axes[number - 1]) { if (!axes[number - 1]) {
axes[number - 1] = { axes[number - 1] = {
n: number, // save the number for future reference n: number, // save the number for future reference
direction: axes == xaxes ? "x" : "y", direction: axes === xaxes ? "x" : "y",
options: $.extend(true, {}, axes == xaxes ? options.xaxis : options.yaxis) options: $.extend(true, {}, axes === xaxes ? options.xaxis : options.yaxis)
}; };
} }
...@@ -977,7 +977,7 @@ Licensed under the MIT license. ...@@ -977,7 +977,7 @@ Licensed under the MIT license.
var sc = series[i].color; var sc = series[i].color;
if (sc != null) { if (sc != null) {
neededColors--; neededColors--;
if (typeof sc == "number" && sc > maxIndex) { if (typeof sc === "number" && sc > maxIndex) {
maxIndex = sc; maxIndex = sc;
} }
} }
...@@ -1008,7 +1008,7 @@ Licensed under the MIT license. ...@@ -1008,7 +1008,7 @@ Licensed under the MIT license.
// Reset the variation after every few cycles, or else // Reset the variation after every few cycles, or else
// it will end up producing only white or black colors. // it will end up producing only white or black colors.
if (i % colorPoolSize == 0 && i) { if (i % colorPoolSize === 0 && i) {
if (variation >= 0) { if (variation >= 0) {
if (variation < 0.5) { if (variation < 0.5) {
variation = -variation - 0.2; variation = -variation - 0.2;
...@@ -1034,7 +1034,7 @@ Licensed under the MIT license. ...@@ -1034,7 +1034,7 @@ Licensed under the MIT license.
s.color = colors[colori].toString(); s.color = colors[colori].toString();
++colori; ++colori;
} }
else if (typeof s.color == "number") { else if (typeof s.color === "number") {
s.color = colors[s.color].toString(); s.color = colors[s.color].toString();
} }
...@@ -1074,10 +1074,10 @@ Licensed under the MIT license. ...@@ -1074,10 +1074,10 @@ Licensed under the MIT license.
data, format; data, format;
function updateAxis(axis, min, max) { function updateAxis(axis, min, max) {
if (min < axis.datamin && min != -fakeInfinity) { if (min < axis.datamin && min !== -fakeInfinity) {
axis.datamin = min; axis.datamin = min;
} }
if (max > axis.datamax && max != fakeInfinity) { if (max > axis.datamax && max !== fakeInfinity) {
axis.datamax = max; axis.datamax = max;
} }
} }
...@@ -1147,9 +1147,9 @@ Licensed under the MIT license. ...@@ -1147,9 +1147,9 @@ Licensed under the MIT license.
val = +val; // convert to number val = +val; // convert to number
if (isNaN(val)) { if (isNaN(val)) {
val = null; val = null;
} else if (val == Infinity) { } else if (val === Infinity) {
val = fakeInfinity; val = fakeInfinity;
} else if (val == -Infinity) { } else if (val === -Infinity) {
val = -fakeInfinity; val = -fakeInfinity;
} }
} }
...@@ -1193,8 +1193,8 @@ Licensed under the MIT license. ...@@ -1193,8 +1193,8 @@ Licensed under the MIT license.
// better means... // better means...
if (insertSteps && k > 0 && if (insertSteps && k > 0 &&
points[k - ps] != null && points[k - ps] != null &&
points[k - ps] != points[k] && points[k - ps] !== points[k] &&
points[k - ps + 1] != points[k + 1]) { points[k - ps + 1] !== points[k + 1]) {
// copy the point to make room for a middle point // copy the point to make room for a middle point
for (m = 0; m < ps; ++m) { for (m = 0; m < ps; ++m) {
points[k + ps + m] = points[k + m]; points[k + ps + m] = points[k + m];
...@@ -1235,7 +1235,7 @@ Licensed under the MIT license. ...@@ -1235,7 +1235,7 @@ Licensed under the MIT license.
for (m = 0; m < ps; ++m) { for (m = 0; m < ps; ++m) {
val = points[j + m]; val = points[j + m];
f = format[m]; f = format[m];
if (!f || f.autoscale === false || val == fakeInfinity || val == -fakeInfinity) { if (!f || f.autoscale === false || val === fakeInfinity || val === -fakeInfinity) {
continue; continue;
} }
...@@ -1290,10 +1290,10 @@ Licensed under the MIT license. ...@@ -1290,10 +1290,10 @@ Licensed under the MIT license.
} }
$.each(allAxes(), function (_, axis) { $.each(allAxes(), function (_, axis) {
if (axis.datamin == topSentry) { if (axis.datamin === topSentry) {
axis.datamin = null; axis.datamin = null;
} }
if (axis.datamax == bottomSentry) { if (axis.datamax === bottomSentry) {
axis.datamax = null; axis.datamax = null;
} }
}); });
...@@ -1307,7 +1307,7 @@ Licensed under the MIT license. ...@@ -1307,7 +1307,7 @@ Licensed under the MIT license.
placeholder.css("padding", 0) // padding messes up the positioning placeholder.css("padding", 0) // padding messes up the positioning
.children(":not(.flot-base,.flot-overlay)").remove(); .children(":not(.flot-base,.flot-overlay)").remove();
if (placeholder.css("position") == "static") { if (placeholder.css("position") === "static") {
placeholder.css("position", "relative"); // for positioning labels and overlay placeholder.css("position", "relative"); // for positioning labels and overlay
} }
...@@ -1377,7 +1377,7 @@ Licensed under the MIT license. ...@@ -1377,7 +1377,7 @@ Licensed under the MIT license.
// precompute how much the axis is scaling a point // precompute how much the axis is scaling a point
// in canvas space // in canvas space
if (axis.direction == "x") { if (axis.direction === "x") {
s = axis.scale = plotWidth / Math.abs(t(axis.max) - t(axis.min)); s = axis.scale = plotWidth / Math.abs(t(axis.max) - t(axis.min));
m = Math.min(t(axis.max), t(axis.min)); m = Math.min(t(axis.max), t(axis.min));
} else { } else {
...@@ -1387,7 +1387,7 @@ Licensed under the MIT license. ...@@ -1387,7 +1387,7 @@ Licensed under the MIT license.
} }
// data point to canvas coordinate // data point to canvas coordinate
if (t == identity) { // slight optimization if (t === identity) { // slight optimization
axis.p2c = function (p) { return (p - m) * s; }; axis.p2c = function (p) { return (p - m) * s; };
} else { } else {
axis.p2c = function (p) { return (t(p) - m) * s; }; axis.p2c = function (p) { return (t(p) - m) * s; };
...@@ -1406,7 +1406,7 @@ Licensed under the MIT license. ...@@ -1406,7 +1406,7 @@ Licensed under the MIT license.
ticks = axis.ticks || [], ticks = axis.ticks || [],
labelWidth = opts.labelWidth || 0, labelWidth = opts.labelWidth || 0,
labelHeight = opts.labelHeight || 0, labelHeight = opts.labelHeight || 0,
maxWidth = labelWidth || axis.direction == "x" ? Math.floor(surface.width / (ticks.length || 1)) : null; maxWidth = labelWidth || axis.direction === "x" ? Math.floor(surface.width / (ticks.length || 1)) : null;
legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis", legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis",
layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles, layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles,
font = opts.font || "flot-tick-label tickLabel"; font = opts.font || "flot-tick-label tickLabel";
...@@ -1442,20 +1442,20 @@ Licensed under the MIT license. ...@@ -1442,20 +1442,20 @@ Licensed under the MIT license.
tickLength = axis.options.tickLength, tickLength = axis.options.tickLength,
axisMargin = options.grid.axisMargin, axisMargin = options.grid.axisMargin,
padding = options.grid.labelMargin, padding = options.grid.labelMargin,
all = axis.direction == "x" ? xaxes : yaxes, all = axis.direction === "x" ? xaxes : yaxes,
index, innermost; index, innermost;
// determine axis margin // determine axis margin
var samePosition = $.grep(all, function (a) { var samePosition = $.grep(all, function (a) {
return a && a.options.position == pos && a.reserveSpace; return a && a.options.position === pos && a.reserveSpace;
}); });
if ($.inArray(axis, samePosition) == samePosition.length - 1) { if ($.inArray(axis, samePosition) === samePosition.length - 1) {
axisMargin = 0; // outermost axisMargin = 0; // outermost
} }
// Determine whether the axis is the first (innermost) on its side // Determine whether the axis is the first (innermost) on its side
innermost = $.inArray(axis, samePosition) == 0; innermost = $.inArray(axis, samePosition) === 0;
// determine tick length - if we're innermost, we can use "full" // determine tick length - if we're innermost, we can use "full"
...@@ -1472,10 +1472,10 @@ Licensed under the MIT license. ...@@ -1472,10 +1472,10 @@ Licensed under the MIT license.
} }
// compute box // compute box
if (axis.direction == "x") { if (axis.direction === "x") {
lh += padding; lh += padding;
if (pos == "bottom") { if (pos === "bottom") {
plotOffset.bottom += lh + axisMargin; plotOffset.bottom += lh + axisMargin;
axis.box = { top: surface.height - plotOffset.bottom, height: lh }; axis.box = { top: surface.height - plotOffset.bottom, height: lh };
} else { } else {
...@@ -1485,7 +1485,7 @@ Licensed under the MIT license. ...@@ -1485,7 +1485,7 @@ Licensed under the MIT license.
} else { } else {
lw += padding; lw += padding;
if (pos == "left") { if (pos === "left") {
axis.box = { left: plotOffset.left + axisMargin, width: lw }; axis.box = { left: plotOffset.left + axisMargin, width: lw };
plotOffset.left += lw + axisMargin; plotOffset.left += lw + axisMargin;
} else { } else {
...@@ -1504,7 +1504,7 @@ Licensed under the MIT license. ...@@ -1504,7 +1504,7 @@ Licensed under the MIT license.
function allocateAxisBoxSecondPhase(axis) { function allocateAxisBoxSecondPhase(axis) {
// now that all axis boxes have been placed in one // now that all axis boxes have been placed in one
// dimension, we can set the remaining dimension coordinates // dimension, we can set the remaining dimension coordinates
if (axis.direction == "x") { if (axis.direction === "x") {
axis.box.left = plotOffset.left - axis.labelWidth / 2; axis.box.left = plotOffset.left - axis.labelWidth / 2;
axis.box.width = surface.width - plotOffset.left - plotOffset.right + axis.labelWidth; axis.box.width = surface.width - plotOffset.left - plotOffset.right + axis.labelWidth;
} else { } else {
...@@ -1538,7 +1538,7 @@ Licensed under the MIT license. ...@@ -1538,7 +1538,7 @@ Licensed under the MIT license.
$.each(allAxes(), function (_, axis) { $.each(allAxes(), function (_, axis) {
var dir = axis.direction; var dir = axis.direction;
if (axis.reserveSpace) { if (axis.reserveSpace) {
margins[dir] = Math.ceil(Math.max(margins[dir], (dir == "x" ? axis.labelWidth : axis.labelHeight) / 2)); margins[dir] = Math.ceil(Math.max(margins[dir], (dir === "x" ? axis.labelWidth : axis.labelHeight) / 2));
} }
}); });
...@@ -1555,7 +1555,7 @@ Licensed under the MIT license. ...@@ -1555,7 +1555,7 @@ Licensed under the MIT license.
for (var a in plotOffset) { for (var a in plotOffset) {
var margin = options.grid.margin || 0; var margin = options.grid.margin || 0;
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]);
...@@ -1563,7 +1563,7 @@ Licensed under the MIT license. ...@@ -1563,7 +1563,7 @@ Licensed under the MIT license.
// If the grid is visible, add its border width to the offset // If the grid is visible, add its border width to the offset
for (var a in plotOffset) { for (var a in plotOffset) {
if(typeof(options.grid.borderWidth) == "object") { if(typeof(options.grid.borderWidth) === "object") {
plotOffset[a] += showGrid ? options.grid.borderWidth[a] : 0; plotOffset[a] += showGrid ? options.grid.borderWidth[a] : 0;
} else { } else {
plotOffset[a] += showGrid ? options.grid.borderWidth : 0; plotOffset[a] += showGrid ? options.grid.borderWidth : 0;
...@@ -1632,9 +1632,9 @@ Licensed under the MIT license. ...@@ -1632,9 +1632,9 @@ Licensed under the MIT license.
max = +(opts.max != null ? opts.max : axis.datamax), max = +(opts.max != null ? opts.max : axis.datamax),
delta = max - min; delta = max - min;
if (delta == 0.0) { if (delta === 0.0) {
// degenerate case // degenerate case
var widen = max == 0 ? 1 : 0.01; var widen = max === 0 ? 1 : 0.01;
if (opts.min == null) { if (opts.min == null) {
min -= widen; min -= widen;
...@@ -1673,12 +1673,12 @@ Licensed under the MIT license. ...@@ -1673,12 +1673,12 @@ Licensed under the MIT license.
// estimate number of ticks // estimate number of ticks
var noTicks; var noTicks;
if (typeof opts.ticks == "number" && opts.ticks > 0) { if (typeof opts.ticks === "number" && opts.ticks > 0) {
noTicks = opts.ticks; noTicks = opts.ticks;
} else { } else {
// heuristic based on the model a*sqrt(x) fitted to // heuristic based on the model a*sqrt(x) fitted to
// some data points that seemed reasonable // some data points that seemed reasonable
noTicks = 0.3 * Math.sqrt(axis.direction == "x" ? surface.width : surface.height); noTicks = 0.3 * Math.sqrt(axis.direction === "x" ? surface.width : surface.height);
} }
var delta = (axis.max - axis.min) / noTicks, var delta = (axis.max - axis.min) / noTicks,
...@@ -1721,7 +1721,7 @@ Licensed under the MIT license. ...@@ -1721,7 +1721,7 @@ Licensed under the MIT license.
// Time mode was moved to a plug-in in 0.8, but since so many people use this // Time mode was moved to a plug-in in 0.8, but since so many people use this
// we'll add an especially friendly make sure they remembered to include it. // we'll add an especially friendly make sure they remembered to include it.
if (opts.mode == "time" && !axis.tickGenerator) { if (opts.mode === "time" && !axis.tickGenerator) {
throw new Error("Time mode requires the flot.time plugin."); throw new Error("Time mode requires the flot.time plugin.");
} }
...@@ -1743,7 +1743,7 @@ Licensed under the MIT license. ...@@ -1743,7 +1743,7 @@ Licensed under the MIT license.
v = start + i * axis.tickSize; v = start + i * axis.tickSize;
ticks.push(v); ticks.push(v);
++i; ++i;
} while (v < axis.max && v != prev); } while (v < axis.max && v !== prev);
return ticks; return ticks;
}; };
...@@ -1757,7 +1757,7 @@ Licensed under the MIT license. ...@@ -1757,7 +1757,7 @@ Licensed under the MIT license.
if (axis.tickDecimals != null) { if (axis.tickDecimals != null) {
var decimal = formatted.indexOf("."); var decimal = formatted.indexOf(".");
var precision = decimal == -1 ? 0 : formatted.length - decimal - 1; var precision = decimal === -1 ? 0 : formatted.length - decimal - 1;
if (precision < axis.tickDecimals) { if (precision < axis.tickDecimals) {
return (precision ? formatted : formatted + ".") + ("" + factor).substr(1, axis.tickDecimals - precision); return (precision ? formatted : formatted + ".") + ("" + factor).substr(1, axis.tickDecimals - precision);
} }
...@@ -1772,8 +1772,8 @@ Licensed under the MIT license. ...@@ -1772,8 +1772,8 @@ Licensed under the MIT license.
} }
if (opts.alignTicksWithAxis != null) { if (opts.alignTicksWithAxis != null) {
var otherAxis = (axis.direction == "x" ? xaxes : yaxes)[opts.alignTicksWithAxis - 1]; var otherAxis = (axis.direction === "x" ? xaxes : yaxes)[opts.alignTicksWithAxis - 1];
if (otherAxis && otherAxis.used && otherAxis != axis) { if (otherAxis && otherAxis.used && otherAxis !== axis) {
// consider snapping min/max to outermost nice ticks // consider snapping min/max to outermost nice ticks
var niceTicks = axis.tickGenerator(axis); var niceTicks = axis.tickGenerator(axis);
if (niceTicks.length > 0) { if (niceTicks.length > 0) {
...@@ -1815,7 +1815,7 @@ Licensed under the MIT license. ...@@ -1815,7 +1815,7 @@ Licensed under the MIT license.
function setTicks(axis) { function setTicks(axis) {
var oticks = axis.options.ticks, ticks = []; var oticks = axis.options.ticks, ticks = [];
if (oticks == null || (typeof oticks == "number" && oticks > 0)) { if (oticks == null || (typeof oticks === "number" && oticks > 0)) {
ticks = axis.tickGenerator(axis); ticks = axis.tickGenerator(axis);
} else if (oticks) { } else if (oticks) {
if ($.isFunction(oticks)) { if ($.isFunction(oticks)) {
...@@ -1832,7 +1832,7 @@ Licensed under the MIT license. ...@@ -1832,7 +1832,7 @@ Licensed under the MIT license.
for (i = 0; i < ticks.length; ++i) { for (i = 0; i < ticks.length; ++i) {
var label = null; var label = null;
var t = ticks[i]; var t = ticks[i];
if (typeof t == "object") { if (typeof t === "object") {
v = +t[0]; v = +t[0];
if (t.length > 1) { if (t.length > 1) {
label = t[1]; label = t[1];
...@@ -1902,9 +1902,9 @@ Licensed under the MIT license. ...@@ -1902,9 +1902,9 @@ Licensed under the MIT license.
for (var i = 0; i < axes.length; ++i) { for (var i = 0; i < axes.length; ++i) {
axis = axes[i]; axis = axes[i];
if (axis.direction == coord) { if (axis.direction === coord) {
key = coord + axis.n + "axis"; key = coord + axis.n + "axis";
if (!ranges[key] && axis.n == 1) { if (!ranges[key] && axis.n === 1) {
key = coord + "axis"; // support x1axis as xaxis key = coord + "axis"; // support x1axis as xaxis
} }
if (ranges[key]) { if (ranges[key]) {
...@@ -1917,7 +1917,7 @@ Licensed under the MIT license. ...@@ -1917,7 +1917,7 @@ Licensed under the MIT license.
// backwards-compat stuff - to be removed in future // backwards-compat stuff - to be removed in future
if (!ranges[key]) { if (!ranges[key]) {
axis = coord == "x" ? xaxes[0] : yaxes[0]; axis = coord === "x" ? xaxes[0] : yaxes[0];
from = ranges[coord + "1"]; from = ranges[coord + "1"];
to = ranges[coord + "2"]; to = ranges[coord + "2"];
} }
...@@ -1992,7 +1992,7 @@ Licensed under the MIT license. ...@@ -1992,7 +1992,7 @@ Licensed under the MIT license.
yrange.from = Math.max(yrange.from, yrange.axis.min); yrange.from = Math.max(yrange.from, yrange.axis.min);
yrange.to = Math.min(yrange.to, yrange.axis.max); yrange.to = Math.min(yrange.to, yrange.axis.max);
if (xrange.from == xrange.to && yrange.from == yrange.to) { if (xrange.from === xrange.to && yrange.from === yrange.to) {
continue; continue;
} }
...@@ -2002,7 +2002,7 @@ Licensed under the MIT license. ...@@ -2002,7 +2002,7 @@ Licensed under the MIT license.
yrange.from = yrange.axis.p2c(yrange.from); yrange.from = yrange.axis.p2c(yrange.from);
yrange.to = yrange.axis.p2c(yrange.to); yrange.to = yrange.axis.p2c(yrange.to);
if (xrange.from == xrange.to || yrange.from == yrange.to) { if (xrange.from === xrange.to || yrange.from === yrange.to) {
// draw line // draw line
ctx.beginPath(); ctx.beginPath();
ctx.strokeStyle = m.color || options.grid.markingsColor; ctx.strokeStyle = m.color || options.grid.markingsColor;
...@@ -2027,26 +2027,26 @@ Licensed under the MIT license. ...@@ -2027,26 +2027,26 @@ Licensed under the MIT license.
for (var j = 0; j < axes.length; ++j) { for (var j = 0; j < axes.length; ++j) {
var axis = axes[j], box = axis.box, var axis = axes[j], box = axis.box,
t = axis.tickLength, x, y, xoff, yoff; t = axis.tickLength, x, y, xoff, yoff;
if (!axis.show || axis.ticks.length == 0) { if (!axis.show || axis.ticks.length === 0) {
continue; continue;
} }
ctx.lineWidth = 1; ctx.lineWidth = 1;
// find the edges // find the edges
if (axis.direction == "x") { if (axis.direction === "x") {
x = 0; x = 0;
if (t == "full") { if (t === "full") {
y = (axis.position == "top" ? 0 : plotHeight); y = (axis.position === "top" ? 0 : plotHeight);
} else { } else {
y = box.top - plotOffset.top + (axis.position == "top" ? box.height : 0); y = box.top - plotOffset.top + (axis.position === "top" ? box.height : 0);
} }
} else { } else {
y = 0; y = 0;
if (t == "full") { if (t === "full") {
x = (axis.position == "left" ? 0 : plotWidth); x = (axis.position === "left" ? 0 : plotWidth);
} else { } else {
x = box.left - plotOffset.left + (axis.position == "left" ? box.width : 0); x = box.left - plotOffset.left + (axis.position === "left" ? box.width : 0);
} }
} }
...@@ -2055,14 +2055,14 @@ Licensed under the MIT license. ...@@ -2055,14 +2055,14 @@ Licensed under the MIT license.
ctx.strokeStyle = axis.options.color; ctx.strokeStyle = axis.options.color;
ctx.beginPath(); ctx.beginPath();
xoff = yoff = 0; xoff = yoff = 0;
if (axis.direction == "x") { if (axis.direction === "x") {
xoff = plotWidth + 1; xoff = plotWidth + 1;
} else { } else {
yoff = plotHeight + 1; yoff = plotHeight + 1;
} }
if (ctx.lineWidth == 1) { if (ctx.lineWidth === 1) {
if (axis.direction == "x") { if (axis.direction === "x") {
y = Math.floor(y) + 0.5; y = Math.floor(y) + 0.5;
} else { } else {
x = Math.floor(x) + 0.5; x = Math.floor(x) + 0.5;
...@@ -2086,30 +2086,30 @@ Licensed under the MIT license. ...@@ -2086,30 +2086,30 @@ Licensed under the MIT license.
if (isNaN(v) || v < axis.min || v > axis.max || ( if (isNaN(v) || v < axis.min || v > axis.max || (
// skip those lying on the axes if we got a border // skip those lying on the axes if we got a border
t == "full" && ((typeof bw == "object" && bw[axis.position] > 0) || bw > 0) && t === "full" && ((typeof bw === "object" && bw[axis.position] > 0) || bw > 0) &&
(v == axis.min || v == axis.max) (v === axis.min || v === axis.max)
)) { )) {
continue; continue;
} }
if (axis.direction == "x") { if (axis.direction === "x") {
x = axis.p2c(v); x = axis.p2c(v);
yoff = t == "full" ? -plotHeight : t; yoff = t === "full" ? -plotHeight : t;
if (axis.position == "top") { if (axis.position === "top") {
yoff = -yoff; yoff = -yoff;
} }
} else { } else {
y = axis.p2c(v); y = axis.p2c(v);
xoff = t == "full" ? -plotWidth : t; xoff = t === "full" ? -plotWidth : t;
if (axis.position == "left") { if (axis.position === "left") {
xoff = -xoff; xoff = -xoff;
} }
} }
if (ctx.lineWidth == 1) { if (ctx.lineWidth === 1) {
if (axis.direction == "x") { if (axis.direction === "x") {
x = Math.floor(x) + 0.5; x = Math.floor(x) + 0.5;
} else { } else {
y = Math.floor(y) + 0.5; y = Math.floor(y) + 0.5;
...@@ -2129,7 +2129,7 @@ Licensed under the MIT license. ...@@ -2129,7 +2129,7 @@ Licensed under the MIT license.
// If either borderWidth or borderColor is an object, then draw the border // If either borderWidth or borderColor is an object, then draw the border
// line by line instead of as one rectangle // line by line instead of as one rectangle
bc = options.grid.borderColor; bc = options.grid.borderColor;
if(typeof bw == "object" || typeof bc == "object") { if(typeof bw === "object" || typeof bc === "object") {
if (typeof bw !== "object") { if (typeof bw !== "object") {
bw = {top: bw, right: bw, bottom: bw, left: bw}; bw = {top: bw, right: bw, bottom: bw, left: bw};
} }
...@@ -2185,7 +2185,7 @@ Licensed under the MIT license. ...@@ -2185,7 +2185,7 @@ Licensed under the MIT license.
function drawAxisLabels() { function drawAxisLabels() {
$.each(allAxes(), function (_, axis) { $.each(allAxes(), function (_, axis) {
if (!axis.show || axis.ticks.length == 0) { if (!axis.show || axis.ticks.length === 0) {
return; return;
} }
...@@ -2204,10 +2204,10 @@ Licensed under the MIT license. ...@@ -2204,10 +2204,10 @@ Licensed under the MIT license.
continue; continue;
} }
if (axis.direction == "x") { if (axis.direction === "x") {
halign = "center"; halign = "center";
x = plotOffset.left + axis.p2c(tick.v); x = plotOffset.left + axis.p2c(tick.v);
if (axis.position == "bottom") { if (axis.position === "bottom") {
y = box.top + box.padding; y = box.top + box.padding;
} else { } else {
y = box.top + box.height - box.padding; y = box.top + box.height - box.padding;
...@@ -2216,7 +2216,7 @@ Licensed under the MIT license. ...@@ -2216,7 +2216,7 @@ Licensed under the MIT license.
} else { } else {
valign = "middle"; valign = "middle";
y = plotOffset.top + axis.p2c(tick.v); y = plotOffset.top + axis.p2c(tick.v);
if (axis.position == "left") { if (axis.position === "left") {
x = box.left + box.width - box.padding; x = box.left + box.width - box.padding;
halign = "right"; halign = "right";
} else { } else {
...@@ -2317,7 +2317,7 @@ Licensed under the MIT license. ...@@ -2317,7 +2317,7 @@ Licensed under the MIT license.
x2 = axisx.max; x2 = axisx.max;
} }
if (x1 != prevx || y1 != prevy) { if (x1 !== prevx || y1 !== prevy) {
ctx.moveTo(axisx.p2c(x1) + xoffset, axisy.p2c(y1) + yoffset); ctx.moveTo(axisx.p2c(x1) + xoffset, axisy.p2c(y1) + yoffset);
} }
...@@ -2358,7 +2358,7 @@ Licensed under the MIT license. ...@@ -2358,7 +2358,7 @@ Licensed under the MIT license.
continue; continue;
} }
if (ps < 0 && i == segmentStart + ps) { if (ps < 0 && i === segmentStart + ps) {
// done with the reverse sweep // done with the reverse sweep
ctx.fill(); ctx.fill();
areaOpen = false; areaOpen = false;
...@@ -2454,7 +2454,7 @@ Licensed under the MIT license. ...@@ -2454,7 +2454,7 @@ Licensed under the MIT license.
// if the x value was changed we got a rectangle // if the x value was changed we got a rectangle
// to fill // to fill
if (x1 != x1old) { if (x1 !== x1old) {
ctx.lineTo(axisx.p2c(x1old), axisy.p2c(y1)); ctx.lineTo(axisx.p2c(x1old), axisy.p2c(y1));
// it goes to (x1, y1), but we fill that below // it goes to (x1, y1), but we fill that below
} }
...@@ -2466,7 +2466,7 @@ Licensed under the MIT license. ...@@ -2466,7 +2466,7 @@ Licensed under the MIT license.
ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2)); ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));
// fill the other rectangle if it's there // fill the other rectangle if it's there
if (x2 != x2old) { if (x2 !== x2old) {
ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2)); ctx.lineTo(axisx.p2c(x2), axisy.p2c(y2));
ctx.lineTo(axisx.p2c(x2old), axisy.p2c(y2)); ctx.lineTo(axisx.p2c(x2old), axisy.p2c(y2));
} }
...@@ -2518,7 +2518,7 @@ Licensed under the MIT license. ...@@ -2518,7 +2518,7 @@ Licensed under the MIT license.
ctx.beginPath(); ctx.beginPath();
x = axisx.p2c(x); x = axisx.p2c(x);
y = axisy.p2c(y) + offset; y = axisy.p2c(y) + offset;
if (symbol == "circle") { if (symbol === "circle") {
ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false); ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false);
} else { } else {
symbol(ctx, x, y, radius, shadow); symbol(ctx, x, y, radius, shadow);
...@@ -2546,7 +2546,7 @@ Licensed under the MIT license. ...@@ -2546,7 +2546,7 @@ Licensed under the MIT license.
// Doing the conditional here allows the shadow setting to still be // Doing the conditional here allows the shadow setting to still be
// optional even with a lineWidth of 0. // optional even with a lineWidth of 0.
if( lw == 0 ) { if( lw === 0 ) {
lw = 0.0001; lw = 0.0001;
} }
...@@ -2736,7 +2736,7 @@ Licensed under the MIT license. ...@@ -2736,7 +2736,7 @@ Licensed under the MIT license.
} }
var c = $.color.parse(seriesColor); var c = $.color.parse(seriesColor);
c.a = typeof fill == "number" ? fill : 0.4; c.a = typeof fill === "number" ? fill : 0.4;
c.normalize(); c.normalize();
return c.toString(); return c.toString();
} }
...@@ -2772,13 +2772,13 @@ Licensed under the MIT license. ...@@ -2772,13 +2772,13 @@ Licensed under the MIT license.
if (options.legend.sorted) { if (options.legend.sorted) {
if ($.isFunction(options.legend.sorted)) { if ($.isFunction(options.legend.sorted)) {
entries.sort(options.legend.sorted); entries.sort(options.legend.sorted);
} else if (options.legend.sorted == "reverse") { } else if (options.legend.sorted === "reverse") {
entries.reverse(); entries.reverse();
} else { } else {
var ascending = options.legend.sorted != "descending"; var ascending = options.legend.sorted !== "descending";
entries.sort(function(a, b) { entries.sort(function(a, b) {
return a.label == b.label ? 0 : ( return a.label === b.label ? 0 : (
(a.label < b.label) != ascending ? 1 : -1 // Logical XOR (a.label < b.label) !== ascending ? 1 : -1 // Logical XOR
); );
}); });
} }
...@@ -2790,7 +2790,7 @@ Licensed under the MIT license. ...@@ -2790,7 +2790,7 @@ Licensed under the MIT license.
var entry = entries[i]; var entry = entries[i];
if (i % options.legend.noColumns == 0) { if (i % options.legend.noColumns === 0) {
if (rowStarted) { if (rowStarted) {
fragments.push("</tr>"); fragments.push("</tr>");
} }
...@@ -2808,7 +2808,7 @@ Licensed under the MIT license. ...@@ -2808,7 +2808,7 @@ Licensed under the MIT license.
fragments.push("</tr>"); fragments.push("</tr>");
} }
if (fragments.length == 0) { if (fragments.length === 0) {
return; return;
} }
...@@ -2822,25 +2822,25 @@ Licensed under the MIT license. ...@@ -2822,25 +2822,25 @@ Licensed under the MIT license.
if (m[0] == null) { if (m[0] == null) {
m = [m, m]; m = [m, m];
} }
if (p.charAt(0) == "n") { if (p.charAt(0) === "n") {
pos += "top:" + (m[1] + plotOffset.top) + "px;"; pos += "top:" + (m[1] + plotOffset.top) + "px;";
} else if (p.charAt(0) == "s") { } else if (p.charAt(0) === "s") {
pos += "bottom:" + (m[1] + plotOffset.bottom) + "px;"; pos += "bottom:" + (m[1] + plotOffset.bottom) + "px;";
} }
if (p.charAt(1) == "e") { if (p.charAt(1) === "e") {
pos += "right:" + (m[0] + plotOffset.right) + "px;"; pos += "right:" + (m[0] + plotOffset.right) + "px;";
} else if (p.charAt(1) == "w") { } else if (p.charAt(1) === "w") {
pos += "left:" + (m[0] + plotOffset.left) + "px;"; pos += "left:" + (m[0] + plotOffset.left) + "px;";
} }
var legend = $("<div class='legend'>" + table.replace("style='", "style='position:absolute;" + pos +";") + "</div>").appendTo(placeholder); var legend = $("<div class='legend'>" + table.replace("style='", "style='position:absolute;" + pos +";") + "</div>").appendTo(placeholder);
if (options.legend.backgroundOpacity != 0.0) { if (options.legend.backgroundOpacity !== 0.0) {
// put in the transparent background // put in the transparent background
// separately to avoid blended labels and // separately to avoid blended labels and
// label boxes // label boxes
var c = options.legend.backgroundColor; var c = options.legend.backgroundColor;
if (c == null) { if (c == null) {
c = options.grid.backgroundColor; c = options.grid.backgroundColor;
if (c && typeof c == "string") { if (c && typeof c === "string") {
c = $.color.parse(c); c = $.color.parse(c);
} else { } else {
c = $.color.extract(legend, "background-color"); c = $.color.extract(legend, "background-color");
...@@ -2920,7 +2920,7 @@ Licensed under the MIT license. ...@@ -2920,7 +2920,7 @@ Licensed under the MIT license.
} }
if (s.bars.show && !item) { // no other point can be nearby if (s.bars.show && !item) { // no other point can be nearby
var barLeft = s.bars.align == "left" ? 0 : -s.bars.barWidth/2, var barLeft = s.bars.align === "left" ? 0 : -s.bars.barWidth/2,
barRight = barLeft + s.bars.barWidth; barRight = barLeft + s.bars.barWidth;
for (j = 0; j < points.length; j += ps) { for (j = 0; j < points.length; j += ps) {
...@@ -2958,7 +2958,7 @@ Licensed under the MIT license. ...@@ -2958,7 +2958,7 @@ Licensed under the MIT license.
function onMouseMove(e) { function onMouseMove(e) {
if (options.grid.hoverable) { if (options.grid.hoverable) {
triggerClickHoverEvent("plothover", e, triggerClickHoverEvent("plothover", e,
function (s) { return s["hoverable"] != false; }); function (s) { return s.hoverable !== false; });
} }
} }
...@@ -2971,7 +2971,7 @@ Licensed under the MIT license. ...@@ -2971,7 +2971,7 @@ Licensed under the MIT license.
function onClick(e) { function onClick(e) {
triggerClickHoverEvent("plotclick", e, triggerClickHoverEvent("plotclick", e,
function (s) { return s["clickable"] != false; }); function (s) { return s.clickable !== false; });
} }
// trigger click or hover event (they send the same parameters // trigger click or hover event (they send the same parameters
...@@ -2997,10 +2997,10 @@ Licensed under the MIT license. ...@@ -2997,10 +2997,10 @@ Licensed under the MIT license.
// clear auto-highlights // clear auto-highlights
for (var i = 0; i < highlights.length; ++i) { for (var i = 0; i < highlights.length; ++i) {
var h = highlights[i]; var h = highlights[i];
if (h.auto == eventname && !( if (h.auto === eventname && !(
item && h.series == item.series && item && h.series === item.series &&
h.point[0] == item.datapoint[0] && h.point[0] === item.datapoint[0] &&
h.point[1] == item.datapoint[1] h.point[1] === item.datapoint[1]
)) { )) {
unhighlight(h.series, h.point); unhighlight(h.series, h.point);
} }
...@@ -3016,7 +3016,7 @@ Licensed under the MIT license. ...@@ -3016,7 +3016,7 @@ Licensed under the MIT license.
function triggerRedrawOverlay() { function triggerRedrawOverlay() {
var t = options.interaction.redrawOverlayInterval; var t = options.interaction.redrawOverlayInterval;
if (t == -1) { // skip event queue if (t === -1) { // skip event queue
drawOverlay(); drawOverlay();
return; return;
} }
...@@ -3050,17 +3050,17 @@ Licensed under the MIT license. ...@@ -3050,17 +3050,17 @@ Licensed under the MIT license.
} }
function highlight(s, point, auto) { function highlight(s, point, auto) {
if (typeof s == "number") { if (typeof s === "number") {
s = series[s]; s = series[s];
} }
if (typeof point == "number") { if (typeof point === "number") {
var ps = s.datapoints.pointsize; var ps = s.datapoints.pointsize;
point = s.datapoints.points.slice(ps * point, ps * (point + 1)); point = s.datapoints.points.slice(ps * point, ps * (point + 1));
} }
var i = indexOfHighlight(s, point); var i = indexOfHighlight(s, point);
if (i == -1) { if (i === -1) {
highlights.push({ series: s, point: point, auto: auto }); highlights.push({ series: s, point: point, auto: auto });
triggerRedrawOverlay(); triggerRedrawOverlay();
} else if (!auto) { } else if (!auto) {
...@@ -3075,17 +3075,17 @@ Licensed under the MIT license. ...@@ -3075,17 +3075,17 @@ Licensed under the MIT license.
return; return;
} }
if (typeof s == "number") { if (typeof s === "number") {
s = series[s]; s = series[s];
} }
if (typeof point == "number") { if (typeof point === "number") {
var ps = s.datapoints.pointsize; var ps = s.datapoints.pointsize;
point = s.datapoints.points.slice(ps * point, ps * (point + 1)); point = s.datapoints.points.slice(ps * point, ps * (point + 1));
} }
var i = indexOfHighlight(s, point); var i = indexOfHighlight(s, point);
if (i != -1) { if (i !== -1) {
highlights.splice(i, 1); highlights.splice(i, 1);
triggerRedrawOverlay(); triggerRedrawOverlay();
} }
...@@ -3118,7 +3118,7 @@ Licensed under the MIT license. ...@@ -3118,7 +3118,7 @@ Licensed under the MIT license.
y = axisy.p2c(y); y = axisy.p2c(y);
octx.beginPath(); octx.beginPath();
if (series.points.symbol == "circle") { if (series.points.symbol === "circle") {
octx.arc(x, y, radius, 0, 2 * Math.PI, false); octx.arc(x, y, radius, 0, 2 * Math.PI, false);
} else { } else {
series.points.symbol(octx, x, y, radius, false); series.points.symbol(octx, x, y, radius, false);
...@@ -3130,7 +3130,7 @@ Licensed under the MIT license. ...@@ -3130,7 +3130,7 @@ Licensed under the MIT license.
function drawBarHighlight(series, point) { function drawBarHighlight(series, point) {
var highlightColor = (typeof series.highlightColor === "string") ? series.highlightColor : $.color.parse(series.color).scale("a", 0.5).toString(), var highlightColor = (typeof series.highlightColor === "string") ? series.highlightColor : $.color.parse(series.color).scale("a", 0.5).toString(),
fillStyle = highlightColor, fillStyle = highlightColor,
barLeft = series.bars.align == "left" ? 0 : -series.bars.barWidth/2; barLeft = series.bars.align === "left" ? 0 : -series.bars.barWidth/2;
octx.lineWidth = series.bars.lineWidth; octx.lineWidth = series.bars.lineWidth;
octx.strokeStyle = highlightColor; octx.strokeStyle = highlightColor;
...@@ -3140,7 +3140,7 @@ Licensed under the MIT license. ...@@ -3140,7 +3140,7 @@ Licensed under the MIT license.
} }
function getColorOrGradient(spec, bottom, top, defaultColor) { function getColorOrGradient(spec, bottom, top, defaultColor) {
if (typeof spec == "string") { if (typeof spec === "string") {
return spec; return spec;
} else { } else {
// assume this is a gradient spec; IE currently only // assume this is a gradient spec; IE currently only
...@@ -3150,7 +3150,7 @@ Licensed under the MIT license. ...@@ -3150,7 +3150,7 @@ Licensed under the MIT license.
for (var i = 0, l = spec.colors.length; i < l; ++i) { for (var i = 0, l = spec.colors.length; i < l; ++i) {
var c = spec.colors[i]; var c = spec.colors[i];
if (typeof c != "string") { if (typeof c !== "string") {
var co = $.color.parse(defaultColor); var co = $.color.parse(defaultColor);
if (c.brightness != null) { if (c.brightness != null) {
co = co.scale("rgb", c.brightness); co = co.scale("rgb", c.brightness);
......
...@@ -87,7 +87,7 @@ can set the default in the options. ...@@ -87,7 +87,7 @@ can set the default in the options.
jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com) jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt
*/ */
//(function(a){function e(h){var k,j=this,l=h.data||{};if(l.elem)j=h.dragTarget=l.elem,h.dragProxy=d.proxy||j,h.cursorOffsetX=l.pageX-l.left,h.cursorOffsetY=l.pageY-l.top,h.offsetX=h.pageX-h.cursorOffsetX,h.offsetY=h.pageY-h.cursorOffsetY;else if(d.dragging||l.which>0&&h.which!=l.which||a(h.target).is(l.not))return;switch(h.type){case"mousedown":return a.extend(l,a(j).offset(),{elem:j,target:h.target,pageX:h.pageX,pageY:h.pageY}),b.add(document,"mousemove mouseup",e,l),i(j,!1),d.dragging=null,!1;case!d.dragging&&"mousemove":if(g(h.pageX-l.pageX)+g(h.pageY-l.pageY)<l.distance)break;h.target=l.target,k=f(h,"dragstart",j),k!==!1&&(d.dragging=j,d.proxy=h.dragProxy=a(k||j)[0]);case"mousemove":if(d.dragging){if(k=f(h,"drag",j),c.drop&&(c.drop.allowed=k!==!1,c.drop.handler(h)),k!==!1)break;h.type="mouseup"}case"mouseup":b.remove(document,"mousemove mouseup",e),d.dragging&&(c.drop&&c.drop.handler(h),f(h,"dragend",j)),i(j,!0),d.dragging=d.proxy=l.elem=!1}return!0}function f(b,c,d){b.type=c;var e=a.event.dispatch.call(d,b);return e===!1?!1:e||b.result}function g(a){return Math.pow(a,2)}function h(){return d.dragging===!1}function i(a,b){a&&(a.unselectable=b?"off":"on",a.onselectstart=function(){return b},a.style&&(a.style.MozUserSelect=b?"":"none"))}a.fn.drag=function(a,b,c){return b&&this.bind("dragstart",a),c&&this.bind("dragend",c),a?this.bind("drag",b?b:a):this.trigger("drag")};var b=a.event,c=b.special,d=c.drag={not:":input",distance:0,which:1,dragging:!1,setup:function(c){c=a.extend({distance:d.distance,which:d.which,not:d.not},c||{}),c.distance=g(c.distance),b.add(this,"mousedown",e,c),this.attachEvent&&this.attachEvent("ondragstart",h)},teardown:function(){b.remove(this,"mousedown",e),this===d.dragging&&(d.dragging=d.proxy=!1),i(this,!0),this.detachEvent&&this.detachEvent("ondragstart",h)}};c.dragstart=c.dragend={setup:function(){},teardown:function(){}}})(jQuery); (function(a){function e(h){var k,j=this,l=h.data||{};if(l.elem)j=h.dragTarget=l.elem,h.dragProxy=d.proxy||j,h.cursorOffsetX=l.pageX-l.left,h.cursorOffsetY=l.pageY-l.top,h.offsetX=h.pageX-h.cursorOffsetX,h.offsetY=h.pageY-h.cursorOffsetY;else if(d.dragging||l.which>0&&h.which!=l.which||a(h.target).is(l.not))return;switch(h.type){case"mousedown":return a.extend(l,a(j).offset(),{elem:j,target:h.target,pageX:h.pageX,pageY:h.pageY}),b.add(document,"mousemove mouseup",e,l),i(j,!1),d.dragging=null,!1;case!d.dragging&&"mousemove":if(g(h.pageX-l.pageX)+g(h.pageY-l.pageY)<l.distance)break;h.target=l.target,k=f(h,"dragstart",j),k!==!1&&(d.dragging=j,d.proxy=h.dragProxy=a(k||j)[0]);case"mousemove":if(d.dragging){if(k=f(h,"drag",j),c.drop&&(c.drop.allowed=k!==!1,c.drop.handler(h)),k!==!1)break;h.type="mouseup"}case"mouseup":b.remove(document,"mousemove mouseup",e),d.dragging&&(c.drop&&c.drop.handler(h),f(h,"dragend",j)),i(j,!0),d.dragging=d.proxy=l.elem=!1}return!0}function f(b,c,d){b.type=c;var e=a.event.dispatch.call(d,b);return e===!1?!1:e||b.result}function g(a){return Math.pow(a,2)}function h(){return d.dragging===!1}function i(a,b){a&&(a.unselectable=b?"off":"on",a.onselectstart=function(){return b},a.style&&(a.style.MozUserSelect=b?"":"none"))}a.fn.drag=function(a,b,c){return b&&this.bind("dragstart",a),c&&this.bind("dragend",c),a?this.bind("drag",b?b:a):this.trigger("drag")};var b=a.event,c=b.special,d=c.drag={not:":input",distance:0,which:1,dragging:!1,setup:function(c){c=a.extend({distance:d.distance,which:d.which,not:d.not},c||{}),c.distance=g(c.distance),b.add(this,"mousedown",e,c),this.attachEvent&&this.attachEvent("ondragstart",h)},teardown:function(){b.remove(this,"mousedown",e),this===d.dragging&&(d.dragging=d.proxy=!1),i(this,!0),this.detachEvent&&this.detachEvent("ondragstart",h)}};c.dragstart=c.dragend={setup:function(){},teardown:function(){}}})(jQuery);
/* jquery.mousewheel.min.js /* jquery.mousewheel.min.js
* Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) * Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
...@@ -142,7 +142,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L ...@@ -142,7 +142,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L
panTimeout = null; panTimeout = null;
function onDragStart(e) { function onDragStart(e) {
if (e.which != 1) { // only accept left-click if (e.which !== 1) { // only accept left-click
return false; return false;
} }
var c = plot.getPlaceholder().css("cursor"); var c = plot.getPlaceholder().css("cursor");
......
...@@ -88,7 +88,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -88,7 +88,7 @@ More detail and specific examples can be found in the included HTML file.
// set labels.show // set labels.show
if (options.series.pie.label.show == "auto") { if (options.series.pie.label.show === "auto") {
if (options.legend.show) { if (options.legend.show) {
options.series.pie.label.show = false; options.series.pie.label.show = false;
} else { } else {
...@@ -98,7 +98,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -98,7 +98,7 @@ More detail and specific examples can be found in the included HTML file.
// set radius // set radius
if (options.series.pie.radius == "auto") { if (options.series.pie.radius === "auto") {
if (options.series.pie.label.show) { if (options.series.pie.label.show) {
options.series.pie.radius = 3/4; options.series.pie.radius = 3/4;
} else { } else {
...@@ -180,7 +180,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -180,7 +180,7 @@ More detail and specific examples can be found in the included HTML file.
// new one; this is more efficient and preserves any extra data // new one; this is more efficient and preserves any extra data
// that the user may have stored in higher indexes. // that the user may have stored in higher indexes.
if ($.isArray(value) && value.length == 1) { if ($.isArray(value) && value.length === 1) {
value = value[0]; value = value[0];
} }
...@@ -287,7 +287,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -287,7 +287,7 @@ More detail and specific examples can be found in the included HTML file.
centerTop = canvasHeight / 2 + options.series.pie.offset.top; centerTop = canvasHeight / 2 + options.series.pie.offset.top;
centerLeft = canvasWidth / 2; centerLeft = canvasWidth / 2;
if (options.series.pie.offset.left == "auto") { if (options.series.pie.offset.left === "auto") {
if (options.legend.position.match("w")) { if (options.legend.position.match("w")) {
centerLeft += legendWidth / 2; centerLeft += legendWidth / 2;
} else { } else {
...@@ -469,7 +469,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -469,7 +469,7 @@ More detail and specific examples can be found in the included HTML file.
function drawLabel(slice, startAngle, index) { function drawLabel(slice, startAngle, index) {
if (slice.data[0][1] == 0) { if (slice.data[0][1] === 0) {
return true; return true;
} }
...@@ -507,7 +507,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -507,7 +507,7 @@ More detail and specific examples can be found in the included HTML file.
return false; return false;
} }
if (options.series.pie.label.background.opacity != 0) { if (options.series.pie.label.background.opacity !== 0) {
// put in the transparent background separately to avoid blended labels and label boxes // put in the transparent background separately to avoid blended labels and label boxes
...@@ -665,7 +665,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -665,7 +665,7 @@ More detail and specific examples can be found in the included HTML file.
for (var i = 0; i < highlights.length; ++i) { for (var i = 0; i < highlights.length; ++i) {
var h = highlights[i]; var h = highlights[i];
if (h.auto == eventname && !(item && h.series == item.series)) { if (h.auto === eventname && !(item && h.series === item.series)) {
unhighlight(h.series); unhighlight(h.series);
} }
} }
...@@ -690,7 +690,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -690,7 +690,7 @@ More detail and specific examples can be found in the included HTML file.
var i = indexOfHighlight(s); var i = indexOfHighlight(s);
if (i == -1) { if (i === -1) {
highlights.push({ series: s, auto: auto }); highlights.push({ series: s, auto: auto });
plot.triggerRedrawOverlay(); plot.triggerRedrawOverlay();
} else if (!auto) { } else if (!auto) {
...@@ -710,7 +710,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -710,7 +710,7 @@ More detail and specific examples can be found in the included HTML file.
var i = indexOfHighlight(s); var i = indexOfHighlight(s);
if (i != -1) { if (i !== -1) {
highlights.splice(i, 1); highlights.splice(i, 1);
plot.triggerRedrawOverlay(); plot.triggerRedrawOverlay();
} }
...@@ -719,7 +719,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -719,7 +719,7 @@ More detail and specific examples can be found in the included HTML file.
function indexOfHighlight(s) { function indexOfHighlight(s) {
for (var i = 0; i < highlights.length; ++i) { for (var i = 0; i < highlights.length; ++i) {
var h = highlights[i]; var h = highlights[i];
if (h.series == s) { if (h.series === s) {
return i; return i;
} }
} }
......
...@@ -31,7 +31,7 @@ can just fix the size of their placeholders. ...@@ -31,7 +31,7 @@ can just fix the size of their placeholders.
// somebody might have hidden us and we can't plot // somebody might have hidden us and we can't plot
// when we don't have the dimensions // when we don't have the dimensions
if (placeholder.width() == 0 || placeholder.height() == 0) { if (placeholder.width() === 0 || placeholder.height() === 0) {
return; return;
} }
......
...@@ -104,7 +104,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -104,7 +104,7 @@ The plugin allso adds the following methods to the plot object:
} }
function onMouseDown(e) { function onMouseDown(e) {
if (e.which != 1) { // only accept left-click if (e.which !== 1) { // only accept left-click
return; return;
} }
...@@ -199,12 +199,12 @@ The plugin allso adds the following methods to the plot object: ...@@ -199,12 +199,12 @@ The plugin allso adds the following methods to the plot object:
pos.x = clamp(0, e.pageX - offset.left - plotOffset.left, plot.width()); pos.x = clamp(0, e.pageX - offset.left - plotOffset.left, plot.width());
pos.y = clamp(0, e.pageY - offset.top - plotOffset.top, plot.height()); pos.y = clamp(0, e.pageY - offset.top - plotOffset.top, plot.height());
if (o.selection.mode == "y") { if (o.selection.mode === "y") {
pos.x = pos == selection.first ? 0 : plot.width(); pos.x = pos === selection.first ? 0 : plot.width();
} }
if (o.selection.mode == "x") { if (o.selection.mode === "x") {
pos.y = pos == selection.first ? 0 : plot.height(); pos.y = pos === selection.first ? 0 : plot.height();
} }
} }
...@@ -238,9 +238,9 @@ The plugin allso adds the following methods to the plot object: ...@@ -238,9 +238,9 @@ The plugin allso adds the following methods to the plot object:
for (var k in axes) { for (var k in axes) {
axis = axes[k]; axis = axes[k];
if (axis.direction == coord) { if (axis.direction === coord) {
key = coord + axis.n + "axis"; key = coord + axis.n + "axis";
if (!ranges[key] && axis.n == 1) { if (!ranges[key] && axis.n === 1) {
key = coord + "axis"; // support x1axis as xaxis key = coord + "axis"; // support x1axis as xaxis
} }
if (ranges[key]) { if (ranges[key]) {
...@@ -253,7 +253,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -253,7 +253,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]) {
axis = coord == "x" ? plot.getXAxes()[0] : plot.getYAxes()[0]; axis = coord === "x" ? plot.getXAxes()[0] : plot.getYAxes()[0];
from = ranges[coord + "1"]; from = ranges[coord + "1"];
to = ranges[coord + "2"]; to = ranges[coord + "2"];
} }
...@@ -271,7 +271,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -271,7 +271,7 @@ The plugin allso adds the following methods to the plot object:
function setSelection(ranges, preventEvent) { function setSelection(ranges, preventEvent) {
var axis, range, o = plot.getOptions(); var axis, range, o = plot.getOptions();
if (o.selection.mode == "y") { if (o.selection.mode === "y") {
selection.first.x = 0; selection.first.x = 0;
selection.second.x = plot.width(); selection.second.x = plot.width();
} }
...@@ -282,7 +282,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -282,7 +282,7 @@ The plugin allso adds the following methods to the plot object:
selection.second.x = range.axis.p2c(range.to); selection.second.x = range.axis.p2c(range.to);
} }
if (o.selection.mode == "x") { if (o.selection.mode === "x") {
selection.first.y = 0; selection.first.y = 0;
selection.second.y = plot.height(); selection.second.y = plot.height();
} }
......
...@@ -44,11 +44,11 @@ charts or filled areas). ...@@ -44,11 +44,11 @@ charts or filled areas).
function findMatchingSeries(s, allseries) { function findMatchingSeries(s, allseries) {
var res = null; var res = null;
for (var i = 0; i < allseries.length; ++i) { for (var i = 0; i < allseries.length; ++i) {
if (s == allseries[i]) { if (s === allseries[i]) {
break; break;
} }
if (allseries[i].stack == s.stack) { if (allseries[i].stack === s.stack) {
res = allseries[i]; res = allseries[i];
} }
} }
...@@ -120,7 +120,7 @@ charts or filled areas). ...@@ -120,7 +120,7 @@ charts or filled areas).
qy = otherpoints[j + accumulateOffset]; qy = otherpoints[j + accumulateOffset];
bottom = 0; bottom = 0;
if (px == qx) { if (px === qx) {
for (m = 0; m < ps; ++m) { for (m = 0; m < ps; ++m) {
newpoints.push(points[i + m]); newpoints.push(points[i + m]);
} }
...@@ -170,16 +170,16 @@ charts or filled areas). ...@@ -170,16 +170,16 @@ charts or filled areas).
fromgap = false; fromgap = false;
if (l != newpoints.length && withbottom) { if (l !== newpoints.length && withbottom) {
newpoints[l + 2] += bottom; newpoints[l + 2] += bottom;
} }
} }
// maintain the line steps invariant // maintain the line steps invariant
if (withsteps && l != newpoints.length && l > 0 && if (withsteps && l !== newpoints.length && l > 0 &&
newpoints[l] != null && newpoints[l] != null &&
newpoints[l] != newpoints[l - ps] && newpoints[l] !== newpoints[l - ps] &&
newpoints[l + 1] != newpoints[l - ps + 1]) { newpoints[l + 1] !== newpoints[l - ps + 1]) {
for (m = 0; m < ps; ++m) { for (m = 0; m < ps; ++m) {
newpoints[l + ps + m] = newpoints[l + m]; newpoints[l + ps + m] = newpoints[l + m];
} }
......
...@@ -77,7 +77,7 @@ You may need to check for this in hover events. ...@@ -77,7 +77,7 @@ You may need to check for this in hover events.
p = newpoints; p = newpoints;
} }
if (addCrossingPoints && prevp != p && x != null && i > 0 && origpoints[i - ps] != null) { if (addCrossingPoints && prevp !== p && x != null && i > 0 && origpoints[i - ps] != null) {
var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]); var interx = x + (below - y) * (x - origpoints[i - ps]) / (y - origpoints[i - ps + 1]);
prevp.push(interx); prevp.push(interx);
prevp.push(below); prevp.push(below);
......
...@@ -30,14 +30,14 @@ API.txt for details. ...@@ -30,14 +30,14 @@ API.txt for details.
function formatDate(d, fmt, monthNames, dayNames) { function formatDate(d, fmt, monthNames, dayNames) {
if (typeof d.strftime == "function") { if ($.isFunction(d.strftime)) {
return d.strftime(fmt); return d.strftime(fmt);
} }
var leftPad = function(n, pad) { var leftPad = function(n, pad) {
n = "" + n; n = "" + n;
pad = "" + (pad == null ? "0" : pad); pad = "" + (pad == null ? "0" : pad);
return n.length == 1 ? pad + n : n; return n.length === 1 ? pad + n : n;
}; };
var r = []; var r = [];
...@@ -57,7 +57,7 @@ API.txt for details. ...@@ -57,7 +57,7 @@ API.txt for details.
if (hours > 12) { if (hours > 12) {
hours12 = hours - 12; hours12 = hours - 12;
} else if (hours == 0) { } else if (hours === 0) {
hours12 = 12; hours12 = 12;
} else { } else {
hours12 = hours; hours12 = hours;
...@@ -92,7 +92,7 @@ API.txt for details. ...@@ -92,7 +92,7 @@ API.txt for details.
r.push(c); r.push(c);
escape = false; escape = false;
} else { } else {
if (c == "%") { if (c === "%") {
escape = true; escape = true;
} else { } else {
r.push(c); r.push(c);
...@@ -122,7 +122,7 @@ API.txt for details. ...@@ -122,7 +122,7 @@ API.txt for details.
// support strftime, if found // support strftime, if found
if (d.strftime != undefined) { if (d.strftime !== undefined) {
addProxyMethod(utc, "strftime", d, "strftime"); addProxyMethod(utc, "strftime", d, "strftime");
} }
...@@ -143,11 +143,11 @@ API.txt for details. ...@@ -143,11 +143,11 @@ API.txt for details.
// desired timezone // desired timezone
function dateGenerator(ts, opts) { function dateGenerator(ts, opts) {
if (opts.timezone == "browser") { if (opts.timezone === "browser") {
return new Date(ts); return new Date(ts);
} else if (!opts.timezone || opts.timezone == "utc") { } else if (!opts.timezone || opts.timezone === "utc") {
return makeUtcWrapper(new Date(ts)); return makeUtcWrapper(new Date(ts));
} else if (typeof timezoneJS != "undefined" && typeof timezoneJS.Date != "undefined") { } else if (typeof timezoneJS !== "undefined" && typeof timezoneJS.Date !== "undefined") {
var d = new timezoneJS.Date(); var d = new timezoneJS.Date();
// timezone-js is fickle, so be sure to set the time zone before // timezone-js is fickle, so be sure to set the time zone before
// setting the time. // setting the time.
...@@ -200,7 +200,7 @@ API.txt for details. ...@@ -200,7 +200,7 @@ API.txt for details.
var opts = axis.options; var opts = axis.options;
if (opts.mode == "time") { if (opts.mode === "time") {
axis.tickGenerator = function(axis) { axis.tickGenerator = function(axis) {
var ticks = []; var ticks = [];
...@@ -216,7 +216,7 @@ API.txt for details. ...@@ -216,7 +216,7 @@ API.txt for details.
"quarter") ? specQuarters : specMonths; "quarter") ? specQuarters : specMonths;
if (opts.minTickSize != null) { if (opts.minTickSize != null) {
if (typeof opts.tickSize == "number") { if (typeof opts.tickSize === "number") {
minSize = opts.tickSize; minSize = opts.tickSize;
} else { } else {
minSize = opts.minTickSize[0] * timeUnitSize[opts.minTickSize[1]]; minSize = opts.minTickSize[0] * timeUnitSize[opts.minTickSize[1]];
...@@ -236,12 +236,12 @@ API.txt for details. ...@@ -236,12 +236,12 @@ API.txt for details.
// special-case the possibility of several years // special-case the possibility of several years
if (unit == "year") { if (unit === "year") {
// if given a minTickSize in years, just use it, // if given a minTickSize in years, just use it,
// ensuring that it's an integer // ensuring that it's an integer
if (opts.minTickSize != null && opts.minTickSize[1] == "year") { if (opts.minTickSize != null && opts.minTickSize[1] === "year") {
size = Math.floor(opts.minTickSize[0]); size = Math.floor(opts.minTickSize[0]);
} else { } else {
...@@ -274,18 +274,18 @@ API.txt for details. ...@@ -274,18 +274,18 @@ API.txt for details.
var step = tickSize * timeUnitSize[unit]; var step = tickSize * timeUnitSize[unit];
if (unit == "second") { if (unit === "second") {
d.setSeconds(floorInBase(d.getSeconds(), tickSize)); d.setSeconds(floorInBase(d.getSeconds(), tickSize));
} else if (unit == "minute") { } else if (unit === "minute") {
d.setMinutes(floorInBase(d.getMinutes(), tickSize)); d.setMinutes(floorInBase(d.getMinutes(), tickSize));
} else if (unit == "hour") { } else if (unit === "hour") {
d.setHours(floorInBase(d.getHours(), tickSize)); d.setHours(floorInBase(d.getHours(), tickSize));
} else if (unit == "month") { } else if (unit === "month") {
d.setMonth(floorInBase(d.getMonth(), tickSize)); d.setMonth(floorInBase(d.getMonth(), tickSize));
} else if (unit == "quarter") { } else if (unit === "quarter") {
d.setMonth(3 * floorInBase(d.getMonth() / 3, d.setMonth(3 * floorInBase(d.getMonth() / 3,
tickSize)); tickSize));
} else if (unit == "year") { } else if (unit === "year") {
d.setFullYear(floorInBase(d.getFullYear(), tickSize)); d.setFullYear(floorInBase(d.getFullYear(), tickSize));
} }
...@@ -325,7 +325,7 @@ API.txt for details. ...@@ -325,7 +325,7 @@ API.txt for details.
v = d.getTime(); v = d.getTime();
ticks.push(v); ticks.push(v);
if (unit == "month" || unit == "quarter") { if (unit === "month" || unit === "quarter") {
if (tickSize < 1) { if (tickSize < 1) {
// a bit complicated - we'll divide the // a bit complicated - we'll divide the
...@@ -335,21 +335,21 @@ API.txt for details. ...@@ -335,21 +335,21 @@ API.txt for details.
d.setDate(1); d.setDate(1);
var start = d.getTime(); var start = d.getTime();
d.setMonth(d.getMonth() + (unit == "quarter" ? 3 : 1)); d.setMonth(d.getMonth() + (unit === "quarter" ? 3 : 1));
var end = d.getTime(); var end = d.getTime();
d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize); d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize);
carry = d.getHours(); carry = d.getHours();
d.setHours(0); d.setHours(0);
} else { } else {
d.setMonth(d.getMonth() + d.setMonth(d.getMonth() +
tickSize * (unit == "quarter" ? 3 : 1)); tickSize * (unit === "quarter" ? 3 : 1));
} }
} else if (unit == "year") { } else if (unit === "year") {
d.setFullYear(d.getFullYear() + tickSize); d.setFullYear(d.getFullYear() + tickSize);
} else { } else {
d.setTime(v + step); d.setTime(v + step);
} }
} while (v < axis.max && v != prev); } while (v < axis.max && v !== prev);
return ticks; return ticks;
}; };
...@@ -368,9 +368,9 @@ API.txt for details. ...@@ -368,9 +368,9 @@ API.txt for details.
// any of these places // any of these places
var useQuarters = (axis.options.tickSize && var useQuarters = (axis.options.tickSize &&
axis.options.tickSize[1] == "quarter") || axis.options.tickSize[1] === "quarter") ||
(axis.options.minTickSize && (axis.options.minTickSize &&
axis.options.minTickSize[1] == "quarter"); axis.options.minTickSize[1] === "quarter");
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]]; var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];
var span = axis.max - axis.min; var span = axis.max - axis.min;
......
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