Commit fcc7c16b authored by Nick Schonning's avatar Nick Schonning

JSCS: Remove space between function and bracket

parent 67dce054
......@@ -43,7 +43,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
*/
(function ($) {
(function($) {
var options = {
xaxis: {
categories: null
......@@ -121,7 +121,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
}
}
res.sort(function (a, b) { return a[0] - b[0]; });
res.sort(function(a, b) { return a[0] - b[0]; });
return res;
}
......
......@@ -40,7 +40,7 @@ The plugin also adds four public methods:
Example usage:
var myFlot = $.plot( $("#graph"), ..., { crosshair: { mode: "x" } } };
$("#graph").bind( "plothover", function ( evt, position, item ) {
$("#graph").bind( "plothover", function( evt, position, item ) {
if ( item ) {
// Lock the crosshair to the data point being hovered
myFlot.lockCrosshair({
......@@ -58,7 +58,7 @@ The plugin also adds four public methods:
Free the crosshair to move again after locking it.
*/
(function ($) {
(function($) {
var options = {
crosshair: {
......@@ -124,7 +124,7 @@ The plugin also adds four public methods:
plot.triggerRedrawOverlay();
}
plot.hooks.bindEvents.push(function (plot, eventHolder) {
plot.hooks.bindEvents.push(function(plot, eventHolder) {
if (!plot.getOptions().crosshair.mode) {
return;
}
......@@ -133,7 +133,7 @@ The plugin also adds four public methods:
eventHolder.mousemove(onMouseMove);
});
plot.hooks.drawOverlay.push(function (plot, ctx) {
plot.hooks.drawOverlay.push(function(plot, ctx) {
var c = plot.getOptions().crosshair;
if (!c.mode) {
return;
......@@ -167,7 +167,7 @@ The plugin also adds four public methods:
ctx.restore();
});
plot.hooks.shutdown.push(function (plot, eventHolder) {
plot.hooks.shutdown.push(function(plot, eventHolder) {
eventHolder.unbind("mouseout", onMouseOut);
eventHolder.unbind("mousemove", onMouseMove);
});
......
......@@ -62,7 +62,7 @@ shadowSize and lineWidth are derived as well from the points series.
*/
(function ($) {
(function($) {
var options = {
series: {
points: {
......@@ -377,7 +377,7 @@ shadowSize and lineWidth are derived as well from the points series.
ctx.save();
ctx.translate(plotOffset.left, plotOffset.top);
$.each(plot.getData(), function (i, s) {
$.each(plot.getData(), function(i, s) {
if (s.points.errorbars && (s.points.xerr.show || s.points.yerr.show)) {
drawSeriesErrors(plot, ctx, s);
}
......
......@@ -29,7 +29,7 @@ jquery.flot.stack.js plugin, possibly some code could be shared.
*/
(function ($) {
(function($) {
var options = {
series: {
......
......@@ -52,7 +52,7 @@ Google Maps).
*/
(function ($) {
(function($) {
var options = {
series: {
images: {
......@@ -65,12 +65,12 @@ Google Maps).
$.plot.image = {};
$.plot.image.loadDataImages = function (series, options, callback) {
$.plot.image.loadDataImages = function(series, options, callback) {
var urls = [], points = [];
var defaultShow = options.series.images.show;
$.each(series, function (i, s) {
$.each(series, function(i, s) {
if (!(defaultShow || s.images.show)) {
return;
}
......@@ -79,7 +79,7 @@ Google Maps).
s = s.data;
}
$.each(s, function (i, p) {
$.each(s, function(i, p) {
if (typeof p[0] === "string") {
urls.push(p[0]);
points.push(p);
......@@ -87,8 +87,8 @@ Google Maps).
});
});
$.plot.image.load(urls, function (loadedImages) {
$.each(points, function (i, p) {
$.plot.image.load(urls, function(loadedImages) {
$.each(points, function(i, p) {
var url = p[0];
if (loadedImages[url]) {
p[0] = loadedImages[url];
......@@ -99,14 +99,14 @@ Google Maps).
});
};
$.plot.image.load = function (urls, callback) {
$.plot.image.load = function(urls, callback) {
var missing = urls.length, loaded = {};
if (missing === 0) {
callback({});
}
$.each(urls, function (i, url) {
var handler = function () {
$.each(urls, function(i, url) {
var handler = function() {
--missing;
loaded[url] = this;
......
......@@ -742,29 +742,29 @@ Licensed under the MIT license.
plot.getPlaceholder = function() { return placeholder; };
plot.getCanvas = function() { return surface.element; };
plot.getPlotOffset = function() { return plotOffset; };
plot.width = function () { return plotWidth; };
plot.height = function () { return plotHeight; };
plot.offset = function () {
plot.width = function() { return plotWidth; };
plot.height = function() { return plotHeight; };
plot.offset = function() {
var o = eventHolder.offset();
o.left += plotOffset.left;
o.top += plotOffset.top;
return o;
};
plot.getData = function () { return series; };
plot.getAxes = function () {
plot.getData = function() { return series; };
plot.getAxes = function() {
var res = {};
$.each(xaxes.concat(yaxes), function (_, axis) {
$.each(xaxes.concat(yaxes), function(_, axis) {
if (axis) {
res[axis.direction + (axis.n !== 1 ? axis.n : "") + "axis"] = axis;
}
});
return res;
};
plot.getXAxes = function () { return xaxes; };
plot.getYAxes = function () { return yaxes; };
plot.getXAxes = function() { return xaxes; };
plot.getYAxes = function() { return yaxes; };
plot.c2p = canvasToAxisCoords;
plot.p2c = axisToCanvasCoords;
plot.getOptions = function () { return options; };
plot.getOptions = function() { return options; };
plot.highlight = highlight;
plot.unhighlight = unhighlight;
plot.triggerRedrawOverlay = triggerRedrawOverlay;
......@@ -775,7 +775,7 @@ Licensed under the MIT license.
};
};
plot.shutdown = shutdown;
plot.destroy = function () {
plot.destroy = function() {
shutdown();
placeholder.removeData("plot").empty();
......@@ -792,7 +792,7 @@ Licensed under the MIT license.
highlights = [];
plot = null;
};
plot.resize = function (width, height) {
plot.resize = function(width, height) {
width = width || placeholder.width();
height = height || placeholder.height();
surface.resize(width, height);
......@@ -1099,7 +1099,7 @@ Licensed under the MIT license.
function allAxes() {
// return flat array without annoying null entries
return $.grep(xaxes.concat(yaxes), function (a) { return a; });
return $.grep(xaxes.concat(yaxes), function(a) { return a; });
}
function canvasToAxisCoords(pos) {
......@@ -1291,7 +1291,7 @@ Licensed under the MIT license.
}
}
$.each(allAxes(), function (_, axis) {
$.each(allAxes(), function(_, axis) {
// init axis
axis.datamin = topSentry;
axis.datamax = bottomSentry;
......@@ -1473,7 +1473,7 @@ Licensed under the MIT license.
updateAxis(s.yaxis, ymin, ymax);
}
$.each(allAxes(), function (_, axis) {
$.each(allAxes(), function(_, axis) {
if (axis.datamin === topSentry) {
axis.datamin = null;
}
......@@ -1574,15 +1574,15 @@ Licensed under the MIT license.
// data point to canvas coordinate
if (t === identity) { // slight optimization
axis.p2c = function (p) { return (p - m) * s; };
axis.p2c = function(p) { return (p - m) * s; };
} else {
axis.p2c = function (p) { return (t(p) - m) * s; };
axis.p2c = function(p) { return (t(p) - m) * s; };
}
// canvas coordinate to data point
if (!it) {
axis.c2p = function (c) { return m + c / s; };
axis.c2p = function(c) { return m + c / s; };
} else {
axis.c2p = function (c) { return it(m + c / s); };
axis.c2p = function(c) { return it(m + c / s); };
}
}
......@@ -1756,7 +1756,7 @@ Licensed under the MIT license.
// check axis labels, note we don't check the actual
// labels but instead use the overall width/height to not
// jump as much around with replots
$.each(allAxes(), function (_, axis) {
$.each(allAxes(), function(_, axis) {
if (axis.reserveSpace && axis.ticks && axis.ticks.length) {
var lastTick = axis.ticks[axis.ticks.length - 1];
if (axis.direction === "x") {
......@@ -1806,7 +1806,7 @@ Licensed under the MIT license.
}
// init axes
$.each(axes, function (_, axis) {
$.each(axes, function(_, axis) {
axis.show = axis.options.show;
if (axis.show == null) {
axis.show = axis.used; // by default an axis is visible if it's got data
......@@ -1819,9 +1819,9 @@ Licensed under the MIT license.
if (showGrid) {
var allocatedAxes = $.grep(axes, function (axis) { return axis.reserveSpace; });
var allocatedAxes = $.grep(axes, function(axis) { return axis.reserveSpace; });
$.each(allocatedAxes, function (_, axis) {
$.each(allocatedAxes, function(_, axis) {
// make the ticks
setupTickGeneration(axis);
setTicks(axis);
......@@ -1840,7 +1840,7 @@ Licensed under the MIT license.
// might stick out
adjustLayoutForThingsStickingOut();
$.each(allocatedAxes, function (_, axis) {
$.each(allocatedAxes, function(_, axis) {
allocateAxisBoxSecondPhase(axis);
});
}
......@@ -1849,7 +1849,7 @@ Licensed under the MIT license.
plotHeight = surface.height - plotOffset.bottom - plotOffset.top;
// now we got the proper plot dimensions, we can compute the scaling
$.each(axes, function (_, axis) {
$.each(axes, function(_, axis) {
setTransformationHelpers(axis);
});
......@@ -1964,7 +1964,7 @@ Licensed under the MIT license.
if (!axis.tickGenerator) {
axis.tickGenerator = function (axis) {
axis.tickGenerator = function(axis) {
var ticks = [],
start = floorInBase(axis.min, axis.tickSize),
......@@ -1981,7 +1981,7 @@ Licensed under the MIT license.
return ticks;
};
axis.tickFormatter = function (value, axis) {
axis.tickFormatter = function(value, axis) {
var factor = axis.tickDecimals ? Math.pow(10, axis.tickDecimals) : 1;
var formatted = "" + Math.round(value * factor) / factor;
......@@ -2002,7 +2002,7 @@ Licensed under the MIT license.
}
if ($.isFunction(opts.tickFormatter)) {
axis.tickFormatter = function (v, axis) { return "" + opts.tickFormatter(v, axis); };
axis.tickFormatter = function(v, axis) { return "" + opts.tickFormatter(v, axis); };
}
if (opts.alignTicksWithAxis != null) {
......@@ -2019,7 +2019,7 @@ Licensed under the MIT license.
}
}
axis.tickGenerator = function (axis) {
axis.tickGenerator = function(axis) {
// copy ticks, scaled to this axis
var ticks = [], v, i;
for (i = 0; i < otherAxis.ticks.length; ++i) {
......@@ -2481,7 +2481,7 @@ Licensed under the MIT license.
function drawAxisLabels() {
$.each(allAxes(), function (_, axis) {
$.each(allAxes(), function(_, axis) {
var box = axis.box,
axisOptions = axis.options,
......@@ -3050,7 +3050,7 @@ Licensed under the MIT license.
barLeft = -series.bars.barWidth / 2;
}
var fillStyleCallback = series.bars.fill ? function (bottom, top) { return getFillStyle(series.bars, series.color, bottom, top); } : null;
var fillStyleCallback = series.bars.fill ? function(bottom, top) { return getFillStyle(series.bars, series.color, bottom, top); } : null;
plotBars(series.datapoints, barLeft, barLeft + series.bars.barWidth, fillStyleCallback, series.xaxis, series.yaxis);
ctx.restore();
}
......@@ -3332,20 +3332,20 @@ Licensed under the MIT license.
function onMouseMove(e) {
if (options.grid.hoverable) {
triggerClickHoverEvent("plothover", e,
function (s) { return s.hoverable !== false; });
function(s) { return s.hoverable !== false; });
}
}
function onMouseLeave(e) {
if (options.grid.hoverable) {
triggerClickHoverEvent("plothover", e,
function () { return false; });
function() { return false; });
}
}
function onClick(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
......@@ -3528,7 +3528,7 @@ Licensed under the MIT license.
octx.strokeStyle = highlightColor;
drawBar(point[0], point[1], point[2] || 0, barLeft, barLeft + series.bars.barWidth,
function () { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal, series.bars.lineWidth);
function() { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal, series.bars.lineWidth);
}
function getColorOrGradient(spec, bottom, top, defaultColor) {
......
......@@ -79,7 +79,7 @@ can set the default in the options.
*/
(function ($) {
(function($) {
var options = {
xaxis: {
zoomRange: null, // or [number, number] (min range, max range)
......@@ -137,7 +137,7 @@ can set the default in the options.
return;
}
panTimeout = setTimeout(function () {
panTimeout = setTimeout(function() {
plot.pan({ left: prevPageX - e.pageX,
top: prevPageY - e.pageY });
prevPageX = e.pageX;
......@@ -172,7 +172,7 @@ can set the default in the options.
}
}
plot.zoomOut = function (args) {
plot.zoomOut = function(args) {
if (!args) {
args = {};
}
......@@ -185,7 +185,7 @@ can set the default in the options.
plot.zoom(args);
};
plot.zoom = function (args) {
plot.zoom = function(args) {
if (!args) {
args = {};
}
......@@ -260,7 +260,7 @@ can set the default in the options.
}
};
plot.pan = function (args) {
plot.pan = function(args) {
var delta = {
x: +args.left,
y: +args.top
......@@ -273,7 +273,7 @@ can set the default in the options.
delta.y = 0;
}
$.each(plot.getAxes(), function (_, axis) {
$.each(plot.getAxes(), function(_, axis) {
var opts = axis.options,
min = axis.c2p(axis.p2c(axis.min) + d),
......
......@@ -11,7 +11,7 @@ can just fix the size of their placeholders.
*/
(function ($) {
(function($) {
var options = { }; // no options
function init(plot) {
......
......@@ -78,7 +78,7 @@ The plugin allso adds the following methods to the plot object:
*/
(function ($) {
(function($) {
function init(plot) {
var selection = {
......@@ -124,11 +124,11 @@ The plugin allso adds the following methods to the plot object:
// prevent text selection and drag in old-school browsers
if (document.onselectstart !== undefined && savedhandlers.onselectstart === null) {
savedhandlers.onselectstart = document.onselectstart;
document.onselectstart = function () { return false; };
document.onselectstart = function() { return false; };
}
if (document.ondrag !== undefined && savedhandlers.ondrag === null) {
savedhandlers.ondrag = document.ondrag;
document.ondrag = function () { return false; };
document.ondrag = function() { return false; };
}
setSelectionPos(selection.first, e);
......@@ -137,7 +137,7 @@ The plugin allso adds the following methods to the plot object:
// this is a bit silly, but we have to use a closure to be
// able to whack the same handler again
mouseUpHandler = function (e) { onMouseUp(e); };
mouseUpHandler = function(e) { onMouseUp(e); };
$(document).one(selection.touch ? "touchend" : "mouseup", mouseUpHandler);
}
......@@ -179,7 +179,7 @@ The plugin allso adds the following methods to the plot object:
c1 = selection.first,
c2 = selection.second;
$.each(plot.getAxes(), function (name, axis) {
$.each(plot.getAxes(), function(name, axis) {
if (axis.used) {
var p1 = axis.c2p(c1[axis.direction]),
p2 = axis.c2p(c2[axis.direction]);
......@@ -339,7 +339,7 @@ The plugin allso adds the following methods to the plot object:
});
plot.hooks.drawOverlay.push(function (plot, ctx) {
plot.hooks.drawOverlay.push(function(plot, ctx) {
// draw selection
if (selection.show && selectionIsSane()) {
var plotOffset = plot.getPlotOffset();
......@@ -367,7 +367,7 @@ The plugin allso adds the following methods to the plot object:
}
});
plot.hooks.shutdown.push(function (plot, eventHolder) {
plot.hooks.shutdown.push(function(plot, eventHolder) {
eventHolder.unbind("mousemove", onMouseMove);
eventHolder.unbind("mousedown", onMouseDown);
if (mouseUpHandler) {
......
......@@ -35,7 +35,7 @@ charts or filled areas).
*/
(function ($) {
(function($) {
var options = {
series: { stack: null } // or number/string
};
......
......@@ -13,18 +13,18 @@ The symbols are accessed as strings through the standard symbol options:
*/
(function ($) {
(function($) {
function processRawData(plot, series) {
// we normalize the area of each symbol so it is approximately the
// same as a circle of the given radius
var handlers = {
square: function (ctx, x, y, radius) {
square: function(ctx, x, y, radius) {
// pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
var size = radius * Math.sqrt(Math.PI) / 2;
ctx.rect(x - size, y - size, size + size, size + size);
},
diamond: function (ctx, x, y, radius) {
diamond: function(ctx, x, y, radius) {
// pi * r^2 = 2s^2 => s = r * sqrt(pi/2)
var size = radius * Math.sqrt(Math.PI / 2);
ctx.moveTo(x - size, y);
......@@ -33,7 +33,7 @@ The symbols are accessed as strings through the standard symbol options:
ctx.lineTo(x, y + size);
ctx.lineTo(x - size, y);
},
triangle: function (ctx, x, y, radius, shadow) {
triangle: function(ctx, x, y, radius, shadow) {
// 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 height = size * Math.sin(Math.PI / 3);
......@@ -44,7 +44,7 @@ The symbols are accessed as strings through the standard symbol options:
ctx.lineTo(x - size/2, y + height/2);
}
},
cross: function (ctx, x, y, radius) {
cross: function(ctx, x, y, radius) {
// pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
var size = radius * Math.sqrt(Math.PI) / 2;
ctx.moveTo(x - size, y - size);
......
......@@ -43,7 +43,7 @@ You may need to check for this in hover events.
*/
(function ($) {
(function($) {
var options = {
series: { threshold: null } // or { below: number, color: color spec}
};
......
......@@ -226,7 +226,7 @@ API.txt for details.
[1, "year"]]);
function init(plot) {
plot.hooks.processOptions.push(function (plot) {
plot.hooks.processOptions.push(function(plot) {
$.each(plot.getAxes(), function(axisName, axis) {
var opts = axis.options;
......@@ -385,7 +385,7 @@ API.txt for details.
return ticks;
};
axis.tickFormatter = function (v, axis) {
axis.tickFormatter = function(v, axis) {
var d = dateGenerator(v, axis.options);
......
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