Add support for Infinity/-Infinity by hacking it into +/- Number.MAX_VALUE (closes issue 444)

git-svn-id: https://flot.googlecode.com/svn/trunk@294 1e0a6537-2640-0410-bfb7-f154510ff394
pull/1/head
olau@iola.dk 15 years ago
parent d8e20bf13b
commit 70e36134d6

@ -78,6 +78,8 @@ Changes:
types (sponsored by Utility Data Corporation).
- Resize plugin for automatically redrawing when the placeholder
changes size, e.g. on window resizes (sponsored by Novus Partners).
- Support Infinity/-Infinity for plotting asymptotes by hacking it
into +/-Number.MAX_VALUE (reported by rabaea.mircea).
- New hooks: drawSeries

@ -500,6 +500,7 @@
function processData() {
var topSentry = Number.POSITIVE_INFINITY,
bottomSentry = Number.NEGATIVE_INFINITY,
fakeInfinity = Number.MAX_VALUE,
i, j, k, m, length,
s, points, ps, x, y, axis, val, f, p;
@ -513,9 +514,9 @@
}
function updateAxis(axis, min, max) {
if (min < axis.datamin)
if (min < axis.datamin && min != -fakeInfinity)
axis.datamin = min;
if (max > axis.datamax)
if (max > axis.datamax && max != fakeInfinity)
axis.datamax = max;
}
@ -579,6 +580,10 @@
val = +val; // convert to number
if (isNaN(val))
val = null;
else if (val == Infinity)
val = fakeInfinity;
else if (val == -Infinity)
val = -fakeInfinity;
}
if (val == null) {

Loading…
Cancel
Save