Commit 70e36134 authored by olau@iola.dk's avatar olau@iola.dk

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
parent d8e20bf1
......@@ -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) {
......
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