@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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,50 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
Starting with 5.0.0, this changelog tracks the @kevinburke/flot fork.
|
|
6
6
|
For earlier upstream history, see the [flot/flot repository](https://github.com/flot/flot).
|
|
7
7
|
|
|
8
|
+
## [5.1.3] - 2026-04-22
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- `rollup.config.js` / `jquery-adapter.js` / `jquery.flot.image.js`:
|
|
13
|
+
fix the standalone plugin bundles so they resolve their external
|
|
14
|
+
imports against `window.Flot` and `window.Flot.helpers` at runtime
|
|
15
|
+
instead of referencing missing Rollup-generated identifiers. This
|
|
16
|
+
restores loading for the broken standalone IIFE plugins, including
|
|
17
|
+
`jquery.flot.image.js`, `jquery.flot.crosshair.js`,
|
|
18
|
+
`jquery.flot.pie.js`, `jquery.flot.resize.js`, and
|
|
19
|
+
`jquery.flot.threshold.js`.
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
|
|
23
|
+
- `API.md` / `CHANGELOG.md` (2.0.1 section): document the
|
|
24
|
+
`bars.barWidth` semantics correctly. Since 2.0, a plain numeric
|
|
25
|
+
`barWidth` is a multiplier of the minimum point spacing and absolute
|
|
26
|
+
widths require `[width, true]`.
|
|
27
|
+
|
|
28
|
+
## [5.1.2] - 2026-04-22
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- `jquery-adapter.js`: restore upstream flot/flot event-dispatch
|
|
33
|
+
semantics for consumers using `@kevinburke/flot/jquery` (or the
|
|
34
|
+
`jquery.flot.min.js` bundle). In 5.0.0, the fork's core switched to
|
|
35
|
+
native `CustomEvent` with extra args stashed on `event.detail`. That
|
|
36
|
+
is correct for the jQuery-free core, but broke every handler bound
|
|
37
|
+
through jQuery — `$(el).on("plothover", function(event, pos, item))`
|
|
38
|
+
silently received `undefined` for `pos` and `item`, because native
|
|
39
|
+
`dispatchEvent` does not spread args into jQuery handler positional
|
|
40
|
+
parameters. Same for `plotclick`, `plotselected`, `plotunselected`,
|
|
41
|
+
`plotselecting`, `plotzoom`, `plotpan`, `plotactivated`, and the pie
|
|
42
|
+
plugin's events.
|
|
43
|
+
Fixed by adding a `setTrigger()` hook in `helpers.js` and having the
|
|
44
|
+
jQuery adapter install a jQuery-aware trigger: arrays are dispatched
|
|
45
|
+
as `$(el).trigger(type, args)` (spreading into handler params);
|
|
46
|
+
non-array args are wrapped in a `$.Event` with `detail`, matching
|
|
47
|
+
upstream's `re-center` contract. The jQuery-free core path is
|
|
48
|
+
unchanged.
|
|
49
|
+
Added a browser regression test (`plothover handler receives pos
|
|
50
|
+
and item positional args`) that would have caught this.
|
|
51
|
+
|
|
8
52
|
## [5.1.1] - 2026-04-15
|
|
9
53
|
|
|
10
54
|
### Fixed
|
|
@@ -401,6 +445,24 @@ After:
|
|
|
401
445
|
|
|
402
446
|
Note: A new capability allows for data (and min/max settings of axes) to be specified with a `timeBase` of either seconds or milliseconds. So, a range from 1-10 can either represent 9 milliseconds of data, or 9 seconds of data, depending on the setting of `timeBase` (whose default is "seconds").
|
|
403
447
|
|
|
448
|
+
### `bars.barWidth`:
|
|
449
|
+
Before:
|
|
450
|
+
|
|
451
|
+
bars: { show: true, barWidth: 24 * 60 * 60 * 1000 } // one day, time mode
|
|
452
|
+
|
|
453
|
+
After:
|
|
454
|
+
|
|
455
|
+
bars: { show: true, barWidth: [24 * 60 * 60 * 1000, true] } // one day, absolute
|
|
456
|
+
|
|
457
|
+
Note: A plain-number `barWidth` is now interpreted as a *multiplier* of
|
|
458
|
+
the minimum distance between consecutive x-values in the series (so
|
|
459
|
+
`barWidth: 0.8` means "80% of the point spacing"). To keep the pre-2.0
|
|
460
|
+
behavior where `barWidth` is an absolute width in axis units, pass
|
|
461
|
+
`[width, true]`. Code ported from 0.x / 1.x that used absolute widths
|
|
462
|
+
(typical in time-mode bar charts) will silently produce bars many
|
|
463
|
+
orders of magnitude too wide, which can also inflate `axis.datamin` /
|
|
464
|
+
`axis.datamax` enough to break the time-axis tick generator.
|
|
465
|
+
|
|
404
466
|
### Script Locations:
|
|
405
467
|
|
|
406
468
|
All scripts have been moved under the 'source' folder, so you will need to update all reference scripts to point to new location. Or you can use the file dist/es5/jquery.flot.js which is all source combined and minified.
|
package/dist/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
|
var Flot = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ var Flot = (function (exports) {
|
|
|
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 @@ var Flot = (function (exports) {
|
|
|
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 @@ var Flot = (function (exports) {
|
|
|
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,10 @@ var Flot = (function (exports) {
|
|
|
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);
|
|
185
193
|
}
|
|
186
194
|
|
|
187
195
|
// Bind an event listener, tracking it so unbindAll can remove it later.
|
|
@@ -444,7 +452,9 @@ var Flot = (function (exports) {
|
|
|
444
452
|
layer.style.left = '0px';
|
|
445
453
|
layer.style.bottom = '0px';
|
|
446
454
|
layer.style.right = '0px';
|
|
447
|
-
svgElement
|
|
455
|
+
if (svgElement) {
|
|
456
|
+
svgElement.appendChild(layer);
|
|
457
|
+
}
|
|
448
458
|
this.SVG[classes] = layer;
|
|
449
459
|
}
|
|
450
460
|
|
|
@@ -538,8 +548,8 @@ var Flot = (function (exports) {
|
|
|
538
548
|
|
|
539
549
|
element.style.position = 'absolute';
|
|
540
550
|
element.style.maxWidth = width;
|
|
541
|
-
element.setAttributeNS(null, 'x', -9999);
|
|
542
|
-
element.setAttributeNS(null, 'y', -9999);
|
|
551
|
+
element.setAttributeNS(null, 'x', String(-9999));
|
|
552
|
+
element.setAttributeNS(null, 'y', String(-9999));
|
|
543
553
|
|
|
544
554
|
if (typeof font === 'object') {
|
|
545
555
|
element.style.font = textStyle;
|
|
@@ -563,7 +573,9 @@ var Flot = (function (exports) {
|
|
|
563
573
|
while (element.firstChild) {
|
|
564
574
|
element.removeChild(element.firstChild);
|
|
565
575
|
}
|
|
566
|
-
element.parentNode
|
|
576
|
+
if (element.parentNode) {
|
|
577
|
+
element.parentNode.removeChild(element);
|
|
578
|
+
}
|
|
567
579
|
}
|
|
568
580
|
|
|
569
581
|
info.measured = true;
|
|
@@ -4521,7 +4533,7 @@ var Flot = (function (exports) {
|
|
|
4521
4533
|
// Plugin registry. Plugins push to this array to register themselves.
|
|
4522
4534
|
var plugins = [];
|
|
4523
4535
|
|
|
4524
|
-
var version = "5.1.
|
|
4536
|
+
var version = "5.1.3";
|
|
4525
4537
|
|
|
4526
4538
|
// The main plot function.
|
|
4527
4539
|
function plot(placeholder, data, options) {
|
|
@@ -6017,7 +6029,7 @@ var Flot = (function (exports) {
|
|
|
6017
6029
|
ctx.lineJoin = "round";
|
|
6018
6030
|
var startx = Math.round(panHint.start.x),
|
|
6019
6031
|
starty = Math.round(panHint.start.y),
|
|
6020
|
-
endx, endy;
|
|
6032
|
+
endx = 0, endy = 0;
|
|
6021
6033
|
|
|
6022
6034
|
if (panAxes) {
|
|
6023
6035
|
if (panAxes[0].direction === 'x') {
|
|
@@ -6782,13 +6794,14 @@ var Flot = (function (exports) {
|
|
|
6782
6794
|
}
|
|
6783
6795
|
|
|
6784
6796
|
function initTouchNavigation$1(plot, options) {
|
|
6797
|
+
/** @type {{ zoomEnable: boolean, prevDistance: number | null, prevTapTime: number, prevPanPosition: {x: number, y: number}, prevTapPosition: {x: number, y: number} }} */
|
|
6785
6798
|
var gestureState = {
|
|
6786
6799
|
zoomEnable: false,
|
|
6787
6800
|
prevDistance: null,
|
|
6788
|
-
prevTapTime: 0,
|
|
6789
6801
|
prevPanPosition: { x: 0, y: 0 },
|
|
6790
6802
|
prevTapPosition: { x: 0, y: 0 }
|
|
6791
6803
|
},
|
|
6804
|
+
/** @type {{ prevTouchedAxis: string, currentTouchedAxis: string, touchedAxis: any, navigationConstraint: string, initialState: any }} */
|
|
6792
6805
|
navigationState = {
|
|
6793
6806
|
prevTouchedAxis: 'none',
|
|
6794
6807
|
currentTouchedAxis: 'none',
|
|
@@ -6845,7 +6858,7 @@ var Flot = (function (exports) {
|
|
|
6845
6858
|
drag: function(e) {
|
|
6846
6859
|
presetNavigationState(e, 'pan');
|
|
6847
6860
|
|
|
6848
|
-
if (useSmartPan) {
|
|
6861
|
+
if (useSmartPan && navigationState.initialState) {
|
|
6849
6862
|
var point = getPoint(e, 'pan');
|
|
6850
6863
|
plot.smartPan({
|
|
6851
6864
|
x: navigationState.initialState.startPageX - point.x,
|
|
@@ -6869,7 +6882,7 @@ var Flot = (function (exports) {
|
|
|
6869
6882
|
}
|
|
6870
6883
|
|
|
6871
6884
|
if (wasPinchEvent(e, gestureState)) {
|
|
6872
|
-
|
|
6885
|
+
updatePrevPanPosition(e, 'pan', gestureState, navigationState);
|
|
6873
6886
|
}
|
|
6874
6887
|
}
|
|
6875
6888
|
};
|
|
@@ -6901,7 +6914,7 @@ var Flot = (function (exports) {
|
|
|
6901
6914
|
|
|
6902
6915
|
var dist = pinchDistance(e);
|
|
6903
6916
|
|
|
6904
|
-
if (gestureState.zoomEnable || Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN) {
|
|
6917
|
+
if (gestureState.zoomEnable || (gestureState.prevDistance != null && Math.abs(dist - gestureState.prevDistance) > ZOOM_DISTANCE_MARGIN)) {
|
|
6905
6918
|
zoomPlot(plot, e, gestureState, navigationState);
|
|
6906
6919
|
|
|
6907
6920
|
//activate zoom mode
|
|
@@ -7161,10 +7174,10 @@ var Flot = (function (exports) {
|
|
|
7161
7174
|
newEvent = new CustomEvent('mouseevent');
|
|
7162
7175
|
|
|
7163
7176
|
//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;
|
|
7177
|
+
/** @type {any} */ (newEvent).pageX = e.detail.changedTouches[0].pageX;
|
|
7178
|
+
/** @type {any} */ (newEvent).pageY = e.detail.changedTouches[0].pageY;
|
|
7179
|
+
/** @type {any} */ (newEvent).clientX = e.detail.changedTouches[0].clientX;
|
|
7180
|
+
/** @type {any} */ (newEvent).clientY = e.detail.changedTouches[0].clientY;
|
|
7168
7181
|
|
|
7169
7182
|
if (o.grid.hoverable) {
|
|
7170
7183
|
doTriggerClickHoverEvent(newEvent, eventType.hover, 30);
|
|
@@ -7443,6 +7456,7 @@ var Flot = (function (exports) {
|
|
|
7443
7456
|
}
|
|
7444
7457
|
|
|
7445
7458
|
function initTouchNavigation(plot, options) {
|
|
7459
|
+
/** @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
7460
|
var gestureState = {
|
|
7447
7461
|
twoTouches: false,
|
|
7448
7462
|
currentTapStart: { x: 0, y: 0 },
|
|
@@ -7596,6 +7610,7 @@ var Flot = (function (exports) {
|
|
|
7596
7610
|
},
|
|
7597
7611
|
|
|
7598
7612
|
isLongTap: function(e) {
|
|
7613
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7599
7614
|
var currentTime = new Date().getTime(),
|
|
7600
7615
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7601
7616
|
if (tapDuration >= minLongTapDuration && !gestureState.interceptedLongTap) {
|
|
@@ -7636,6 +7651,7 @@ var Flot = (function (exports) {
|
|
|
7636
7651
|
},
|
|
7637
7652
|
|
|
7638
7653
|
isTap: function(e) {
|
|
7654
|
+
if (gestureState.tapStartTime == null) return false;
|
|
7639
7655
|
var currentTime = new Date().getTime(),
|
|
7640
7656
|
tapDuration = currentTime - gestureState.tapStartTime;
|
|
7641
7657
|
if (tapDuration <= pressedTapDuration) {
|
|
@@ -7684,7 +7700,9 @@ var Flot = (function (exports) {
|
|
|
7684
7700
|
}
|
|
7685
7701
|
function isDoubleTap(e) {
|
|
7686
7702
|
var currentTime = new Date().getTime(),
|
|
7687
|
-
intervalBetweenTaps =
|
|
7703
|
+
intervalBetweenTaps = gestureState.prevTapTime != null
|
|
7704
|
+
? currentTime - gestureState.prevTapTime
|
|
7705
|
+
: Infinity;
|
|
7688
7706
|
|
|
7689
7707
|
if (intervalBetweenTaps >= 0 && intervalBetweenTaps < maxIntervalBetweenTaps) {
|
|
7690
7708
|
if (distance(gestureState.prevTap.x, gestureState.prevTap.y, gestureState.currentTap.x, gestureState.currentTap.y) < maxDistanceBetweenTaps) {
|
|
@@ -8071,9 +8089,9 @@ var Flot = (function (exports) {
|
|
|
8071
8089
|
}
|
|
8072
8090
|
|
|
8073
8091
|
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) {
|
|
8092
|
+
if (axis.delta < (Number(spec[i][0]) * timeUnitSize[spec[i][1]] +
|
|
8093
|
+
Number(spec[i + 1][0]) * timeUnitSize[spec[i + 1][1]]) / 2 &&
|
|
8094
|
+
Number(spec[i][0]) * timeUnitSize[spec[i][1]] >= minSize) {
|
|
8077
8095
|
break;
|
|
8078
8096
|
}
|
|
8079
8097
|
}
|
|
@@ -8736,6 +8754,7 @@ var Flot = (function (exports) {
|
|
|
8736
8754
|
}
|
|
8737
8755
|
|
|
8738
8756
|
function triggerSelectedEvent() {
|
|
8757
|
+
/** @type {any} */
|
|
8739
8758
|
var r = getSelection();
|
|
8740
8759
|
|
|
8741
8760
|
trigger(plot.getPlaceholder(), "plotselected", [ r ]);
|
|
@@ -8818,7 +8837,7 @@ var Flot = (function (exports) {
|
|
|
8818
8837
|
|
|
8819
8838
|
// function taken from markings support in Flot
|
|
8820
8839
|
function extractRange(ranges, coord) {
|
|
8821
|
-
var axis, from, to, key, axes = plot.getAxes();
|
|
8840
|
+
var axis, from, to, /** @type {string|undefined} */ key, axes = plot.getAxes();
|
|
8822
8841
|
|
|
8823
8842
|
for (var k in axes) {
|
|
8824
8843
|
axis = axes[k];
|
|
@@ -8838,7 +8857,7 @@ var Flot = (function (exports) {
|
|
|
8838
8857
|
}
|
|
8839
8858
|
|
|
8840
8859
|
// backwards-compat stuff - to be removed in future
|
|
8841
|
-
if (!ranges[key]) {
|
|
8860
|
+
if (key && !ranges[key]) {
|
|
8842
8861
|
axis = coord === "x" ? plot.getXAxes()[0] : plot.getYAxes()[0];
|
|
8843
8862
|
from = ranges[coord + "1"];
|
|
8844
8863
|
to = ranges[coord + "2"];
|
|
@@ -9247,7 +9266,7 @@ var Flot = (function (exports) {
|
|
|
9247
9266
|
const utf8Array = new Uint8Array(arrayBuffer);
|
|
9248
9267
|
const blockSize = 16384;
|
|
9249
9268
|
for (var i = 0; i < utf8Array.length; i = i + blockSize) {
|
|
9250
|
-
const binarySubString = String.fromCharCode.apply(null, utf8Array.subarray(i, i + blockSize));
|
|
9269
|
+
const binarySubString = String.fromCharCode.apply(null, /** @type {any} */ (utf8Array.subarray(i, i + blockSize)));
|
|
9251
9270
|
binaryString = binaryString + binarySubString;
|
|
9252
9271
|
}
|
|
9253
9272
|
return binaryString;
|
|
@@ -9462,7 +9481,7 @@ var Flot = (function (exports) {
|
|
|
9462
9481
|
|
|
9463
9482
|
var left = 0;
|
|
9464
9483
|
var columnWidths = [];
|
|
9465
|
-
var style = window.getComputedStyle(document.
|
|
9484
|
+
var style = window.getComputedStyle(document.body);
|
|
9466
9485
|
for (i = 0; i < entries.length; ++i) {
|
|
9467
9486
|
let columnIndex = i % options.legend.noColumns;
|
|
9468
9487
|
entry = entries[i];
|