diff --git a/API.txt b/API.txt index 1665add..e8cfb99 100644 --- a/API.txt +++ b/API.txt @@ -140,7 +140,8 @@ background. If you want the legend to appear somewhere else in the DOM, you can specify "container" as a jQuery object to put the legend table into. -The "position" and "margin" etc. options will then be ignored. +The "position" and "margin" etc. options will then be ignored. Note +that it will overwrite the contents of the container. diff --git a/NEWS.txt b/NEWS.txt index 696bd90..5ad9a42 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -16,6 +16,10 @@ multiple plots aligned. The "fill" option can now be a number that specifies the opacity of the fill. +Using the "container" option in legend now overwrites the container +element instead of just appending to it (fixes infinite legend bug, +reported by several people, fix by Brad Dewey). + Fixed a bug in calculating spacing around the plot (reported by timothytoe). Fixed a bug in finding max values for all-negative data sets. Prevent the possibility of eternal looping in tick calculations. diff --git a/jquery.flot.js b/jquery.flot.js index 9edaf7e..44f84c3 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -1345,7 +1345,7 @@ if (fragments.length > 0) { var table = '' + fragments.join("") + '
'; if (options.legend.container != null) - options.legend.container.append(table); + options.legend.container.html(table); else { var pos = ""; var p = options.legend.position, m = options.legend.margin;