From 866a9fb9e17d66fb417dad57fc5aa7b64dfd568d Mon Sep 17 00:00:00 2001 From: David Schnur Date: Wed, 10 Apr 2013 07:40:26 -0400 Subject: [PATCH 01/35] Added new feature work branch guidelines. --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e4eafe1..eef971b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,11 @@ To make merging as easy as possible, please keep these rules in mind: 2. Format your code according to the style guidelines below. - 3. Rebase against master, if necessary, before submitting your pull request. + 3. Submit new features or architectural changes to the -work branch + for the next major release. Submit bug fixes to the master branch. + + 4. Rebase, if necessary, before submitting your pull request, to reduce the + work we need to do to merge it. ### Flot Style Guidelines ### From 0f83ac3d5cecc10d6616f1eeb1a2e23fdac803da Mon Sep 17 00:00:00 2001 From: David Schnur Date: Thu, 11 Apr 2013 20:37:02 -0400 Subject: [PATCH 02/35] Fixed missing semicolons. --- jquery.flot.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index b377809..25b39e4 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -410,7 +410,7 @@ Licensed under the MIT license. if (layerCache != null) { for (var styleKey in layerCache) { if (hasOwnProperty.call(layerCache, styleKey)) { - var styleCache = layerCache[styleKey] + var styleCache = layerCache[styleKey]; for (var key in styleCache) { if (hasOwnProperty.call(styleCache, key)) { styleCache[key].active = false; @@ -1100,7 +1100,7 @@ Licensed under the MIT license. // second pass: find datamax/datamin for auto-scaling for (i = 0; i < series.length; ++i) { s = series[i]; - points = s.datapoints.points, + points = s.datapoints.points; ps = s.datapoints.pointsize; format = s.datapoints.format; @@ -2970,7 +2970,7 @@ Licensed under the MIT license. return this.each(function() { $.plot(this, data, options); }); - } + }; // round to nearby lower multiple of base function floorInBase(n, base) { From e037f5ca56cf3c9b09880745d7f6929d8d53c881 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Thu, 11 Apr 2013 20:44:07 -0400 Subject: [PATCH 03/35] Updated version number to 0.8.1-alpha. --- NEWS.md | 3 +++ component.json | 2 +- flot.jquery.json | 2 +- jquery.flot.js | 4 ++-- package.json | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/NEWS.md b/NEWS.md index c88e906..f116c1a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +## Flot 0.8.1 ## + + ## Flot 0.8.0 ## ### API changes ### diff --git a/component.json b/component.json index 6d88c2a..95d6f4e 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "Flot", - "version": "0.8.0", + "version": "0.8.1-alpha", "main": "jquery.flot.js", "dependencies": { "jquery": ">= 1.2.6" diff --git a/flot.jquery.json b/flot.jquery.json index 81c0dd5..a7c3ed8 100644 --- a/flot.jquery.json +++ b/flot.jquery.json @@ -1,6 +1,6 @@ { "name": "flot", - "version": "0.8.0", + "version": "0.8.1-alpha", "title": "Flot", "author": { "name": "Ole Laursen", diff --git a/jquery.flot.js b/jquery.flot.js index 25b39e4..eb73cd7 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1,4 +1,4 @@ -/* Javascript plotting library for jQuery, version 0.8.0. +/* Javascript plotting library for jQuery, version 0.8.1-alpha. Copyright (c) 2007-2013 IOLA and Ole Laursen. Licensed under the MIT license. @@ -2960,7 +2960,7 @@ Licensed under the MIT license. return plot; }; - $.plot.version = "0.8.0"; + $.plot.version = "0.8.1-alpha"; $.plot.plugins = []; diff --git a/package.json b/package.json index 5e084dc..08997a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Flot", - "version": "0.8.0", + "version": "0.8.1-alpha", "main": "jquery.flot.js", "scripts": { "test": "make test" From bf3fffd1e1bc52a5d1b62976fef6688ffe06999b Mon Sep 17 00:00:00 2001 From: David Schnur Date: Thu, 11 Apr 2013 20:44:26 -0400 Subject: [PATCH 04/35] Added credits for the missing semicolon fix. --- NEWS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS.md b/NEWS.md index f116c1a..052125e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ ## Flot 0.8.1 ## +### Bug fixes ### + + - Fixed missing semicolons in the core library. + (reported by Michal Zglinski) + ## Flot 0.8.0 ## From ec7322e4ab93f390360b3aeb8f5805ae9275c261 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sat, 13 Apr 2013 16:35:00 -0400 Subject: [PATCH 05/35] Initialize time-mode support in processOptions. Resolves #1016. Initialization consists of adding the tickGenerator and tickFormatter functions to each axis. This should happen exactly once per plot, but since the code was previously using the processDatapoints hook, it was called once per series. When no series were present, it ran zero times, triggering an exception when we later checked for the existence of the functions. Binding to the processOptions hook ensures that the axes are always modified once, regardless of how many series there are. The axes are already initialized by the point the hook runs, so this change shouldn't cause any problems. --- jquery.flot.time.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.flot.time.js b/jquery.flot.time.js index 3d3360b..55c4d4f 100644 --- a/jquery.flot.time.js +++ b/jquery.flot.time.js @@ -194,7 +194,7 @@ API.txt for details. [1, "year"]]); function init(plot) { - plot.hooks.processDatapoints.push(function (plot, series, datapoints) { + plot.hooks.processOptions.push(function (plot, options) { $.each(plot.getAxes(), function(axisName, axis) { var opts = axis.options; From a2503c2e844efb18dede20d005b56d6576329097 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sat, 13 Apr 2013 16:38:04 -0400 Subject: [PATCH 06/35] Updated credits for #1016 exception fix. --- NEWS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 052125e..f52fbe7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,9 @@ - Fixed missing semicolons in the core library. (reported by Michal Zglinski) + - Avoid triggering the time-mode plugin exception when there are zero series. + (reported by Daniel Rothig, patch by Mark Raymond, issues #1016) + ## Flot 0.8.0 ## From 5594e3384245b6d2579cb0bc213d86077a2cf363 Mon Sep 17 00:00:00 2001 From: vird Date: Fri, 19 Apr 2013 15:15:39 +0300 Subject: [PATCH 07/35] Update jquery.flot.navigate.js BUGFIX navigation wheel scrolls page. --- jquery.flot.navigate.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jquery.flot.navigate.js b/jquery.flot.navigate.js index b5949b4..10256b8 100644 --- a/jquery.flot.navigate.js +++ b/jquery.flot.navigate.js @@ -135,6 +135,7 @@ Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-L } function onMouseWheel(e, delta) { + e.preventDefault(); onZoomClick(e, delta < 0); return false; } From a35c7ab696fd7bb31a87cebc8f08601f66a09b2e Mon Sep 17 00:00:00 2001 From: Daniel Shapiro Date: Fri, 19 Apr 2013 15:55:51 -0300 Subject: [PATCH 08/35] Remove some incorrect else-if logic in time plugin Looks like this was mistakenly introduced in a whitespace/bracket cleanup. --- jquery.flot.time.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/jquery.flot.time.js b/jquery.flot.time.js index 55c4d4f..c457ca5 100644 --- a/jquery.flot.time.js +++ b/jquery.flot.time.js @@ -294,17 +294,23 @@ API.txt for details. if (step >= timeUnitSize.minute) { d.setSeconds(0); - } else if (step >= timeUnitSize.hour) { + } + if (step >= timeUnitSize.hour) { d.setMinutes(0); - } else if (step >= timeUnitSize.day) { + } + if (step >= timeUnitSize.day) { d.setHours(0); - } else if (step >= timeUnitSize.day * 4) { + } + if (step >= timeUnitSize.day * 4) { d.setDate(1); - } else if (step >= timeUnitSize.month * 2) { + } + if (step >= timeUnitSize.month * 2) { d.setMonth(floorInBase(d.getMonth(), 3)); - } else if (step >= timeUnitSize.quarter * 2) { + } + if (step >= timeUnitSize.quarter * 2) { d.setMonth(floorInBase(d.getMonth(), 6)); - } else if (step >= timeUnitSize.year) { + } + if (step >= timeUnitSize.year) { d.setMonth(0); } From 24f70fc6bd71eb6c3f975472df8ceb4450e531ae Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sat, 20 Apr 2013 20:18:06 -0400 Subject: [PATCH 09/35] Re-introduced the %h specifier for back-compat. --- API.md | 4 ++++ jquery.flot.time.js | 1 + 2 files changed, 5 insertions(+) diff --git a/API.md b/API.md index 8d3fba9..23bcf09 100644 --- a/API.md +++ b/API.md @@ -636,6 +636,10 @@ standard strftime specifiers are supported (plus the nonstandard %q): %w: weekday as number (0-6, 0 being Sunday) ``` +Flot 0.8 switched from %h to the standard %H hours specifier. The %h specifier +is still available, for backwards-compatibility, but is deprecated and +scheduled to be removed permanently with the release of version 1.0. + You can customize the month names with the "monthNames" option. For instance, for Danish you might specify: diff --git a/jquery.flot.time.js b/jquery.flot.time.js index c457ca5..15f5281 100644 --- a/jquery.flot.time.js +++ b/jquery.flot.time.js @@ -73,6 +73,7 @@ API.txt for details. case 'b': c = "" + monthNames[d.getMonth()]; break; case 'd': c = leftPad(d.getDate()); break; case 'e': c = leftPad(d.getDate(), " "); break; + case 'h': // For back-compat with 0.7; remove in 1.0 case 'H': c = leftPad(hours); break; case 'I': c = leftPad(hours12); break; case 'l': c = leftPad(hours12, " "); break; From 5fe3646ab02953eaf42380df45405ea135dc04f7 Mon Sep 17 00:00:00 2001 From: Lee Willis Date: Tue, 23 Apr 2013 11:02:53 +0100 Subject: [PATCH 10/35] Remove $.isNumeric() for compat with jQuery < 1.7. Fixes #1026 --- jquery.flot.pie.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jquery.flot.pie.js b/jquery.flot.pie.js index ebff1a3..80c1fd6 100644 --- a/jquery.flot.pie.js +++ b/jquery.flot.pie.js @@ -181,12 +181,13 @@ More detail and specific examples can be found in the included HTML file. // that the user may have stored in higher indexes. if ($.isArray(value)) { - if ($.isNumeric(value[1])) { + // Equivalent to $.isNumeric() but compatible with jQuery < 1.7 + if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) { value[1] = +value[1]; } else { value[1] = 0; } - } else if ($.isNumeric(value)) { + } else if (!isNaN(parseFloat(value)) && isFinite(value)) { value = [1, +value]; } else { value = [1, 0]; From fccc8a6e2109483ce9e7eb465794233aa0703631 Mon Sep 17 00:00:00 2001 From: goorpy Date: Wed, 24 Apr 2013 16:53:41 -0300 Subject: [PATCH 11/35] Override colors array after extend in parseOptions (Realted to flot issue #1031: https://github.com/flot/flot/issues/1031) Currently, if the user declares a custom color palette with less than 5 colors (say, n), $.extend(true, options, opts) only modifies the first n colors of the default palette and leaves the last 5-n in place. When the number of series is >n, colors are used that are not part of user-defined palette, contrary to description of colors array in API. This line overrides the extended colors array and replaces it with exactly the user-defined colors array, when present. Afterwards, the user color palette is respected by the auto tinting/shading system for when there are more series than colors. --- jquery.flot.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jquery.flot.js b/jquery.flot.js index eb73cd7..d739bdf 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -641,6 +641,8 @@ Licensed under the MIT license. function parseOptions(opts) { $.extend(true, options, opts); + + if (opts.colors) options.colors = opts.colors; if (options.xaxis.color == null) options.xaxis.color = $.color.parse(options.grid.color).scale('a', 0.22).toString(); From 3f0d69315188d3276a7a2f08d45968b951606f02 Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Thu, 25 Apr 2013 22:31:04 -0300 Subject: [PATCH 12/35] Add link to README.md --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index 23bcf09..5027b51 100644 --- a/API.md +++ b/API.md @@ -8,7 +8,7 @@ var plot = $.plot(placeholder, data, options) The placeholder is a jQuery object or DOM element or jQuery expression that the plot will be put into. This placeholder needs to have its -width and height set as explained in the README (go read that now if +width and height set as explained in the [README](README.md) (go read that now if you haven't, it's short). The plot will modify some properties of the placeholder so it's recommended you simply pass in a div that you don't use for anything else. Make sure you check any fancy styling From 321f3a49ce5c52c3b2a11d34fe6d3e640d6724a1 Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Thu, 25 Apr 2013 23:45:32 -0300 Subject: [PATCH 13/35] Add link to API.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e5b922a..4de7bde 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ $.plot($("#placeholder"), data, options); Here, data is an array of data series and options is an object with settings if you want to customize the plot. Take a look at the -examples for some ideas of what to put in or look at the reference -in the file `API.txt`. Here's a quick example that'll draw a line from -(0, 0) to (1, 1): +examples for some ideas of what to put in or look at the +[API reference](API.md). Here's a quick example that'll draw a line +from (0, 0) to (1, 1): ```js $.plot($("#placeholder"), [ [[0, 0], [1, 1]] ], { yaxis: { max: 1 } }); From c20370ab57327100daf09828dd0a9e811b026cac Mon Sep 17 00:00:00 2001 From: goorpy Date: Sun, 28 Apr 2013 04:43:13 -0300 Subject: [PATCH 14/35] Add comment and desired structure to colors patch Per request from dnschnur (https://github.com/flot/flot/pull/1034#issuecomment-17119203), I have: - Added a comment explaining the purpose of the new check/override - Changed the structure to match preferred standard structure --- jquery.flot.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jquery.flot.js b/jquery.flot.js index d739bdf..447714a 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -642,7 +642,11 @@ Licensed under the MIT license. $.extend(true, options, opts); - if (opts.colors) options.colors = opts.colors; + //Override options.colors after $.extend if user has set colors, because extend does not clear out excess + //default colors if user defines color palette smaller than default palette size (currently 5). + if (opts.colors) { + options.colors = opts.colors; + } if (options.xaxis.color == null) options.xaxis.color = $.color.parse(options.grid.color).scale('a', 0.22).toString(); From 14f694f9b9f6e4b17057713ac0d9c43407f905b2 Mon Sep 17 00:00:00 2001 From: Nicolas Morel Date: Sat, 27 Apr 2013 18:23:01 +0200 Subject: [PATCH 15/35] Fixed regression on pie plugin on data format allowed (without recursion) --- jquery.flot.pie.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jquery.flot.pie.js b/jquery.flot.pie.js index ebff1a3..3518f69 100644 --- a/jquery.flot.pie.js +++ b/jquery.flot.pie.js @@ -180,6 +180,10 @@ More detail and specific examples can be found in the included HTML file. // new one; this is more efficient and preserves any extra data // that the user may have stored in higher indexes. + if ($.isArray(value) && value.length == 1) { + value = value[0]; + } + if ($.isArray(value)) { if ($.isNumeric(value[1])) { value[1] = +value[1]; From 7c6993e77beed20098c446737d2b0b60c5e57ae6 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sun, 28 Apr 2013 14:08:22 -0400 Subject: [PATCH 16/35] Fix a regression when no options are provided. --- jquery.flot.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 447714a..15938fc 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -641,10 +641,13 @@ Licensed under the MIT license. function parseOptions(opts) { $.extend(true, options, opts); - - //Override options.colors after $.extend if user has set colors, because extend does not clear out excess - //default colors if user defines color palette smaller than default palette size (currently 5). - if (opts.colors) { + + // $.extend merges arrays, rather than replacing them. When less + // colors are provided than the size of the default palette, we + // end up with those colors plus the remaining defaults, which is + // not expected behavior; avoid it by replacing them here. + + if (opts && opts.colors) { options.colors = opts.colors; } From e8ef7084940a4ee8e5ee6a957cddab91fd21ba2a Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sun, 5 May 2013 16:51:19 -0400 Subject: [PATCH 17/35] Added a width parameter to control text wrapping. The optional width parameter establishes a maximum width for the text's bounding box, forcing it to wrap when it reaches that size. --- jquery.flot.canvas.js | 10 +++++----- jquery.flot.js | 14 +++++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/jquery.flot.canvas.js b/jquery.flot.canvas.js index 392c554..07b0623 100644 --- a/jquery.flot.canvas.js +++ b/jquery.flot.canvas.js @@ -132,10 +132,10 @@ browser, but needs to redraw with canvas text when exporting as an image. // }, // } - Canvas.prototype.getTextInfo = function(layer, text, font, angle) { + Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) { if (!plot.getOptions().canvas) { - return getTextInfo.call(this, layer, text, font, angle); + return getTextInfo.call(this, layer, text, font, angle, width); } var textStyle, layerCache, styleCache, info; @@ -251,13 +251,13 @@ browser, but needs to redraw with canvas text when exporting as an image. // Adds a text string to the canvas text overlay. - Canvas.prototype.addText = function(layer, x, y, text, font, angle, halign, valign) { + Canvas.prototype.addText = function(layer, x, y, text, font, angle, width, halign, valign) { if (!plot.getOptions().canvas) { - return addText.call(this, layer, x, y, text, font, angle, halign, valign); + return addText.call(this, layer, x, y, text, font, angle, width, halign, valign); } - var info = this.getTextInfo(layer, text, font, angle), + var info = this.getTextInfo(layer, text, font, angle, width), lines = info.lines; // Mark the text for inclusion in the next render pass diff --git a/jquery.flot.js b/jquery.flot.js index 15938fc..81eb981 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -273,9 +273,10 @@ Licensed under the MIT license. // classes or a font-spec object, defining the text's font and style. // @param {number=} angle Angle at which to rotate the text, in degrees. // Angle is currently unused, it will be implemented in the future. + // @param {number=} width Maximum width of the text before it wraps. // @return {object} a text info object. - Canvas.prototype.getTextInfo = function(layer, text, font, angle) { + Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) { var textStyle, layerCache, styleCache, info; @@ -314,6 +315,7 @@ Licensed under the MIT license. var element = $("
").html(text) .css({ position: "absolute", + 'max-width': width, top: -9999 }) .appendTo(this.getTextLayer(layer)); @@ -355,14 +357,15 @@ Licensed under the MIT license. // classes or a font-spec object, defining the text's font and style. // @param {number=} angle Angle at which to rotate the text, in degrees. // Angle is currently unused, it will be implemented in the future. + // @param {number=} width Maximum width of the text before it wraps. // @param {string=} halign Horizontal alignment of the text; either "left", // "center" or "right". // @param {string=} valign Vertical alignment of the text; either "top", // "middle" or "bottom". - Canvas.prototype.addText = function(layer, x, y, text, font, angle, halign, valign) { + Canvas.prototype.addText = function(layer, x, y, text, font, angle, width, halign, valign) { - var info = this.getTextInfo(layer, text, font, angle); + var info = this.getTextInfo(layer, text, font, angle, width); // Mark the div for inclusion in the next render pass @@ -386,7 +389,8 @@ Licensed under the MIT license. info.element.css({ top: Math.round(y), - left: Math.round(x) + left: Math.round(x), + 'text-align': halign // In case the text wraps }); }; @@ -2065,7 +2069,7 @@ Licensed under the MIT license. } } - surface.addText(layer, x, y, tick.label, font, null, halign, valign); + surface.addText(layer, x, y, tick.label, font, null, null, halign, valign); } }); } From 571d86e936a5b27cb7fc54dc16a4ea74842c11ec Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sun, 5 May 2013 16:58:06 -0400 Subject: [PATCH 18/35] Restore 0.7's maximum width for x-axis labels. Flot 0.7 calculated x-axis label dimensions by assigning each label a fixed width, then measuring the height as determined by the browser. A side-effect of this technique is that x-axis label divs received a fixed width. The rewrite of the text system in 0.8 accidentally removed this feature; this patch restores it. --- jquery.flot.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 81eb981..16ed7ae 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1284,8 +1284,11 @@ Licensed under the MIT license. function measureTickLabels(axis) { - var opts = axis.options, ticks = axis.ticks || [], - axisw = opts.labelWidth || 0, axish = opts.labelHeight || 0, + var opts = axis.options, + ticks = axis.ticks || [], + labelWidth = opts.labelWidth || 0, + labelHeight = opts.labelHeight || 0, + maxWidth = labelWidth || axis.direction == "x" ? Math.floor(surface.width / (ticks.length || 1)) : null; legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis", layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles, font = opts.font || "flot-tick-label tickLabel"; @@ -1297,16 +1300,14 @@ Licensed under the MIT license. if (!t.label) continue; - var info = surface.getTextInfo(layer, t.label, font); + var info = surface.getTextInfo(layer, t.label, font, null, maxWidth); - if (opts.labelWidth == null) - axisw = Math.max(axisw, info.width); - if (opts.labelHeight == null) - axish = Math.max(axish, info.height); + labelWidth = Math.max(labelWidth, info.width); + labelHeight = Math.max(labelHeight, info.height); } - axis.labelWidth = Math.ceil(axisw); - axis.labelHeight = Math.ceil(axish); + axis.labelWidth = opts.labelWidth || labelWidth; + axis.labelHeight = opts.labelHeight || labelHeight; } function allocateAxisBoxFirstPhase(axis) { From b224b1ca7e33d02200e55133903b848ed6d89224 Mon Sep 17 00:00:00 2001 From: Marcelo Jorge Vieira Date: Sun, 5 May 2013 23:48:27 -0300 Subject: [PATCH 19/35] Removed executable permissions from jquery.flot.selection.js --- jquery.flot.selection.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 jquery.flot.selection.js diff --git a/jquery.flot.selection.js b/jquery.flot.selection.js old mode 100755 new mode 100644 From 5fb61a92c8c5c17c4b0653312d4f6d73eb6b6787 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Tue, 7 May 2013 21:02:29 -0400 Subject: [PATCH 20/35] Respect autoscale when nullifying points. Resolves #1033. --- jquery.flot.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 16ed7ae..f2668ad 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1073,10 +1073,14 @@ Licensed under the MIT license. if (val != null) { f = format[m]; // extract min/max info - if (f.x) - updateAxis(s.xaxis, val, val); - if (f.y) - updateAxis(s.yaxis, val, val); + if (f.autoscale) { + if (f.x) { + updateAxis(s.xaxis, val, val); + } + if (f.y) { + updateAxis(s.yaxis, val, val); + } + } } points[k + m] = null; } From 77a4b8647b6f500e2372251ff53296fa8e38fe1f Mon Sep 17 00:00:00 2001 From: David Schnur Date: Tue, 7 May 2013 21:14:12 -0400 Subject: [PATCH 21/35] Trigger an overlay refresh when drawing the plot. Resolves #1030. The performance impact should be low, and is the correct thing to do in just about all cases where a plot is being redrawn. --- jquery.flot.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jquery.flot.js b/jquery.flot.js index f2668ad..169d189 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1758,6 +1758,11 @@ Licensed under the MIT license. } surface.render(); + + // A draw implies that either the axes or data have changed, so we + // should probably update the overlay highlights as well. + + triggerRedrawOverlay(); } function extractRange(ranges, coord) { From defe65161785cceca16b9640e2dc4be7544e7ed9 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Tue, 21 May 2013 22:59:28 -0400 Subject: [PATCH 22/35] Allow the same text in multiple locations. Resolves #1032. Previously it was impossible to draw the same text, with the same style, in two different locations, because the second would end up using the first's cache entry, which only ended up moving the element to a new position. Now each cache entry holds a list of positions at which the text appears, creating clones of the original element for each position beyond the first. --- jquery.flot.canvas.js | 78 ++++++++++++++++++++---------- jquery.flot.js | 108 ++++++++++++++++++++++++++++++++---------- 2 files changed, 136 insertions(+), 50 deletions(-) diff --git a/jquery.flot.canvas.js b/jquery.flot.canvas.js index 07b0623..d94b961 100644 --- a/jquery.flot.canvas.js +++ b/jquery.flot.canvas.js @@ -79,12 +79,9 @@ browser, but needs to redraw with canvas text when exporting as an image. for (var key in styleCache) { if (hasOwnProperty.call(styleCache, key)) { - var info = styleCache[key]; - - if (!info.active) { - delete styleCache[key]; - continue; - } + var info = styleCache[key], + positions = info.positions, + lines = info.lines; // Since every element at this level of the cache have the // same font and fill styles, we can just change them once @@ -96,10 +93,18 @@ browser, but needs to redraw with canvas text when exporting as an image. updateStyles = false; } - var lines = info.lines; - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; - context.fillText(line.text, line.x, line.y); + for (var i = 0, position; position = positions[i]; i++) { + if (position.active) { + for (var j = 0, line; line = position.lines[j]; j++) { + context.fillText(lines[j].text, line[0], line[1]); + } + } else { + positions.splice(i--, 1); + } + } + + if (positions.length == 0) { + delete styleCache[key]; } } } @@ -116,11 +121,9 @@ browser, but needs to redraw with canvas text when exporting as an image. // When the canvas option is set, the object looks like this: // // { - // x: X coordinate at which the text is located. - // x: Y coordinate at which the text is located. // width: Width of the text's bounding box. // height: Height of the text's bounding box. - // active: Flag indicating whether the text should be visible. + // positions: Array of positions at which this text is drawn. // lines: [{ // height: Height of this line. // widths: Width of this line. @@ -131,6 +134,15 @@ browser, but needs to redraw with canvas text when exporting as an image. // color: Color of the text. // }, // } + // + // The positions array contains objects that look like this: + // + // { + // active: Flag indicating whether the text should be visible. + // lines: Array of [x, y] coordinates at which to draw the line. + // x: X coordinate at which to draw the text. + // y: Y coordinate at which to draw the text. + // } Canvas.prototype.getTextInfo = function(layer, text, font, angle, width) { @@ -210,7 +222,7 @@ browser, but needs to redraw with canvas text when exporting as an image. info = styleCache[text] = { width: 0, height: 0, - active: false, + positions: [], lines: [], font: { definition: textStyle, @@ -258,12 +270,9 @@ browser, but needs to redraw with canvas text when exporting as an image. } var info = this.getTextInfo(layer, text, font, angle, width), + positions = info.positions, lines = info.lines; - // Mark the text for inclusion in the next render pass - - info.active = true; - // Text is drawn with baseline 'middle', which we need to account // for by adding half a line's height to the y position. @@ -289,20 +298,39 @@ browser, but needs to redraw with canvas text when exporting as an image. y -= 2; } + // Determine whether this text already exists at this position. + // If so, mark it for inclusion in the next render pass. + + for (var i = 0, position; position = positions[i]; i++) { + if (position.x == x && position.y == y) { + position.active = true; + return; + } + } + + // If the text doesn't exist at this position, create a new entry + + position = { + active: true, + lines: [], + x: x, + y: y + }; + + positions.push(position); + // Fill in the x & y positions of each line, adjusting them // individually for horizontal alignment. - for (var i = 0; i < lines.length; ++i) { - var line = lines[i]; - line.y = y; - y += line.height; + for (var i = 0, line; line = lines[i]; i++) { if (halign == "center") { - line.x = Math.round(x - line.width / 2); + position.lines.push([Math.round(x - line.width / 2), y]); } else if (halign == "right") { - line.x = Math.round(x - line.width); + position.lines.push([Math.round(x - line.width), y]); } else { - line.x = Math.round(x); + position.lines.push([Math.round(x), y]); } + y += line.height; } }; } diff --git a/jquery.flot.js b/jquery.flot.js index 169d189..8534ba1 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -184,17 +184,25 @@ Licensed under the MIT license. var styleCache = layerCache[styleKey]; for (var key in styleCache) { if (hasOwnProperty.call(styleCache, key)) { - var info = styleCache[key]; - if (info.active) { - if (!info.rendered) { - layer.append(info.element); - info.rendered = true; + + var positions = styleCache[key].positions; + + for (var i = 0, position; position = positions[i]; i++) { + if (position.active) { + if (!position.rendered) { + layer.append(position.element); + position.rendered = true; + } + } else { + positions.splice(i--, 1); + if (position.rendered) { + position.element.detach(); + } } - } else { + } + + if (positions.length == 0) { delete styleCache[key]; - if (info.rendered) { - info.element.detach(); - } } } } @@ -258,11 +266,26 @@ Licensed under the MIT license. // { // width: Width of the text's wrapper div. // height: Height of the text's wrapper div. + // element: The jQuery-wrapped HTML div containing the text. + // positions: Array of positions at which this text is drawn. + // } + // + // The positions array contains objects that look like this: + // + // { // active: Flag indicating whether the text should be visible. // rendered: Flag indicating whether the text is currently visible. // element: The jQuery-wrapped HTML div containing the text. + // x: X coordinate at which to draw the text. + // y: Y coordinate at which to draw the text. // } // + // Each position after the first receives a clone of the original element. + // + // The idea is that that the width, height, and general 'identity' of the + // text is constant no matter where it is placed; the placements are a + // secondary property. + // // Canvas maintains a cache of recently-used text info objects; getTextInfo // either returns the cached element or creates a new entry. // @@ -330,11 +353,10 @@ Licensed under the MIT license. } info = styleCache[text] = { - active: false, - rendered: false, - element: element, width: element.outerWidth(true), - height: element.outerHeight(true) + height: element.outerHeight(true), + element: element, + positions: [] }; element.detach(); @@ -365,11 +387,8 @@ Licensed under the MIT license. Canvas.prototype.addText = function(layer, x, y, text, font, angle, width, halign, valign) { - var info = this.getTextInfo(layer, text, font, angle, width); - - // Mark the div for inclusion in the next render pass - - info.active = true; + var info = this.getTextInfo(layer, text, font, angle, width), + positions = info.positions; // Tweak the div's position to match the text's alignment @@ -385,9 +404,34 @@ Licensed under the MIT license. y -= info.height; } + // Determine whether this text already exists at this position. + // If so, mark it for inclusion in the next render pass. + + for (var i = 0, position; position = positions[i]; i++) { + if (position.x == x && position.y == y) { + position.active = true; + return; + } + } + + // If the text doesn't exist at this position, create a new entry + + // For the very first position we'll re-use the original element, + // while for subsequent ones we'll clone it. + + position = { + active: true, + rendered: false, + element: positions.length ? info.element.clone() : info.element, + x: x, + y: y + } + + positions.push(position); + // Move the element to its final position within the container - info.element.css({ + position.element.css({ top: Math.round(y), left: Math.round(x), 'text-align': halign // In case the text wraps @@ -397,18 +441,24 @@ Licensed under the MIT license. // Removes one or more text strings from the canvas text overlay. // // If no parameters are given, all text within the layer is removed. - // The text is not actually removed; it is simply marked as inactive, which - // will result in its removal on the next render pass. + // + // Note that the text is not immediately removed; it is simply marked as + // inactive, which will result in its removal on the next render pass. + // This avoids the performance penalty for 'clear and redraw' behavior, + // where we potentially get rid of all text on a layer, but will likely + // add back most or all of it later, as when redrawing axes, for example. // // @param {string} layer A string of space-separated CSS classes uniquely // identifying the layer containing this text. - // @param {string} text Text string to remove. + // @param {number=} x X coordinate of the text. + // @param {number=} y Y coordinate of the text. + // @param {string=} text Text string to remove. // @param {(string|object)=} font Either a string of space-separated CSS // classes or a font-spec object, defining the text's font and style. // @param {number=} angle Angle at which the text is rotated, in degrees. // Angle is currently unused, it will be implemented in the future. - Canvas.prototype.removeText = function(layer, text, font, angle) { + Canvas.prototype.removeText = function(layer, x, y, text, font, angle) { if (text == null) { var layerCache = this._textCache[layer]; if (layerCache != null) { @@ -417,14 +467,22 @@ Licensed under the MIT license. var styleCache = layerCache[styleKey]; for (var key in styleCache) { if (hasOwnProperty.call(styleCache, key)) { - styleCache[key].active = false; + var positions = styleCache[key].positions; + for (var i = 0, position; position = positions[i]; i++) { + position.active = false; + } } } } } } } else { - this.getTextInfo(layer, text, font, angle).active = false; + var positions = this.getTextInfo(layer, text, font, angle).positions; + for (var i = 0, position; position = positions[i]; i++) { + if (position.x == x && position.y == y) { + position.active = false; + } + } } }; From fd6fdf3c0ac612a56084d241b9db09a52655bb7d Mon Sep 17 00:00:00 2001 From: David Schnur Date: Wed, 22 May 2013 08:17:11 -0400 Subject: [PATCH 23/35] Updated credits for various fixes in 0.8.1. --- NEWS.md | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index f52fbe7..da6ecb4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,11 +2,47 @@ ### Bug fixes ### - - Fixed missing semicolons in the core library. - (reported by Michal Zglinski) + - Fixed a regression in the time plugin, introduced in 0.8, that caused dates + to align to the minute rather than to the highest appropriate unit. This + caused many x-axes in 0.8 to have different ticks than they did in 0.7. + (reported by Tom Sheppard, patch by Daniel Shapiro, issue #1017, pull + request #1023) + + - Fixed a regression in text rendering, introduced in 0.8, that caused axis + labels with the same text as another label on the same axis to disappear. + More generally, it's again possible to have the same text in two locations. + (issue #1032) + + - Fixed a regression in text rendering, introduced in 0.8, where axis labels + were no longer assigned an explicit width, and their text could not wrap. + (reported by sabregreen, issue #1019) + + - Fixed a regression in the pie plugin, introduced in 0.8, that prevented it + from accepting data in the format '[[x, y]]'. + (patch by Nicolas Morel, pull request #1024) + + - The 'zero' series option and 'autoscale' format option are no longer + ignored when the series contains a null value. + (reported by Daniel Shapiro, issue #1033) - Avoid triggering the time-mode plugin exception when there are zero series. - (reported by Daniel Rothig, patch by Mark Raymond, issues #1016) + (reported by Daniel Rothig, patch by Mark Raymond, issue #1016) + + - When a custom color palette has fewer colors than the default palette, Flot + no longer fills out the colors with the remainder of the default. + (patch by goorpy, issue #1031, pull request #1034) + + - Fixed missing update for bar highlights after a zoom or other redraw. + (reported by Paolo Valleri, issue #1030) + + - Fixed compatibility with jQuery versions earlier than 1.7. + (patch by Lee Willis, issue #1027, pull request #1027) + + - The mouse wheel no longer scrolls the page when using the navigate plugin. + (patch by vird, pull request #1020) + + - Fixed missing semicolons in the core library. + (reported by Michal Zglinski) ## Flot 0.8.0 ## From 7f5f90384ed6d6c30b232580d358c84e355919ab Mon Sep 17 00:00:00 2001 From: David Schnur Date: Wed, 22 May 2013 08:17:57 -0400 Subject: [PATCH 24/35] Updated version number to 0.8.1 final. --- component.json | 2 +- flot.jquery.json | 2 +- jquery.flot.js | 4 ++-- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/component.json b/component.json index 95d6f4e..6f1dbb5 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "Flot", - "version": "0.8.1-alpha", + "version": "0.8.1", "main": "jquery.flot.js", "dependencies": { "jquery": ">= 1.2.6" diff --git a/flot.jquery.json b/flot.jquery.json index a7c3ed8..b418f6e 100644 --- a/flot.jquery.json +++ b/flot.jquery.json @@ -1,6 +1,6 @@ { "name": "flot", - "version": "0.8.1-alpha", + "version": "0.8.1", "title": "Flot", "author": { "name": "Ole Laursen", diff --git a/jquery.flot.js b/jquery.flot.js index 8534ba1..aa7e362 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1,4 +1,4 @@ -/* Javascript plotting library for jQuery, version 0.8.1-alpha. +/* Javascript plotting library for jQuery, version 0.8.1. Copyright (c) 2007-2013 IOLA and Ole Laursen. Licensed under the MIT license. @@ -3041,7 +3041,7 @@ Licensed under the MIT license. return plot; }; - $.plot.version = "0.8.1-alpha"; + $.plot.version = "0.8.1"; $.plot.plugins = []; diff --git a/package.json b/package.json index 08997a3..09a1032 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Flot", - "version": "0.8.1-alpha", + "version": "0.8.1", "main": "jquery.flot.js", "scripts": { "test": "make test" From 7f94a133f9423e6b083f2a247822499ec13feb9b Mon Sep 17 00:00:00 2001 From: David Schnur Date: Wed, 22 May 2013 21:38:09 -0400 Subject: [PATCH 25/35] Updated version number to 0.8.2-alpha. --- component.json | 2 +- flot.jquery.json | 2 +- jquery.flot.js | 4 ++-- package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/component.json b/component.json index 6f1dbb5..d211bcc 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "Flot", - "version": "0.8.1", + "version": "0.8.2-alpha", "main": "jquery.flot.js", "dependencies": { "jquery": ">= 1.2.6" diff --git a/flot.jquery.json b/flot.jquery.json index b418f6e..14d67e9 100644 --- a/flot.jquery.json +++ b/flot.jquery.json @@ -1,6 +1,6 @@ { "name": "flot", - "version": "0.8.1", + "version": "0.8.2-alpha", "title": "Flot", "author": { "name": "Ole Laursen", diff --git a/jquery.flot.js b/jquery.flot.js index aa7e362..0e21a68 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1,4 +1,4 @@ -/* Javascript plotting library for jQuery, version 0.8.1. +/* Javascript plotting library for jQuery, version 0.8.2-alpha. Copyright (c) 2007-2013 IOLA and Ole Laursen. Licensed under the MIT license. @@ -3041,7 +3041,7 @@ Licensed under the MIT license. return plot; }; - $.plot.version = "0.8.1"; + $.plot.version = "0.8.2-alpha"; $.plot.plugins = []; diff --git a/package.json b/package.json index 09a1032..1ee63f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Flot", - "version": "0.8.1", + "version": "0.8.2-alpha", "main": "jquery.flot.js", "scripts": { "test": "make test" From ed3f14897ea131df3e1ba9cbf5218f2f0566c691 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Mon, 27 May 2013 12:56:24 -0400 Subject: [PATCH 26/35] Always set the axis innermost property. It doesn't make sense to calculate the innermost property only when no tickLength has been provided; the two have little to do with each other. --- examples/axes-multiple/index.html | 5 ++++- jquery.flot.js | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/axes-multiple/index.html b/examples/axes-multiple/index.html index 4c7c68c..da168fa 100644 --- a/examples/axes-multiple/index.html +++ b/examples/axes-multiple/index.html @@ -32,7 +32,10 @@ position: position, tickFormatter: euroFormatter } ], - legend: { position: "sw" } + legend: { position: "sw" }, + grid: { + borderWidth: { top: 0, bottom: 1, left: 0, right: 0} + } }); } diff --git a/jquery.flot.js b/jquery.flot.js index 0e21a68..9ce07c7 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1395,13 +1395,15 @@ Licensed under the MIT license. if ($.inArray(axis, samePosition) == samePosition.length - 1) axisMargin = 0; // outermost + // Determine whether the axis is the first (innermost) on its side + + innermost = $.inArray(axis, $.grep(all, function (a) { + return a && a.reserveSpace; + })) == 0; + // determine tick length - if we're innermost, we can use "full" - if (tickLength == null) { - var sameDirection = $.grep(all, function (a) { - return a && a.reserveSpace; - }); - innermost = $.inArray(axis, sameDirection) == 0; + if (tickLength == null) { if (innermost) tickLength = "full"; else From 1f9e3ba730e5d4e46ea9eb6d4feb5ea164cbc28a Mon Sep 17 00:00:00 2001 From: David Schnur Date: Mon, 27 May 2013 13:16:22 -0400 Subject: [PATCH 27/35] Fix incorrect check for the innermost axis. An axis is innermost when it's first among those not just in its direction, but also on its side, i.e. left/right, of the plot. So the inArray check should be against the samePosition list, not all. Resolves #1056. --- jquery.flot.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 9ce07c7..f5a6661 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1397,9 +1397,7 @@ Licensed under the MIT license. // Determine whether the axis is the first (innermost) on its side - innermost = $.inArray(axis, $.grep(all, function (a) { - return a && a.reserveSpace; - })) == 0; + innermost = $.inArray(axis, samePosition) == 0; // determine tick length - if we're innermost, we can use "full" From b0f864bd67473d1a13e8edab79ccef3b8508e783 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Mon, 27 May 2013 13:16:35 -0400 Subject: [PATCH 28/35] Updated credits for the axis innermost fix. --- NEWS.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NEWS.md b/NEWS.md index da6ecb4..826a17b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,15 @@ +## Flot 0.8.2 ## + +### Bug fixes ### + + - Fixed a bug where the second axis in an xaxes/yaxes array incorrectly had + its 'innermost' property set to false or undefined, even if it was on the + other side of the plot from the first axis. This resulted in the axis bar + being visible when it shouldn't have been, which was especially obvious + when the grid had a left/right border width of zero. + (reported by Teq1, fix researched by ryleyb, issue #1056) + + ## Flot 0.8.1 ## ### Bug fixes ### From 2c4c39f47298047781b648acd893be66321cd9a1 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Mon, 27 May 2013 13:18:18 -0400 Subject: [PATCH 29/35] Revert changes committed accidentally. These changes were used to test the axis innermost property fix, and should not have been committed. --- examples/axes-multiple/index.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/examples/axes-multiple/index.html b/examples/axes-multiple/index.html index da168fa..4c7c68c 100644 --- a/examples/axes-multiple/index.html +++ b/examples/axes-multiple/index.html @@ -32,10 +32,7 @@ position: position, tickFormatter: euroFormatter } ], - legend: { position: "sw" }, - grid: { - borderWidth: { top: 0, bottom: 1, left: 0, right: 0} - } + legend: { position: "sw" } }); } From 7efb3876fac94b1d51c0928c3430881cd1ea0991 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Tue, 28 May 2013 19:12:04 -0400 Subject: [PATCH 30/35] Add missing semicolon. --- jquery.flot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.flot.js b/jquery.flot.js index f5a6661..3d12081 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -425,7 +425,7 @@ Licensed under the MIT license. element: positions.length ? info.element.clone() : info.element, x: x, y: y - } + }; positions.push(position); From 11ed6a29097a6c8821eecfca1b8bf942e32ffe32 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Tue, 28 May 2013 20:20:06 -0400 Subject: [PATCH 31/35] Enable tooltips and coordinates by default. Lots of people ask about implementing tooltips; hopefully enabling it by default will help them find it more easily. --- examples/interacting/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/interacting/index.html b/examples/interacting/index.html index 19136df..15b2437 100644 --- a/examples/interacting/index.html +++ b/examples/interacting/index.html @@ -111,14 +111,14 @@

One of the goals of Flot is to support user interactions. Try pointing and clicking on the points.

- +

A tooltip is easy to build with a bit of jQuery code and the data returned from the plot.

-

+

From 1d4bee99fb57fdb4a7380335d659b2c1ffc68244 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Tue, 28 May 2013 23:00:09 -0400 Subject: [PATCH 32/35] Fix incorrect line termination. --- jquery.flot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.flot.js b/jquery.flot.js index 3d12081..13455bd 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1350,7 +1350,7 @@ Licensed under the MIT license. ticks = axis.ticks || [], labelWidth = opts.labelWidth || 0, labelHeight = opts.labelHeight || 0, - maxWidth = labelWidth || axis.direction == "x" ? Math.floor(surface.width / (ticks.length || 1)) : null; + maxWidth = labelWidth || axis.direction == "x" ? Math.floor(surface.width / (ticks.length || 1)) : null, legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis", layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles, font = opts.font || "flot-tick-label tickLabel"; From d777b2e79518b5956cf344d2857e8451260f086d Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Thu, 30 May 2013 15:33:37 -0400 Subject: [PATCH 33/35] Add table of contents The reference document is quite large; a table of contents would help readers navigate and find topics. (TOC was generated via [DocToc](http://doctoc.herokuapp.com/)) --- API.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/API.md b/API.md index 5027b51..ffee330 100644 --- a/API.md +++ b/API.md @@ -1,3 +1,20 @@ +**Table of Contents** + +- [Flot Reference](#flot-reference) +- [Data Format](#data-format) +- [Plot Options](#plot-options) +- [Customizing the legend](#customizing-the-legend) +- [Customizing the axes](#customizing-the-axes) +- [Multiple axes](#multiple-axes) +- [Time series data](#time-series-data) +- [Customizing the data series](#customizing-the-data-series) +- [Customizing the grid](#customizing-the-grid) +- [Specifying gradients](#specifying-gradients) +- [Plot Methods](#plot-methods) +- [Hooks](#hooks) +- [Plugins](#plugins) +- [Version number](#version-number) + # Flot Reference # Consider a call to the plot function: From 2b901841b2d9f30f8ed046bcba97725b0b99f481 Mon Sep 17 00:00:00 2001 From: Brian Peiris Date: Thu, 30 May 2013 18:03:48 -0300 Subject: [PATCH 34/35] Move TOC below main title and make it horizontal --- API.md | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/API.md b/API.md index ffee330..a9aaf17 100644 --- a/API.md +++ b/API.md @@ -1,21 +1,25 @@ -**Table of Contents** +# Flot Reference # -- [Flot Reference](#flot-reference) -- [Data Format](#data-format) -- [Plot Options](#plot-options) -- [Customizing the legend](#customizing-the-legend) -- [Customizing the axes](#customizing-the-axes) -- [Multiple axes](#multiple-axes) -- [Time series data](#time-series-data) -- [Customizing the data series](#customizing-the-data-series) -- [Customizing the grid](#customizing-the-grid) -- [Specifying gradients](#specifying-gradients) -- [Plot Methods](#plot-methods) -- [Hooks](#hooks) -- [Plugins](#plugins) -- [Version number](#version-number) +**Table of Contents** -# Flot Reference # +[Introduction](#introduction) +| [Data Format](#data-format) +| [Plot Options](#plot-options) +| [Customizing the legend](#customizing-the-legend) +| [Customizing the axes](#customizing-the-axes) +| [Multiple axes](#multiple-axes) +| [Time series data](#time-series-data) +| [Customizing the data series](#customizing-the-data-series) +| [Customizing the grid](#customizing-the-grid) +| [Specifying gradients](#specifying-gradients) +| [Plot Methods](#plot-methods) +| [Hooks](#hooks) +| [Plugins](#plugins) +| [Version number](#version-number) + +--- + +## Introduction ## Consider a call to the plot function: From b074bde4aa40e28fbe4de22f4c6abc77820d7c38 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Thu, 30 May 2013 22:48:49 -0300 Subject: [PATCH 35/35] Updated credits for API table of contents. --- NEWS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS.md b/NEWS.md index 826a17b..3c5407c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,10 @@ ## Flot 0.8.2 ## +### Changes ### + + - Added a table of contents to the API documentation. + (patch by Brian Peiris, pull request #1064) + ### Bug fixes ### - Fixed a bug where the second axis in an xaxes/yaxes array incorrectly had