diff --git a/LICENSE.txt b/LICENSE.txt index 67f4625..719da06 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2007-2013 IOLA and Ole Laursen +Copyright (c) 2007-2014 IOLA and Ole Laursen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/NEWS.md b/NEWS.md index 8103ffb..66dc62b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,54 @@ by Jason Swank, issue #331, and Rene Pieter Kok, issue #344) +## Flot 0.8.3 ## + +### Changes ### + +- Updated example code to avoid encouraging unnecessary re-plots. + (patch by soenter, pull request #1221) + +### Bug fixes ### + + - Added a work-around to disable the allocation of extra space for first and + last axis ticks, allowing plots to span the full width of their container. + A proper solution for this bug will be implemented in the 0.9 release. + (reported by Josh Pigford and andig, issue #1212, pull request #1290) + + - Fixed a regression introduced in 0.8.1, where the last tick label would + sometimes wrap rather than extending the plot's offset to create space. + (reported by Elite Gamer, issue #1283) + + - Fixed a regression introduced in 0.8.2, where the resize plugin would use + unexpectedly high amounts of CPU even when idle. + (reported by tommie, issue #1277, pull request #1289) + + - Fixed the selection example to work with jQuery 1.9.x and later. + (reported by EGLadona and dmfalke, issue #1250, pull request #1285) + + - Added a detach shim to fix support for jQuery versions earlier than 1.4.x. + (reported by ngavard, issue #1240, pull request #1286) + + - Fixed a rare 'Uncaught TypeError' when using the resize plugin in IE 7/8. + (reported by tleish, issue #1265, pull request #1289) + + - Fixed zoom constraints to apply only in the direction of the zoom. + (patch by Neil Katin, issue #1204, pull request #1205) + + - Markings lines are no longer blurry when drawn on pixel boundaries. + (reported by btccointicker and Rouillard, issue #1210) + + - Don't discard original pie data-series values when combining slices. + (patch by Phil Tsarik, pull request #1238) + + - Fixed broken auto-scale behavior when using deprecated [x|y]2axis options. + (reported by jorese, issue #1228, pull request #1284) + + - Exposed the dateGenerator function on the plot object, as it used to be + before time-mode was moved into a separate plugin. + (patch by Paolo Valleri, pull request #1028) + + ## Flot 0.8.2 ## ### Changes ### diff --git a/examples/ajax/index.html b/examples/ajax/index.html index ea100a4..d29e5aa 100644 --- a/examples/ajax/index.html +++ b/examples/ajax/index.html @@ -167,7 +167,7 @@ diff --git a/examples/annotating/index.html b/examples/annotating/index.html index 853b3bd..39a70ef 100644 --- a/examples/annotating/index.html +++ b/examples/annotating/index.html @@ -81,7 +81,7 @@ diff --git a/examples/axes-interacting/index.html b/examples/axes-interacting/index.html index cffe0c0..bacce62 100644 --- a/examples/axes-interacting/index.html +++ b/examples/axes-interacting/index.html @@ -91,7 +91,7 @@ diff --git a/examples/axes-multiple/index.html b/examples/axes-multiple/index.html index 79403fd..0561da8 100644 --- a/examples/axes-multiple/index.html +++ b/examples/axes-multiple/index.html @@ -71,7 +71,7 @@ diff --git a/examples/axes-time-zones/index.html b/examples/axes-time-zones/index.html index de29844..4d09932 100644 --- a/examples/axes-time-zones/index.html +++ b/examples/axes-time-zones/index.html @@ -108,7 +108,7 @@ diff --git a/examples/axes-time/index.html b/examples/axes-time/index.html index 1588364..0cf9729 100644 --- a/examples/axes-time/index.html +++ b/examples/axes-time/index.html @@ -131,7 +131,7 @@ diff --git a/examples/basic-options/index.html b/examples/basic-options/index.html index 35d25e0..396a645 100644 --- a/examples/basic-options/index.html +++ b/examples/basic-options/index.html @@ -85,7 +85,7 @@ diff --git a/examples/basic-usage/index.html b/examples/basic-usage/index.html index c587cca..f4e76bb 100644 --- a/examples/basic-usage/index.html +++ b/examples/basic-usage/index.html @@ -51,7 +51,7 @@ diff --git a/examples/canvas/index.html b/examples/canvas/index.html index eaf3754..8a5d8de 100644 --- a/examples/canvas/index.html +++ b/examples/canvas/index.html @@ -69,7 +69,7 @@ diff --git a/examples/categories/index.html b/examples/categories/index.html index ca7f633..38fb601 100644 --- a/examples/categories/index.html +++ b/examples/categories/index.html @@ -53,7 +53,7 @@ diff --git a/examples/image/index.html b/examples/image/index.html index e1b4010..635f86c 100644 --- a/examples/image/index.html +++ b/examples/image/index.html @@ -63,7 +63,7 @@ diff --git a/examples/interacting/index.html b/examples/interacting/index.html index e695902..5c8f55f 100644 --- a/examples/interacting/index.html +++ b/examples/interacting/index.html @@ -112,7 +112,7 @@ diff --git a/examples/navigate/index.html b/examples/navigate/index.html index 8074bc2..f903e99 100644 --- a/examples/navigate/index.html +++ b/examples/navigate/index.html @@ -147,7 +147,7 @@ diff --git a/examples/percentiles/index.html b/examples/percentiles/index.html index fe0de0d..6b9da28 100644 --- a/examples/percentiles/index.html +++ b/examples/percentiles/index.html @@ -73,7 +73,7 @@ diff --git a/examples/realtime/index.html b/examples/realtime/index.html index 8595c20..3f7643e 100644 --- a/examples/realtime/index.html +++ b/examples/realtime/index.html @@ -116,7 +116,7 @@ diff --git a/examples/resize/index.html b/examples/resize/index.html index d0a20ba..e232ba0 100644 --- a/examples/resize/index.html +++ b/examples/resize/index.html @@ -39,7 +39,7 @@ maxWidth: 900, maxHeight: 500, minWidth: 450, - minHeight: 250, + minHeight: 250 }); // Add the Flot version string to the footer @@ -70,7 +70,7 @@ diff --git a/examples/selection/index.html b/examples/selection/index.html index f58cae8..cb5bc7d 100644 --- a/examples/selection/index.html +++ b/examples/selection/index.html @@ -13,6 +13,15 @@ $(function() { + // Shim allowing us to get the state of the check-box on jQuery versions + // prior to 1.6, when prop was added. The reason we don't just use attr + // is because it doesn't work in jQuery versions 1.9.x and later. + + // TODO: Remove this once Flot's minimum supported jQuery reaches 1.6. + if (typeof $.fn.prop != 'function') { + $.fn.prop = $.fn.attr; + } + var data = [{ label: "United States", data: [[1990, 18.9], [1991, 18.7], [1992, 18.4], [1993, 19.3], [1994, 19.5], [1995, 19.3], [1996, 19.4], [1997, 20.2], [1998, 19.8], [1999, 19.9], [2000, 20.4], [2001, 20.1], [2002, 20.0], [2003, 19.8], [2004, 20.4]] @@ -65,15 +74,17 @@ $("#selection").text(ranges.xaxis.from.toFixed(1) + " to " + ranges.xaxis.to.toFixed(1)); - var zoom = $("#zoom").attr("checked"); + var zoom = $("#zoom").prop("checked"); if (zoom) { - plot = $.plot(placeholder, data, $.extend(true, {}, options, { - xaxis: { - min: ranges.xaxis.from, - max: ranges.xaxis.to - } - })); + $.each(plot.getXAxes(), function(_, axis) { + var opts = axis.options; + opts.min = ranges.xaxis.from; + opts.max = ranges.xaxis.to; + }); + plot.setupGrid(); + plot.draw(); + plot.clearSelection(); } }); @@ -135,7 +146,7 @@ diff --git a/examples/series-errorbars/index.html b/examples/series-errorbars/index.html index 6042d78..26566f2 100644 --- a/examples/series-errorbars/index.html +++ b/examples/series-errorbars/index.html @@ -144,7 +144,7 @@ diff --git a/examples/series-pie/index.html b/examples/series-pie/index.html index 78094b0..5221b4d 100644 --- a/examples/series-pie/index.html +++ b/examples/series-pie/index.html @@ -812,7 +812,7 @@ diff --git a/examples/series-toggle/index.html b/examples/series-toggle/index.html index 4a68295..33eb568 100644 --- a/examples/series-toggle/index.html +++ b/examples/series-toggle/index.html @@ -115,7 +115,7 @@ diff --git a/examples/series-types/index.html b/examples/series-types/index.html index 634eecb..7027a1f 100644 --- a/examples/series-types/index.html +++ b/examples/series-types/index.html @@ -85,7 +85,7 @@ diff --git a/examples/stacking/index.html b/examples/stacking/index.html index 3d5c828..d3cae4f 100644 --- a/examples/stacking/index.html +++ b/examples/stacking/index.html @@ -101,7 +101,7 @@ diff --git a/examples/symbols/index.html b/examples/symbols/index.html index 26149f5..cef3a35 100644 --- a/examples/symbols/index.html +++ b/examples/symbols/index.html @@ -70,7 +70,7 @@ diff --git a/examples/threshold/index.html b/examples/threshold/index.html index a8232ff..25ce7f8 100644 --- a/examples/threshold/index.html +++ b/examples/threshold/index.html @@ -70,7 +70,7 @@ diff --git a/examples/tracking/index.html b/examples/tracking/index.html index a6eef69..d0c8757 100644 --- a/examples/tracking/index.html +++ b/examples/tracking/index.html @@ -129,7 +129,7 @@ diff --git a/examples/visitors/index.html b/examples/visitors/index.html index fa668fc..e14678b 100644 --- a/examples/visitors/index.html +++ b/examples/visitors/index.html @@ -93,13 +93,14 @@ $("#placeholder").bind("plotselected", function (event, ranges) { // do the zooming - - plot = $.plot("#placeholder", [d], $.extend(true, {}, options, { - xaxis: { - min: ranges.xaxis.from, - max: ranges.xaxis.to - } - })); + $.each(plot.getXAxes(), function(_, axis) { + var opts = axis.options; + opts.min = ranges.xaxis.from; + opts.max = ranges.xaxis.to; + }); + plot.setupGrid(); + plot.draw(); + plot.clearSelection(); // don't fire event on the overview to prevent eternal loop @@ -140,7 +141,7 @@ diff --git a/examples/zooming/index.html b/examples/zooming/index.html index ade769c..aa33fc1 100644 --- a/examples/zooming/index.html +++ b/examples/zooming/index.html @@ -138,7 +138,7 @@ diff --git a/flot.jquery.json b/flot.jquery.json index 25352b7..0700fc1 100644 --- a/flot.jquery.json +++ b/flot.jquery.json @@ -24,4 +24,4 @@ "email": "dnschnur@gmail.com", "url": "http://github.com/dnschnur" }] -} \ No newline at end of file +} diff --git a/lib/jquery.resize.js b/lib/jquery.resize.js index 1f41d37..e24da47 100644 --- a/lib/jquery.resize.js +++ b/lib/jquery.resize.js @@ -49,28 +49,31 @@ (function($,window,undefined){ '$:nomunge'; // Used by YUI compressor. - // A jQuery object containing all non-window elements to which the resize + // Array containing all non-window elements to which the resize // event is bound. - var elems = $([]), + var elems = [], // Extend $.resize if it already exists, otherwise create it. jq_resize = $.resize = $.extend( $.resize, {} ), timeout_id, + active = false, // Reused strings. str_setTimeout = 'setTimeout', str_resize = 'resize', str_data = str_resize + '-special-event', - str_delay = 'delay', + str_pendingDelay = 'pendingDelay', + str_activeDelay = 'activeDelay', str_throttle = 'throttleWindow'; // Property: jQuery.resize.delay // // The numeric interval (in milliseconds) at which the resize event polling - // loop executes. Defaults to 250. + // loop executes. Defaults to 200. - jq_resize[ str_delay ] = 250; + jq_resize[ str_pendingDelay ] = 200; + jq_resize[ str_activeDelay ] = 20; // Property: jQuery.resize.throttleWindow // @@ -139,13 +142,17 @@ var elem = $(this); // Add this element to the list of internal elements to monitor. - elems = elems.add( elem ); + elems.push( this ); // Initialize data store on the element. - $.data( this, str_data, { w: elem.width(), h: elem.height() } ); + elem.data( str_data, { w: elem.width(), h: elem.height() } ); // If this is the first element added, start the polling loop. - if ( elems.length === 1 ) { + if ( elems.length === 1 ) { + //set the timeout_id to undefined. + timeout_id = undefined; + + //start the loop loopy(); } }, @@ -161,14 +168,26 @@ var elem = $(this); // Remove this element from the list of internal elements to monitor. - elems = elems.not( elem ); + for (var i = elems.length - 1; i >= 0; i--) { + if(elems[i] == this){ + elems.splice(i, 1); + break; + } + }; // Remove any data stored on the element. elem.removeData( str_data ); // If this is the last element removed, stop the polling loop. if ( !elems.length ) { - clearTimeout( timeout_id ); + if (active) { + cancelAnimationFrame( timeout_id ); + } else { + clearTimeout( timeout_id ); + } + + //set the timeout_id to null, to make sure the loop is stopped + timeout_id = null; } }, @@ -190,7 +209,7 @@ function new_handler( e, w, h ) { var elem = $(this), - data = $.data( this, str_data ); + data = elem.data( str_data ) || {}; // If called from the polling loop, w and h will be passed in as // arguments. If called manually, via .trigger( 'resize' ) or .resize(), @@ -216,31 +235,79 @@ }; - function loopy() { - - // Start the polling loop, asynchronously. - timeout_id = window[ str_setTimeout ](function(){ - + function loopy(timestamp) { + // If this is the first call since switching to active polling, then save + // its timestamp; we need it to determine when to switch back to passive + // polling. Note the || 1; this is just in case the first real timestamp + // is legitimately zero; in that case we still want a truthy value. + if (active === true) { + active = timestamp || 1; + } + // Iterate over all elements to which the 'resize' event is bound. - elems.each(function(){ - var elem = $(this), - width = elem.width(), - height = elem.height(), - data = $.data( this, str_data ); - - // If element size has changed since the last time, update the element - // data store and trigger the 'resize' event. - if ( width !== data.w || height !== data.h ) { - elem.trigger( str_resize, [ data.w = width, data.h = height ] ); + for (var i = elems.length - 1; i >= 0; i--) { + var elem = $(elems[i]); + if (elem[0] == window || elem.is(':visible')) { + + var width = elem.width(), + height = elem.height(), + data = elem.data( str_data ); + + // If element size has changed since the last time, update the element + // data store and trigger the 'resize' event. + if ( data && ( width !== data.w || height !== data.h ) ) { + elem.trigger( str_resize, [ data.w = width, data.h = height ] ); + active = timestamp || true; + } + } else { + // resetting stored width and height so that resize event is triggered next time + data = elem.data(str_data); + data.w = 0; + data.h = 0; } - - }); - - // Loop. - loopy(); - - }, jq_resize[ str_delay ] ); - + }; + + // Poll gently until there is a change, then requestAnimationFrame until + // a second passes without a resize event, at which point we switch back. + if (timeout_id !== null) { + if (active && (timestamp == null || timestamp - active < 1000)) { + timeout_id = window.requestAnimationFrame(loopy); + } else { + timeout_id = setTimeout(loopy, jq_resize[ str_pendingDelay ]); + active = false; + } + } }; + /** + * Provides requestAnimationFrame in a cross browser way. + * http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + */ + if ( !window.requestAnimationFrame ) { + window.requestAnimationFrame = (function(){ + return window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function( /* function FrameRequestCallback */ callback, /* DOMElement Element */ element ) { + return window.setTimeout(function() { + callback((new Date()).getTime()); + }, jq_resize[ str_activeDelay ] ); + }; + })(); + } + /** + * Provides cancelAnimationFrame in a cross browser way. + */ + if( !window.cancelAnimationFrame ){ + window.cancelAnimationFrame = ( function() { + return window.webkitCancelRequestAnimationFrame || + window.mozCancelRequestAnimationFrame || + window.oCancelRequestAnimationFrame || + window.msCancelRequestAnimationFrame || + clearTimeout + })(); + } + + })(jQuery,this); diff --git a/src/jquery.flot.js b/src/jquery.flot.js index c6c8c56..d2a41d0 100644 --- a/src/jquery.flot.js +++ b/src/jquery.flot.js @@ -1,6 +1,6 @@ /* Javascript plotting library for jQuery, version 0.9.0-alpha. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. */ @@ -1125,10 +1125,24 @@ Licensed under the MIT license. if (options.x2axis) { options.xaxes[1] = $.extend(true, {}, options.xaxis, options.x2axis); options.xaxes[1].position = "top"; + // Override the inherit to allow the axis to auto-scale + if (options.x2axis.min == null) { + options.xaxes[1].min = null; + } + if (options.x2axis.max == null) { + options.xaxes[1].max = null; + } } if (options.y2axis) { options.yaxes[1] = $.extend(true, {}, options.yaxis, options.y2axis); options.yaxes[1].position = "right"; + // Override the inherit to allow the axis to auto-scale + if (options.y2axis.min == null) { + options.yaxes[1].min = null; + } + if (options.y2axis.max == null) { + options.yaxes[1].max = null; + } } if (options.grid.coloredAreas) { options.grid.markings = options.grid.coloredAreas; @@ -1777,7 +1791,7 @@ Licensed under the MIT license. // Determine the axis's position in its direction and on its side $.each(isXAxis ? xaxes : yaxes, function(i, a) { - if (a && a.reserveSpace) { + if (a && (a.show || a.reserveSpace)) { if (a === axis) { found = true; } else if (a.options.position === axisPosition) { @@ -1886,17 +1900,12 @@ Licensed under the MIT license. // jump as much around with replots $.each(allAxes(), function(_, axis) { if (axis.reserveSpace && axis.ticks && axis.ticks.length) { - var lastTick = axis.ticks[axis.ticks.length - 1]; if (axis.direction === "x") { margins.left = Math.max(margins.left, axis.tickWidth / 2); - if (lastTick.v <= axis.max) { - margins.right = Math.max(margins.right, axis.tickWidth / 2); - } + margins.right = Math.max(margins.right, axis.tickWidth / 2); } else { margins.bottom = Math.max(margins.bottom, axis.tickHeight / 2); - if (lastTick.v <= axis.max) { - margins.top = Math.max(margins.top, axis.tickHeight / 2); - } + margins.top = Math.max(margins.top, axis.tickHeight / 2); } } }); @@ -1931,26 +1940,20 @@ Licensed under the MIT license. } } - // init axes $.each(axes, function(_, axis) { - axis.show = axis.options.show; - if (axis.show == null) { - - // by default an axis is visible if it's got data - axis.show = axis.used; - } - - axis.reserveSpace = axis.show || axis.options.reserveSpace; - + var axisOpts = axis.options; + axis.show = axisOpts.show == null ? axis.used : axisOpts.show; + axis.reserveSpace = axisOpts.reserveSpace == null ? axis.show : axisOpts.reserveSpace; setRange(axis); }); if (showGrid) { - var allocatedAxes = $.grep(axes, function(axis) { return axis.reserveSpace; }); + var allocatedAxes = $.grep(axes, function(axis) { + return axis.show || axis.reserveSpace; + }); $.each(allocatedAxes, function(_, axis) { - // make the ticks setupTickGeneration(axis); setTicks(axis); @@ -2563,35 +2566,44 @@ Licensed under the MIT license. yrange.from = Math.max(yrange.from, yrange.axis.min); yrange.to = Math.min(yrange.to, yrange.axis.max); - // then draw - xrange.from = xrange.axis.p2c(xrange.from); - xrange.to = xrange.axis.p2c(xrange.to); - yrange.from = yrange.axis.p2c(yrange.from); - yrange.to = yrange.axis.p2c(yrange.to); + var xequal = xrange.from === xrange.to, + yequal = yrange.from === yrange.to; - if (xrange.from !== xrange.to || xrange.from !== yrange.to) { - if (xrange.from === xrange.to || yrange.from === yrange.to) { + if (xequal && yequal) { + continue; + } - // draw line - ctx.beginPath(); - ctx.strokeStyle = m.color || options.grid.markingsColor; - ctx.lineWidth = m.lineWidth || options.grid.markingsLineWidth; - ctx.moveTo(xrange.from, yrange.from); - ctx.lineTo(xrange.to, yrange.to); - ctx.stroke(); + // then draw + xrange.from = Math.floor(xrange.axis.p2c(xrange.from)); + xrange.to = Math.floor(xrange.axis.p2c(xrange.to)); + yrange.from = Math.floor(yrange.axis.p2c(yrange.from)); + yrange.to = Math.floor(yrange.axis.p2c(yrange.to)); + + if (xequal || yequal) { + var lineWidth = m.lineWidth || options.grid.markingsLineWidth, + subPixel = lineWidth % 2 ? 0.5 : 0; + ctx.beginPath(); + ctx.strokeStyle = m.color || options.grid.markingsColor; + ctx.lineWidth = lineWidth; + if (xequal) { + ctx.moveTo(xrange.to + subPixel, yrange.from); + ctx.lineTo(xrange.to + subPixel, yrange.to); } else { - - // fill area - ctx.fillStyle = m.color || options.grid.markingsColor; - - if (!m.rounded) { - ctx.fillRect(xrange.from, yrange.to, - xrange.to - xrange.from, - yrange.from - yrange.to); - } else { - roundRect(ctx, xrange.from, yrange.to, xrange.to - xrange.from, yrange.from - yrange.to, m.rounded); - ctx.fill(); - } + ctx.moveTo(xrange.from, yrange.to + subPixel); + ctx.lineTo(xrange.to, yrange.to + subPixel); + } + ctx.stroke(); + } else { + ctx.fillStyle = m.color || options.grid.markingsColor; + if (m.rounded) { + roundRect( + ctx, xrange.from, yrange.to, xrange.to - xrange.from, + yrange.from - yrange.to, m.rounded); + ctx.fill(); + } else { + ctx.fillRect( + xrange.from, yrange.to, xrange.to - xrange.from, + yrange.from - yrange.to); } } diff --git a/src/plugins/jquery.flot.canvas.js b/src/plugins/jquery.flot.canvas.js index b7b8161..e1649da 100644 --- a/src/plugins/jquery.flot.canvas.js +++ b/src/plugins/jquery.flot.canvas.js @@ -1,6 +1,6 @@ /* Flot plugin for drawing all elements of a plot on the canvas. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. Flot normally produces certain elements, like axis labels and the legend, using diff --git a/src/plugins/jquery.flot.categories.js b/src/plugins/jquery.flot.categories.js index 80b6ea9..f1019bc 100644 --- a/src/plugins/jquery.flot.categories.js +++ b/src/plugins/jquery.flot.categories.js @@ -1,6 +1,6 @@ /* Flot plugin for plotting textual data or categories. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. Consider a dataset like [["February", 34], ["March", 20], ...]. This plugin diff --git a/src/plugins/jquery.flot.crosshair.js b/src/plugins/jquery.flot.crosshair.js index 0fab48a..4dc1bdb 100644 --- a/src/plugins/jquery.flot.crosshair.js +++ b/src/plugins/jquery.flot.crosshair.js @@ -1,6 +1,6 @@ /* Flot plugin for showing crosshairs when the mouse hovers over the plot. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The plugin supports these options: @@ -145,7 +145,7 @@ The plugin also adds four public methods: ctx.translate(plotOffset.left, plotOffset.top); if (crosshair.x !== -1) { - var adj = plot.getOptions().crosshair.lineWidth % 2 === 0 ? 0 : 0.5; + var adj = plot.getOptions().crosshair.lineWidth % 2 ? 0.5 : 0; ctx.strokeStyle = c.color; ctx.lineWidth = c.lineWidth; @@ -153,12 +153,12 @@ The plugin also adds four public methods: ctx.beginPath(); if (c.mode.indexOf("x") !== -1) { - var drawX = Math.round(crosshair.x) + adj; + var drawX = Math.floor(crosshair.x) + adj; ctx.moveTo(drawX, 0); ctx.lineTo(drawX, plot.height()); } if (c.mode.indexOf("y") !== -1) { - var drawY = Math.round(crosshair.y) + adj; + var drawY = Math.floor(crosshair.y) + adj; ctx.moveTo(0, drawY); ctx.lineTo(plot.width(), drawY); } diff --git a/src/plugins/jquery.flot.errorbars.js b/src/plugins/jquery.flot.errorbars.js index 55f3274..6d13765 100644 --- a/src/plugins/jquery.flot.errorbars.js +++ b/src/plugins/jquery.flot.errorbars.js @@ -1,6 +1,6 @@ /* Flot plugin for plotting error bars. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. Error bars are used to show standard deviation and other statistical diff --git a/src/plugins/jquery.flot.fillbetween.js b/src/plugins/jquery.flot.fillbetween.js index 4776e96..e847e81 100644 --- a/src/plugins/jquery.flot.fillbetween.js +++ b/src/plugins/jquery.flot.fillbetween.js @@ -1,6 +1,6 @@ /* Flot plugin for computing bottoms for filled line and bar charts. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The case: you've got two series that you want to fill the area between. In Flot diff --git a/src/plugins/jquery.flot.image.js b/src/plugins/jquery.flot.image.js index b322266..9b2c9e8 100644 --- a/src/plugins/jquery.flot.image.js +++ b/src/plugins/jquery.flot.image.js @@ -1,6 +1,6 @@ /* Flot plugin for plotting images. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The data syntax is [ [ image, x1, y1, x2, y2 ], ... ] where (x1, y1) and diff --git a/src/plugins/jquery.flot.navigate.js b/src/plugins/jquery.flot.navigate.js index 244825b..294778d 100644 --- a/src/plugins/jquery.flot.navigate.js +++ b/src/plugins/jquery.flot.navigate.js @@ -1,6 +1,6 @@ /* Flot plugin for adding the ability to pan and zoom the plot. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The default behaviour is double click and scrollwheel up/down to zoom in, drag @@ -245,8 +245,8 @@ can set the default in the options. var range = max - min; if (zr && - ((zr[0] != null && range < zr[0]) || - (zr[1] != null && range > zr[1]))) { + ((zr[0] != null && range < zr[0] && amount > 1) || + (zr[1] != null && range > zr[1] && amount < 1))) { return; } diff --git a/src/plugins/jquery.flot.pie.js b/src/plugins/jquery.flot.pie.js index 79466ef..0395fbd 100644 --- a/src/plugins/jquery.flot.pie.js +++ b/src/plugins/jquery.flot.pie.js @@ -1,6 +1,6 @@ /* Flot plugin for rendering pie charts. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The plugin assumes that each series has a single data value, and that each @@ -225,13 +225,17 @@ More detail and specific examples can be found in the included HTML file. for (i = 0; i < data.length; ++i) { value = data[i].data[0][1]; if (numCombined < 2 || value / total > options.series.pie.combine.threshold) { - newdata.push({ - data: [[1, value]], - color: data[i].color, - label: data[i].label, - angle: value * Math.PI * 2 / total, - percent: value / (total / 100) - }); + newdata.push( + // Use extend rather than replacing, so other original + // data values can be used, e.g. in labelFormatter. + $.extend(data[i], { + data: [[1, value]], + color: data[i].color, + label: data[i].label, + angle: value * Math.PI * 2 / total, + percent: value / (total / 100) + }) + ); } } diff --git a/src/plugins/jquery.flot.resize.js b/src/plugins/jquery.flot.resize.js index 3934685..202e660 100644 --- a/src/plugins/jquery.flot.resize.js +++ b/src/plugins/jquery.flot.resize.js @@ -1,6 +1,6 @@ /* Flot plugin for automatically redrawing plots as the placeholder resizes. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. It works by listening for changes on the placeholder div (through the jQuery diff --git a/src/plugins/jquery.flot.selection.js b/src/plugins/jquery.flot.selection.js index c8b11dc..6c8ced6 100644 --- a/src/plugins/jquery.flot.selection.js +++ b/src/plugins/jquery.flot.selection.js @@ -1,6 +1,6 @@ /* Flot plugin for selecting regions of a plot. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The plugin supports these options: diff --git a/src/plugins/jquery.flot.stack.js b/src/plugins/jquery.flot.stack.js index bb4c268..bcab864 100644 --- a/src/plugins/jquery.flot.stack.js +++ b/src/plugins/jquery.flot.stack.js @@ -1,6 +1,6 @@ /* Flot plugin for stacking data sets rather than overlyaing them. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The plugin assumes the data is sorted on x (or y if stacking horizontally). diff --git a/src/plugins/jquery.flot.symbol.js b/src/plugins/jquery.flot.symbol.js index f144bdf..268a741 100644 --- a/src/plugins/jquery.flot.symbol.js +++ b/src/plugins/jquery.flot.symbol.js @@ -1,6 +1,6 @@ /* Flot plugin that adds some extra symbols for plotting points. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The symbols are accessed as strings through the standard symbol options: diff --git a/src/plugins/jquery.flot.threshold.js b/src/plugins/jquery.flot.threshold.js index 59f4925..a175392 100644 --- a/src/plugins/jquery.flot.threshold.js +++ b/src/plugins/jquery.flot.threshold.js @@ -1,6 +1,6 @@ /* Flot plugin for thresholding data. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. The plugin supports these options: diff --git a/src/plugins/jquery.flot.time.js b/src/plugins/jquery.flot.time.js index 0499e9d..2812fa7 100644 --- a/src/plugins/jquery.flot.time.js +++ b/src/plugins/jquery.flot.time.js @@ -1,6 +1,6 @@ /* Pretty handling of time axes. -Copyright (c) 2007-2013 IOLA and Ole Laursen. +Copyright (c) 2007-2014 IOLA and Ole Laursen. Licensed under the MIT license. Set axis.mode to "time" to enable. See the section "Time series data" in