Update flot-tooltip to 0.9.0

This commit is contained in:
Garret Wassermann 2017-05-26 16:05:19 -04:00
parent 1e9c4888b9
commit 23898fbf35
3 changed files with 59 additions and 55 deletions

View File

@ -2,11 +2,11 @@
* jquery.flot.tooltip
*
* description: easy-to-use tooltips for Flot charts
* version: 0.8.7
* version: 0.9.0
* authors: Krzysztof Urbas @krzysu [myviews.pl],Evan Steinkerchner @Roundaround
* website: https://github.com/krzysu/flot.tooltip
*
* build on 2016-03-15
* build on 2016-07-26
* released under MIT License, 2012
*/
(function ($) {
@ -260,6 +260,7 @@
var totalTipHeight = $tip.outerHeight() + that.tooltipOptions.shifts.y;
if ((pos.x - $(window).scrollLeft()) > ($(window)[that.wfunc]() - totalTipWidth)) {
pos.x -= totalTipWidth;
pos.x = Math.max(pos.x, 0);
}
if ((pos.y - $(window).scrollTop()) > ($(window)[that.hfunc]() - totalTipHeight)) {
pos.y -= totalTipHeight;
@ -299,7 +300,7 @@
return;
$tip.html(tipText);
plot.setTooltipPosition({ x: position.pageX, y: position.pageY });
plot.setTooltipPosition({ x: that.tipPosition.x, y: that.tipPosition.y });
$tip.css({
left: that.tipPosition.x + that.tooltipOptions.shifts.x,
top: that.tipPosition.y + that.tooltipOptions.shifts.y
@ -416,8 +417,9 @@
precede the replacement of single-character templates
to avoid conflict between '%c' and '%ct' and similar substrings
*/
if (customText)
if (customText) {
content = content.replace(customTextPattern, customText);
}
// percent match for pie charts and stacked percent
if (typeof (item.series.percent) !== 'undefined') {
@ -431,7 +433,7 @@
// replace %n with number of items represented by slice in pie charts
if (item.series.hasOwnProperty('pie')) {
if (typeof (item.series.data[0][1] !== 'undefined')) {
if (typeof item.series.data[0][1] !== 'undefined') {
n = item.series.data[0][1];
}
}

File diff suppressed because one or more lines are too long

View File

@ -249,6 +249,7 @@
var totalTipHeight = $tip.outerHeight() + that.tooltipOptions.shifts.y;
if ((pos.x - $(window).scrollLeft()) > ($(window)[that.wfunc]() - totalTipWidth)) {
pos.x -= totalTipWidth;
pos.x = Math.max(pos.x, 0);
}
if ((pos.y - $(window).scrollTop()) > ($(window)[that.hfunc]() - totalTipHeight)) {
pos.y -= totalTipHeight;
@ -288,7 +289,7 @@
return;
$tip.html(tipText);
plot.setTooltipPosition({ x: position.pageX, y: position.pageY });
plot.setTooltipPosition({ x: that.tipPosition.x, y: that.tipPosition.y });
$tip.css({
left: that.tipPosition.x + that.tooltipOptions.shifts.x,
top: that.tipPosition.y + that.tooltipOptions.shifts.y
@ -405,8 +406,9 @@
precede the replacement of single-character templates
to avoid conflict between '%c' and '%ct' and similar substrings
*/
if (customText)
if (customText) {
content = content.replace(customTextPattern, customText);
}
// percent match for pie charts and stacked percent
if (typeof (item.series.percent) !== 'undefined') {
@ -420,7 +422,7 @@
// replace %n with number of items represented by slice in pie charts
if (item.series.hasOwnProperty('pie')) {
if (typeof (item.series.data[0][1] !== 'undefined')) {
if (typeof item.series.data[0][1] !== 'undefined') {
n = item.series.data[0][1];
}
}