diff --git a/API.txt b/API.txt index 2861cf3..73bd3b3 100644 --- a/API.txt +++ b/API.txt @@ -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: diff --git a/NEWS.txt b/NEWS.txt index bf8281d..a172ac2 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -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 diff --git a/jquery.flot.js b/jquery.flot.js index 0fdbaa1..30ec6e0 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -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; }