Commit cba14862 authored by olau@iola.dk's avatar olau@iola.dk

Convert data coordinates explicitly to numbers

git-svn-id: https://flot.googlecode.com/svn/trunk@53 1e0a6537-2640-0410-bfb7-f154510ff394
parent 1d8f4807
......@@ -39,13 +39,14 @@ E.g.
Note that to simplify the internal logic in Flot both the x and y
values must be numbers, even if specifying time series (see below for
how to do this). This is a common problem because you might
accidentally retrieve data from the database as strings and serialize
them directly to JSON without noticing the wrong type.
accidentally retrieve data from the database and serialize them
directly to JSON without noticing the wrong type.
If a null is specified as a point or if one of the coordinates is null
or NaN, the point is ignored. As a special case, a null value for
lines is interpreted as a line segment end, i.e. the two points before
and after the null value are not connected.
or NaN or couldn't be converted to a number, the point is ignored. As
a special case, a null value for lines is interpreted as a line
segment end, i.e. the two points before and after the null value are
not connected.
The format of a single series object is as follows:
......
......@@ -21,16 +21,21 @@ directly with axis.minTickSize and axis.tickSize.
Cleaned up the automatic axis scaling algorithm and fixed how it
interacts with ticks. Also fixed a couple of tick-related corner case
bugs.
bugs (one reported by mainstreetmark).
The option axis.tickFormatter now takes a function with two
parameters, the second parameter is an optional object with
information about the axis. It has min, max, tickDecimals, tickSize.
Added support for segmented lines (based on patch from Michael
MacDonald) and for ignoring null values (suggestion from Nick
Konidaris).
Fixed a bug in handling single-item bar series (reported by Emil
Filipov). Fixed erratic behaviour when interacting with the plot
with IE 7 (reported by Lau Bech Lauritzen). Prevent IE/Safari text
selection when selecting stuff on the canvas.
selection when selecting stuff on the canvas. The data is now
implicitly converted to
......
......@@ -202,7 +202,8 @@
var x = data[j][0], y = data[j][1];
if (x == null || isNaN(x) || y == null || isNaN(y)) {
// convert to number
if (x == null || y == null || isNaN(x = +x) || isNaN(y = +y)) {
data[j] = null; // mark this point as invalid
continue;
}
......
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