Commit 339aab91 authored by Nick Schonning's avatar Nick Schonning

JSCS: Don't stick operators to values

Fix jQuery preset as per https://github.com/mdevils/node-jscs/issues/117
parent fcc7c16b
...@@ -55,7 +55,7 @@ module.exports = function(grunt) { ...@@ -55,7 +55,7 @@ module.exports = function(grunt) {
"requireMultipleVarDecl": true, "requireMultipleVarDecl": true,
"requireSpacesInsideObjectBrackets": "all", // Different from jQuery preset "requireSpacesInsideObjectBrackets": "all", // Different from jQuery preset
"disallowSpacesInsideArrayBrackets": true, // Different from jQuery preset "disallowSpacesInsideArrayBrackets": true, // Different from jQuery preset
"disallowLeftStickedOperators": [ "?", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=" ], "disallowLeftStickedOperators": [ "?", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=" ],
"disallowRightStickedOperators": [ "?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowRightStickedOperators": [ "?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-"], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-"],
......
...@@ -278,13 +278,13 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -278,13 +278,13 @@ shadowSize and lineWidth are derived as well from the points series.
var w = sw / 2; var w = sw / 2;
ctx.lineWidth = w; ctx.lineWidth = w;
ctx.strokeStyle = "rgba(0,0,0,0.1)"; ctx.strokeStyle = "rgba(0,0,0,0.1)";
drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w + w/2, minmax); drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w + w / 2, minmax);
ctx.strokeStyle = "rgba(0,0,0,0.2)"; ctx.strokeStyle = "rgba(0,0,0,0.2)";
drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w/2, minmax); drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w / 2, minmax);
} }
ctx.strokeStyle = err[e].color? err[e].color: s.color; ctx.strokeStyle = err[e].color ? err[e].color : s.color;
ctx.lineWidth = lw; ctx.lineWidth = lw;
//draw it //draw it
drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, 0, minmax); drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, 0, minmax);
...@@ -327,7 +327,7 @@ shadowSize and lineWidth are derived as well from the points series. ...@@ -327,7 +327,7 @@ shadowSize and lineWidth are derived as well from the points series.
//internal radius value in errorbar, allows to plot radius 0 points and still keep proper sized caps //internal radius value in errorbar, allows to plot radius 0 points and still keep proper sized caps
//this is a way to get errorbars on lines without visible connecting dots //this is a way to get errorbars on lines without visible connecting dots
radius = err.radius != null? err.radius: radius; radius = err.radius != null ? err.radius : radius;
// upper cap // upper cap
if (drawUpper) { if (drawUpper) {
......
...@@ -158,10 +158,10 @@ Google Maps). ...@@ -158,10 +158,10 @@ 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;
tmp = 0.5 * (y2-y1) / (img.height - 1); tmp = 0.5 * (y2 - y1) / (img.height - 1);
y1 -= tmp; y1 -= tmp;
y2 += tmp; y2 += tmp;
} }
......
...@@ -710,7 +710,7 @@ Licensed under the MIT license. ...@@ -710,7 +710,7 @@ Licensed under the MIT license.
mouseActiveRadius: 10 // how far the mouse can be away to activate an item mouseActiveRadius: 10 // how far the mouse can be away to activate an item
}, },
interaction: { interaction: {
redrawOverlayInterval: 1000/60 // time between updates, -1 means in same flow redrawOverlayInterval: 1000 / 60 // time between updates, -1 means in same flow
}, },
hooks: {} hooks: {}
}, },
...@@ -1337,7 +1337,7 @@ Licensed under the MIT license. ...@@ -1337,7 +1337,7 @@ Licensed under the MIT license.
ps = s.datapoints.pointsize; ps = s.datapoints.pointsize;
points = s.datapoints.points; points = s.datapoints.points;
s.xaxis.used = s.yaxis.used = true; s.xaxis.used = s.yaxis.used = true;
for (j = k = 0; j < data.length; ++j, k += ps) { for (j = k = 0; j < data.length; ++j, k += ps) {
...@@ -2187,7 +2187,7 @@ Licensed under the MIT license. ...@@ -2187,7 +2187,7 @@ Licensed under the MIT license.
// process markings // process markings
var markingsUnderGrid = []; var markingsUnderGrid = [];
var markingsAboveGrid = []; var markingsAboveGrid = [];
var markings = options.grid.markings; var markings = options.grid.markings;
if (markings) { if (markings) {
if ($.isFunction(markings)) { if ($.isFunction(markings)) {
...@@ -2204,7 +2204,7 @@ Licensed under the MIT license. ...@@ -2204,7 +2204,7 @@ Licensed under the MIT license.
for (i = 0; i < markings.length; ++i) { for (i = 0; i < markings.length; ++i) {
var m = markings[i]; var m = markings[i];
if (m.aboveGrid) { if (m.aboveGrid) {
markingsAboveGrid.push(m); markingsAboveGrid.push(m);
} else { } else {
...@@ -2212,7 +2212,7 @@ Licensed under the MIT license. ...@@ -2212,7 +2212,7 @@ Licensed under the MIT license.
} }
} }
} }
drawMarkings(markingsUnderGrid, markingLayer); drawMarkings(markingsUnderGrid, markingLayer);
// draw the ticks // draw the ticks
...@@ -2365,7 +2365,7 @@ Licensed under the MIT license. ...@@ -2365,7 +2365,7 @@ Licensed under the MIT license.
ctx.lineWidth = bw.left; ctx.lineWidth = bw.left;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(0 - bw.left / 2, plotHeight + bw.bottom); ctx.moveTo(0 - bw.left / 2, plotHeight + bw.bottom);
ctx.lineTo(0- bw.left / 2, 0); ctx.lineTo(0 - bw.left / 2, 0);
ctx.stroke(); ctx.stroke();
} }
} else { } else {
...@@ -2377,7 +2377,7 @@ Licensed under the MIT license. ...@@ -2377,7 +2377,7 @@ Licensed under the MIT license.
ctx.restore(); ctx.restore();
} }
function drawMarkings(markings, markingLayer) { function drawMarkings(markings, markingLayer) {
if (!markings) { if (!markings) {
return; return;
...@@ -2387,7 +2387,7 @@ Licensed under the MIT license. ...@@ -2387,7 +2387,7 @@ Licensed under the MIT license.
drawMarking(markings[i], markingLayer); drawMarking(markings[i], markingLayer);
} }
} }
function drawMarking(m, markingLayer) { function drawMarking(m, markingLayer) {
var xrange = extractRange(m, "x"), var xrange = extractRange(m, "x"),
yrange = extractRange(m, "y"); yrange = extractRange(m, "y");
...@@ -3589,9 +3589,9 @@ Licensed under the MIT license. ...@@ -3589,9 +3589,9 @@ Licensed under the MIT license.
// Draw a rectangle with rounded corner on the canvas. // Draw a rectangle with rounded corner on the canvas.
// //
// @param {CanvasRenderingContext2D} ctx The canvas 2D context. // @param {CanvasRenderingContext2D} ctx The canvas 2D context.
// @param {number} x The x-axis coordinate of the upper left corner of // @param {number} x The x-axis coordinate of the upper left corner of
// the rectangle to be drawn. // the rectangle to be drawn.
// @param {number} y The y-axis coordinate of the upper left corner of // @param {number} y The y-axis coordinate of the upper left corner of
// the rectangle to be drawn. // the rectangle to be drawn.
// @param {number} width The width of the rectangle to be drawn. // @param {number} width The width of the rectangle to be drawn.
// @param {number} height The height of the rectangle to be drawn. // @param {number} height The height of the rectangle to be drawn.
......
...@@ -101,7 +101,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -101,7 +101,7 @@ More detail and specific examples can be found in the included HTML file.
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 {
options.series.pie.radius = 1; options.series.pie.radius = 1;
} }
...@@ -567,7 +567,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -567,7 +567,7 @@ More detail and specific examples can be found in the included HTML file.
function isPointInPoly(poly, pt) { function isPointInPoly(poly, pt) {
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) { for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || ((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) ||
(poly[j][1] <= pt[1] && pt[1]< poly[i][1])) && (poly[j][1] <= pt[1] && pt[1] < poly[i][1])) &&
(pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0]) && (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0]) &&
(c = !c); (c = !c);
} }
...@@ -774,7 +774,7 @@ More detail and specific examples can be found in the included HTML file. ...@@ -774,7 +774,7 @@ More detail and specific examples can be found in the included HTML file.
show: false, show: false,
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value) radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
innerRadius: 0, /* for donut */ innerRadius: 0, /* for donut */
startAngle: 3/2, startAngle: 3 / 2,
tilt: 1, tilt: 1,
shadow: { shadow: {
left: 5, // shadow left offset left: 5, // shadow left offset
......
...@@ -37,11 +37,11 @@ The symbols are accessed as strings through the standard symbol options: ...@@ -37,11 +37,11 @@ The symbols are accessed as strings through the standard symbol options:
// pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3)) // pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3))
var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3)); var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3));
var height = size * Math.sin(Math.PI / 3); var height = size * Math.sin(Math.PI / 3);
ctx.moveTo(x - size/2, y + height/2); ctx.moveTo(x - size / 2, y + height / 2);
ctx.lineTo(x + size/2, y + height/2); ctx.lineTo(x + size / 2, y + height / 2);
if (!shadow) { if (!shadow) {
ctx.lineTo(x, y - height/2); ctx.lineTo(x, y - height / 2);
ctx.lineTo(x - size/2, y + height/2); ctx.lineTo(x - size / 2, y + height / 2);
} }
}, },
cross: function(ctx, x, y, radius) { cross: function(ctx, x, y, radius) {
......
...@@ -135,7 +135,7 @@ You may need to check for this in hover events. ...@@ -135,7 +135,7 @@ You may need to check for this in hover events.
} }
plot.hooks.processDatapoints.push(processThresholds); plot.hooks.processDatapoints.push(processThresholds);
function processThresholdsLegend(ctx, canvas, s) { function processThresholdsLegend(ctx, canvas, s) {
if (!s.threshold) { if (!s.threshold) {
...@@ -148,8 +148,8 @@ You may need to check for this in hover events. ...@@ -148,8 +148,8 @@ You may need to check for this in hover events.
if($(this).text() === s.label) if($(this).text() === s.label)
{ {
var legend = $(this).prev().find("div > div"); var legend = $(this).prev().find("div > div");
legend.css("border-right-color" , color); legend.css("border-right-color", color);
legend.css("border-bottom-color" , color); legend.css("border-bottom-color", color);
} }
}); });
} }
......
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