Commit e1684b46 authored by David Schnur's avatar David Schnur

Remove trailing white-space.

parent 68337794
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
o[c.charAt(i)] += d; o[c.charAt(i)] += d;
return o.normalize(); return o.normalize();
}; };
o.scale = function (c, f) { o.scale = function (c, f) {
for (var i = 0; i < c.length; ++i) for (var i = 0; i < c.length; ++i)
o[c.charAt(i)] *= f; o[c.charAt(i)] *= f;
return o.normalize(); return o.normalize();
}; };
o.toString = function () { o.toString = function () {
if (o.a >= 1.0) { if (o.a >= 1.0) {
return "rgb("+[o.r, o.g, o.b].join(",")+")"; return "rgb("+[o.r, o.g, o.b].join(",")+")";
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
function clamp(min, value, max) { function clamp(min, value, max) {
return value < min ? min: (value > max ? max: value); return value < min ? min: (value > max ? max: value);
} }
o.r = clamp(0, parseInt(o.r, 10), 255); o.r = clamp(0, parseInt(o.r, 10), 255);
o.g = clamp(0, parseInt(o.g, 10), 255); o.g = clamp(0, parseInt(o.g, 10), 255);
o.b = clamp(0, parseInt(o.b, 10), 255); o.b = clamp(0, parseInt(o.b, 10), 255);
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
// 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";
return $.color.parse(c); return $.color.parse(c);
}; };
// parse CSS color string (like "rgb(10, 32, 43)" or "#fff"), // parse CSS color string (like "rgb(10, 32, 43)" or "#fff"),
// returns color object, if parsing failed, you get black (0, 0, // returns color object, if parsing failed, you get black (0, 0,
// 0) out // 0) out
...@@ -100,12 +100,12 @@ ...@@ -100,12 +100,12 @@
res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str); res = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str);
if (res) if (res)
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10)); return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10));
// Look for rgba(num,num,num,num) // Look for rgba(num,num,num,num)
res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str); res = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str);
if (res) if (res)
return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4])); return m(parseInt(res[1], 10), parseInt(res[2], 10), parseInt(res[3], 10), parseFloat(res[4]));
// Look for rgb(num%,num%,num%) // Look for rgb(num%,num%,num%)
res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str); res = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str);
if (res) if (res)
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str); res = /rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str);
if (res) if (res)
return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55, parseFloat(res[4])); return m(parseFloat(res[1])*2.55, parseFloat(res[2])*2.55, parseFloat(res[3])*2.55, parseFloat(res[4]));
// Look for #a0b1c2 // Look for #a0b1c2
res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str); res = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str);
if (res) if (res)
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
return m(res[0], res[1], res[2]); return m(res[0], res[1], res[2]);
} }
}; };
var lookupColors = { var lookupColors = {
aqua:[0,255,255], aqua:[0,255,255],
azure:[240,255,255], azure:[240,255,255],
......
...@@ -52,7 +52,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -52,7 +52,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
categories: null categories: null
} }
}; };
function processRawData(plot, series, data, datapoints) { function processRawData(plot, series, data, datapoints) {
// if categories are enabled, we need to disable // if categories are enabled, we need to disable
// auto-transformation to numbers so the strings are intact // auto-transformation to numbers so the strings are intact
...@@ -60,7 +60,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -60,7 +60,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
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;
...@@ -81,14 +81,14 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -81,14 +81,14 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
format[format.length - 1].x = true; format[format.length - 1].x = true;
} }
} }
datapoints.format = format; datapoints.format = format;
} }
for (var m = 0; m < format.length; ++m) { for (var m = 0; m < format.length; ++m) {
if (format[m].x && xCategories) if (format[m].x && xCategories)
format[m].number = false; format[m].number = false;
if (format[m].y && yCategories) if (format[m].y && yCategories)
format[m].number = false; format[m].number = false;
} }
...@@ -96,7 +96,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -96,7 +96,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
function getNextIndex(categories) { function getNextIndex(categories) {
var index = -1; var index = -1;
for (var v in categories) for (var v in categories)
if (categories[v] > index) if (categories[v] > index)
index = categories[v]; index = categories[v];
...@@ -116,11 +116,11 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -116,11 +116,11 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
return res; return res;
} }
function setupCategoriesForAxis(series, axis, datapoints) { function setupCategoriesForAxis(series, axis, datapoints) {
if (series[axis].options.mode != "categories") if (series[axis].options.mode != "categories")
return; return;
if (!series[axis].categories) { if (!series[axis].categories) {
// parse options // parse options
var c = {}, o = series[axis].options.categories || {}; var c = {}, o = series[axis].options.categories || {};
...@@ -132,7 +132,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -132,7 +132,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
for (var v in o) for (var v in o)
c[v] = o[v]; c[v] = o[v];
} }
series[axis].categories = c; series[axis].categories = c;
} }
...@@ -142,7 +142,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -142,7 +142,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
transformPointsOnAxis(datapoints, axis, series[axis].categories); transformPointsOnAxis(datapoints, axis, series[axis].categories);
} }
function transformPointsOnAxis(datapoints, axis, categories) { function transformPointsOnAxis(datapoints, axis, categories) {
// go through the points, transforming them // go through the points, transforming them
var points = datapoints.points, var points = datapoints.points,
...@@ -154,7 +154,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -154,7 +154,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
for (var i = 0; i < points.length; i += ps) { for (var i = 0; i < points.length; i += ps) {
if (points[i] == null) if (points[i] == null)
continue; continue;
for (var m = 0; m < ps; ++m) { for (var m = 0; m < ps; ++m) {
var val = points[i + m]; var val = points[i + m];
...@@ -165,7 +165,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -165,7 +165,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
categories[val] = index; categories[val] = index;
++index; ++index;
} }
points[i + m] = categories[val]; points[i + m] = categories[val];
} }
} }
...@@ -180,7 +180,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories. ...@@ -180,7 +180,7 @@ as "categories" on the axis object, e.g. plot.getAxes().xaxis.categories.
plot.hooks.processRawData.push(processRawData); plot.hooks.processRawData.push(processRawData);
plot.hooks.processDatapoints.push(processDatapoints); plot.hooks.processDatapoints.push(processDatapoints);
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
......
...@@ -66,7 +66,7 @@ The plugin also adds four public methods: ...@@ -66,7 +66,7 @@ The plugin also adds four public methods:
lineWidth: 1 lineWidth: 1
} }
}; };
function init(plot) { function init(plot) {
// position of crosshair in pixels // position of crosshair in pixels
var crosshair = { x: -1, y: -1, locked: false }; var crosshair = { x: -1, y: -1, locked: false };
...@@ -79,12 +79,12 @@ The plugin also adds four public methods: ...@@ -79,12 +79,12 @@ The plugin also adds four public methods:
crosshair.x = Math.max(0, Math.min(o.left, plot.width())); crosshair.x = Math.max(0, Math.min(o.left, plot.width()));
crosshair.y = Math.max(0, Math.min(o.top, plot.height())); crosshair.y = Math.max(0, Math.min(o.top, plot.height()));
} }
plot.triggerRedrawOverlay(); plot.triggerRedrawOverlay();
}; };
plot.clearCrosshair = plot.setCrosshair; // passes null for pos plot.clearCrosshair = plot.setCrosshair; // passes null for pos
plot.lockCrosshair = function lockCrosshair(pos) { plot.lockCrosshair = function lockCrosshair(pos) {
if (pos) if (pos)
plot.setCrosshair(pos); plot.setCrosshair(pos);
...@@ -108,18 +108,18 @@ The plugin also adds four public methods: ...@@ -108,18 +108,18 @@ The plugin also adds four public methods:
function onMouseMove(e) { function onMouseMove(e) {
if (crosshair.locked) if (crosshair.locked)
return; return;
if (plot.getSelection && plot.getSelection()) { if (plot.getSelection && plot.getSelection()) {
crosshair.x = -1; // hide the crosshair while selecting crosshair.x = -1; // hide the crosshair while selecting
return; return;
} }
var offset = plot.offset(); var offset = plot.offset();
crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width())); crosshair.x = Math.max(0, Math.min(e.pageX - offset.left, plot.width()));
crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height())); crosshair.y = Math.max(0, Math.min(e.pageY - offset.top, plot.height()));
plot.triggerRedrawOverlay(); plot.triggerRedrawOverlay();
} }
plot.hooks.bindEvents.push(function (plot, eventHolder) { plot.hooks.bindEvents.push(function (plot, eventHolder) {
if (!plot.getOptions().crosshair.mode) if (!plot.getOptions().crosshair.mode)
return; return;
...@@ -134,7 +134,7 @@ The plugin also adds four public methods: ...@@ -134,7 +134,7 @@ The plugin also adds four public methods:
return; return;
var plotOffset = plot.getPlotOffset(); var plotOffset = plot.getPlotOffset();
ctx.save(); ctx.save();
ctx.translate(plotOffset.left, plotOffset.top); ctx.translate(plotOffset.left, plotOffset.top);
...@@ -166,7 +166,7 @@ The plugin also adds four public methods: ...@@ -166,7 +166,7 @@ The plugin also adds four public methods:
eventHolder.unbind("mousemove", onMouseMove); eventHolder.unbind("mousemove", onMouseMove);
}); });
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
......
...@@ -69,11 +69,11 @@ Google Maps). ...@@ -69,11 +69,11 @@ Google Maps).
var urls = [], points = []; var urls = [], points = [];
var defaultShow = options.series.images.show; var defaultShow = options.series.images.show;
$.each(series, function (i, s) { $.each(series, function (i, s) {
if (!(defaultShow || s.images.show)) if (!(defaultShow || s.images.show))
return; return;
if (s.data) if (s.data)
s = s.data; s = s.data;
...@@ -95,7 +95,7 @@ Google Maps). ...@@ -95,7 +95,7 @@ Google Maps).
callback(); callback();
}); });
}; };
$.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)
...@@ -104,9 +104,9 @@ Google Maps). ...@@ -104,9 +104,9 @@ Google Maps).
$.each(urls, function (i, url) { $.each(urls, function (i, url) {
var handler = function () { var handler = function () {
--missing; --missing;
loaded[url] = this; loaded[url] = this;
if (missing == 0) if (missing == 0)
callback(loaded); callback(loaded);
}; };
...@@ -114,16 +114,16 @@ Google Maps). ...@@ -114,16 +114,16 @@ Google Maps).
$('<img />').load(handler).error(handler).attr('src', url); $('<img />').load(handler).error(handler).attr('src', url);
}); });
}; };
function drawSeries(plot, ctx, series) { function drawSeries(plot, ctx, series) {
var plotOffset = plot.getPlotOffset(); var plotOffset = plot.getPlotOffset();
if (!series.images || !series.images.show) if (!series.images || !series.images.show)
return; return;
var points = series.datapoints.points, var points = series.datapoints.points,
ps = series.datapoints.pointsize; ps = series.datapoints.pointsize;
for (var i = 0; i < points.length; i += ps) { for (var i = 0; i < points.length; i += ps) {
var img = points[i], var img = points[i],
x1 = points[i + 1], y1 = points[i + 2], x1 = points[i + 1], y1 = points[i + 2],
...@@ -147,7 +147,7 @@ Google Maps). ...@@ -147,7 +147,7 @@ Google Maps).
y2 = y1; y2 = y1;
y1 = tmp; y1 = tmp;
} }
// 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") {
...@@ -158,7 +158,7 @@ Google Maps). ...@@ -158,7 +158,7 @@ Google Maps).
y1 -= tmp; y1 -= tmp;
y2 += tmp; y2 += tmp;
} }
// clip // clip
if (x1 == x2 || y1 == y2 || if (x1 == x2 || y1 == y2 ||
x1 >= xaxis.max || x2 <= xaxis.min || x1 >= xaxis.max || x2 <= xaxis.min ||
...@@ -185,12 +185,12 @@ Google Maps). ...@@ -185,12 +185,12 @@ Google Maps).
sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1); sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1);
y2 = yaxis.max; y2 = yaxis.max;
} }
x1 = xaxis.p2c(x1); x1 = xaxis.p2c(x1);
x2 = xaxis.p2c(x2); x2 = xaxis.p2c(x2);
y1 = yaxis.p2c(y1); y1 = yaxis.p2c(y1);
y2 = yaxis.p2c(y2); y2 = yaxis.p2c(y2);
// the transformation may have swapped us // the transformation may have swapped us
if (x1 > x2) { if (x1 > x2) {
tmp = x2; tmp = x2;
...@@ -226,12 +226,12 @@ Google Maps). ...@@ -226,12 +226,12 @@ Google Maps).
{ y: true, number: true, required: true } { y: true, number: true, required: true }
]; ];
} }
function init(plot) { function init(plot) {
plot.hooks.processRawData.push(processRawData); plot.hooks.processRawData.push(processRawData);
plot.hooks.drawSeries.push(drawSeries); plot.hooks.drawSeries.push(drawSeries);
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
......
This diff is collapsed.
...@@ -38,7 +38,7 @@ can just fix the size of their placeholders. ...@@ -38,7 +38,7 @@ can just fix the size of their placeholders.
plot.setupGrid(); plot.setupGrid();
plot.draw(); plot.draw();
} }
function bindEvents(plot, eventHolder) { function bindEvents(plot, eventHolder) {
plot.getPlaceholder().resize(onResize); plot.getPlaceholder().resize(onResize);
} }
...@@ -46,11 +46,11 @@ can just fix the size of their placeholders. ...@@ -46,11 +46,11 @@ can just fix the size of their placeholders.
function shutdown(plot, eventHolder) { function shutdown(plot, eventHolder) {
plot.getPlaceholder().unbind("resize", onResize); plot.getPlaceholder().unbind("resize", onResize);
} }
plot.hooks.bindEvents.push(bindEvents); plot.hooks.bindEvents.push(bindEvents);
plot.hooks.shutdown.push(shutdown); plot.hooks.shutdown.push(shutdown);
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
......
...@@ -94,11 +94,11 @@ The plugin allso adds the following methods to the plot object: ...@@ -94,11 +94,11 @@ The plugin allso adds the following methods to the plot object:
var savedhandlers = {}; var savedhandlers = {};
var mouseUpHandler = null; var mouseUpHandler = null;
function onMouseMove(e) { function onMouseMove(e) {
if (selection.active) { if (selection.active) {
updateSelection(e); updateSelection(e);
plot.getPlaceholder().trigger("plotselecting", [ getSelection() ]); plot.getPlaceholder().trigger("plotselecting", [ getSelection() ]);
} }
} }
...@@ -106,7 +106,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -106,7 +106,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;
// cancel out any text selections // cancel out any text selections
document.body.focus(); document.body.focus();
...@@ -127,13 +127,13 @@ The plugin allso adds the following methods to the plot object: ...@@ -127,13 +127,13 @@ 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 // this is a bit silly, but we have to use a closure to be
// able to whack the same handler again // able to whack the same handler again
mouseUpHandler = function (e) { onMouseUp(e); }; mouseUpHandler = function (e) { onMouseUp(e); };
$(document).one("mouseup", mouseUpHandler); $(document).one("mouseup", mouseUpHandler);
} }
function onMouseUp(e) { function onMouseUp(e) {
mouseUpHandler = null; mouseUpHandler = null;
// revert drag stuff for old-school browsers // revert drag stuff for old-school browsers
if (document.onselectstart !== undefined) if (document.onselectstart !== undefined)
document.onselectstart = savedhandlers.onselectstart; document.onselectstart = savedhandlers.onselectstart;
...@@ -158,7 +158,7 @@ The plugin allso adds the following methods to the plot object: ...@@ -158,7 +158,7 @@ The plugin allso adds the following methods to the plot object:
function getSelection() { function getSelection() {
if (!selectionIsSane()) if (!selectionIsSane())
return null; return null;
if (!selection.show) return null; if (!selection.show) return null;
var r = {}, c1 = selection.first, c2 = selection.second; var r = {}, c1 = selection.first, c2 = selection.second;
...@@ -252,10 +252,10 @@ The plugin allso adds the following methods to the plot object: ...@@ -252,10 +252,10 @@ The plugin allso adds the following methods to the plot object:
from = to; from = to;
to = tmp; to = tmp;
} }
return { from: from, to: to, axis: axis }; return { from: from, to: to, axis: axis };
} }
function setSelection(ranges, preventEvent) { function setSelection(ranges, preventEvent) {
var axis, range, o = plot.getOptions(); var axis, range, o = plot.getOptions();
...@@ -333,11 +333,11 @@ The plugin allso adds the following methods to the plot object: ...@@ -333,11 +333,11 @@ The plugin allso adds the following methods to the plot object:
ctx.restore(); ctx.restore();
} }
}); });
plot.hooks.shutdown.push(function (plot, eventHolder) { plot.hooks.shutdown.push(function (plot, eventHolder) {
eventHolder.unbind("mousemove", onMouseMove); eventHolder.unbind("mousemove", onMouseMove);
eventHolder.unbind("mousedown", onMouseDown); eventHolder.unbind("mousedown", onMouseDown);
if (mouseUpHandler) if (mouseUpHandler)
$(document).unbind("mouseup", mouseUpHandler); $(document).unbind("mouseup", mouseUpHandler);
}); });
......
...@@ -39,21 +39,21 @@ charts or filled areas). ...@@ -39,21 +39,21 @@ charts or filled areas).
var options = { var options = {
series: { stack: null } // or number/string series: { stack: null } // or number/string
}; };
function init(plot) { function init(plot) {
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];
} }
return res; return res;
} }
function stackData(plot, s, datapoints) { function stackData(plot, s, datapoints) {
if (s.stack == null || s.stack === false) if (s.stack == null || s.stack === false)
return; return;
...@@ -118,7 +118,7 @@ charts or filled areas). ...@@ -118,7 +118,7 @@ charts or filled areas).
newpoints[l + accumulateOffset] += qy; newpoints[l + accumulateOffset] += qy;
bottom = qy; bottom = qy;
i += ps; i += ps;
j += otherps; j += otherps;
} }
...@@ -142,22 +142,22 @@ charts or filled areas). ...@@ -142,22 +142,22 @@ charts or filled areas).
i += ps; i += ps;
continue; continue;
} }
for (m = 0; m < ps; ++m) for (m = 0; m < ps; ++m)
newpoints.push(points[i + m]); newpoints.push(points[i + m]);
// we might be able to interpolate a point below, // we might be able to interpolate a point below,
// this can give us a better y // this can give us a better y
if (withlines && j > 0 && otherpoints[j - otherps] != null) if (withlines && j > 0 && otherpoints[j - otherps] != null)
bottom = qy + (otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx) / (otherpoints[j - otherps + keyOffset] - qx); bottom = qy + (otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx) / (otherpoints[j - otherps + keyOffset] - qx);
newpoints[l + accumulateOffset] += bottom; newpoints[l + accumulateOffset] += bottom;
i += ps; i += ps;
} }
fromgap = false; fromgap = false;
if (l != newpoints.length && withbottom) if (l != newpoints.length && withbottom)
newpoints[l + 2] += bottom; newpoints[l + 2] += bottom;
} }
...@@ -175,10 +175,10 @@ charts or filled areas). ...@@ -175,10 +175,10 @@ charts or filled areas).
datapoints.points = newpoints; datapoints.points = newpoints;
} }
plot.hooks.processDatapoints.push(stackData); plot.hooks.processDatapoints.push(stackData);
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
......
...@@ -58,11 +58,11 @@ The symbols are accessed as strings through the standard symbol options: ...@@ -58,11 +58,11 @@ The symbols are accessed as strings through the standard symbol options:
if (handlers[s]) if (handlers[s])
series.points.symbol = handlers[s]; series.points.symbol = handlers[s];
} }
function init(plot) { function init(plot) {
plot.hooks.processDatapoints.push(processRawData); plot.hooks.processDatapoints.push(processRawData);
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
name: 'symbols', name: 'symbols',
......
...@@ -46,7 +46,7 @@ You may need to check for this in hover events. ...@@ -46,7 +46,7 @@ You may need to check for this in hover events.
var options = { var options = {
series: { threshold: null } // or { below: number, color: color spec} series: { threshold: null } // or { below: number, color: color spec}
}; };
function init(plot) { function init(plot) {
function thresholdData(plot, s, datapoints, below, color) { function thresholdData(plot, s, datapoints, below, color) {
var ps = datapoints.pointsize, i, x, y, p, prevp, var ps = datapoints.pointsize, i, x, y, p, prevp,
...@@ -58,7 +58,7 @@ You may need to check for this in hover events. ...@@ -58,7 +58,7 @@ You may need to check for this in hover events.
thresholded.threshold = null; thresholded.threshold = null;
thresholded.originSeries = s; thresholded.originSeries = s;
thresholded.data = []; thresholded.data = [];
var origpoints = datapoints.points, var origpoints = datapoints.points,
addCrossingPoints = s.lines.show; addCrossingPoints = s.lines.show;
...@@ -83,7 +83,7 @@ You may need to check for this in hover events. ...@@ -83,7 +83,7 @@ You may need to check for this in hover events.
prevp.push(below); prevp.push(below);
for (m = 2; m < ps; ++m) for (m = 2; m < ps; ++m)
prevp.push(origpoints[i + m]); prevp.push(origpoints[i + m]);
p.push(null); // start new segment p.push(null); // start new segment
p.push(null); p.push(null);
for (m = 2; m < ps; ++m) for (m = 2; m < ps; ++m)
...@@ -102,25 +102,25 @@ You may need to check for this in hover events. ...@@ -102,25 +102,25 @@ You may need to check for this in hover events.
datapoints.points = newpoints; datapoints.points = newpoints;
thresholded.datapoints.points = threspoints; thresholded.datapoints.points = threspoints;
if (thresholded.datapoints.points.length > 0) { if (thresholded.datapoints.points.length > 0) {
var origIndex = $.inArray(s, plot.getData()); var origIndex = $.inArray(s, plot.getData());
// Insert newly-generated series right after original one (to prevent it from becoming top-most) // Insert newly-generated series right after original one (to prevent it from becoming top-most)
plot.getData().splice(origIndex + 1, 0, thresholded); plot.getData().splice(origIndex + 1, 0, thresholded);
} }
// FIXME: there are probably some edge cases left in bars // FIXME: there are probably some edge cases left in bars
} }
function processThresholds(plot, s, datapoints) { function processThresholds(plot, s, datapoints) {
if (!s.threshold) if (!s.threshold)
return; return;
if (s.threshold instanceof Array) { if (s.threshold instanceof Array) {
s.threshold.sort(function(a, b) { s.threshold.sort(function(a, b) {
return a.below - b.below; return a.below - b.below;
}); });
$(s.threshold).each(function(i, th) { $(s.threshold).each(function(i, th) {
thresholdData(plot, s, datapoints, th.below, th.color); thresholdData(plot, s, datapoints, th.below, th.color);
}); });
...@@ -129,10 +129,10 @@ You may need to check for this in hover events. ...@@ -129,10 +129,10 @@ You may need to check for this in hover events.
thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color); thresholdData(plot, s, datapoints, s.threshold.below, s.threshold.color);
} }
} }
plot.hooks.processDatapoints.push(processThresholds); plot.hooks.processDatapoints.push(processThresholds);
} }
$.plot.plugins.push({ $.plot.plugins.push({
init: init, init: init,
options: options, options: options,
......
...@@ -158,7 +158,7 @@ API.txt for details. ...@@ -158,7 +158,7 @@ API.txt for details.
return makeUtcWrapper(new Date(ts)); return makeUtcWrapper(new Date(ts));
} }
} }
// map of app. size of time units in milliseconds // map of app. size of time units in milliseconds
var timeUnitSize = { var timeUnitSize = {
......
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