blazeplot 0.1.11 → 0.1.12
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/dist/index.js +133 -94
- package/dist/index.js.map +1 -1
- package/dist/plugins/legend.js +6 -3
- package/dist/plugins/legend.js.map +1 -1
- package/dist/plugins/tooltip.js +11 -7
- package/dist/plugins/tooltip.js.map +1 -1
- package/dist/ui/AxisOverlay.d.ts +2 -1
- package/dist/ui/AxisOverlay.d.ts.map +1 -1
- package/dist/ui/Chart.d.ts +10 -1
- package/dist/ui/Chart.d.ts.map +1 -1
- package/dist/ui/Legend.d.ts.map +1 -1
- package/dist/ui/Tooltip.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -500,7 +500,7 @@ var i = class {
|
|
|
500
500
|
vert: h,
|
|
501
501
|
frag: g
|
|
502
502
|
}
|
|
503
|
-
}, v = 3, y = 2, b = 4, x = 4, S = .8, C = 0,
|
|
503
|
+
}, v = 3, y = 2, b = 4, x = 4, S = .8, C = 0, ee = class {
|
|
504
504
|
backend;
|
|
505
505
|
lineProgram;
|
|
506
506
|
segmentProgram;
|
|
@@ -793,13 +793,13 @@ var i = class {
|
|
|
793
793
|
dispose() {
|
|
794
794
|
this.backend.destroy();
|
|
795
795
|
}
|
|
796
|
-
},
|
|
796
|
+
}, w = [
|
|
797
797
|
1024,
|
|
798
798
|
4096,
|
|
799
799
|
16384,
|
|
800
800
|
32768,
|
|
801
801
|
131072
|
|
802
|
-
],
|
|
802
|
+
], te = class {
|
|
803
803
|
regl;
|
|
804
804
|
pool = [];
|
|
805
805
|
preAllocated = !1;
|
|
@@ -812,7 +812,7 @@ var i = class {
|
|
|
812
812
|
preAllocate() {
|
|
813
813
|
if (!this.preAllocated) {
|
|
814
814
|
this.preAllocated = !0;
|
|
815
|
-
for (let e of
|
|
815
|
+
for (let e of w) this.pool.push(this.createEntry(e, "stream"));
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
acquire(e, t = "stream") {
|
|
@@ -852,17 +852,17 @@ var i = class {
|
|
|
852
852
|
return this.pool.find((t) => !t.inUse && t.floatCapacity >= e);
|
|
853
853
|
}
|
|
854
854
|
roundUp(e) {
|
|
855
|
-
for (let t of
|
|
856
|
-
let t =
|
|
855
|
+
for (let t of w) if (t >= e) return t;
|
|
856
|
+
let t = w[w.length - 1], n = 1 << 32 - Math.clz32(e - 1);
|
|
857
857
|
return Math.max(t * 2, n);
|
|
858
858
|
}
|
|
859
859
|
};
|
|
860
860
|
//#endregion
|
|
861
861
|
//#region src/render/ReglBackend.ts
|
|
862
|
-
function
|
|
862
|
+
function ne(e) {
|
|
863
863
|
return e;
|
|
864
864
|
}
|
|
865
|
-
var
|
|
865
|
+
var T = class {
|
|
866
866
|
gl;
|
|
867
867
|
regl;
|
|
868
868
|
resources;
|
|
@@ -882,10 +882,10 @@ var E = class {
|
|
|
882
882
|
});
|
|
883
883
|
if (!n) throw Error("BlazePlot requires WebGL2, but this browser/context does not support it.");
|
|
884
884
|
this.gl = n, this.regl = e({
|
|
885
|
-
gl:
|
|
885
|
+
gl: ne(this.gl),
|
|
886
886
|
extensions: [],
|
|
887
887
|
optionalExtensions: ["angle_instanced_arrays", "ext_disjoint_timer_query_webgl2"]
|
|
888
|
-
}), this.capabilities = { instancing: this.regl.hasExtension("angle_instanced_arrays") }, this.resources = new
|
|
888
|
+
}), this.capabilities = { instancing: this.regl.hasExtension("angle_instanced_arrays") }, this.resources = new te(this.regl), this.resources.preAllocate();
|
|
889
889
|
}
|
|
890
890
|
createBuffer(e) {
|
|
891
891
|
let { buffer: t } = this.resources.acquire(e.length, e.usage);
|
|
@@ -1004,7 +1004,7 @@ var E = class {
|
|
|
1004
1004
|
default: return e;
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
},
|
|
1007
|
+
}, E = class e {
|
|
1008
1008
|
_xMin = 0;
|
|
1009
1009
|
_xMax = 1;
|
|
1010
1010
|
_yMin = 0;
|
|
@@ -1089,7 +1089,7 @@ var E = class {
|
|
|
1089
1089
|
static assertFinite(e, t) {
|
|
1090
1090
|
if (!Number.isFinite(t)) throw RangeError(`Camera2D ${e} must be finite.`);
|
|
1091
1091
|
}
|
|
1092
|
-
},
|
|
1092
|
+
}, D = class {
|
|
1093
1093
|
camera;
|
|
1094
1094
|
constructor(e) {
|
|
1095
1095
|
this.camera = e;
|
|
@@ -1121,7 +1121,7 @@ var E = class {
|
|
|
1121
1121
|
let n = Math.max(0, -Math.floor(Math.log10(t)) + 2), r = Number(e.toFixed(n));
|
|
1122
1122
|
return Object.is(r, -0) ? 0 : r;
|
|
1123
1123
|
}
|
|
1124
|
-
},
|
|
1124
|
+
}, O = class {
|
|
1125
1125
|
layout;
|
|
1126
1126
|
config;
|
|
1127
1127
|
options;
|
|
@@ -1132,6 +1132,11 @@ var E = class {
|
|
|
1132
1132
|
constructor(e, t, n = {}) {
|
|
1133
1133
|
this.layout = e, this.config = t, this.options = n;
|
|
1134
1134
|
}
|
|
1135
|
+
setOptions(e) {
|
|
1136
|
+
this.options = e;
|
|
1137
|
+
for (let e of this.xPool) e.style.font = this.options.font ?? "11px ui-monospace, monospace, sans-serif", e.style.color = this.options.color ?? "#bfd6ff";
|
|
1138
|
+
for (let e of this.yPool) e.style.font = this.options.font ?? "11px ui-monospace, monospace, sans-serif", e.style.color = this.options.color ?? "#bfd6ff";
|
|
1139
|
+
}
|
|
1135
1140
|
update(e, t) {
|
|
1136
1141
|
let n = Math.max(1, this.layout.plot.clientWidth), r = Math.max(1, this.layout.plot.clientHeight);
|
|
1137
1142
|
this.config.x.visible ? t.getXTickValues(n, 12, this.xTicks) : this.xTicks.length = 0, this.config.y.visible ? t.getYTickValues(r, 8, this.yTicks) : this.yTicks.length = 0, this.updateAxis(this.xPool, this.xTicks, "x", e, n, r, t), this.updateAxis(this.yPool, this.yTicks, "y", e, n, r, t);
|
|
@@ -1163,7 +1168,7 @@ var E = class {
|
|
|
1163
1168
|
}
|
|
1164
1169
|
}
|
|
1165
1170
|
}
|
|
1166
|
-
},
|
|
1171
|
+
}, k = class {
|
|
1167
1172
|
root;
|
|
1168
1173
|
plot;
|
|
1169
1174
|
canvas;
|
|
@@ -1190,7 +1195,7 @@ var E = class {
|
|
|
1190
1195
|
applyBaseStyles() {
|
|
1191
1196
|
this.root.style.position = "relative", this.root.style.display = "grid", this.root.style.width = "100%", this.root.style.height = "100%", this.root.style.minWidth = "0", this.root.style.minHeight = "0", this.root.style.overflow = "hidden", this.plot.style.position = "relative", this.plot.style.gridColumn = "2", this.plot.style.gridRow = "1", this.plot.style.minWidth = "0", this.plot.style.minHeight = "0", this.plot.style.overflow = "hidden", this.canvas.style.position = "absolute", this.canvas.style.inset = "0", this.canvas.style.display = "block", this.canvas.style.width = "100%", this.canvas.style.height = "100%", this.canvas.style.touchAction = "none", this.yAxis.style.position = "relative", this.yAxis.style.gridColumn = "1", this.yAxis.style.gridRow = "1", this.yAxis.style.minWidth = "0", this.yAxis.style.minHeight = "0", this.yAxis.style.overflow = "hidden", this.yAxis.style.pointerEvents = "none", this.xAxis.style.position = "relative", this.xAxis.style.gridColumn = "2", this.xAxis.style.gridRow = "2", this.xAxis.style.minWidth = "0", this.xAxis.style.minHeight = "0", this.xAxis.style.overflow = "hidden", this.xAxis.style.pointerEvents = "none", this.corner.style.gridColumn = "1", this.corner.style.gridRow = "2", this.corner.style.minWidth = "0", this.corner.style.minHeight = "0", this.corner.style.pointerEvents = "none";
|
|
1192
1197
|
}
|
|
1193
|
-
},
|
|
1198
|
+
}, A = {
|
|
1194
1199
|
backgroundColor: [
|
|
1195
1200
|
.08,
|
|
1196
1201
|
.1,
|
|
@@ -1253,39 +1258,39 @@ var E = class {
|
|
|
1253
1258
|
legendMutedTextColor: "#789",
|
|
1254
1259
|
legendFont: "11px/1.35 ui-monospace, monospace"
|
|
1255
1260
|
};
|
|
1256
|
-
function
|
|
1257
|
-
if (!e) return
|
|
1258
|
-
let n =
|
|
1261
|
+
function j(e, t) {
|
|
1262
|
+
if (!e) return A;
|
|
1263
|
+
let n = M(e.backgroundColor, A.backgroundColor, t), r = e.seriesColors?.length ? e.seriesColors.map((e, n) => M(e, A.seriesColors[n % A.seriesColors.length], t)) : A.seriesColors;
|
|
1259
1264
|
return {
|
|
1260
1265
|
backgroundColor: n,
|
|
1261
|
-
backgroundCssColor:
|
|
1262
|
-
gridColor:
|
|
1263
|
-
axisColor: e.axisColor ??
|
|
1264
|
-
axisFont: e.axisFont ??
|
|
1266
|
+
backgroundCssColor: N(e.backgroundColor, A.backgroundCssColor),
|
|
1267
|
+
gridColor: M(e.gridColor, A.gridColor, t),
|
|
1268
|
+
axisColor: e.axisColor ?? A.axisColor,
|
|
1269
|
+
axisFont: e.axisFont ?? A.axisFont,
|
|
1265
1270
|
seriesColors: r,
|
|
1266
|
-
tooltipBackgroundColor: e.tooltipBackgroundColor ??
|
|
1267
|
-
tooltipTextColor: e.tooltipTextColor ??
|
|
1268
|
-
tooltipFont: e.tooltipFont ??
|
|
1269
|
-
legendBackgroundColor: e.legendBackgroundColor ??
|
|
1270
|
-
legendBorderColor: e.legendBorderColor ??
|
|
1271
|
-
legendTextColor: e.legendTextColor ??
|
|
1272
|
-
legendMutedTextColor: e.legendMutedTextColor ??
|
|
1273
|
-
legendFont: e.legendFont ??
|
|
1271
|
+
tooltipBackgroundColor: e.tooltipBackgroundColor ?? A.tooltipBackgroundColor,
|
|
1272
|
+
tooltipTextColor: e.tooltipTextColor ?? A.tooltipTextColor,
|
|
1273
|
+
tooltipFont: e.tooltipFont ?? A.tooltipFont,
|
|
1274
|
+
legendBackgroundColor: e.legendBackgroundColor ?? A.legendBackgroundColor,
|
|
1275
|
+
legendBorderColor: e.legendBorderColor ?? A.legendBorderColor,
|
|
1276
|
+
legendTextColor: e.legendTextColor ?? A.legendTextColor,
|
|
1277
|
+
legendMutedTextColor: e.legendMutedTextColor ?? A.legendMutedTextColor,
|
|
1278
|
+
legendFont: e.legendFont ?? A.legendFont
|
|
1274
1279
|
};
|
|
1275
1280
|
}
|
|
1276
|
-
function
|
|
1281
|
+
function M(e, t, n) {
|
|
1277
1282
|
if (!e) return t;
|
|
1278
1283
|
if (typeof e != "string") return e;
|
|
1279
|
-
let r =
|
|
1280
|
-
return
|
|
1284
|
+
let r = F(e, n), i = L(r ?? e, n);
|
|
1285
|
+
return I(r ?? e) ?? I(i ?? "") ?? t;
|
|
1281
1286
|
}
|
|
1282
|
-
function
|
|
1283
|
-
return e ? typeof e == "string" ? e :
|
|
1287
|
+
function N(e, t) {
|
|
1288
|
+
return e ? typeof e == "string" ? e : P(e) : t;
|
|
1284
1289
|
}
|
|
1285
|
-
function
|
|
1290
|
+
function P(e) {
|
|
1286
1291
|
return `rgba(${Math.round(e[0] * 255)}, ${Math.round(e[1] * 255)}, ${Math.round(e[2] * 255)}, ${e[3]})`;
|
|
1287
1292
|
}
|
|
1288
|
-
function
|
|
1293
|
+
function F(e, t) {
|
|
1289
1294
|
let n = t?.ownerDocument ?? globalThis.document;
|
|
1290
1295
|
if (!n?.documentElement || typeof getComputedStyle > "u") return null;
|
|
1291
1296
|
let r = t instanceof HTMLElement ? t : n.documentElement, i = n.createElement("span");
|
|
@@ -1293,11 +1298,11 @@ function I(e, t) {
|
|
|
1293
1298
|
let a = getComputedStyle(i).color;
|
|
1294
1299
|
return i.remove(), a || null;
|
|
1295
1300
|
}
|
|
1296
|
-
function
|
|
1301
|
+
function I(e) {
|
|
1297
1302
|
let t = e.trim();
|
|
1298
|
-
return
|
|
1303
|
+
return R(t) ?? z(t) ?? B(t);
|
|
1299
1304
|
}
|
|
1300
|
-
function
|
|
1305
|
+
function L(e, t) {
|
|
1301
1306
|
let n = t?.ownerDocument ?? globalThis.document;
|
|
1302
1307
|
if (!n?.createElement) return null;
|
|
1303
1308
|
let r = n.createElement("canvas").getContext("2d");
|
|
@@ -1307,12 +1312,12 @@ function R(e, t) {
|
|
|
1307
1312
|
let a = String(r.fillStyle);
|
|
1308
1313
|
return a === i ? null : a;
|
|
1309
1314
|
}
|
|
1310
|
-
function
|
|
1315
|
+
function R(e) {
|
|
1311
1316
|
let t = e.match(/^rgba?\((.*)\)$/i);
|
|
1312
1317
|
if (!t) return null;
|
|
1313
1318
|
let n = t[1].trim().split("/").map((e) => e.trim()), r = n[0], i = n[1], a = r.includes(",") ? r.split(",").map((e) => e.trim()).filter(Boolean) : r.split(/\s+/).filter(Boolean);
|
|
1314
1319
|
if (a.length < 3) return null;
|
|
1315
|
-
let o =
|
|
1320
|
+
let o = V(a[0]), s = V(a[1]), c = V(a[2]), l = U(i ?? (a.length > 3 ? a[3] : void 0));
|
|
1316
1321
|
return o === null || s === null || c === null || l === null ? null : [
|
|
1317
1322
|
o,
|
|
1318
1323
|
s,
|
|
@@ -1320,12 +1325,12 @@ function z(e) {
|
|
|
1320
1325
|
l
|
|
1321
1326
|
];
|
|
1322
1327
|
}
|
|
1323
|
-
function
|
|
1328
|
+
function z(e) {
|
|
1324
1329
|
let t = e.match(/^color\(\s*srgb\s+(.+)\)$/i);
|
|
1325
1330
|
if (!t) return null;
|
|
1326
1331
|
let n = t[1].split("/").map((e) => e.trim()), r = n[0].split(/\s+/).filter(Boolean);
|
|
1327
1332
|
if (r.length < 3) return null;
|
|
1328
|
-
let i =
|
|
1333
|
+
let i = H(r[0]), a = H(r[1]), o = H(r[2]), s = U(n[1]);
|
|
1329
1334
|
return i === null || a === null || o === null || s === null ? null : [
|
|
1330
1335
|
i,
|
|
1331
1336
|
a,
|
|
@@ -1333,7 +1338,7 @@ function B(e) {
|
|
|
1333
1338
|
s
|
|
1334
1339
|
];
|
|
1335
1340
|
}
|
|
1336
|
-
function
|
|
1341
|
+
function B(e) {
|
|
1337
1342
|
let t = e.startsWith("#") ? e.slice(1) : "";
|
|
1338
1343
|
if (![
|
|
1339
1344
|
3,
|
|
@@ -1349,22 +1354,22 @@ function V(e) {
|
|
|
1349
1354
|
n.length === 8 ? (r & 255) / 255 : 1
|
|
1350
1355
|
] : null;
|
|
1351
1356
|
}
|
|
1357
|
+
function V(e) {
|
|
1358
|
+
return e.endsWith("%") ? W(Number.parseFloat(e) / 100) : W(Number.parseFloat(e) / 255);
|
|
1359
|
+
}
|
|
1352
1360
|
function H(e) {
|
|
1353
|
-
return e.endsWith("%") ?
|
|
1361
|
+
return e.endsWith("%") ? W(Number.parseFloat(e) / 100) : W(Number.parseFloat(e));
|
|
1354
1362
|
}
|
|
1355
1363
|
function U(e) {
|
|
1356
|
-
return e.endsWith("%") ?
|
|
1364
|
+
return e ? e.endsWith("%") ? W(Number.parseFloat(e) / 100) : W(Number.parseFloat(e)) : 1;
|
|
1357
1365
|
}
|
|
1358
1366
|
function W(e) {
|
|
1359
|
-
return e ? e.endsWith("%") ? G(Number.parseFloat(e) / 100) : G(Number.parseFloat(e)) : 1;
|
|
1360
|
-
}
|
|
1361
|
-
function G(e) {
|
|
1362
1367
|
return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : null;
|
|
1363
1368
|
}
|
|
1364
1369
|
//#endregion
|
|
1365
1370
|
//#region src/ui/Chart.ts
|
|
1366
|
-
var
|
|
1367
|
-
function
|
|
1371
|
+
var G = 16384, K = G >> 1, q = G >> 1, J = 3, Y = 4096, X = 12, Z = 64;
|
|
1372
|
+
function Q(e) {
|
|
1368
1373
|
return e === !1 ? {
|
|
1369
1374
|
visible: !1,
|
|
1370
1375
|
position: "inside"
|
|
@@ -1376,7 +1381,31 @@ function $(e) {
|
|
|
1376
1381
|
position: e.position ?? "inside"
|
|
1377
1382
|
};
|
|
1378
1383
|
}
|
|
1379
|
-
|
|
1384
|
+
function $(e) {
|
|
1385
|
+
return e === !1 ? {
|
|
1386
|
+
x: {
|
|
1387
|
+
visible: !1,
|
|
1388
|
+
position: "inside"
|
|
1389
|
+
},
|
|
1390
|
+
y: {
|
|
1391
|
+
visible: !1,
|
|
1392
|
+
position: "inside"
|
|
1393
|
+
}
|
|
1394
|
+
} : e === !0 || e === void 0 ? {
|
|
1395
|
+
x: {
|
|
1396
|
+
visible: !0,
|
|
1397
|
+
position: "inside"
|
|
1398
|
+
},
|
|
1399
|
+
y: {
|
|
1400
|
+
visible: !0,
|
|
1401
|
+
position: "inside"
|
|
1402
|
+
}
|
|
1403
|
+
} : {
|
|
1404
|
+
x: Q(e.x),
|
|
1405
|
+
y: Q(e.y)
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
var re = class {
|
|
1380
1409
|
options;
|
|
1381
1410
|
series = [];
|
|
1382
1411
|
camera;
|
|
@@ -1396,6 +1425,7 @@ var ne = class {
|
|
|
1396
1425
|
axisOverlay = null;
|
|
1397
1426
|
normalizedAxes;
|
|
1398
1427
|
resolvedTheme;
|
|
1428
|
+
_gridVisible;
|
|
1399
1429
|
layout;
|
|
1400
1430
|
stats = {
|
|
1401
1431
|
fps: 0,
|
|
@@ -1409,6 +1439,7 @@ var ne = class {
|
|
|
1409
1439
|
pluginDisposers = [];
|
|
1410
1440
|
hoverSubscribers = /* @__PURE__ */ new Set();
|
|
1411
1441
|
seriesSubscribers = /* @__PURE__ */ new Set();
|
|
1442
|
+
themeSubscribers = /* @__PURE__ */ new Set();
|
|
1412
1443
|
currentHover = null;
|
|
1413
1444
|
lastPointerClientX = 0;
|
|
1414
1445
|
lastPointerClientY = 0;
|
|
@@ -1422,33 +1453,10 @@ var ne = class {
|
|
|
1422
1453
|
this.pointerInPlot = !1, this.emitHover(null);
|
|
1423
1454
|
};
|
|
1424
1455
|
constructor(e, t = {}) {
|
|
1425
|
-
this.options = t, this.resolvedTheme =
|
|
1426
|
-
let n = t.axes;
|
|
1427
|
-
n === !1 ? this.normalizedAxes = {
|
|
1428
|
-
x: {
|
|
1429
|
-
visible: !1,
|
|
1430
|
-
position: "inside"
|
|
1431
|
-
},
|
|
1432
|
-
y: {
|
|
1433
|
-
visible: !1,
|
|
1434
|
-
position: "inside"
|
|
1435
|
-
}
|
|
1436
|
-
} : n === !0 || n === void 0 ? this.normalizedAxes = {
|
|
1437
|
-
x: {
|
|
1438
|
-
visible: !0,
|
|
1439
|
-
position: "inside"
|
|
1440
|
-
},
|
|
1441
|
-
y: {
|
|
1442
|
-
visible: !0,
|
|
1443
|
-
position: "inside"
|
|
1444
|
-
}
|
|
1445
|
-
} : this.normalizedAxes = {
|
|
1446
|
-
x: $(n.x),
|
|
1447
|
-
y: $(n.y)
|
|
1448
|
-
}, this.layout = new A(e, this.normalizedAxes), this.layout.root.style.background = this.resolvedTheme.backgroundCssColor, this.applyCanvasSize(), this.camera = new D(), this.axis = new O(this.camera), this.renderer = new w(new E(this.layout.canvas)), this.rawLineData = new Float32Array(K * 2), this.rawLineBuffer = this.renderer.createFloatBuffer(this.rawLineData.length), this.minMaxInstanceData = new Float32Array(J * Y), this.minMaxInstanceBuffer = this.renderer.createFloatBuffer(this.minMaxInstanceData.length), this.barTriangleData = new Float32Array(X * Z), this.barTriangleBuffer = this.renderer.createFloatBuffer(this.barTriangleData.length), this.gridData = new Float32Array(Q * 2), this.gridBuffer = this.renderer.createFloatBuffer(this.gridData.length), this.gridStyle = {
|
|
1456
|
+
this.options = t, this.resolvedTheme = j(t.theme, e), this.normalizedAxes = $(t.axes), this._gridVisible = t.grid !== !1, this.layout = new k(e, this.normalizedAxes), this.layout.root.style.background = this.resolvedTheme.backgroundCssColor, this.applyCanvasSize(), this.camera = new E(), this.axis = new D(this.camera), this.renderer = new ee(new T(this.layout.canvas)), this.rawLineData = new Float32Array(G * 2), this.rawLineBuffer = this.renderer.createFloatBuffer(this.rawLineData.length), this.minMaxInstanceData = new Float32Array(q * J), this.minMaxInstanceBuffer = this.renderer.createFloatBuffer(this.minMaxInstanceData.length), this.barTriangleData = new Float32Array(Y * X), this.barTriangleBuffer = this.renderer.createFloatBuffer(this.barTriangleData.length), this.gridData = new Float32Array(Z * 2), this.gridBuffer = this.renderer.createFloatBuffer(this.gridData.length), this.gridStyle = {
|
|
1449
1457
|
color: t.gridStyle?.color ?? this.resolvedTheme.gridColor,
|
|
1450
1458
|
lineWidth: t.gridStyle?.lineWidth ?? 1
|
|
1451
|
-
}, (this.normalizedAxes.x.visible || this.normalizedAxes.y.visible) && (this.axisOverlay = new
|
|
1459
|
+
}, (this.normalizedAxes.x.visible || this.normalizedAxes.y.visible) && (this.axisOverlay = new O(this.layout, this.normalizedAxes, {
|
|
1452
1460
|
color: this.resolvedTheme.axisColor,
|
|
1453
1461
|
font: this.resolvedTheme.axisFont
|
|
1454
1462
|
})), this.canvas.addEventListener("pointermove", this.handlePointerMove), this.canvas.addEventListener("pointerleave", this.handlePointerLeave), typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => this.resize()), this.resizeObserver.observe(this.layout.plot));
|
|
@@ -1582,9 +1590,28 @@ var ne = class {
|
|
|
1582
1590
|
let e = t;
|
|
1583
1591
|
return this.hoverSubscribers.add(e), () => this.hoverSubscribers.delete(e);
|
|
1584
1592
|
}
|
|
1593
|
+
if (e === "themechange") {
|
|
1594
|
+
let e = t;
|
|
1595
|
+
return this.themeSubscribers.add(e), () => this.themeSubscribers.delete(e);
|
|
1596
|
+
}
|
|
1585
1597
|
let n = t;
|
|
1586
1598
|
return this.seriesSubscribers.add(n), () => this.seriesSubscribers.delete(n);
|
|
1587
1599
|
}
|
|
1600
|
+
setTheme(e) {
|
|
1601
|
+
this.resolvedTheme = j(e, this.layout.root), this.applyTheme(), this.emitThemeChange(), this.refreshHover();
|
|
1602
|
+
}
|
|
1603
|
+
setGridVisible(e) {
|
|
1604
|
+
this._gridVisible = e;
|
|
1605
|
+
}
|
|
1606
|
+
getGridVisible() {
|
|
1607
|
+
return this._gridVisible;
|
|
1608
|
+
}
|
|
1609
|
+
setAxes(e) {
|
|
1610
|
+
this.normalizedAxes = $(e), this.layout.update(this.normalizedAxes), this.axisOverlay?.dispose(), this.axisOverlay = null, (this.normalizedAxes.x.visible || this.normalizedAxes.y.visible) && (this.axisOverlay = new O(this.layout, this.normalizedAxes, {
|
|
1611
|
+
color: this.resolvedTheme.axisColor,
|
|
1612
|
+
font: this.resolvedTheme.axisFont
|
|
1613
|
+
})), this.resize(), this.refreshHover();
|
|
1614
|
+
}
|
|
1588
1615
|
pick(e, t, n = {}) {
|
|
1589
1616
|
let r = this.canvas.getBoundingClientRect();
|
|
1590
1617
|
if (r.width <= 0 || r.height <= 0) return null;
|
|
@@ -1609,7 +1636,7 @@ var ne = class {
|
|
|
1609
1636
|
o.width = i, o.height = a;
|
|
1610
1637
|
let s = o.getContext("2d");
|
|
1611
1638
|
if (!s) throw Error("Unable to create a 2D canvas context for screenshot export.");
|
|
1612
|
-
return s.fillStyle = e.background ??
|
|
1639
|
+
return s.fillStyle = e.background ?? P(this.resolvedTheme.backgroundColor), s.fillRect(0, 0, i, a), s.drawImage(this.canvas, (n.left - t.left) * r, (n.top - t.top) * r, n.width * r, n.height * r), this.drawDomTextForScreenshot(s, t, r), new Promise((t, n) => {
|
|
1613
1640
|
o.toBlob((e) => e ? t(e) : n(/* @__PURE__ */ Error("Unable to encode chart screenshot.")), e.type ?? "image/png", e.quality);
|
|
1614
1641
|
});
|
|
1615
1642
|
}
|
|
@@ -1628,7 +1655,7 @@ var ne = class {
|
|
|
1628
1655
|
let [t, n, r, i] = this.resolvedTheme.backgroundColor;
|
|
1629
1656
|
this.renderer.viewport(0, 0, this.canvas.width, this.canvas.height), this.renderer.clear(t, n, r, i);
|
|
1630
1657
|
let a = this.camera.viewport;
|
|
1631
|
-
if (this.
|
|
1658
|
+
if (this._gridVisible) {
|
|
1632
1659
|
let e = this.writeGridVertices(a);
|
|
1633
1660
|
e > 0 && (this.renderer.updateFloatBuffer(this.gridBuffer, this.gridData), this.renderer.drawLines(this.gridBuffer, e, this.gridStyle, this.camera), this.stats.drawCalls++, this.stats.uploadBytes += this.gridData.byteLength);
|
|
1634
1661
|
}
|
|
@@ -1646,14 +1673,14 @@ var ne = class {
|
|
|
1646
1673
|
this.drawAreaSeries(e, a);
|
|
1647
1674
|
continue;
|
|
1648
1675
|
}
|
|
1649
|
-
let t = e.visibleSampleCount(a), n = e.hasLOD && t >
|
|
1676
|
+
let t = e.visibleSampleCount(a), n = e.hasLOD && t > G;
|
|
1650
1677
|
if (n && this.renderer.supportsInstancedSegments) {
|
|
1651
1678
|
let t = e.copyMinMaxInstanced(a, this.minMaxInstanceData, this.maxMinMaxSegments());
|
|
1652
1679
|
if (t <= 0) continue;
|
|
1653
1680
|
this.renderer.updateFloatBuffer(this.minMaxInstanceBuffer, this.minMaxInstanceData), this.renderer.drawMinMaxSegmentsInstanced(this.minMaxInstanceBuffer, t, e.style, this.camera), this.recordRenderMode("minmax"), this.stats.pointsRendered += t * 2, this.stats.drawCalls++, this.stats.uploadBytes += this.minMaxInstanceData.byteLength;
|
|
1654
1681
|
continue;
|
|
1655
1682
|
}
|
|
1656
|
-
let r = n ? e.copyMinMaxVisible(a, this.rawLineData, this.maxMinMaxSegments()) : e.copyRawVisible(a, this.rawLineData,
|
|
1683
|
+
let r = n ? e.copyMinMaxVisible(a, this.rawLineData, this.maxMinMaxSegments()) : e.copyRawVisible(a, this.rawLineData, G);
|
|
1657
1684
|
r < 2 || (this.renderer.updateFloatBuffer(this.rawLineBuffer, this.rawLineData), n ? (this.renderer.drawMinMaxSegments(this.rawLineBuffer, r, e.style, this.camera), this.recordRenderMode("minmax")) : (this.renderer.drawLineStrip(this.rawLineBuffer, r, e.style, this.camera), this.recordRenderMode("raw")), this.stats.pointsRendered += r, this.stats.drawCalls++, this.stats.uploadBytes += this.rawLineData.byteLength);
|
|
1658
1685
|
}
|
|
1659
1686
|
this.axisOverlay?.update(this.camera, this.axis), this.stats.frameMs = performance.now() - e, this.refreshHover();
|
|
@@ -1663,19 +1690,28 @@ var ne = class {
|
|
|
1663
1690
|
for (let e of this.pluginDisposers.splice(0)) e();
|
|
1664
1691
|
this.axisOverlay?.dispose(), this.renderer.dispose(), this.layout.dispose();
|
|
1665
1692
|
}
|
|
1693
|
+
applyTheme() {
|
|
1694
|
+
this.layout.root.style.background = this.resolvedTheme.backgroundCssColor, this.options.gridStyle?.color === void 0 && (this.gridStyle = {
|
|
1695
|
+
...this.gridStyle,
|
|
1696
|
+
color: this.resolvedTheme.gridColor
|
|
1697
|
+
}), this.axisOverlay?.setOptions({
|
|
1698
|
+
color: this.resolvedTheme.axisColor,
|
|
1699
|
+
font: this.resolvedTheme.axisFont
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1666
1702
|
applyCanvasSize(e = globalThis.devicePixelRatio) {
|
|
1667
1703
|
let t = Number.isFinite(e) ? Math.max(1, e) : 1, n = Math.max(1, Math.floor(this.canvas.clientWidth * t)), r = Math.max(1, Math.floor(this.canvas.clientHeight * t));
|
|
1668
1704
|
return this.canvas.width === n && this.canvas.height === r ? !1 : (this.canvas.width = n, this.canvas.height = r, !0);
|
|
1669
1705
|
}
|
|
1670
1706
|
drawAreaSeries(e, t) {
|
|
1671
|
-
let n = e.style.baseline ?? 0, r = e.copyAreaVisible(t, this.rawLineData,
|
|
1707
|
+
let n = e.style.baseline ?? 0, r = e.copyAreaVisible(t, this.rawLineData, K, n);
|
|
1672
1708
|
if (r < 4) return;
|
|
1673
1709
|
this.renderer.updateFloatBuffer(this.rawLineBuffer, this.rawLineData), this.renderer.drawAreaStrip(this.rawLineBuffer, r, e.style, this.camera), this.stats.pointsRendered += r, this.stats.drawCalls++, this.stats.uploadBytes += this.rawLineData.byteLength;
|
|
1674
|
-
let i = this.uploadRawInstances(e, t,
|
|
1710
|
+
let i = this.uploadRawInstances(e, t, K);
|
|
1675
1711
|
i >= 2 && (this.renderer.drawLineStrip(this.rawLineBuffer, i, e.style, this.camera), this.stats.pointsRendered += i, this.stats.drawCalls++), this.recordRenderMode("area");
|
|
1676
1712
|
}
|
|
1677
1713
|
drawScatterSeries(e, t) {
|
|
1678
|
-
let n = this.uploadRawInstances(e, t,
|
|
1714
|
+
let n = this.uploadRawInstances(e, t, G);
|
|
1679
1715
|
n <= 0 || (this.renderer.supportsInstancedPoints ? this.renderer.drawPointsInstanced(this.rawLineBuffer, n, e.style, this.camera, this.canvas.width, this.canvas.height) : this.renderer.drawPointSprites(this.rawLineBuffer, n, e.style, this.camera), this.recordInstancedDraw("points", n));
|
|
1680
1716
|
}
|
|
1681
1717
|
drawBarSeries(e, t) {
|
|
@@ -1703,7 +1739,7 @@ var ne = class {
|
|
|
1703
1739
|
}
|
|
1704
1740
|
includeBaselineInBarRanges(e, t) {
|
|
1705
1741
|
for (let n = 0; n < e; n++) {
|
|
1706
|
-
let e = n *
|
|
1742
|
+
let e = n * J, r = this.minMaxInstanceData[e + 1], i = this.minMaxInstanceData[e + 2];
|
|
1707
1743
|
this.minMaxInstanceData[e + 1] = Math.min(t, r), this.minMaxInstanceData[e + 2] = Math.max(t, i);
|
|
1708
1744
|
}
|
|
1709
1745
|
}
|
|
@@ -1737,7 +1773,7 @@ var ne = class {
|
|
|
1737
1773
|
return [Math.max(n.xMin, s), Math.min(n.xMax, c)];
|
|
1738
1774
|
}
|
|
1739
1775
|
writeBarTriangle(e, t, n, r, i) {
|
|
1740
|
-
let a = e *
|
|
1776
|
+
let a = e * X;
|
|
1741
1777
|
this.barTriangleData[a] = t, this.barTriangleData[a + 1] = r, this.barTriangleData[a + 2] = n, this.barTriangleData[a + 3] = r, this.barTriangleData[a + 4] = t, this.barTriangleData[a + 5] = i, this.barTriangleData[a + 6] = t, this.barTriangleData[a + 7] = i, this.barTriangleData[a + 8] = n, this.barTriangleData[a + 9] = r, this.barTriangleData[a + 10] = n, this.barTriangleData[a + 11] = i;
|
|
1742
1778
|
}
|
|
1743
1779
|
drawBarTriangleFallback(e, t) {
|
|
@@ -1801,6 +1837,9 @@ var ne = class {
|
|
|
1801
1837
|
for (let e of this.seriesSubscribers) e();
|
|
1802
1838
|
this.refreshHover();
|
|
1803
1839
|
}
|
|
1840
|
+
emitThemeChange() {
|
|
1841
|
+
for (let e of this.themeSubscribers) e();
|
|
1842
|
+
}
|
|
1804
1843
|
drawDomTextForScreenshot(e, t, n) {
|
|
1805
1844
|
let r = this.layout.root.querySelectorAll("div");
|
|
1806
1845
|
for (let i of r) {
|
|
@@ -1813,24 +1852,24 @@ var ne = class {
|
|
|
1813
1852
|
}
|
|
1814
1853
|
}
|
|
1815
1854
|
maxMinMaxSegments() {
|
|
1816
|
-
return Math.min(this.canvas.width,
|
|
1855
|
+
return Math.min(this.canvas.width, q);
|
|
1817
1856
|
}
|
|
1818
1857
|
maxBarFallbackBars() {
|
|
1819
|
-
return Math.min(
|
|
1858
|
+
return Math.min(Y, G);
|
|
1820
1859
|
}
|
|
1821
1860
|
maxRawBarInstances() {
|
|
1822
|
-
return this.renderer.supportsInstancedBars ?
|
|
1861
|
+
return this.renderer.supportsInstancedBars ? G : this.maxBarFallbackBars();
|
|
1823
1862
|
}
|
|
1824
1863
|
writeGridVertices(e) {
|
|
1825
1864
|
let t = Math.max(1, this.canvas.clientWidth), n = Math.max(1, this.canvas.clientHeight);
|
|
1826
1865
|
this.axis.getXTickValues(t, 12, this.xTicks), this.axis.getYTickValues(n, 8, this.yTicks);
|
|
1827
1866
|
let r = 0;
|
|
1828
1867
|
for (let t of this.xTicks) {
|
|
1829
|
-
if (r + 2 >
|
|
1868
|
+
if (r + 2 > Z) return r;
|
|
1830
1869
|
this.gridData[r * 2] = t, this.gridData[r * 2 + 1] = e.yMin, r++, this.gridData[r * 2] = t, this.gridData[r * 2 + 1] = e.yMax, r++;
|
|
1831
1870
|
}
|
|
1832
1871
|
for (let t of this.yTicks) {
|
|
1833
|
-
if (r + 2 >
|
|
1872
|
+
if (r + 2 > Z) return r;
|
|
1834
1873
|
this.gridData[r * 2] = e.xMin, this.gridData[r * 2 + 1] = t, r++, this.gridData[r * 2] = e.xMax, this.gridData[r * 2 + 1] = t, r++;
|
|
1835
1874
|
}
|
|
1836
1875
|
return r;
|
|
@@ -1838,7 +1877,7 @@ var ne = class {
|
|
|
1838
1877
|
recordRenderMode(e) {
|
|
1839
1878
|
this.stats.renderMode === "none" ? this.stats.renderMode = e : this.stats.renderMode !== e && (this.stats.renderMode = "mixed");
|
|
1840
1879
|
}
|
|
1841
|
-
},
|
|
1880
|
+
}, ie = class {
|
|
1842
1881
|
xData;
|
|
1843
1882
|
yData;
|
|
1844
1883
|
constructor(e, t) {
|
|
@@ -1880,6 +1919,6 @@ var ne = class {
|
|
|
1880
1919
|
}
|
|
1881
1920
|
};
|
|
1882
1921
|
//#endregion
|
|
1883
|
-
export {
|
|
1922
|
+
export { D as AxisController, E as Camera2D, re as Chart, A as DEFAULT_CHART_THEME, n as MinMaxPyramid, a as RingBuffer, i as SeriesStore, ie as StaticDataset };
|
|
1884
1923
|
|
|
1885
1924
|
//# sourceMappingURL=index.js.map
|