@kevinburke/flot 5.1.1 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/dist/flot.js +47 -28
- package/dist/flot.min.js +1 -1
- package/dist/flot.min.js.map +1 -1
- package/dist/flot.mjs +47 -28
- package/dist/jquery.flot.js +94 -31
- package/dist/jquery.flot.min.js +1 -1
- package/dist/jquery.flot.min.js.map +1 -1
- package/dist/plugins/jquery.flot.crosshair.js +2 -2
- package/dist/plugins/jquery.flot.crosshair.min.js +1 -1
- package/dist/plugins/jquery.flot.image.js +6 -6
- package/dist/plugins/jquery.flot.image.min.js +1 -1
- package/dist/plugins/jquery.flot.image.min.js.map +1 -1
- package/dist/plugins/jquery.flot.pie.js +4 -4
- package/dist/plugins/jquery.flot.pie.min.js +1 -1
- package/dist/plugins/jquery.flot.pie.min.js.map +1 -1
- package/dist/plugins/jquery.flot.resize.js +2 -2
- package/dist/plugins/jquery.flot.resize.min.js +1 -1
- package/dist/plugins/jquery.flot.resize.min.js.map +1 -1
- package/dist/plugins/jquery.flot.threshold.js +2 -2
- package/dist/plugins/jquery.flot.threshold.min.js +1 -1
- package/package.json +1 -1
- package/source/globals.d.ts +5 -0
- package/source/helpers.js +16 -4
- package/source/jquery-adapter.js +27 -2
- package/source/jquery.canvaswrapper.js +8 -4
- package/source/jquery.flot.browser.js +1 -1
- package/source/jquery.flot.composeImages.js +1 -1
- package/source/jquery.flot.hover.js +4 -4
- package/source/jquery.flot.image.js +6 -1
- package/source/jquery.flot.js +1 -1
- package/source/jquery.flot.legend.js +1 -1
- package/source/jquery.flot.navigate.js +1 -1
- package/source/jquery.flot.pie.js +2 -2
- package/source/jquery.flot.selection.js +3 -2
- package/source/jquery.flot.time.js +3 -3
- package/source/jquery.flot.touch.js +6 -1
- package/source/jquery.flot.touchNavigate.js +5 -3
- package/types/jquery.d.ts +2 -1
- package/source/jquery.js +0 -9473
package/dist/flot.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @kevinburke/flot v5.1.
|
|
1
|
+
/*! @kevinburke/flot v5.1.3 | MIT License | https://github.com/kevinburke/flot */
|
|
2
2
|
var browser = {
|
|
3
3
|
getPageXY: function (e) {
|
|
4
4
|
var doc = document.documentElement,
|
|
@@ -21,7 +21,7 @@ var browser = {
|
|
|
21
21
|
isSafari: function() {
|
|
22
22
|
var top = window.top;
|
|
23
23
|
if (!top) return false;
|
|
24
|
-
return /constructor/i.test(top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!top['safari'] || (typeof top.safari !== 'undefined' && top.safari.pushNotification));
|
|
24
|
+
return /constructor/i.test(/** @type {any} */ (top.HTMLElement)) || (function (/** @type {any} */ p) { return p.toString() === "[object SafariRemoteNotification]"; })(!(/** @type {any} */ (top))['safari'] || (typeof (/** @type {any} */ (top)).safari !== 'undefined' && (/** @type {any} */ (top)).safari.pushNotification));
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
isMobileSafari: function() {
|
|
@@ -102,6 +102,9 @@ function extend(deep, target) {
|
|
|
102
102
|
var keys = Object.keys(src);
|
|
103
103
|
for (var k = 0; k < keys.length; k++) {
|
|
104
104
|
var key = keys[k];
|
|
105
|
+
if (key === '__proto__' || key === 'constructor') {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
105
108
|
var val = src[key];
|
|
106
109
|
if (val === undefined) {
|
|
107
110
|
continue;
|
|
@@ -168,10 +171,11 @@ function removeData(el, key) {
|
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
173
|
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
|
|
174
|
+
// Default trigger: dispatches a native CustomEvent with extra args stashed
|
|
175
|
+
// on `event.detail` (an array). The jQuery adapter overrides this via
|
|
176
|
+
// setTrigger so handlers bound with $(el).on(type, fn) receive the extra
|
|
177
|
+
// args as positional parameters, matching upstream flot/flot behavior.
|
|
178
|
+
var triggerImpl = function(el, type, args) {
|
|
175
179
|
var event = new CustomEvent(type, {
|
|
176
180
|
detail: args || [],
|
|
177
181
|
bubbles: true,
|
|
@@ -179,6 +183,10 @@ function trigger(el, type, args) {
|
|
|
179
183
|
});
|
|
180
184
|
el.dispatchEvent(event);
|
|
181
185
|
return event;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
function trigger(el, type, args) {
|
|
189
|
+
return triggerImpl(el, type, args);
|
|
182
190
|
}
|
|
183
191
|
|
|
184
192
|
// Bind an event listener, tracking it so unbindAll can remove it later.
|
|
@@ -441,7 +449,9 @@ var Canvas = function(cls, container) {
|
|
|
441
449
|
layer.style.left = '0px';
|
|
442
450
|
layer.style.bottom = '0px';
|
|
443
451
|
layer.style.right = '0px';
|
|
444
|
-
svgElement
|
|
452
|
+
if (svgElement) {
|
|
453
|
+
svgElement.appendChild(layer);
|
|
454
|
+
}
|
|
445
455
|
this.SVG[classes] = layer;
|
|
446
456
|
}
|
|
447
457
|
|
|
@@ -535,8 +545,8 @@ var Canvas = function(cls, container) {
|
|
|
535
545
|
|
|
536
546
|
element.style.position = 'absolute';
|
|
537
547
|
element.style.maxWidth = width;
|
|
538
|
-
element.setAttributeNS(null, 'x', -9999);
|
|
539
|
-
element.setAttributeNS(null, 'y', -9999);
|
|
548
|
+
element.setAttributeNS(null, 'x', String(-9999));
|
|
549
|
+
element.setAttributeNS(null, 'y', String(-9999));
|
|
540
550
|
|
|
541
551
|
if (typeof font === 'object') {
|
|
542
552
|
element.style.font = textStyle;
|
|
@@ -560,7 +570,9 @@ var Canvas = function(cls, container) {
|
|
|
560
570
|
while (element.firstChild) {
|
|
561
571
|
element.removeChild(element.firstChild);
|
|
562
572
|
}
|
|
563
|
-
element.parentNode
|
|
573
|
+
if (element.parentNode) {
|
|
574
|
+
element.parentNode.removeChild(element);
|
|
575
|
+
}
|
|
564
576
|
}
|
|
565
577
|
|
|
566
578
|
info.measured = true;
|
|
@@ -4518,7 +4530,7 @@ Licensed under the MIT license.
|
|
|
4518
4530
|
// Plugin registry. Plugins push to this array to register themselves.
|
|
4519
4531
|
var plugins = [];
|
|
4520
4532
|
|
|
4521
|
-
var version = "5.1.
|
|
4533
|
+
var version = "5.1.3";
|
|
4522
4534
|
|
|
4523
4535
|
// The main plot function.
|
|
4524
4536
|
function plot(placeholder, data, options) {
|
|
@@ -6014,7 +6026,7 @@ Licensed under the MIT license.
|
|
|
6014
6026
|
ctx.lineJoin = "round";
|
|
6015
6027
|
var startx = Math.round(panHint.start.x),
|
|
6016
6028
|
starty = Math.round(panHint.start.y),
|
|
6017
|
-
endx, endy;
|
|
6029
|
+
endx = 0, endy = 0;
|
|
6018
6030
|
|
|
6019
6031
|
if (panAxes) {
|
|
6020
6032
|
if (panAxes[0].direction === 'x') {
|
|
@@ -6779,13 +6791,14 @@ var options$4 = {
|
|
|
6779
6791
|
}
|
|
6780
6792
|
|
|
6781
6793
|
function initTouchNavigation$1(plot, options) {
|
|
6794
|
+
/** @type {{ zoomEnable: boolean, prevDistance: number | null, prevTapTime: number, prevPanPosition: {x: number, y: number}, prevTapPosition: {x: number, y: number} }} */
|
|
6782
6795
|
var gestureState = {
|
|
6783
6796
|
zoomEnable: false,
|
|
6784
6797
|
prevDistance: null,
|
|
6785
|
-
prevTapTime: 0,
|
|
6786
6798
|
prevPanPosition: { x: 0, y: 0 },
|
|
6787
6799
|
prevTapPosition: { x: 0, y: 0 }
|
|
6788
6800
|
},
|
|
6801
|
+
/** @type {{ prevTouchedAxis: string, currentTouchedAxis: string, touchedAxis: any, navigationConstraint: string, initialState: any }} */
|
|
6789
6802
|
navigationState = {
|
|
6790
6803
|
prevTouchedAxis: 'none',
|
|
6791
6804
|
currentTouchedAxis: 'none',
|
|
@@ -6842,7 +6855,7 @@ var options$4 = {
|
|
|
6842
6855
|
drag: function(e) {
|
|
6843
6856
|
presetNavigationState(e, 'pan');
|
|
6844
6857
|
|
|
6845
|
-
if (useSmartPan) {
|
|
6858
|
+
if (useSmartPan && navigationState.initialState) {
|
|
6846
6859
|
var point = getPoint(e, 'pan');
|
|
6847
6860
|
plot.smartPan({
|
|
6848
6861
|
x: navigationState.initialState.startPageX - point.x,
|
|
@@ -6866,7 +6879,7 @@ var options$4 = {
|
|
|
6866
6879
|
}
|
|
6867
6880
|
|
|
6868
6881
|
if (wasPinchEvent(e, gestureState)) {
|
|
6869
|
-
|
|
6882
|
+
updatePrevPanPosition(e, 'pan', gestureState, navigationState);
|
|
6870
6883
|
}
|
|
6871
6884
|
}
|
|
6872
6885
|
};
|
|
@@ -6898,7 +6911,7 @@ var options$4 = {
|
|
|
6898
6911
|
|
|
6899
6912
|
var dist = pinchDistance(e);
|
|
6900
6913
|
|
|
6901
|
-
if (gestureState.zoomEnable || Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN) {
|
|
6914
|
+
if (gestureState.zoomEnable || (gestureState.prevDistance != null && Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN)) {
|
|
6902
6915
|
zoomPlot(plot, e, gestureState, navigationState);
|
|
6903
6916
|
|
|
6904
6917
|
//activate zoom mode
|
|
@@ -7158,10 +7171,10 @@ var options$4 = {
|
|
|
7158
7171
|
newEvent = new CustomEvent('mouseevent');
|
|
7159
7172
|
|
|
7160
7173
|
//transform from touch event to mouse event format
|
|
7161
|
-
newEvent.pageX = e.detail.changedTouches[0].pageX;
|
|
7162
|
-
newEvent.pageY = e.detail.changedTouches[0].pageY;
|
|
7163
|
-
newEvent.clientX = e.detail.changedTouches[0].clientX;
|
|
7164
|
-
newEvent.clientY = e.detail.changedTouches[0].clientY;
|
|
7174
|
+
/** @type {any} */ (newEvent).pageX = e.detail.changedTouches[0].pageX;
|
|
7175
|
+
/** @type {any} */ (newEvent).pageY = e.detail.changedTouches[0].pageY;
|
|
7176
|
+
/** @type {any} */ (newEvent).clientX = e.detail.changedTouches[0].clientX;
|
|
7177
|
+
/** @type {any} */ (newEvent).clientY = e.detail.changedTouches[0].clientY;
|
|
7165
7178
|
|
|
7166
7179
|
if (o.grid.hoverable) {
|
|
7167
7180
|
doTriggerClickHoverEvent(newEvent, eventType.hover, 30);
|
|
@@ -7440,6 +7453,7 @@ var options$2 = {
|
|
|
7440
7453
|
}
|
|
7441
7454
|
|
|
7442
7455
|
function initTouchNavigation(plot, options) {
|
|
7456
|
+
/** @type {{ twoTouches: boolean, currentTapStart: {x: number, y: number}, currentTapEnd: {x: number, y: number}, prevTap: {x: number, y: number}, currentTap: {x: number, y: number}, interceptedLongTap: boolean, isUnsupportedGesture: boolean, prevTapTime: number | null, tapStartTime: number | null, longTapTriggerId: ReturnType<typeof setTimeout> | null }} */
|
|
7443
7457
|
var gestureState = {
|
|
7444
7458
|
twoTouches: false,
|
|
7445
7459
|
currentTapStart: { x: 0, y: 0 },
|
|
@@ -7593,6 +7607,7 @@ var options$2 = {
|
|
|
7593
7607
|
},
|
|
7594
7608
|
|
|
7595
7609
|
isLongTap: function(e) {
|
|
7610
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7596
7611
|
var currentTime = new Date().getTime(),
|
|
7597
7612
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7598
7613
|
if (tapDuration >= minLongTapDuration && !gestureState.interceptedLongTap) {
|
|
@@ -7633,6 +7648,7 @@ var options$2 = {
|
|
|
7633
7648
|
},
|
|
7634
7649
|
|
|
7635
7650
|
isTap: function(e) {
|
|
7651
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7636
7652
|
var currentTime = new Date().getTime(),
|
|
7637
7653
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7638
7654
|
if (tapDuration <= pressedTapDuration) {
|
|
@@ -7681,7 +7697,9 @@ var options$2 = {
|
|
|
7681
7697
|
}
|
|
7682
7698
|
function isDoubleTap(e) {
|
|
7683
7699
|
var currentTime = new Date().getTime(),
|
|
7684
|
-
intervalBetweenTaps =
|
|
7700
|
+
intervalBetweenTaps = gestureState.prevTapTime != null
|
|
7701
|
+
? currentTime - gestureState.prevTapTime
|
|
7702
|
+
: Infinity;
|
|
7685
7703
|
|
|
7686
7704
|
if (intervalBetweenTaps >= 0 && intervalBetweenTaps < maxIntervalBetweenTaps) {
|
|
7687
7705
|
if (distance(gestureState.prevTap.x, gestureState.prevTap.y, gestureState.currentTap.x, gestureState.currentTap.y) < maxDistanceBetweenTaps) {
|
|
@@ -8068,9 +8086,9 @@ API.txt for details.
|
|
|
8068
8086
|
}
|
|
8069
8087
|
|
|
8070
8088
|
for (var i = 0; i < spec.length - 1; ++i) {
|
|
8071
|
-
if (axis.delta < (spec[i][0] * timeUnitSize[spec[i][1]] +
|
|
8072
|
-
spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2 &&
|
|
8073
|
-
spec[i][0] * timeUnitSize[spec[i][1]] >= minSize) {
|
|
8089
|
+
if (axis.delta < (Number(spec[i][0]) * timeUnitSize[spec[i][1]] +
|
|
8090
|
+
Number(spec[i + 1][0]) * timeUnitSize[spec[i + 1][1]]) / 2 &&
|
|
8091
|
+
Number(spec[i][0]) * timeUnitSize[spec[i][1]] >= minSize) {
|
|
8074
8092
|
break;
|
|
8075
8093
|
}
|
|
8076
8094
|
}
|
|
@@ -8733,6 +8751,7 @@ The plugin allso adds the following methods to the plot object:
|
|
|
8733
8751
|
}
|
|
8734
8752
|
|
|
8735
8753
|
function triggerSelectedEvent() {
|
|
8754
|
+
/** @type {any} */
|
|
8736
8755
|
var r = getSelection();
|
|
8737
8756
|
|
|
8738
8757
|
trigger(plot.getPlaceholder(), "plotselected", [ r ]);
|
|
@@ -8815,7 +8834,7 @@ The plugin allso adds the following methods to the plot object:
|
|
|
8815
8834
|
|
|
8816
8835
|
// function taken from markings support in Flot
|
|
8817
8836
|
function extractRange(ranges, coord) {
|
|
8818
|
-
var axis, from, to, key, axes = plot.getAxes();
|
|
8837
|
+
var axis, from, to, /** @type {string|undefined} */ key, axes = plot.getAxes();
|
|
8819
8838
|
|
|
8820
8839
|
for (var k in axes) {
|
|
8821
8840
|
axis = axes[k];
|
|
@@ -8835,7 +8854,7 @@ The plugin allso adds the following methods to the plot object:
|
|
|
8835
8854
|
}
|
|
8836
8855
|
|
|
8837
8856
|
// backwards-compat stuff - to be removed in future
|
|
8838
|
-
if (!ranges[key]) {
|
|
8857
|
+
if (key && !ranges[key]) {
|
|
8839
8858
|
axis = coord === "x" ? plot.getXAxes()[0] : plot.getYAxes()[0];
|
|
8840
8859
|
from = ranges[coord + "1"];
|
|
8841
8860
|
to = ranges[coord + "2"];
|
|
@@ -9244,7 +9263,7 @@ temporary images load their data.
|
|
|
9244
9263
|
const utf8Array = new Uint8Array(arrayBuffer);
|
|
9245
9264
|
const blockSize = 16384;
|
|
9246
9265
|
for (var i = 0; i < utf8Array.length; i = i + blockSize) {
|
|
9247
|
-
const binarySubString = String.fromCharCode.apply(null, utf8Array.subarray(i, i + blockSize));
|
|
9266
|
+
const binarySubString = String.fromCharCode.apply(null, /** @type {any} */ (utf8Array.subarray(i, i + blockSize)));
|
|
9248
9267
|
binaryString = binaryString + binarySubString;
|
|
9249
9268
|
}
|
|
9250
9269
|
return binaryString;
|
|
@@ -9459,7 +9478,7 @@ temporary images load their data.
|
|
|
9459
9478
|
|
|
9460
9479
|
var left = 0;
|
|
9461
9480
|
var columnWidths = [];
|
|
9462
|
-
var style = window.getComputedStyle(document.
|
|
9481
|
+
var style = window.getComputedStyle(document.body);
|
|
9463
9482
|
for (i = 0; i < entries.length; ++i) {
|
|
9464
9483
|
let columnIndex = i % options.legend.noColumns;
|
|
9465
9484
|
entry = entries[i];
|
package/dist/jquery.flot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @kevinburke/flot v5.1.
|
|
1
|
+
/*! @kevinburke/flot v5.1.3 | MIT License | https://github.com/kevinburke/flot */
|
|
2
2
|
(function ($) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
isSafari: function() {
|
|
25
25
|
var top = window.top;
|
|
26
26
|
if (!top) return false;
|
|
27
|
-
return /constructor/i.test(top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!top['safari'] || (typeof top.safari !== 'undefined' && top.safari.pushNotification));
|
|
27
|
+
return /constructor/i.test(/** @type {any} */ (top.HTMLElement)) || (function (/** @type {any} */ p) { return p.toString() === "[object SafariRemoteNotification]"; })(!(/** @type {any} */ (top))['safari'] || (typeof (/** @type {any} */ (top)).safari !== 'undefined' && (/** @type {any} */ (top)).safari.pushNotification));
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
isMobileSafari: function() {
|
|
@@ -105,6 +105,9 @@
|
|
|
105
105
|
var keys = Object.keys(src);
|
|
106
106
|
for (var k = 0; k < keys.length; k++) {
|
|
107
107
|
var key = keys[k];
|
|
108
|
+
if (key === '__proto__' || key === 'constructor') {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
108
111
|
var val = src[key];
|
|
109
112
|
if (val === undefined) {
|
|
110
113
|
continue;
|
|
@@ -165,16 +168,19 @@
|
|
|
165
168
|
function removeData(el, key) {
|
|
166
169
|
var store = dataStore.get(el);
|
|
167
170
|
if (store) {
|
|
168
|
-
{
|
|
171
|
+
if (key) {
|
|
169
172
|
delete store[key];
|
|
173
|
+
} else {
|
|
174
|
+
dataStore.delete(el);
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
}
|
|
173
178
|
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
|
|
179
|
+
// Default trigger: dispatches a native CustomEvent with extra args stashed
|
|
180
|
+
// on `event.detail` (an array). The jQuery adapter overrides this via
|
|
181
|
+
// setTrigger so handlers bound with $(el).on(type, fn) receive the extra
|
|
182
|
+
// args as positional parameters, matching upstream flot/flot behavior.
|
|
183
|
+
var triggerImpl = function(el, type, args) {
|
|
178
184
|
var event = new CustomEvent(type, {
|
|
179
185
|
detail: args || [],
|
|
180
186
|
bubbles: true,
|
|
@@ -182,6 +188,14 @@
|
|
|
182
188
|
});
|
|
183
189
|
el.dispatchEvent(event);
|
|
184
190
|
return event;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
function trigger(el, type, args) {
|
|
194
|
+
return triggerImpl(el, type, args);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function setTrigger$1(fn) {
|
|
198
|
+
triggerImpl = fn;
|
|
185
199
|
}
|
|
186
200
|
|
|
187
201
|
// Bind an event listener, tracking it so unbindAll can remove it later.
|
|
@@ -223,6 +237,20 @@
|
|
|
223
237
|
}
|
|
224
238
|
}
|
|
225
239
|
|
|
240
|
+
var helpers = /*#__PURE__*/Object.freeze({
|
|
241
|
+
__proto__: null,
|
|
242
|
+
bind: bind,
|
|
243
|
+
css: css,
|
|
244
|
+
data: data,
|
|
245
|
+
extend: extend,
|
|
246
|
+
height: height,
|
|
247
|
+
removeData: removeData,
|
|
248
|
+
setTrigger: setTrigger$1,
|
|
249
|
+
trigger: trigger,
|
|
250
|
+
unbind: unbind,
|
|
251
|
+
width: width
|
|
252
|
+
});
|
|
253
|
+
|
|
226
254
|
/** ## jquery.flot.canvaswrapper
|
|
227
255
|
|
|
228
256
|
This plugin contains the function for creating and manipulating both the canvas
|
|
@@ -444,7 +472,9 @@
|
|
|
444
472
|
layer.style.left = '0px';
|
|
445
473
|
layer.style.bottom = '0px';
|
|
446
474
|
layer.style.right = '0px';
|
|
447
|
-
svgElement
|
|
475
|
+
if (svgElement) {
|
|
476
|
+
svgElement.appendChild(layer);
|
|
477
|
+
}
|
|
448
478
|
this.SVG[classes] = layer;
|
|
449
479
|
}
|
|
450
480
|
|
|
@@ -538,8 +568,8 @@
|
|
|
538
568
|
|
|
539
569
|
element.style.position = 'absolute';
|
|
540
570
|
element.style.maxWidth = width;
|
|
541
|
-
element.setAttributeNS(null, 'x', -9999);
|
|
542
|
-
element.setAttributeNS(null, 'y', -9999);
|
|
571
|
+
element.setAttributeNS(null, 'x', String(-9999));
|
|
572
|
+
element.setAttributeNS(null, 'y', String(-9999));
|
|
543
573
|
|
|
544
574
|
if (typeof font === 'object') {
|
|
545
575
|
element.style.font = textStyle;
|
|
@@ -563,7 +593,9 @@
|
|
|
563
593
|
while (element.firstChild) {
|
|
564
594
|
element.removeChild(element.firstChild);
|
|
565
595
|
}
|
|
566
|
-
element.parentNode
|
|
596
|
+
if (element.parentNode) {
|
|
597
|
+
element.parentNode.removeChild(element);
|
|
598
|
+
}
|
|
567
599
|
}
|
|
568
600
|
|
|
569
601
|
info.measured = true;
|
|
@@ -4521,7 +4553,7 @@
|
|
|
4521
4553
|
// Plugin registry. Plugins push to this array to register themselves.
|
|
4522
4554
|
var plugins = [];
|
|
4523
4555
|
|
|
4524
|
-
var version = "5.1.
|
|
4556
|
+
var version = "5.1.3";
|
|
4525
4557
|
|
|
4526
4558
|
// The main plot function.
|
|
4527
4559
|
function plot(placeholder, data, options) {
|
|
@@ -6017,7 +6049,7 @@
|
|
|
6017
6049
|
ctx.lineJoin = "round";
|
|
6018
6050
|
var startx = Math.round(panHint.start.x),
|
|
6019
6051
|
starty = Math.round(panHint.start.y),
|
|
6020
|
-
endx, endy;
|
|
6052
|
+
endx = 0, endy = 0;
|
|
6021
6053
|
|
|
6022
6054
|
if (panAxes) {
|
|
6023
6055
|
if (panAxes[0].direction === 'x') {
|
|
@@ -6782,13 +6814,14 @@
|
|
|
6782
6814
|
}
|
|
6783
6815
|
|
|
6784
6816
|
function initTouchNavigation$1(plot, options) {
|
|
6817
|
+
/** @type {{ zoomEnable: boolean, prevDistance: number | null, prevTapTime: number, prevPanPosition: {x: number, y: number}, prevTapPosition: {x: number, y: number} }} */
|
|
6785
6818
|
var gestureState = {
|
|
6786
6819
|
zoomEnable: false,
|
|
6787
6820
|
prevDistance: null,
|
|
6788
|
-
prevTapTime: 0,
|
|
6789
6821
|
prevPanPosition: { x: 0, y: 0 },
|
|
6790
6822
|
prevTapPosition: { x: 0, y: 0 }
|
|
6791
6823
|
},
|
|
6824
|
+
/** @type {{ prevTouchedAxis: string, currentTouchedAxis: string, touchedAxis: any, navigationConstraint: string, initialState: any }} */
|
|
6792
6825
|
navigationState = {
|
|
6793
6826
|
prevTouchedAxis: 'none',
|
|
6794
6827
|
currentTouchedAxis: 'none',
|
|
@@ -6845,7 +6878,7 @@
|
|
|
6845
6878
|
drag: function(e) {
|
|
6846
6879
|
presetNavigationState(e, 'pan');
|
|
6847
6880
|
|
|
6848
|
-
if (useSmartPan) {
|
|
6881
|
+
if (useSmartPan && navigationState.initialState) {
|
|
6849
6882
|
var point = getPoint(e, 'pan');
|
|
6850
6883
|
plot.smartPan({
|
|
6851
6884
|
x: navigationState.initialState.startPageX - point.x,
|
|
@@ -6869,7 +6902,7 @@
|
|
|
6869
6902
|
}
|
|
6870
6903
|
|
|
6871
6904
|
if (wasPinchEvent(e, gestureState)) {
|
|
6872
|
-
|
|
6905
|
+
updatePrevPanPosition(e, 'pan', gestureState, navigationState);
|
|
6873
6906
|
}
|
|
6874
6907
|
}
|
|
6875
6908
|
};
|
|
@@ -6901,7 +6934,7 @@
|
|
|
6901
6934
|
|
|
6902
6935
|
var dist = pinchDistance(e);
|
|
6903
6936
|
|
|
6904
|
-
if (gestureState.zoomEnable || Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN) {
|
|
6937
|
+
if (gestureState.zoomEnable || (gestureState.prevDistance != null && Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN)) {
|
|
6905
6938
|
zoomPlot(plot, e, gestureState, navigationState);
|
|
6906
6939
|
|
|
6907
6940
|
//activate zoom mode
|
|
@@ -7161,10 +7194,10 @@
|
|
|
7161
7194
|
newEvent = new CustomEvent('mouseevent');
|
|
7162
7195
|
|
|
7163
7196
|
//transform from touch event to mouse event format
|
|
7164
|
-
newEvent.pageX = e.detail.changedTouches[0].pageX;
|
|
7165
|
-
newEvent.pageY = e.detail.changedTouches[0].pageY;
|
|
7166
|
-
newEvent.clientX = e.detail.changedTouches[0].clientX;
|
|
7167
|
-
newEvent.clientY = e.detail.changedTouches[0].clientY;
|
|
7197
|
+
/** @type {any} */ (newEvent).pageX = e.detail.changedTouches[0].pageX;
|
|
7198
|
+
/** @type {any} */ (newEvent).pageY = e.detail.changedTouches[0].pageY;
|
|
7199
|
+
/** @type {any} */ (newEvent).clientX = e.detail.changedTouches[0].clientX;
|
|
7200
|
+
/** @type {any} */ (newEvent).clientY = e.detail.changedTouches[0].clientY;
|
|
7168
7201
|
|
|
7169
7202
|
if (o.grid.hoverable) {
|
|
7170
7203
|
doTriggerClickHoverEvent(newEvent, eventType.hover, 30);
|
|
@@ -7443,6 +7476,7 @@
|
|
|
7443
7476
|
}
|
|
7444
7477
|
|
|
7445
7478
|
function initTouchNavigation(plot, options) {
|
|
7479
|
+
/** @type {{ twoTouches: boolean, currentTapStart: {x: number, y: number}, currentTapEnd: {x: number, y: number}, prevTap: {x: number, y: number}, currentTap: {x: number, y: number}, interceptedLongTap: boolean, isUnsupportedGesture: boolean, prevTapTime: number | null, tapStartTime: number | null, longTapTriggerId: ReturnType<typeof setTimeout> | null }} */
|
|
7446
7480
|
var gestureState = {
|
|
7447
7481
|
twoTouches: false,
|
|
7448
7482
|
currentTapStart: { x: 0, y: 0 },
|
|
@@ -7596,6 +7630,7 @@
|
|
|
7596
7630
|
},
|
|
7597
7631
|
|
|
7598
7632
|
isLongTap: function(e) {
|
|
7633
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7599
7634
|
var currentTime = new Date().getTime(),
|
|
7600
7635
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7601
7636
|
if (tapDuration >= minLongTapDuration && !gestureState.interceptedLongTap) {
|
|
@@ -7636,6 +7671,7 @@
|
|
|
7636
7671
|
},
|
|
7637
7672
|
|
|
7638
7673
|
isTap: function(e) {
|
|
7674
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7639
7675
|
var currentTime = new Date().getTime(),
|
|
7640
7676
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7641
7677
|
if (tapDuration <= pressedTapDuration) {
|
|
@@ -7684,7 +7720,9 @@
|
|
|
7684
7720
|
}
|
|
7685
7721
|
function isDoubleTap(e) {
|
|
7686
7722
|
var currentTime = new Date().getTime(),
|
|
7687
|
-
intervalBetweenTaps =
|
|
7723
|
+
intervalBetweenTaps = gestureState.prevTapTime != null
|
|
7724
|
+
? currentTime - gestureState.prevTapTime
|
|
7725
|
+
: Infinity;
|
|
7688
7726
|
|
|
7689
7727
|
if (intervalBetweenTaps >= 0 && intervalBetweenTaps < maxIntervalBetweenTaps) {
|
|
7690
7728
|
if (distance(gestureState.prevTap.x, gestureState.prevTap.y, gestureState.currentTap.x, gestureState.currentTap.y) < maxDistanceBetweenTaps) {
|
|
@@ -8071,9 +8109,9 @@
|
|
|
8071
8109
|
}
|
|
8072
8110
|
|
|
8073
8111
|
for (var i = 0; i < spec.length - 1; ++i) {
|
|
8074
|
-
if (axis.delta < (spec[i][0] * timeUnitSize[spec[i][1]] +
|
|
8075
|
-
spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2 &&
|
|
8076
|
-
spec[i][0] * timeUnitSize[spec[i][1]] >= minSize) {
|
|
8112
|
+
if (axis.delta < (Number(spec[i][0]) * timeUnitSize[spec[i][1]] +
|
|
8113
|
+
Number(spec[i + 1][0]) * timeUnitSize[spec[i + 1][1]]) / 2 &&
|
|
8114
|
+
Number(spec[i][0]) * timeUnitSize[spec[i][1]] >= minSize) {
|
|
8077
8115
|
break;
|
|
8078
8116
|
}
|
|
8079
8117
|
}
|
|
@@ -8736,6 +8774,7 @@
|
|
|
8736
8774
|
}
|
|
8737
8775
|
|
|
8738
8776
|
function triggerSelectedEvent() {
|
|
8777
|
+
/** @type {any} */
|
|
8739
8778
|
var r = getSelection();
|
|
8740
8779
|
|
|
8741
8780
|
trigger(plot.getPlaceholder(), "plotselected", [ r ]);
|
|
@@ -8818,7 +8857,7 @@
|
|
|
8818
8857
|
|
|
8819
8858
|
// function taken from markings support in Flot
|
|
8820
8859
|
function extractRange(ranges, coord) {
|
|
8821
|
-
var axis, from, to, key, axes = plot.getAxes();
|
|
8860
|
+
var axis, from, to, /** @type {string|undefined} */ key, axes = plot.getAxes();
|
|
8822
8861
|
|
|
8823
8862
|
for (var k in axes) {
|
|
8824
8863
|
axis = axes[k];
|
|
@@ -8838,7 +8877,7 @@
|
|
|
8838
8877
|
}
|
|
8839
8878
|
|
|
8840
8879
|
// backwards-compat stuff - to be removed in future
|
|
8841
|
-
if (!ranges[key]) {
|
|
8880
|
+
if (key && !ranges[key]) {
|
|
8842
8881
|
axis = coord === "x" ? plot.getXAxes()[0] : plot.getYAxes()[0];
|
|
8843
8882
|
from = ranges[coord + "1"];
|
|
8844
8883
|
to = ranges[coord + "2"];
|
|
@@ -9247,7 +9286,7 @@
|
|
|
9247
9286
|
const utf8Array = new Uint8Array(arrayBuffer);
|
|
9248
9287
|
const blockSize = 16384;
|
|
9249
9288
|
for (var i = 0; i < utf8Array.length; i = i + blockSize) {
|
|
9250
|
-
const binarySubString = String.fromCharCode.apply(null, utf8Array.subarray(i, i + blockSize));
|
|
9289
|
+
const binarySubString = String.fromCharCode.apply(null, /** @type {any} */ (utf8Array.subarray(i, i + blockSize)));
|
|
9251
9290
|
binaryString = binaryString + binarySubString;
|
|
9252
9291
|
}
|
|
9253
9292
|
return binaryString;
|
|
@@ -9462,7 +9501,7 @@
|
|
|
9462
9501
|
|
|
9463
9502
|
var left = 0;
|
|
9464
9503
|
var columnWidths = [];
|
|
9465
|
-
var style = window.getComputedStyle(document.
|
|
9504
|
+
var style = window.getComputedStyle(document.body);
|
|
9466
9505
|
for (i = 0; i < entries.length; ++i) {
|
|
9467
9506
|
let columnIndex = i % options.legend.noColumns;
|
|
9468
9507
|
entry = entries[i];
|
|
@@ -9898,14 +9937,33 @@
|
|
|
9898
9937
|
// import '@kevinburke/flot/jquery';
|
|
9899
9938
|
// $.plot("#placeholder", data, options);
|
|
9900
9939
|
|
|
9940
|
+
var setTrigger = setTrigger$1;
|
|
9941
|
+
|
|
9942
|
+
// Route flot's internal trigger() through jQuery so plugin handlers bound
|
|
9943
|
+
// via $(el).on(type, fn) see the same data shape as upstream flot/flot.
|
|
9944
|
+
// Two conventions coexist in the plugins, matching upstream:
|
|
9945
|
+
// - trigger(el, type, [arg0, arg1, ...]) → $(el).trigger(type, [args])
|
|
9946
|
+
// jQuery spreads the array into handler positional params, so
|
|
9947
|
+
// function(event, pos, item, items) works (plothover, plotzoom, ...).
|
|
9948
|
+
// - trigger(el, type, <non-array>) → $.Event(type, { detail: x })
|
|
9949
|
+
// Handlers read event.detail, matching upstream's re-center contract
|
|
9950
|
+
// where a plain object (or Event) is attached to event.detail.
|
|
9951
|
+
setTrigger(function(el, type, args) {
|
|
9952
|
+
if (args === undefined || Array.isArray(args)) {
|
|
9953
|
+
$(el).trigger(type, args || []);
|
|
9954
|
+
return;
|
|
9955
|
+
}
|
|
9956
|
+
var event = $.Event(type, { detail: args });
|
|
9957
|
+
$(el).trigger(event);
|
|
9958
|
+
});
|
|
9901
9959
|
|
|
9902
9960
|
// Register $.plot and $.color on the jQuery object.
|
|
9903
|
-
$.plot = function(placeholder, data, options) {
|
|
9961
|
+
$.plot = /** @type {typeof $.plot} */ (function(placeholder, data, options) {
|
|
9904
9962
|
var el = typeof placeholder === 'string'
|
|
9905
9963
|
? document.querySelector(placeholder)
|
|
9906
9964
|
: (placeholder instanceof $ ? placeholder[0] : placeholder);
|
|
9907
9965
|
return plot(el, data, options);
|
|
9908
|
-
};
|
|
9966
|
+
});
|
|
9909
9967
|
|
|
9910
9968
|
$.plot.plugins = plugins;
|
|
9911
9969
|
$.plot.version = version;
|
|
@@ -9943,6 +10001,11 @@
|
|
|
9943
10001
|
window.Flot = {};
|
|
9944
10002
|
}
|
|
9945
10003
|
window.Flot.Canvas = Canvas;
|
|
10004
|
+
// Exposed so standalone plugin bundles (dist/plugins/*.js) can resolve
|
|
10005
|
+
// their `import { plugins } from './jquery.flot.js'` and
|
|
10006
|
+
// `import { ... } from './helpers.js'` to live objects on this global.
|
|
10007
|
+
window.Flot.plugins = plugins;
|
|
10008
|
+
window.Flot.helpers = helpers;
|
|
9946
10009
|
}
|
|
9947
10010
|
|
|
9948
10011
|
})(jQuery);
|