@kevinburke/flot 5.1.1 → 5.1.2
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 +24 -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 +69 -28
- package/dist/jquery.flot.min.js +1 -1
- package/dist/jquery.flot.min.js.map +1 -1
- package/dist/plugins/jquery.flot.crosshair.js +1 -1
- package/dist/plugins/jquery.flot.image.js +1 -1
- package/dist/plugins/jquery.flot.pie.js +3 -3
- 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 +1 -1
- package/dist/plugins/jquery.flot.threshold.js +1 -1
- package/package.json +1 -1
- package/source/helpers.js +16 -4
- package/source/jquery-adapter.js +19 -0
- 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.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/source/jquery.js +0 -9473
package/dist/flot.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @kevinburke/flot v5.1.
|
|
1
|
+
/*! @kevinburke/flot v5.1.2 | 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.2";
|
|
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.2 | 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;
|
|
@@ -171,10 +174,11 @@
|
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
|
|
177
|
+
// Default trigger: dispatches a native CustomEvent with extra args stashed
|
|
178
|
+
// on `event.detail` (an array). The jQuery adapter overrides this via
|
|
179
|
+
// setTrigger so handlers bound with $(el).on(type, fn) receive the extra
|
|
180
|
+
// args as positional parameters, matching upstream flot/flot behavior.
|
|
181
|
+
var triggerImpl = function(el, type, args) {
|
|
178
182
|
var event = new CustomEvent(type, {
|
|
179
183
|
detail: args || [],
|
|
180
184
|
bubbles: true,
|
|
@@ -182,6 +186,14 @@
|
|
|
182
186
|
});
|
|
183
187
|
el.dispatchEvent(event);
|
|
184
188
|
return event;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
function trigger(el, type, args) {
|
|
192
|
+
return triggerImpl(el, type, args);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function setTrigger(fn) {
|
|
196
|
+
triggerImpl = fn;
|
|
185
197
|
}
|
|
186
198
|
|
|
187
199
|
// Bind an event listener, tracking it so unbindAll can remove it later.
|
|
@@ -444,7 +456,9 @@
|
|
|
444
456
|
layer.style.left = '0px';
|
|
445
457
|
layer.style.bottom = '0px';
|
|
446
458
|
layer.style.right = '0px';
|
|
447
|
-
svgElement
|
|
459
|
+
if (svgElement) {
|
|
460
|
+
svgElement.appendChild(layer);
|
|
461
|
+
}
|
|
448
462
|
this.SVG[classes] = layer;
|
|
449
463
|
}
|
|
450
464
|
|
|
@@ -538,8 +552,8 @@
|
|
|
538
552
|
|
|
539
553
|
element.style.position = 'absolute';
|
|
540
554
|
element.style.maxWidth = width;
|
|
541
|
-
element.setAttributeNS(null, 'x', -9999);
|
|
542
|
-
element.setAttributeNS(null, 'y', -9999);
|
|
555
|
+
element.setAttributeNS(null, 'x', String(-9999));
|
|
556
|
+
element.setAttributeNS(null, 'y', String(-9999));
|
|
543
557
|
|
|
544
558
|
if (typeof font === 'object') {
|
|
545
559
|
element.style.font = textStyle;
|
|
@@ -563,7 +577,9 @@
|
|
|
563
577
|
while (element.firstChild) {
|
|
564
578
|
element.removeChild(element.firstChild);
|
|
565
579
|
}
|
|
566
|
-
element.parentNode
|
|
580
|
+
if (element.parentNode) {
|
|
581
|
+
element.parentNode.removeChild(element);
|
|
582
|
+
}
|
|
567
583
|
}
|
|
568
584
|
|
|
569
585
|
info.measured = true;
|
|
@@ -4521,7 +4537,7 @@
|
|
|
4521
4537
|
// Plugin registry. Plugins push to this array to register themselves.
|
|
4522
4538
|
var plugins = [];
|
|
4523
4539
|
|
|
4524
|
-
var version = "5.1.
|
|
4540
|
+
var version = "5.1.2";
|
|
4525
4541
|
|
|
4526
4542
|
// The main plot function.
|
|
4527
4543
|
function plot(placeholder, data, options) {
|
|
@@ -6017,7 +6033,7 @@
|
|
|
6017
6033
|
ctx.lineJoin = "round";
|
|
6018
6034
|
var startx = Math.round(panHint.start.x),
|
|
6019
6035
|
starty = Math.round(panHint.start.y),
|
|
6020
|
-
endx, endy;
|
|
6036
|
+
endx = 0, endy = 0;
|
|
6021
6037
|
|
|
6022
6038
|
if (panAxes) {
|
|
6023
6039
|
if (panAxes[0].direction === 'x') {
|
|
@@ -6782,13 +6798,14 @@
|
|
|
6782
6798
|
}
|
|
6783
6799
|
|
|
6784
6800
|
function initTouchNavigation$1(plot, options) {
|
|
6801
|
+
/** @type {{ zoomEnable: boolean, prevDistance: number | null, prevTapTime: number, prevPanPosition: {x: number, y: number}, prevTapPosition: {x: number, y: number} }} */
|
|
6785
6802
|
var gestureState = {
|
|
6786
6803
|
zoomEnable: false,
|
|
6787
6804
|
prevDistance: null,
|
|
6788
|
-
prevTapTime: 0,
|
|
6789
6805
|
prevPanPosition: { x: 0, y: 0 },
|
|
6790
6806
|
prevTapPosition: { x: 0, y: 0 }
|
|
6791
6807
|
},
|
|
6808
|
+
/** @type {{ prevTouchedAxis: string, currentTouchedAxis: string, touchedAxis: any, navigationConstraint: string, initialState: any }} */
|
|
6792
6809
|
navigationState = {
|
|
6793
6810
|
prevTouchedAxis: 'none',
|
|
6794
6811
|
currentTouchedAxis: 'none',
|
|
@@ -6845,7 +6862,7 @@
|
|
|
6845
6862
|
drag: function(e) {
|
|
6846
6863
|
presetNavigationState(e, 'pan');
|
|
6847
6864
|
|
|
6848
|
-
if (useSmartPan) {
|
|
6865
|
+
if (useSmartPan && navigationState.initialState) {
|
|
6849
6866
|
var point = getPoint(e, 'pan');
|
|
6850
6867
|
plot.smartPan({
|
|
6851
6868
|
x: navigationState.initialState.startPageX - point.x,
|
|
@@ -6869,7 +6886,7 @@
|
|
|
6869
6886
|
}
|
|
6870
6887
|
|
|
6871
6888
|
if (wasPinchEvent(e, gestureState)) {
|
|
6872
|
-
|
|
6889
|
+
updatePrevPanPosition(e, 'pan', gestureState, navigationState);
|
|
6873
6890
|
}
|
|
6874
6891
|
}
|
|
6875
6892
|
};
|
|
@@ -6901,7 +6918,7 @@
|
|
|
6901
6918
|
|
|
6902
6919
|
var dist = pinchDistance(e);
|
|
6903
6920
|
|
|
6904
|
-
if (gestureState.zoomEnable || Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN) {
|
|
6921
|
+
if (gestureState.zoomEnable || (gestureState.prevDistance != null && Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN)) {
|
|
6905
6922
|
zoomPlot(plot, e, gestureState, navigationState);
|
|
6906
6923
|
|
|
6907
6924
|
//activate zoom mode
|
|
@@ -7161,10 +7178,10 @@
|
|
|
7161
7178
|
newEvent = new CustomEvent('mouseevent');
|
|
7162
7179
|
|
|
7163
7180
|
//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;
|
|
7181
|
+
/** @type {any} */ (newEvent).pageX = e.detail.changedTouches[0].pageX;
|
|
7182
|
+
/** @type {any} */ (newEvent).pageY = e.detail.changedTouches[0].pageY;
|
|
7183
|
+
/** @type {any} */ (newEvent).clientX = e.detail.changedTouches[0].clientX;
|
|
7184
|
+
/** @type {any} */ (newEvent).clientY = e.detail.changedTouches[0].clientY;
|
|
7168
7185
|
|
|
7169
7186
|
if (o.grid.hoverable) {
|
|
7170
7187
|
doTriggerClickHoverEvent(newEvent, eventType.hover, 30);
|
|
@@ -7443,6 +7460,7 @@
|
|
|
7443
7460
|
}
|
|
7444
7461
|
|
|
7445
7462
|
function initTouchNavigation(plot, options) {
|
|
7463
|
+
/** @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
7464
|
var gestureState = {
|
|
7447
7465
|
twoTouches: false,
|
|
7448
7466
|
currentTapStart: { x: 0, y: 0 },
|
|
@@ -7596,6 +7614,7 @@
|
|
|
7596
7614
|
},
|
|
7597
7615
|
|
|
7598
7616
|
isLongTap: function(e) {
|
|
7617
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7599
7618
|
var currentTime = new Date().getTime(),
|
|
7600
7619
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7601
7620
|
if (tapDuration >= minLongTapDuration && !gestureState.interceptedLongTap) {
|
|
@@ -7636,6 +7655,7 @@
|
|
|
7636
7655
|
},
|
|
7637
7656
|
|
|
7638
7657
|
isTap: function(e) {
|
|
7658
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7639
7659
|
var currentTime = new Date().getTime(),
|
|
7640
7660
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7641
7661
|
if (tapDuration <= pressedTapDuration) {
|
|
@@ -7684,7 +7704,9 @@
|
|
|
7684
7704
|
}
|
|
7685
7705
|
function isDoubleTap(e) {
|
|
7686
7706
|
var currentTime = new Date().getTime(),
|
|
7687
|
-
intervalBetweenTaps =
|
|
7707
|
+
intervalBetweenTaps = gestureState.prevTapTime != null
|
|
7708
|
+
? currentTime - gestureState.prevTapTime
|
|
7709
|
+
: Infinity;
|
|
7688
7710
|
|
|
7689
7711
|
if (intervalBetweenTaps >= 0 && intervalBetweenTaps < maxIntervalBetweenTaps) {
|
|
7690
7712
|
if (distance(gestureState.prevTap.x, gestureState.prevTap.y, gestureState.currentTap.x, gestureState.currentTap.y) < maxDistanceBetweenTaps) {
|
|
@@ -8071,9 +8093,9 @@
|
|
|
8071
8093
|
}
|
|
8072
8094
|
|
|
8073
8095
|
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) {
|
|
8096
|
+
if (axis.delta < (Number(spec[i][0]) * timeUnitSize[spec[i][1]] +
|
|
8097
|
+
Number(spec[i + 1][0]) * timeUnitSize[spec[i + 1][1]]) / 2 &&
|
|
8098
|
+
Number(spec[i][0]) * timeUnitSize[spec[i][1]] >= minSize) {
|
|
8077
8099
|
break;
|
|
8078
8100
|
}
|
|
8079
8101
|
}
|
|
@@ -8736,6 +8758,7 @@
|
|
|
8736
8758
|
}
|
|
8737
8759
|
|
|
8738
8760
|
function triggerSelectedEvent() {
|
|
8761
|
+
/** @type {any} */
|
|
8739
8762
|
var r = getSelection();
|
|
8740
8763
|
|
|
8741
8764
|
trigger(plot.getPlaceholder(), "plotselected", [ r ]);
|
|
@@ -8818,7 +8841,7 @@
|
|
|
8818
8841
|
|
|
8819
8842
|
// function taken from markings support in Flot
|
|
8820
8843
|
function extractRange(ranges, coord) {
|
|
8821
|
-
var axis, from, to, key, axes = plot.getAxes();
|
|
8844
|
+
var axis, from, to, /** @type {string|undefined} */ key, axes = plot.getAxes();
|
|
8822
8845
|
|
|
8823
8846
|
for (var k in axes) {
|
|
8824
8847
|
axis = axes[k];
|
|
@@ -8838,7 +8861,7 @@
|
|
|
8838
8861
|
}
|
|
8839
8862
|
|
|
8840
8863
|
// backwards-compat stuff - to be removed in future
|
|
8841
|
-
if (!ranges[key]) {
|
|
8864
|
+
if (key && !ranges[key]) {
|
|
8842
8865
|
axis = coord === "x" ? plot.getXAxes()[0] : plot.getYAxes()[0];
|
|
8843
8866
|
from = ranges[coord + "1"];
|
|
8844
8867
|
to = ranges[coord + "2"];
|
|
@@ -9247,7 +9270,7 @@
|
|
|
9247
9270
|
const utf8Array = new Uint8Array(arrayBuffer);
|
|
9248
9271
|
const blockSize = 16384;
|
|
9249
9272
|
for (var i = 0; i < utf8Array.length; i = i + blockSize) {
|
|
9250
|
-
const binarySubString = String.fromCharCode.apply(null, utf8Array.subarray(i, i + blockSize));
|
|
9273
|
+
const binarySubString = String.fromCharCode.apply(null, /** @type {any} */ (utf8Array.subarray(i, i + blockSize)));
|
|
9251
9274
|
binaryString = binaryString + binarySubString;
|
|
9252
9275
|
}
|
|
9253
9276
|
return binaryString;
|
|
@@ -9462,7 +9485,7 @@
|
|
|
9462
9485
|
|
|
9463
9486
|
var left = 0;
|
|
9464
9487
|
var columnWidths = [];
|
|
9465
|
-
var style = window.getComputedStyle(document.
|
|
9488
|
+
var style = window.getComputedStyle(document.body);
|
|
9466
9489
|
for (i = 0; i < entries.length; ++i) {
|
|
9467
9490
|
let columnIndex = i % options.legend.noColumns;
|
|
9468
9491
|
entry = entries[i];
|
|
@@ -9899,6 +9922,24 @@
|
|
|
9899
9922
|
// $.plot("#placeholder", data, options);
|
|
9900
9923
|
|
|
9901
9924
|
|
|
9925
|
+
// Route flot's internal trigger() through jQuery so plugin handlers bound
|
|
9926
|
+
// via $(el).on(type, fn) see the same data shape as upstream flot/flot.
|
|
9927
|
+
// Two conventions coexist in the plugins, matching upstream:
|
|
9928
|
+
// - trigger(el, type, [arg0, arg1, ...]) → $(el).trigger(type, [args])
|
|
9929
|
+
// jQuery spreads the array into handler positional params, so
|
|
9930
|
+
// function(event, pos, item, items) works (plothover, plotzoom, ...).
|
|
9931
|
+
// - trigger(el, type, <non-array>) → $.Event(type, { detail: x })
|
|
9932
|
+
// Handlers read event.detail, matching upstream's re-center contract
|
|
9933
|
+
// where a plain object (or Event) is attached to event.detail.
|
|
9934
|
+
setTrigger(function(el, type, args) {
|
|
9935
|
+
if (args === undefined || Array.isArray(args)) {
|
|
9936
|
+
$(el).trigger(type, args || []);
|
|
9937
|
+
return;
|
|
9938
|
+
}
|
|
9939
|
+
var event = $.Event(type, { detail: args });
|
|
9940
|
+
$(el).trigger(event);
|
|
9941
|
+
});
|
|
9942
|
+
|
|
9902
9943
|
// Register $.plot and $.color on the jQuery object.
|
|
9903
9944
|
$.plot = function(placeholder, data, options) {
|
|
9904
9945
|
var el = typeof placeholder === 'string'
|