apexcharts 8.2.0 → 8.3.0
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/README.md +7 -7
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +271 -173
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +35 -0
- package/dist/apexcharts.esm.js +1722 -1527
- package/dist/apexcharts.full.js +1459 -1075
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +994 -715
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +994 -715
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +91 -40
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +433 -394
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +364 -322
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +91 -40
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +364 -322
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +433 -394
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +271 -173
- package/dist/donut.common.js +1 -1
- package/dist/donut.esm.js +1 -1
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +433 -394
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +250 -187
- package/dist/features/annotations.common.js +1 -1
- package/dist/features/annotations.esm.js +1 -1
- package/dist/features/annotations.js +1 -1
- package/dist/features/context-menu.common.js +1 -1
- package/dist/features/context-menu.esm.js +1 -1
- package/dist/features/context-menu.js +1 -1
- package/dist/features/drilldown.common.js +2 -2
- package/dist/features/drilldown.esm.js +4 -2
- package/dist/features/drilldown.js +2 -2
- package/dist/features/dumbbell.common.js +1 -1
- package/dist/features/dumbbell.esm.js +1 -1
- package/dist/features/dumbbell.js +1 -1
- package/dist/features/exports.common.js +1 -1
- package/dist/features/exports.esm.js +1 -1
- package/dist/features/exports.js +1 -1
- package/dist/features/facet.common.js +1 -1
- package/dist/features/facet.esm.js +1 -1
- package/dist/features/facet.js +1 -1
- package/dist/features/highlight-filter.common.js +2 -2
- package/dist/features/highlight-filter.esm.js +14 -9
- package/dist/features/highlight-filter.js +2 -2
- package/dist/features/history.common.js +1 -1
- package/dist/features/history.esm.js +1 -1
- package/dist/features/history.js +1 -1
- package/dist/features/ink.common.js +1 -1
- package/dist/features/ink.esm.js +1 -1
- package/dist/features/ink.js +1 -1
- package/dist/features/keyboard.common.js +2 -2
- package/dist/features/keyboard.esm.js +97 -145
- package/dist/features/keyboard.js +2 -2
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +63 -43
- package/dist/features/legend.js +2 -2
- package/dist/features/link.common.js +1 -1
- package/dist/features/link.esm.js +1 -1
- package/dist/features/link.js +1 -1
- package/dist/features/marks.common.js +1 -1
- package/dist/features/marks.esm.js +1 -1
- package/dist/features/marks.js +1 -1
- package/dist/features/measure.common.js +1 -1
- package/dist/features/measure.esm.js +1 -1
- package/dist/features/measure.js +1 -1
- package/dist/features/morph.common.js +1 -1
- package/dist/features/morph.esm.js +1 -1
- package/dist/features/morph.js +1 -1
- package/dist/features/perspectives.common.js +1 -1
- package/dist/features/perspectives.esm.js +1 -1
- package/dist/features/perspectives.js +1 -1
- package/dist/features/raincloud.common.js +1 -1
- package/dist/features/raincloud.esm.js +1 -1
- package/dist/features/raincloud.js +1 -1
- package/dist/features/renderer-canvas.common.js +2 -2
- package/dist/features/renderer-canvas.esm.js +2 -1
- package/dist/features/renderer-canvas.js +2 -2
- package/dist/features/stats.common.js +1 -1
- package/dist/features/stats.esm.js +1 -1
- package/dist/features/stats.js +1 -1
- package/dist/features/storyboard.common.js +1 -1
- package/dist/features/storyboard.esm.js +1 -1
- package/dist/features/storyboard.js +1 -1
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +3 -2
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +92 -2
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +83 -47
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +1 -1
- package/dist/features/waterfall.esm.js +1 -1
- package/dist/features/waterfall.js +1 -1
- package/dist/features/weave.common.js +1 -1
- package/dist/features/weave.esm.js +1 -1
- package/dist/features/weave.js +1 -1
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +950 -795
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +3 -17
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +433 -394
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +54 -38
- package/dist/icicle.js +2 -2
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +91 -40
- package/dist/line.js +2 -2
- package/dist/locales/en.json +2 -1
- package/dist/locales/ro.json +3 -2
- package/dist/pictograms.common.js +1 -1
- package/dist/pictograms.esm.js +1 -1
- package/dist/pictograms.js +1 -1
- package/dist/pie.common.js +1 -1
- package/dist/pie.esm.js +1 -1
- package/dist/pie.js +1 -1
- package/dist/polarArea.common.js +1 -1
- package/dist/polarArea.esm.js +1 -1
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +5 -4
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +1 -1
- package/dist/radialBar.esm.js +1 -1
- package/dist/radialBar.js +1 -1
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +72 -26
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +91 -40
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +433 -394
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +91 -40
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +93 -41
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +103 -93
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +105 -86
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +1 -1
- package/dist/unit-shapes.esm.js +1 -1
- package/dist/unit-shapes.js +1 -1
- package/dist/unit.common.js +2 -2
- package/dist/unit.esm.js +280 -202
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +72 -26
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +432 -393
- package/package.json +1 -1
- package/src/apexcharts.js +13 -6
- package/src/assets/apexcharts.css +35 -0
- package/src/charts/Bar.js +62 -55
- package/src/charts/BarStacked.js +80 -88
- package/src/charts/BoxCandleStick.js +28 -31
- package/src/charts/Icicle.js +37 -37
- package/src/charts/Line.js +118 -42
- package/src/charts/Radar.js +5 -7
- package/src/charts/RangeBar.js +47 -43
- package/src/charts/Sunburst.js +101 -98
- package/src/charts/Treemap.js +108 -66
- package/src/charts/Unit.js +368 -250
- package/src/charts/Violin.js +48 -30
- package/src/charts/common/Breadcrumb.js +2 -2
- package/src/charts/common/Hierarchy.js +32 -11
- package/src/charts/common/Jitter.js +32 -7
- package/src/charts/common/bar/DataLabels.js +76 -81
- package/src/charts/common/bar/Helpers.js +43 -7
- package/src/charts/common/line/Helpers.js +12 -15
- package/src/charts/common/partition/NodeTooltip.js +8 -1
- package/src/charts/common/partition/Partition.js +33 -1
- package/src/charts/common/treemap/Helpers.js +3 -11
- package/src/locales/en.json +2 -1
- package/src/locales/ro.json +3 -2
- package/src/modules/Core.js +4 -0
- package/src/modules/CoreUtils.js +18 -42
- package/src/modules/Data.js +23 -24
- package/src/modules/DataLabels.js +6 -6
- package/src/modules/Graphics.js +62 -49
- package/src/modules/Markers.js +3 -1
- package/src/modules/Range.js +44 -29
- package/src/modules/RendererController.js +17 -3
- package/src/modules/Scales.js +32 -9
- package/src/modules/Series.js +39 -18
- package/src/modules/Theme.js +1 -1
- package/src/modules/ZoomPanSelection.js +119 -2
- package/src/modules/accessibility/KeyboardNavigation.js +114 -186
- package/src/modules/animations/LengthTransition.js +22 -2
- package/src/modules/drilldown/Breadcrumb.js +5 -2
- package/src/modules/helpers/Destroy.js +1 -1
- package/src/modules/highlightFilter/HighlightFilter.js +8 -9
- package/src/modules/highlightFilter/TreemapPart.js +2 -2
- package/src/modules/legend/HeatmapGradientLegend.js +76 -45
- package/src/modules/legend/Helpers.js +2 -0
- package/src/modules/legend/Legend.js +11 -12
- package/src/modules/settings/Options.js +7 -0
- package/src/modules/streamgraph/StreamLabels.js +1 -0
- package/src/modules/tooltip/Tooltip.js +20 -4
- package/src/modules/tooltip/Utils.js +8 -0
- package/src/modules/trellis/Trellis.js +6 -0
- package/src/modules/trellis/TrellisChrome.js +18 -7
- package/src/modules/trellis/TrellisSync.js +2 -0
- package/src/renderers/canvas/CanvasGraphics.js +1 -0
- package/src/ssr/DOMShim.js +10 -0
- package/src/types/internal.d.ts +9 -3
- package/types/apexcharts.d.ts +31 -12
package/dist/waterfall.esm.js
CHANGED
|
@@ -30,7 +30,7 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
/*!
|
|
33
|
-
* ApexCharts v8.
|
|
33
|
+
* ApexCharts v8.3.0
|
|
34
34
|
* (c) 2018-2026 ApexCharts
|
|
35
35
|
*/
|
|
36
36
|
import * as _core from "apexcharts/core";
|
|
@@ -336,180 +336,6 @@ const resolveDataLabelOffset = (value, w, seriesIndex, dataPointIndex) => {
|
|
|
336
336
|
});
|
|
337
337
|
return Number.isFinite(resolved) ? resolved : 0;
|
|
338
338
|
};
|
|
339
|
-
const Animations = _core.__apex_Animations;
|
|
340
|
-
const computeStagger = _core.__apex_Animations_computeStagger;
|
|
341
|
-
const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
|
|
342
|
-
function lengthTransitionEnabled(w) {
|
|
343
|
-
var _a;
|
|
344
|
-
const anim = w.config.chart.animations;
|
|
345
|
-
if (!anim || anim.enabled === false) return false;
|
|
346
|
-
if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
|
|
350
|
-
if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
|
|
351
|
-
return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
|
|
352
|
-
}
|
|
353
|
-
function datumKey(w, realIndex, j) {
|
|
354
|
-
var _a, _b, _c, _d;
|
|
355
|
-
if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
|
|
356
|
-
const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
|
|
357
|
-
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
358
|
-
}
|
|
359
|
-
const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
|
|
360
|
-
if (lbl != null && String(lbl) !== "") {
|
|
361
|
-
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
362
|
-
}
|
|
363
|
-
return "j:" + j;
|
|
364
|
-
}
|
|
365
|
-
function frameDatumKey(frame, realIndex, j) {
|
|
366
|
-
var _a, _b;
|
|
367
|
-
if (frame.isXNumeric) {
|
|
368
|
-
const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
|
|
369
|
-
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
370
|
-
}
|
|
371
|
-
const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
|
|
372
|
-
if (lbl != null && String(lbl) !== "") {
|
|
373
|
-
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
374
|
-
}
|
|
375
|
-
return "j:" + j;
|
|
376
|
-
}
|
|
377
|
-
function joinKeys(oldKeys, newKeys) {
|
|
378
|
-
const oldIndex = /* @__PURE__ */ new Map();
|
|
379
|
-
oldKeys.forEach((k, i) => {
|
|
380
|
-
if (!oldIndex.has(k)) oldIndex.set(k, i);
|
|
381
|
-
});
|
|
382
|
-
const toOld = new Array(newKeys.length);
|
|
383
|
-
const usedOld = /* @__PURE__ */ new Set();
|
|
384
|
-
let prev = -1;
|
|
385
|
-
let ordered = true;
|
|
386
|
-
let identity = oldKeys.length === newKeys.length;
|
|
387
|
-
newKeys.forEach((k, i) => {
|
|
388
|
-
const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
|
|
389
|
-
toOld[i] = oi;
|
|
390
|
-
if (oi !== -1) {
|
|
391
|
-
usedOld.add(oi);
|
|
392
|
-
if (oi < prev) ordered = false;
|
|
393
|
-
prev = oi;
|
|
394
|
-
}
|
|
395
|
-
if (oi !== i) identity = false;
|
|
396
|
-
});
|
|
397
|
-
const exits = [];
|
|
398
|
-
for (let i = 0; i < oldKeys.length; i++) {
|
|
399
|
-
if (!usedOld.has(i)) exits.push(i);
|
|
400
|
-
}
|
|
401
|
-
return { toOld, exits, ordered, changed: !identity };
|
|
402
|
-
}
|
|
403
|
-
function uniquifyKeys(keys) {
|
|
404
|
-
const seen = /* @__PURE__ */ new Map();
|
|
405
|
-
return keys.map((k) => {
|
|
406
|
-
const count = seen.get(k) || 0;
|
|
407
|
-
seen.set(k, count + 1);
|
|
408
|
-
return count === 0 ? k : `${k}#${count}`;
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
|
|
412
|
-
var _a, _b;
|
|
413
|
-
if (!lengthTransitionEnabled(w)) return null;
|
|
414
|
-
const frame = w.globals.prevStreamFrame;
|
|
415
|
-
if (!frame) return null;
|
|
416
|
-
const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
|
|
417
|
-
const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
|
|
418
|
-
if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
|
|
419
|
-
if (!oldY.length || !newY.length) return null;
|
|
420
|
-
const oldKeys = uniquifyKeys(
|
|
421
|
-
oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
|
|
422
|
-
);
|
|
423
|
-
const newKeys = uniquifyKeys(newY.map((_, j) => datumKey(w, realIndex, j)));
|
|
424
|
-
const join = joinKeys(oldKeys, newKeys);
|
|
425
|
-
if (!join.ordered && !allowReorder) return null;
|
|
426
|
-
if (!join.changed && !includeIdentity) return null;
|
|
427
|
-
return { join, oldKeys, newKeys };
|
|
428
|
-
}
|
|
429
|
-
function firstMove(d) {
|
|
430
|
-
const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
|
|
431
|
-
if (!m) return null;
|
|
432
|
-
const x = parseFloat(m[1]);
|
|
433
|
-
const y = parseFloat(m[2]);
|
|
434
|
-
return isFinite(x) && isFinite(y) ? { x, y } : null;
|
|
435
|
-
}
|
|
436
|
-
function renderBarExitGhosts({
|
|
437
|
-
w,
|
|
438
|
-
elSeries,
|
|
439
|
-
record,
|
|
440
|
-
newKeys,
|
|
441
|
-
isHorizontal,
|
|
442
|
-
speed
|
|
443
|
-
}) {
|
|
444
|
-
var _a;
|
|
445
|
-
if (!lengthTransitionEnabled(w)) return;
|
|
446
|
-
if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
|
|
447
|
-
const newKeySet = new Set(newKeys);
|
|
448
|
-
const exits = record.paths.filter(
|
|
449
|
-
(p) => p && p.d && p.key != null && !newKeySet.has(p.key)
|
|
450
|
-
);
|
|
451
|
-
if (!exits.length) return;
|
|
452
|
-
const graphics = new Graphics(w);
|
|
453
|
-
const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
|
|
454
|
-
exits.forEach((p) => {
|
|
455
|
-
let fill = p.fill || fallbackFill || "#c8c8c8";
|
|
456
|
-
if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
|
|
457
|
-
const ghost = graphics.drawPath({
|
|
458
|
-
d: p.d,
|
|
459
|
-
stroke: "none",
|
|
460
|
-
strokeWidth: 0,
|
|
461
|
-
fill,
|
|
462
|
-
fillOpacity: 1,
|
|
463
|
-
classes: "apexcharts-bar-ghost"
|
|
464
|
-
});
|
|
465
|
-
const node = ghost.node;
|
|
466
|
-
node.setAttribute("pointer-events", "none");
|
|
467
|
-
ghost.attr(
|
|
468
|
-
"clip-path",
|
|
469
|
-
`url(#gridRectBarMask${w.globals.cuid})`
|
|
470
|
-
);
|
|
471
|
-
elSeries.node.insertBefore(node, elSeries.node.firstChild);
|
|
472
|
-
const start = firstMove(p.d);
|
|
473
|
-
let origin = isHorizontal ? "left center" : "center bottom";
|
|
474
|
-
try {
|
|
475
|
-
const bb = node.getBBox();
|
|
476
|
-
if (start && bb) {
|
|
477
|
-
if (isHorizontal) {
|
|
478
|
-
origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
|
|
479
|
-
} else {
|
|
480
|
-
origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
} catch (_) {
|
|
484
|
-
}
|
|
485
|
-
const style = node.style;
|
|
486
|
-
style.transformBox = "fill-box";
|
|
487
|
-
style.transformOrigin = origin;
|
|
488
|
-
node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
|
|
489
|
-
try {
|
|
490
|
-
const bb = node.getBBox();
|
|
491
|
-
const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
|
|
492
|
-
if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
|
|
493
|
-
} catch (_) {
|
|
494
|
-
}
|
|
495
|
-
const duration = Math.max(1, speed || 1);
|
|
496
|
-
const startAt = performance.now();
|
|
497
|
-
const step = (now) => {
|
|
498
|
-
if (w.globals.isDestroyed || !node.parentNode) return;
|
|
499
|
-
const t = Math.max(0, Math.min(1, (now - startAt) / duration));
|
|
500
|
-
const eased = 1 - Math.pow(1 - t, 3);
|
|
501
|
-
const scale = 1 - eased;
|
|
502
|
-
style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
|
|
503
|
-
style.opacity = String(1 - eased);
|
|
504
|
-
if (t < 1) {
|
|
505
|
-
BrowserAPIs.requestAnimationFrame(step);
|
|
506
|
-
} else {
|
|
507
|
-
node.parentNode.removeChild(node);
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
BrowserAPIs.requestAnimationFrame(step);
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
339
|
class BarDataLabels {
|
|
514
340
|
/**
|
|
515
341
|
* @param {import('../../../charts/Bar').default} barCtx
|
|
@@ -545,7 +371,8 @@ class BarDataLabels {
|
|
|
545
371
|
barXPosition,
|
|
546
372
|
barYPosition,
|
|
547
373
|
visibleSeries,
|
|
548
|
-
hl
|
|
374
|
+
hl,
|
|
375
|
+
noLabel
|
|
549
376
|
} = opts;
|
|
550
377
|
const w = this.w;
|
|
551
378
|
const graphics = new Graphics(this.barCtx.w);
|
|
@@ -659,7 +486,7 @@ class BarDataLabels {
|
|
|
659
486
|
dataLabelsPos.dataLabelsX = (box.levelStart + box.levelEnd) / 2 + offX;
|
|
660
487
|
}
|
|
661
488
|
}
|
|
662
|
-
dataLabels = this.drawCalculatedDataLabels({
|
|
489
|
+
dataLabels = noLabel ? null : this.drawCalculatedDataLabels({
|
|
663
490
|
x: dataLabelsPos.dataLabelsX,
|
|
664
491
|
y: dataLabelsPos.dataLabelsY,
|
|
665
492
|
neg: params.neg,
|
|
@@ -745,8 +572,8 @@ class BarDataLabels {
|
|
|
745
572
|
return ctx && byGroups && byGroups[ctx.groupIndex] ? byGroups[ctx.groupIndex][j] : this.barCtx.stackedSeriesTotals[j];
|
|
746
573
|
}
|
|
747
574
|
/**
|
|
748
|
-
* The running stack at this
|
|
749
|
-
*
|
|
575
|
+
* The running stack at this bar's x (BarStacked `tops`) on a numeric axis,
|
|
576
|
+
* where bars stack by x rather than by index.
|
|
750
577
|
* @param {number} realIndex @param {number} j
|
|
751
578
|
*/
|
|
752
579
|
xStackTop(realIndex, j) {
|
|
@@ -755,6 +582,21 @@ class BarDataLabels {
|
|
|
755
582
|
return w.axisFlags.isXNumeric && /** @type {any} */
|
|
756
583
|
((_b = (_a = this.barCtx.stacks) == null ? void 0 : _a[w.labelData.seriesGroupIndex[realIndex]]) == null ? void 0 : _b.tops.get(w.seriesData.seriesX[realIndex][j]));
|
|
757
584
|
}
|
|
585
|
+
/**
|
|
586
|
+
* The stacked total's text box, measured in the total's own font.
|
|
587
|
+
* @param {number} realIndex @param {number} j
|
|
588
|
+
*/
|
|
589
|
+
totalRects(realIndex, j) {
|
|
590
|
+
const s = this.barCtx.barOptions.dataLabels.total.style;
|
|
591
|
+
return new Graphics(this.w).getTextRects(
|
|
592
|
+
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
593
|
+
s.fontSize,
|
|
594
|
+
s.fontFamily,
|
|
595
|
+
void 0,
|
|
596
|
+
true,
|
|
597
|
+
s.fontWeight
|
|
598
|
+
);
|
|
599
|
+
}
|
|
758
600
|
/** @param {{realIndex: any, j: any}} opts */
|
|
759
601
|
getStackedTotalDataLabel({ realIndex, j }) {
|
|
760
602
|
const w = this.w;
|
|
@@ -775,7 +617,6 @@ class BarDataLabels {
|
|
|
775
617
|
var _a;
|
|
776
618
|
const w = this.w;
|
|
777
619
|
let {
|
|
778
|
-
i,
|
|
779
620
|
j,
|
|
780
621
|
realIndex,
|
|
781
622
|
y,
|
|
@@ -785,7 +626,6 @@ class BarDataLabels {
|
|
|
785
626
|
textRects,
|
|
786
627
|
dataLabelsX,
|
|
787
628
|
dataLabelsY,
|
|
788
|
-
dataLabelsConfig,
|
|
789
629
|
barDataLabelsConfig,
|
|
790
630
|
barTotalDataLabelsConfig,
|
|
791
631
|
strokeWidth,
|
|
@@ -799,7 +639,7 @@ class BarDataLabels {
|
|
|
799
639
|
barHeight = Math.abs(barHeight);
|
|
800
640
|
const vertical = w.config.plotOptions.bar.dataLabels.orientation === "vertical";
|
|
801
641
|
const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
|
|
802
|
-
i,
|
|
642
|
+
i: realIndex,
|
|
803
643
|
j
|
|
804
644
|
});
|
|
805
645
|
bcx = bcx - strokeWidth / 2;
|
|
@@ -820,7 +660,7 @@ class BarDataLabels {
|
|
|
820
660
|
const offsetDLX = 2;
|
|
821
661
|
dataLabelsX = dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX;
|
|
822
662
|
}
|
|
823
|
-
const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[
|
|
663
|
+
const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[realIndex][j] < 0;
|
|
824
664
|
let newY = y;
|
|
825
665
|
if (this.barCtx.isReversed) {
|
|
826
666
|
newY = y + (valIsNegative ? barHeight : -barHeight);
|
|
@@ -894,16 +734,11 @@ class BarDataLabels {
|
|
|
894
734
|
});
|
|
895
735
|
if (this.hlt) lowestPrevY = this.hlt.edge;
|
|
896
736
|
if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
|
|
897
|
-
const
|
|
898
|
-
const graphics = new Graphics(this.barCtx.w);
|
|
899
|
-
const totalLabeltextRects = graphics.getTextRects(
|
|
900
|
-
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
901
|
-
dataLabelsConfig.fontSize
|
|
902
|
-
);
|
|
737
|
+
const h = this.totalRects(realIndex, j).height;
|
|
903
738
|
if (valIsNegative) {
|
|
904
|
-
totalDataLabelsY = lowestPrevY
|
|
739
|
+
totalDataLabelsY = lowestPrevY + h * 0.77 - offY - barTotalDataLabelsConfig.offsetY;
|
|
905
740
|
} else {
|
|
906
|
-
totalDataLabelsY = lowestPrevY
|
|
741
|
+
totalDataLabelsY = lowestPrevY - h * 0.3 + offY + barTotalDataLabelsConfig.offsetY;
|
|
907
742
|
}
|
|
908
743
|
const xDivision = dataPointsDividedWidth;
|
|
909
744
|
totalDataLabelsX = totalDataLabelsBcx + (w.axisFlags.isXNumeric ? -barWidth / 2 : barWidth / 2 - xDivision) + barTotalDataLabelsConfig.offsetX;
|
|
@@ -933,7 +768,6 @@ class BarDataLabels {
|
|
|
933
768
|
const w = this.w;
|
|
934
769
|
let {
|
|
935
770
|
x,
|
|
936
|
-
i,
|
|
937
771
|
j,
|
|
938
772
|
realIndex,
|
|
939
773
|
bcy,
|
|
@@ -950,7 +784,7 @@ class BarDataLabels {
|
|
|
950
784
|
} = opts;
|
|
951
785
|
const dataPointsDividedHeight = w.layout.gridHeight / w.globals.dataPoints;
|
|
952
786
|
const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
|
|
953
|
-
i,
|
|
787
|
+
i: realIndex,
|
|
954
788
|
j
|
|
955
789
|
});
|
|
956
790
|
barWidth = Math.abs(barWidth);
|
|
@@ -967,7 +801,7 @@ class BarDataLabels {
|
|
|
967
801
|
let totalDataLabelsX;
|
|
968
802
|
let totalDataLabelsY;
|
|
969
803
|
let totalDataLabelsAnchor = "start";
|
|
970
|
-
const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[
|
|
804
|
+
const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[realIndex][j] < 0;
|
|
971
805
|
let newX = x;
|
|
972
806
|
if (this.barCtx.isReversed) {
|
|
973
807
|
newX = x + (valIsNegative ? -barWidth : barWidth);
|
|
@@ -1002,10 +836,14 @@ class BarDataLabels {
|
|
|
1002
836
|
}
|
|
1003
837
|
let lowestPrevX = newX;
|
|
1004
838
|
const totalGroupCtx = this.getTotalGroupContext(realIndex);
|
|
1005
|
-
const
|
|
839
|
+
const top = this.xStackTop(realIndex, j);
|
|
840
|
+
const stacks = top ? [] : (
|
|
1006
841
|
/** @type {any} */
|
|
1007
842
|
this.barCtx.stacks || []
|
|
1008
843
|
);
|
|
844
|
+
if (top) {
|
|
845
|
+
lowestPrevX = valIsNegative ? Math.min(newX, top[4]) : Math.max(newX, top[5]);
|
|
846
|
+
}
|
|
1009
847
|
stacks.forEach((g, gi) => {
|
|
1010
848
|
if (totalGroupCtx && gi !== totalGroupCtx.groupIndex) return;
|
|
1011
849
|
g.prevX.forEach((arr) => {
|
|
@@ -1018,11 +856,7 @@ class BarDataLabels {
|
|
|
1018
856
|
});
|
|
1019
857
|
if (this.hlt) lowestPrevX = this.hlt.edge;
|
|
1020
858
|
if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
|
|
1021
|
-
const
|
|
1022
|
-
const totalLabeltextRects = graphics.getTextRects(
|
|
1023
|
-
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
1024
|
-
dataLabelsConfig.fontSize
|
|
1025
|
-
);
|
|
859
|
+
const totalLabeltextRects = this.totalRects(realIndex, j);
|
|
1026
860
|
if (valIsNegative) {
|
|
1027
861
|
totalDataLabelsX = lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX;
|
|
1028
862
|
totalDataLabelsAnchor = "end";
|
|
@@ -1091,8 +925,9 @@ class BarDataLabels {
|
|
|
1091
925
|
let elDataLabelsWrap = null;
|
|
1092
926
|
const isSeriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) > -1;
|
|
1093
927
|
const isSeriesCollapsing = (w.globals.collapsingSeriesIndices || []).indexOf(i) > -1;
|
|
928
|
+
const dlKey = `${i}::${this.barCtx._keys(i)[j]}`;
|
|
1094
929
|
if (isSeriesCollapsing) {
|
|
1095
|
-
const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(
|
|
930
|
+
const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(dlKey);
|
|
1096
931
|
if (prev && isFinite(prev.val)) {
|
|
1097
932
|
val = prev.val;
|
|
1098
933
|
text = void 0;
|
|
@@ -1105,10 +940,7 @@ class BarDataLabels {
|
|
|
1105
940
|
});
|
|
1106
941
|
const dlCfg = w.config.dataLabels;
|
|
1107
942
|
if (((_b = dlCfg.animate) == null ? void 0 : _b.enabled) || ((_c = dlCfg.countUp) == null ? void 0 : _c.enabled)) {
|
|
1108
|
-
elDataLabelsWrap.node.setAttribute(
|
|
1109
|
-
"data:dlKey",
|
|
1110
|
-
`${i}::${datumKey(w, i, j)}`
|
|
1111
|
-
);
|
|
943
|
+
elDataLabelsWrap.node.setAttribute("data:dlKey", dlKey);
|
|
1112
944
|
elDataLabelsWrap.node.setAttribute("data:dlJ", String(j));
|
|
1113
945
|
if (typeof val === "number" && isFinite(val)) {
|
|
1114
946
|
elDataLabelsWrap.node.setAttribute("data:dlVal", String(val));
|
|
@@ -1126,29 +958,12 @@ class BarDataLabels {
|
|
|
1126
958
|
if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
1127
959
|
text = "";
|
|
1128
960
|
}
|
|
1129
|
-
|
|
1130
|
-
const position = w.config.plotOptions.bar.dataLabels.position;
|
|
961
|
+
let anchor = dataLabelsConfig.textAnchor;
|
|
1131
962
|
if (w.config.plotOptions.bar.dataLabels.orientation === "vertical") {
|
|
1132
|
-
|
|
1133
|
-
if (valIsNegative) dataLabelsConfig.textAnchor = "end";
|
|
1134
|
-
else dataLabelsConfig.textAnchor = "start";
|
|
1135
|
-
}
|
|
1136
|
-
if (position === "center") {
|
|
1137
|
-
dataLabelsConfig.textAnchor = "middle";
|
|
1138
|
-
}
|
|
1139
|
-
if (position === "bottom") {
|
|
1140
|
-
if (valIsNegative) dataLabelsConfig.textAnchor = "end";
|
|
1141
|
-
else dataLabelsConfig.textAnchor = "start";
|
|
1142
|
-
}
|
|
963
|
+
anchor = w.config.plotOptions.bar.dataLabels.position === "center" ? "middle" : (neg != null ? neg : w.seriesData.series[i][j] < 0) ? "end" : "start";
|
|
1143
964
|
}
|
|
1144
|
-
if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) {
|
|
1145
|
-
|
|
1146
|
-
text,
|
|
1147
|
-
parseFloat(dataLabelsConfig.style.fontSize).toString()
|
|
1148
|
-
);
|
|
1149
|
-
if (barWidth < txRect.width) {
|
|
1150
|
-
text = "";
|
|
1151
|
-
}
|
|
965
|
+
if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && barWidth < textRects.width) {
|
|
966
|
+
text = "";
|
|
1152
967
|
}
|
|
1153
968
|
if (w.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && // A collapsing series is measured against its NEW extent, which is
|
|
1154
969
|
// already zero, so this would blank a label whose bar is still at full
|
|
@@ -1164,14 +979,14 @@ class BarDataLabels {
|
|
|
1164
979
|
}
|
|
1165
980
|
}
|
|
1166
981
|
}
|
|
1167
|
-
const modifiedDataLabelsConfig = __spreadValues({}, dataLabelsConfig)
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
982
|
+
const modifiedDataLabelsConfig = __spreadProps(__spreadValues({}, dataLabelsConfig), {
|
|
983
|
+
textAnchor: anchor
|
|
984
|
+
});
|
|
985
|
+
if (this.barCtx.isHorizontal && val < 0) {
|
|
986
|
+
if (anchor === "start") {
|
|
987
|
+
modifiedDataLabelsConfig.textAnchor = "end";
|
|
988
|
+
} else if (anchor === "end") {
|
|
989
|
+
modifiedDataLabelsConfig.textAnchor = "start";
|
|
1175
990
|
}
|
|
1176
991
|
}
|
|
1177
992
|
dataLabels.plotDataLabelsText({
|
|
@@ -1223,7 +1038,7 @@ class BarDataLabels {
|
|
|
1223
1038
|
const { groupIndex } = this.barCtx.barHelpers.getGroupIndex(realIndex);
|
|
1224
1039
|
totalDataLabelText.node.setAttribute(
|
|
1225
1040
|
"data:dlTotalKey",
|
|
1226
|
-
`${groupIndex}::${
|
|
1041
|
+
`${groupIndex}::${this.barCtx._keys(realIndex)[j]}`
|
|
1227
1042
|
);
|
|
1228
1043
|
totalDataLabelText.node.setAttribute(
|
|
1229
1044
|
"data:dlTotalSeries",
|
|
@@ -1239,6 +1054,7 @@ class BarDataLabels {
|
|
|
1239
1054
|
}
|
|
1240
1055
|
const Series = _core.__apex_Series;
|
|
1241
1056
|
const Fill = _core.__apex_Fill;
|
|
1057
|
+
const CoreUtils = _core.__apex_CoreUtils;
|
|
1242
1058
|
function isHistogramOverlay(w) {
|
|
1243
1059
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1244
1060
|
if (((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.chart) == null ? void 0 : _b.requestedType) !== "histogram") return false;
|
|
@@ -1255,9 +1071,11 @@ class Helpers {
|
|
|
1255
1071
|
}
|
|
1256
1072
|
/**
|
|
1257
1073
|
* @param {any[]} series
|
|
1074
|
+
* @param {any} [seriesIndex] a combo's real indices of `series`
|
|
1258
1075
|
*/
|
|
1259
|
-
initVariables(series) {
|
|
1076
|
+
initVariables(series, seriesIndex) {
|
|
1260
1077
|
const w = this.w;
|
|
1078
|
+
this.seriesIndex = seriesIndex;
|
|
1261
1079
|
this.barCtx.series = series;
|
|
1262
1080
|
this.barCtx.totalItems = 0;
|
|
1263
1081
|
this.barCtx.seriesLen = 0;
|
|
@@ -1278,6 +1096,8 @@ class Helpers {
|
|
|
1278
1096
|
this.barCtx.visibleItems = w.globals.dataPoints;
|
|
1279
1097
|
}
|
|
1280
1098
|
}
|
|
1099
|
+
const labels = w.labelData.labels;
|
|
1100
|
+
this.rows = w.globals.isBarHorizontal && w.axisFlags.isXNumeric && !this.barCtx.isRangeBar && w.seriesData.seriesX.some((s) => s == null ? void 0 : s.some((x, j) => x !== labels[j])) ? new Map(labels.map((x, r) => [x, r])) : null;
|
|
1281
1101
|
this.arrBorderRadius = this.createBorderRadiusArr(w.seriesData.series);
|
|
1282
1102
|
if (Utils.isSafari()) {
|
|
1283
1103
|
this.arrBorderRadius = this.arrBorderRadius.map(
|
|
@@ -1342,15 +1162,19 @@ class Helpers {
|
|
|
1342
1162
|
* Collapsed series count too, exactly as they did for `minXDiff`. Skipping
|
|
1343
1163
|
* them would widen every bar the moment someone hid the tightest-spaced
|
|
1344
1164
|
* series from the legend, so bar geometry would depend on legend state.
|
|
1165
|
+
* In a combo only this renderer's own series count: a line's x values say
|
|
1166
|
+
* nothing about how wide a column may be.
|
|
1345
1167
|
*
|
|
1346
1168
|
* @returns {number}
|
|
1347
1169
|
*/
|
|
1348
1170
|
_unionMinXGap() {
|
|
1349
1171
|
const w = this.w;
|
|
1350
1172
|
const seriesX = w.seriesData.seriesX || [];
|
|
1173
|
+
const own = this.seriesIndex;
|
|
1351
1174
|
const arrays = [];
|
|
1352
1175
|
for (let i = 0; i < seriesX.length; i++) {
|
|
1353
1176
|
const xs = seriesX[i];
|
|
1177
|
+
if (own && own.indexOf(i) < 0) continue;
|
|
1354
1178
|
if (Array.isArray(xs) && xs.length > 0) {
|
|
1355
1179
|
arrays.push(
|
|
1356
1180
|
xs.some((v, n) => v < xs[n - 1]) ? xs.filter((v) => v === +v).sort((a, b) => a - b) : xs
|
|
@@ -1391,6 +1215,15 @@ class Helpers {
|
|
|
1391
1215
|
}
|
|
1392
1216
|
return isFinite(min) ? min : 0;
|
|
1393
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* The band a horizontal bar is drawn in: its x's band when the series do
|
|
1220
|
+
* not line up by index (see initVariables), else its index.
|
|
1221
|
+
* @param {number} realIndex @param {number} j
|
|
1222
|
+
*/
|
|
1223
|
+
barRow(realIndex, j) {
|
|
1224
|
+
var _a, _b, _c;
|
|
1225
|
+
return (_c = (_b = this.rows) == null ? void 0 : _b.get((_a = this.w.seriesData.seriesX[realIndex]) == null ? void 0 : _a[j])) != null ? _c : j;
|
|
1226
|
+
}
|
|
1394
1227
|
/**
|
|
1395
1228
|
* @param {number} realIndex
|
|
1396
1229
|
*/
|
|
@@ -1513,7 +1346,7 @@ class Helpers {
|
|
|
1513
1346
|
});
|
|
1514
1347
|
}
|
|
1515
1348
|
const connectorFill = this.getDumbbellConnectorFill(i, j);
|
|
1516
|
-
const datumFill = connectorFill || ((_a = w.config.series[
|
|
1349
|
+
const datumFill = connectorFill || ((_a = w.config.series[realIndex].data[j]) == null ? void 0 : _a.fill);
|
|
1517
1350
|
const connector = this.barCtx.barOptions.isDumbbell ? w.config.plotOptions.bar.dumbbell.connector : null;
|
|
1518
1351
|
let connectorOpacity;
|
|
1519
1352
|
if (connector && connector.color) {
|
|
@@ -1666,11 +1499,10 @@ class Helpers {
|
|
|
1666
1499
|
* @returns {string[][]}
|
|
1667
1500
|
*/
|
|
1668
1501
|
createBorderRadiusArr(series) {
|
|
1669
|
-
var _a;
|
|
1670
1502
|
const w = this.w;
|
|
1671
1503
|
const alwaysApplyRadius = !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0;
|
|
1672
1504
|
const numSeries = series.length;
|
|
1673
|
-
const numColumns = (
|
|
1505
|
+
const numColumns = Math.max(0, ...series.map((s) => (s == null ? void 0 : s.length) | 0));
|
|
1674
1506
|
const output = Array.from(
|
|
1675
1507
|
{ length: numSeries },
|
|
1676
1508
|
() => Array(numColumns).fill(alwaysApplyRadius ? "top" : "none")
|
|
@@ -1826,7 +1658,7 @@ class Helpers {
|
|
|
1826
1658
|
j,
|
|
1827
1659
|
w
|
|
1828
1660
|
}) {
|
|
1829
|
-
var _a, _b;
|
|
1661
|
+
var _a, _b, _c;
|
|
1830
1662
|
const r = this.barRect({
|
|
1831
1663
|
a: barXPosition,
|
|
1832
1664
|
len: barWidth,
|
|
@@ -1857,7 +1689,7 @@ class Helpers {
|
|
|
1857
1689
|
const _ctx = this.barCtx.groupCtx;
|
|
1858
1690
|
_ctx.yArrj.push(y2 - strokeCenter * direction);
|
|
1859
1691
|
_ctx.yArrjF.push(Math.abs(y1 - y2 + r.strokeWidth * direction));
|
|
1860
|
-
_ctx.yArrjVal.push(this.barCtx.series[i][j]);
|
|
1692
|
+
_ctx.yArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
|
|
1861
1693
|
}
|
|
1862
1694
|
return {
|
|
1863
1695
|
pathTo,
|
|
@@ -2047,7 +1879,7 @@ class Helpers {
|
|
|
2047
1879
|
j,
|
|
2048
1880
|
w
|
|
2049
1881
|
}) {
|
|
2050
|
-
var _a, _b;
|
|
1882
|
+
var _a, _b, _c;
|
|
2051
1883
|
const graphics = new Graphics(this.barCtx.w);
|
|
2052
1884
|
const r = this.barRect({
|
|
2053
1885
|
a: barYPosition,
|
|
@@ -2083,7 +1915,7 @@ class Helpers {
|
|
|
2083
1915
|
const _ctx = this.barCtx.groupCtx;
|
|
2084
1916
|
_ctx.xArrj.push(x2 + strokeCenter * direction);
|
|
2085
1917
|
_ctx.xArrjF.push(Math.abs(x1 - x2 - r.strokeWidth * direction));
|
|
2086
|
-
_ctx.xArrjVal.push(this.barCtx.series[i][j]);
|
|
1918
|
+
_ctx.xArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
|
|
2087
1919
|
}
|
|
2088
1920
|
return {
|
|
2089
1921
|
pathTo,
|
|
@@ -2128,6 +1960,9 @@ class Helpers {
|
|
|
2128
1960
|
const w = this.w;
|
|
2129
1961
|
const goals = [];
|
|
2130
1962
|
const pushGoal = (value, attrs) => {
|
|
1963
|
+
if (!w.globals.invalidLogScale) {
|
|
1964
|
+
value = new CoreUtils(w).getLogValAtSeriesIndex(value, i);
|
|
1965
|
+
}
|
|
2131
1966
|
goals.push({
|
|
2132
1967
|
[type]: type === "x" ? this.getXForValue(value, zeroW, false) : this.getYForValue(value, zeroH, translationsIndex, false),
|
|
2133
1968
|
attrs
|
|
@@ -2382,11 +2217,11 @@ class Helpers {
|
|
|
2382
2217
|
let zeroEncounters = 0;
|
|
2383
2218
|
const seriesIndices = w.config.plotOptions.bar.horizontal ? w.seriesData.series.map((_, _i) => _i) : ((_a = w.globals.columnSeries) == null ? void 0 : _a.i.map((_i) => _i)) || [];
|
|
2384
2219
|
seriesIndices.forEach((_si) => {
|
|
2385
|
-
const val = w.
|
|
2220
|
+
const val = w.seriesData.series[_si][j];
|
|
2386
2221
|
if (val) {
|
|
2387
2222
|
nonZeroColumns++;
|
|
2388
2223
|
}
|
|
2389
|
-
if (_si < i && val
|
|
2224
|
+
if (_si < i && !val) {
|
|
2390
2225
|
zeroEncounters++;
|
|
2391
2226
|
}
|
|
2392
2227
|
});
|
|
@@ -2423,8 +2258,186 @@ class Helpers {
|
|
|
2423
2258
|
return { groupIndex, columnGroupIndex };
|
|
2424
2259
|
}
|
|
2425
2260
|
}
|
|
2426
|
-
const CoreUtils = _core.__apex_CoreUtils;
|
|
2427
2261
|
const Filters = _core.__apex_Filters;
|
|
2262
|
+
const Animations = _core.__apex_Animations;
|
|
2263
|
+
const computeStagger = _core.__apex_Animations_computeStagger;
|
|
2264
|
+
const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
|
|
2265
|
+
function lengthTransitionEnabled(w) {
|
|
2266
|
+
var _a;
|
|
2267
|
+
const anim = w.config.chart.animations;
|
|
2268
|
+
if (!anim || anim.enabled === false) return false;
|
|
2269
|
+
if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
|
|
2270
|
+
return false;
|
|
2271
|
+
}
|
|
2272
|
+
const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
|
|
2273
|
+
if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
|
|
2274
|
+
return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
|
|
2275
|
+
}
|
|
2276
|
+
function datumKey(w, realIndex, j) {
|
|
2277
|
+
var _a, _b, _c, _d;
|
|
2278
|
+
if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
|
|
2279
|
+
const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
|
|
2280
|
+
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
2281
|
+
}
|
|
2282
|
+
const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
|
|
2283
|
+
if (lbl != null && String(lbl) !== "") {
|
|
2284
|
+
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
2285
|
+
}
|
|
2286
|
+
return "j:" + j;
|
|
2287
|
+
}
|
|
2288
|
+
function frameDatumKey(frame, realIndex, j) {
|
|
2289
|
+
var _a, _b;
|
|
2290
|
+
if (frame.isXNumeric) {
|
|
2291
|
+
const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
|
|
2292
|
+
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
2293
|
+
}
|
|
2294
|
+
const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
|
|
2295
|
+
if (lbl != null && String(lbl) !== "") {
|
|
2296
|
+
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
2297
|
+
}
|
|
2298
|
+
return "j:" + j;
|
|
2299
|
+
}
|
|
2300
|
+
function joinKeys(oldKeys, newKeys) {
|
|
2301
|
+
const oldIndex = /* @__PURE__ */ new Map();
|
|
2302
|
+
oldKeys.forEach((k, i) => {
|
|
2303
|
+
if (!oldIndex.has(k)) oldIndex.set(k, i);
|
|
2304
|
+
});
|
|
2305
|
+
const toOld = new Array(newKeys.length);
|
|
2306
|
+
const usedOld = /* @__PURE__ */ new Set();
|
|
2307
|
+
let prev = -1;
|
|
2308
|
+
let ordered = true;
|
|
2309
|
+
let identity = oldKeys.length === newKeys.length;
|
|
2310
|
+
newKeys.forEach((k, i) => {
|
|
2311
|
+
const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
|
|
2312
|
+
toOld[i] = oi;
|
|
2313
|
+
if (oi !== -1) {
|
|
2314
|
+
usedOld.add(oi);
|
|
2315
|
+
if (oi < prev) ordered = false;
|
|
2316
|
+
prev = oi;
|
|
2317
|
+
}
|
|
2318
|
+
if (oi !== i) identity = false;
|
|
2319
|
+
});
|
|
2320
|
+
const exits = [];
|
|
2321
|
+
for (let i = 0; i < oldKeys.length; i++) {
|
|
2322
|
+
if (!usedOld.has(i)) exits.push(i);
|
|
2323
|
+
}
|
|
2324
|
+
return { toOld, exits, ordered, changed: !identity };
|
|
2325
|
+
}
|
|
2326
|
+
function uniquifyKeys(keys) {
|
|
2327
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2328
|
+
return keys.map((k) => {
|
|
2329
|
+
const count = seen.get(k) || 0;
|
|
2330
|
+
seen.set(k, count + 1);
|
|
2331
|
+
return count === 0 ? k : `${k}#${count}`;
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
function seriesKeys(w, realIndex, n = ((_a) => (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length)() | 0) {
|
|
2335
|
+
return uniquifyKeys(
|
|
2336
|
+
Array.from({ length: n }, (_, j) => datumKey(w, realIndex, j))
|
|
2337
|
+
);
|
|
2338
|
+
}
|
|
2339
|
+
function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
|
|
2340
|
+
var _a, _b;
|
|
2341
|
+
if (!lengthTransitionEnabled(w)) return null;
|
|
2342
|
+
const frame = w.globals.prevStreamFrame;
|
|
2343
|
+
if (!frame) return null;
|
|
2344
|
+
const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
|
|
2345
|
+
const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
|
|
2346
|
+
if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
|
|
2347
|
+
if (!oldY.length || !newY.length) return null;
|
|
2348
|
+
const oldKeys = uniquifyKeys(
|
|
2349
|
+
oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
|
|
2350
|
+
);
|
|
2351
|
+
const newKeys = seriesKeys(w, realIndex);
|
|
2352
|
+
const join = joinKeys(oldKeys, newKeys);
|
|
2353
|
+
if (!join.ordered && !allowReorder) return null;
|
|
2354
|
+
if (!join.changed && !includeIdentity) return null;
|
|
2355
|
+
return { join, oldKeys, newKeys };
|
|
2356
|
+
}
|
|
2357
|
+
function firstMove(d) {
|
|
2358
|
+
const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
|
|
2359
|
+
if (!m) return null;
|
|
2360
|
+
const x = parseFloat(m[1]);
|
|
2361
|
+
const y = parseFloat(m[2]);
|
|
2362
|
+
return isFinite(x) && isFinite(y) ? { x, y } : null;
|
|
2363
|
+
}
|
|
2364
|
+
function renderBarExitGhosts({
|
|
2365
|
+
w,
|
|
2366
|
+
elSeries,
|
|
2367
|
+
record,
|
|
2368
|
+
newKeys,
|
|
2369
|
+
isHorizontal,
|
|
2370
|
+
speed
|
|
2371
|
+
}) {
|
|
2372
|
+
var _a;
|
|
2373
|
+
if (!lengthTransitionEnabled(w)) return;
|
|
2374
|
+
if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
|
|
2375
|
+
const newKeySet = new Set(newKeys);
|
|
2376
|
+
const exits = record.paths.filter(
|
|
2377
|
+
(p) => p && p.d && p.key != null && !newKeySet.has(p.key)
|
|
2378
|
+
);
|
|
2379
|
+
if (!exits.length) return;
|
|
2380
|
+
const graphics = new Graphics(w);
|
|
2381
|
+
const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
|
|
2382
|
+
exits.forEach((p) => {
|
|
2383
|
+
let fill = p.fill || fallbackFill || "#c8c8c8";
|
|
2384
|
+
if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
|
|
2385
|
+
const ghost = graphics.drawPath({
|
|
2386
|
+
d: p.d,
|
|
2387
|
+
stroke: "none",
|
|
2388
|
+
strokeWidth: 0,
|
|
2389
|
+
fill,
|
|
2390
|
+
fillOpacity: 1,
|
|
2391
|
+
classes: "apexcharts-bar-ghost"
|
|
2392
|
+
});
|
|
2393
|
+
const node = ghost.node;
|
|
2394
|
+
node.setAttribute("pointer-events", "none");
|
|
2395
|
+
ghost.attr(
|
|
2396
|
+
"clip-path",
|
|
2397
|
+
`url(#gridRectBarMask${w.globals.cuid})`
|
|
2398
|
+
);
|
|
2399
|
+
elSeries.node.insertBefore(node, elSeries.node.firstChild);
|
|
2400
|
+
const start = firstMove(p.d);
|
|
2401
|
+
let origin = isHorizontal ? "left center" : "center bottom";
|
|
2402
|
+
try {
|
|
2403
|
+
const bb = node.getBBox();
|
|
2404
|
+
if (start && bb) {
|
|
2405
|
+
if (isHorizontal) {
|
|
2406
|
+
origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
|
|
2407
|
+
} else {
|
|
2408
|
+
origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
} catch (_) {
|
|
2412
|
+
}
|
|
2413
|
+
const style = node.style;
|
|
2414
|
+
style.transformBox = "fill-box";
|
|
2415
|
+
style.transformOrigin = origin;
|
|
2416
|
+
node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
|
|
2417
|
+
try {
|
|
2418
|
+
const bb = node.getBBox();
|
|
2419
|
+
const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
|
|
2420
|
+
if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
|
|
2421
|
+
} catch (_) {
|
|
2422
|
+
}
|
|
2423
|
+
const duration = Math.max(1, speed || 1);
|
|
2424
|
+
const startAt = performance.now();
|
|
2425
|
+
const step = (now) => {
|
|
2426
|
+
if (w.globals.isDestroyed || !node.parentNode) return;
|
|
2427
|
+
const t = Math.max(0, Math.min(1, (now - startAt) / duration));
|
|
2428
|
+
const eased = 1 - Math.pow(1 - t, 3);
|
|
2429
|
+
const scale = 1 - eased;
|
|
2430
|
+
style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
|
|
2431
|
+
style.opacity = String(1 - eased);
|
|
2432
|
+
if (t < 1) {
|
|
2433
|
+
BrowserAPIs.requestAnimationFrame(step);
|
|
2434
|
+
} else {
|
|
2435
|
+
node.parentNode.removeChild(node);
|
|
2436
|
+
}
|
|
2437
|
+
};
|
|
2438
|
+
BrowserAPIs.requestAnimationFrame(step);
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2428
2441
|
class AxisMapping {
|
|
2429
2442
|
/**
|
|
2430
2443
|
* Pixels per data-unit on the x-axis. Derived from `minX..maxX` so it is the
|
|
@@ -2543,15 +2556,17 @@ class Bar {
|
|
|
2543
2556
|
/**
|
|
2544
2557
|
* Point the per-series axis state at this series' y axis. Every bar-family
|
|
2545
2558
|
* renderer calls it before initialPositions, which reads the baseline by
|
|
2546
|
-
* this.translationsIndex.
|
|
2559
|
+
* this.translationsIndex and flips it for a reversed axis.
|
|
2547
2560
|
* @param {number} realIndex
|
|
2548
2561
|
* @return {number} translationsIndex
|
|
2549
2562
|
*/
|
|
2550
2563
|
setSeriesAxis(realIndex) {
|
|
2564
|
+
var _a;
|
|
2551
2565
|
if (this.yRatio.length > 1) {
|
|
2552
2566
|
this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
|
|
2553
2567
|
this.translationsIndex = realIndex;
|
|
2554
2568
|
}
|
|
2569
|
+
this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
|
|
2555
2570
|
return this.translationsIndex;
|
|
2556
2571
|
}
|
|
2557
2572
|
/** primary draw method which is called on bar object
|
|
@@ -2568,7 +2583,7 @@ class Bar {
|
|
|
2568
2583
|
series = coreUtils.getLogSeries(series);
|
|
2569
2584
|
this.series = series;
|
|
2570
2585
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
2571
|
-
this.barHelpers.initVariables(series);
|
|
2586
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
2572
2587
|
const ret = graphics.group({
|
|
2573
2588
|
class: "apexcharts-bar-series apexcharts-plot-series"
|
|
2574
2589
|
});
|
|
@@ -2600,7 +2615,6 @@ class Bar {
|
|
|
2600
2615
|
this.visibleI = this.visibleI + 1;
|
|
2601
2616
|
}
|
|
2602
2617
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
2603
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
2604
2618
|
if (this.isPyramid) {
|
|
2605
2619
|
this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
|
|
2606
2620
|
}
|
|
@@ -2678,7 +2692,9 @@ class Bar {
|
|
|
2678
2692
|
elSeries
|
|
2679
2693
|
};
|
|
2680
2694
|
if (this.isHorizontal) {
|
|
2681
|
-
paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
|
|
2695
|
+
paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
|
|
2696
|
+
y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
2697
|
+
}), {
|
|
2682
2698
|
barHeight,
|
|
2683
2699
|
zeroW,
|
|
2684
2700
|
yDivision
|
|
@@ -2760,6 +2776,7 @@ class Bar {
|
|
|
2760
2776
|
series,
|
|
2761
2777
|
barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
|
|
2762
2778
|
barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
|
|
2779
|
+
barXPosition: paths.barXPosition,
|
|
2763
2780
|
elDataLabelsWrap,
|
|
2764
2781
|
elGoalsMarkers,
|
|
2765
2782
|
elBarShadows,
|
|
@@ -2770,15 +2787,11 @@ class Bar {
|
|
|
2770
2787
|
w.globals.seriesXvalues[realIndex] = xArrj;
|
|
2771
2788
|
w.globals.seriesYvalues[realIndex] = yArrj;
|
|
2772
2789
|
if (w.globals.previousPaths.length > 0) {
|
|
2773
|
-
const newKeys = [];
|
|
2774
|
-
for (let j = 0; j < series[i].length; j++) {
|
|
2775
|
-
newKeys.push(datumKey(w, realIndex, j));
|
|
2776
|
-
}
|
|
2777
2790
|
renderBarExitGhosts({
|
|
2778
2791
|
w,
|
|
2779
2792
|
elSeries,
|
|
2780
2793
|
record: this._prevRecord(realIndex),
|
|
2781
|
-
newKeys,
|
|
2794
|
+
newKeys: this._keys(realIndex),
|
|
2782
2795
|
isHorizontal: this.isHorizontal,
|
|
2783
2796
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
2784
2797
|
});
|
|
@@ -2787,7 +2800,7 @@ class Bar {
|
|
|
2787
2800
|
}
|
|
2788
2801
|
return ret;
|
|
2789
2802
|
}
|
|
2790
|
-
/** @param {{ hl?: any, realIndex?: any, pathFill?: any, lineFill?: any, j?: any, i?: any, columnGroupIndex?: any, pathFrom?: any, pathTo?: any, strokeWidth?: any, elSeries?: any, x?: any, y?: any, y1?: any, y2?: any, series?: any, barHeight?: any, barWidth?: any, barXPosition?: any, barYPosition?: any, elDataLabelsWrap?: any, elGoalsMarkers?: any, elBarShadows?: any, visibleSeries?: any, type?: any, classes?: any, fadeReveal?: boolean }} opts */
|
|
2803
|
+
/** @param {{ hl?: any, realIndex?: any, pathFill?: any, lineFill?: any, j?: any, i?: any, columnGroupIndex?: any, pathFrom?: any, pathTo?: any, strokeWidth?: any, elSeries?: any, x?: any, y?: any, y1?: any, y2?: any, series?: any, barHeight?: any, barWidth?: any, barXPosition?: any, barYPosition?: any, elDataLabelsWrap?: any, elGoalsMarkers?: any, elBarShadows?: any, visibleSeries?: any, type?: any, classes?: any, fadeReveal?: boolean, noLabel?: boolean }} opts */
|
|
2791
2804
|
renderSeries({
|
|
2792
2805
|
hl,
|
|
2793
2806
|
realIndex,
|
|
@@ -2819,7 +2832,9 @@ class Bar {
|
|
|
2819
2832
|
visibleSeries,
|
|
2820
2833
|
type,
|
|
2821
2834
|
classes,
|
|
2822
|
-
fadeReveal = false
|
|
2835
|
+
fadeReveal = false,
|
|
2836
|
+
noLabel
|
|
2837
|
+
// a datum's extra paths (box halves, box lane) label nothing
|
|
2823
2838
|
}) {
|
|
2824
2839
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2825
2840
|
const w = this.w;
|
|
@@ -2893,7 +2908,8 @@ class Bar {
|
|
|
2893
2908
|
barXPosition,
|
|
2894
2909
|
barYPosition,
|
|
2895
2910
|
visibleSeries,
|
|
2896
|
-
hl: hl == null ? void 0 : hl.label
|
|
2911
|
+
hl: hl == null ? void 0 : hl.label,
|
|
2912
|
+
noLabel
|
|
2897
2913
|
})
|
|
2898
2914
|
);
|
|
2899
2915
|
if (delayMs > 0) {
|
|
@@ -2909,19 +2925,18 @@ class Bar {
|
|
|
2909
2925
|
}
|
|
2910
2926
|
let leaving = false;
|
|
2911
2927
|
if (!w.globals.isBarHorizontal) {
|
|
2912
|
-
|
|
2928
|
+
const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
|
|
2929
|
+
const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
|
|
2930
|
+
if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
|
|
2913
2931
|
if (this._wasOnScreen(realIndex, j)) leaving = true;
|
|
2914
2932
|
else skipDrawing = true;
|
|
2915
2933
|
}
|
|
2916
2934
|
}
|
|
2917
|
-
|
|
2918
|
-
/** @type {
|
|
2919
|
-
w.config.series[
|
|
2920
|
-
|
|
2921
|
-
)
|
|
2922
|
-
lineFill = /** @type {Record<string,any>} */
|
|
2923
|
-
w.config.series[i].data[j].strokeColor;
|
|
2924
|
-
}
|
|
2935
|
+
const datum = (
|
|
2936
|
+
/** @type {any} */
|
|
2937
|
+
w.config.series[realIndex].data[j]
|
|
2938
|
+
);
|
|
2939
|
+
if (datum && datum.strokeColor) lineFill = datum.strokeColor;
|
|
2925
2940
|
const fill = pathFill;
|
|
2926
2941
|
if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
|
|
2927
2942
|
pathFill = "none";
|
|
@@ -2944,7 +2959,7 @@ class Bar {
|
|
|
2944
2959
|
pathTo,
|
|
2945
2960
|
stroke: lineFill,
|
|
2946
2961
|
strokeWidth,
|
|
2947
|
-
|
|
2962
|
+
strokeLinecap: w.config.stroke.lineCap,
|
|
2948
2963
|
fill: pathFill,
|
|
2949
2964
|
pathToInterp,
|
|
2950
2965
|
animationDelay: delay,
|
|
@@ -2996,12 +3011,12 @@ class Bar {
|
|
|
2996
3011
|
cy: dataLabelsObj.dataLabelsPos.bcy,
|
|
2997
3012
|
cx: dataLabelsObj.dataLabelsPos.bcx,
|
|
2998
3013
|
j,
|
|
2999
|
-
val: w.seriesData.series[
|
|
3014
|
+
val: w.seriesData.series[realIndex][j],
|
|
3000
3015
|
barHeight,
|
|
3001
3016
|
barWidth,
|
|
3002
3017
|
// Datum identity for the next update's keyed join (see
|
|
3003
3018
|
// LengthTransition): survivors match by key, not array position.
|
|
3004
|
-
"data:pathKey":
|
|
3019
|
+
"data:pathKey": this._keys(realIndex)[j]
|
|
3005
3020
|
});
|
|
3006
3021
|
hl == null ? void 0 : hl.paint(renderedPath, {
|
|
3007
3022
|
delay,
|
|
@@ -3077,7 +3092,10 @@ class Bar {
|
|
|
3077
3092
|
const j = indexes.j;
|
|
3078
3093
|
let barYPosition;
|
|
3079
3094
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
3080
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
3095
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
3096
|
+
i: indexes.realIndex,
|
|
3097
|
+
j
|
|
3098
|
+
});
|
|
3081
3099
|
if (nonZeroColumns > 0) {
|
|
3082
3100
|
barHeight = this.seriesLen * barHeight / nonZeroColumns;
|
|
3083
3101
|
}
|
|
@@ -3216,7 +3234,7 @@ class Bar {
|
|
|
3216
3234
|
barXPosition = xForNumericX.barXPosition;
|
|
3217
3235
|
} else {
|
|
3218
3236
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
3219
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
|
|
3237
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
|
|
3220
3238
|
if (nonZeroColumns > 0) {
|
|
3221
3239
|
barWidth = this.seriesLen * barWidth / nonZeroColumns;
|
|
3222
3240
|
}
|
|
@@ -3280,15 +3298,16 @@ class Bar {
|
|
|
3280
3298
|
/** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
|
|
3281
3299
|
getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
|
|
3282
3300
|
const w = this.w;
|
|
3301
|
+
const overlay = isHistogramOverlay(w);
|
|
3283
3302
|
let sxI = realIndex;
|
|
3284
3303
|
if (!w.seriesData.seriesX[realIndex].length) {
|
|
3285
3304
|
sxI = w.globals.maxValsInArrayIndex;
|
|
3286
3305
|
}
|
|
3287
3306
|
if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
|
|
3288
|
-
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
|
|
3307
|
+
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
|
|
3289
3308
|
}
|
|
3290
3309
|
return {
|
|
3291
|
-
barXPosition: x + (
|
|
3310
|
+
barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
|
|
3292
3311
|
x
|
|
3293
3312
|
};
|
|
3294
3313
|
}
|
|
@@ -3309,7 +3328,20 @@ class Bar {
|
|
|
3309
3328
|
_wasOnScreen(realIndex, j) {
|
|
3310
3329
|
if (!lengthTransitionEnabled(this.w)) return false;
|
|
3311
3330
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3312
|
-
return !!keyed && keyed.has(
|
|
3331
|
+
return !!keyed && keyed.has(this._keys(realIndex)[j]);
|
|
3332
|
+
}
|
|
3333
|
+
/**
|
|
3334
|
+
* This render's datum keys for a series (see seriesKeys), as stamped on
|
|
3335
|
+
* each bar and looked up in the previous render's.
|
|
3336
|
+
* @param {number} realIndex
|
|
3337
|
+
* @returns {string[]}
|
|
3338
|
+
*/
|
|
3339
|
+
_keys(realIndex) {
|
|
3340
|
+
const c = (
|
|
3341
|
+
/** @type {any} */
|
|
3342
|
+
this._keyCache || (this._keyCache = {})
|
|
3343
|
+
);
|
|
3344
|
+
return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
|
|
3313
3345
|
}
|
|
3314
3346
|
/**
|
|
3315
3347
|
* The captured previous-render record for a series (last match wins, same
|
|
@@ -3365,7 +3397,7 @@ class Bar {
|
|
|
3365
3397
|
* @returns {boolean}
|
|
3366
3398
|
*/
|
|
3367
3399
|
isLengthTransition(realIndex) {
|
|
3368
|
-
var _a, _b;
|
|
3400
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3369
3401
|
if (!this._ltCache) this._ltCache = {};
|
|
3370
3402
|
if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
|
|
3371
3403
|
const w = this.w;
|
|
@@ -3373,20 +3405,14 @@ class Bar {
|
|
|
3373
3405
|
if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
|
|
3374
3406
|
const record = this._prevRecord(realIndex);
|
|
3375
3407
|
const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
3408
|
+
const keyed = record && this._prevKeyedPaths(realIndex);
|
|
3376
3409
|
if (!record) {
|
|
3377
3410
|
result = dataLen > 0;
|
|
3378
|
-
} else if (
|
|
3379
|
-
|
|
3411
|
+
} else if (keyed) {
|
|
3412
|
+
const now = new Set(this._keys(realIndex));
|
|
3413
|
+
result = ((_f = (_e = (_d = (_c = w.globals.prevStreamFrame) == null ? void 0 : _c.seriesY) == null ? void 0 : _d[realIndex]) == null ? void 0 : _e.length) != null ? _f : dataLen) !== dataLen || [...keyed.keys()].some((k) => !now.has(k));
|
|
3380
3414
|
} else {
|
|
3381
|
-
|
|
3382
|
-
if (keyed) {
|
|
3383
|
-
for (let j = 0; j < dataLen; j++) {
|
|
3384
|
-
if (!keyed.has(datumKey(w, realIndex, j))) {
|
|
3385
|
-
result = true;
|
|
3386
|
-
break;
|
|
3387
|
-
}
|
|
3388
|
-
}
|
|
3389
|
-
}
|
|
3415
|
+
result = record.paths.length !== dataLen;
|
|
3390
3416
|
}
|
|
3391
3417
|
}
|
|
3392
3418
|
this._ltCache[realIndex] = result;
|
|
@@ -3446,7 +3472,7 @@ class Bar {
|
|
|
3446
3472
|
let isNewDatum = false;
|
|
3447
3473
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3448
3474
|
if (keyed) {
|
|
3449
|
-
const prev = keyed.get(
|
|
3475
|
+
const prev = keyed.get(this._keys(realIndex)[j]);
|
|
3450
3476
|
if (prev) {
|
|
3451
3477
|
oldD = prev.d;
|
|
3452
3478
|
} else {
|
|
@@ -3589,11 +3615,10 @@ class Bar {
|
|
|
3589
3615
|
* @returns {boolean | null} null when there is no previous record to consult
|
|
3590
3616
|
*/
|
|
3591
3617
|
getPreviousFlip(realIndex, j) {
|
|
3592
|
-
const w = this.w;
|
|
3593
3618
|
const record = this._prevRecord(realIndex);
|
|
3594
3619
|
if (!record) return null;
|
|
3595
3620
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3596
|
-
const prev = keyed ? keyed.get(
|
|
3621
|
+
const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
|
|
3597
3622
|
return prev ? !!prev.flip : null;
|
|
3598
3623
|
}
|
|
3599
3624
|
/**
|
|
@@ -3620,7 +3645,7 @@ class BarStacked extends Bar {
|
|
|
3620
3645
|
const coreUtils = new CoreUtils(this.w);
|
|
3621
3646
|
series = coreUtils.getLogSeries(series);
|
|
3622
3647
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
3623
|
-
this.barHelpers.initVariables(series);
|
|
3648
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
3624
3649
|
if (w.config.chart.stackType === "100%") {
|
|
3625
3650
|
series = w.globals.comboCharts ? (
|
|
3626
3651
|
/** @type {any} */
|
|
@@ -3651,7 +3676,6 @@ class BarStacked extends Bar {
|
|
|
3651
3676
|
const xArrValues = [];
|
|
3652
3677
|
const yArrValues = [];
|
|
3653
3678
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
3654
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
3655
3679
|
let elSeries = this.graphics.group({
|
|
3656
3680
|
class: `apexcharts-series`,
|
|
3657
3681
|
seriesName: Utils.escapeString(w.seriesData.seriesNames[realIndex]),
|
|
@@ -3721,7 +3745,9 @@ class BarStacked extends Bar {
|
|
|
3721
3745
|
null
|
|
3722
3746
|
);
|
|
3723
3747
|
if (this.isHorizontal) {
|
|
3724
|
-
paths = this.drawStackedBarPaths(__spreadProps(__spreadValues({}, commonPathOpts), {
|
|
3748
|
+
paths = this.drawStackedBarPaths(__spreadProps(__spreadValues(__spreadValues({}, commonPathOpts), this.barHelpers.rows && {
|
|
3749
|
+
y: initPositions.y + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
3750
|
+
}), {
|
|
3725
3751
|
zeroW,
|
|
3726
3752
|
barHeight,
|
|
3727
3753
|
yDivision
|
|
@@ -3795,6 +3821,7 @@ class BarStacked extends Bar {
|
|
|
3795
3821
|
series,
|
|
3796
3822
|
barHeight,
|
|
3797
3823
|
barWidth,
|
|
3824
|
+
barXPosition: paths.barXPosition,
|
|
3798
3825
|
elDataLabelsWrap,
|
|
3799
3826
|
elGoalsMarkers,
|
|
3800
3827
|
type: "bar",
|
|
@@ -3812,7 +3839,7 @@ class BarStacked extends Bar {
|
|
|
3812
3839
|
this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal);
|
|
3813
3840
|
ret.add(elSeries);
|
|
3814
3841
|
}
|
|
3815
|
-
if (heldMirrors) this.settleHeldMirrors();
|
|
3842
|
+
if (heldMirrors) this.settleHeldMirrors(ret);
|
|
3816
3843
|
return ret;
|
|
3817
3844
|
}
|
|
3818
3845
|
/**
|
|
@@ -3833,15 +3860,21 @@ class BarStacked extends Bar {
|
|
|
3833
3860
|
* 'bottom' → 'top', where the endpoint really is rounded at the other end;
|
|
3834
3861
|
* everywhere else the mirror is an exact identity on the settled shape, so
|
|
3835
3862
|
* removing it changes nothing on screen.
|
|
3863
|
+
*
|
|
3864
|
+
* The marks are collected now, not when the timer fires: a query then also
|
|
3865
|
+
* stripped the mirrors a LATER update was still holding mid-tween.
|
|
3866
|
+
* @param {any} [ret] this draw's series group (default: the whole chart)
|
|
3836
3867
|
*/
|
|
3837
|
-
settleHeldMirrors() {
|
|
3868
|
+
settleHeldMirrors(ret) {
|
|
3838
3869
|
const w = this.w;
|
|
3839
3870
|
if (!Environment.isBrowser()) return;
|
|
3840
3871
|
const anim = w.config.chart.animations;
|
|
3841
3872
|
const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100;
|
|
3873
|
+
const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
|
|
3874
|
+
".apexcharts-flip-held"
|
|
3875
|
+
);
|
|
3842
3876
|
setTimeout(() => {
|
|
3843
|
-
|
|
3844
|
-
w.dom.baseEl.querySelectorAll(".apexcharts-flip-held").forEach((el) => {
|
|
3877
|
+
held.forEach((el) => {
|
|
3845
3878
|
el.classList.remove(
|
|
3846
3879
|
"apexcharts-flip-held",
|
|
3847
3880
|
"apexcharts-flip-y",
|
|
@@ -3917,7 +3950,7 @@ class BarStacked extends Bar {
|
|
|
3917
3950
|
yDivision,
|
|
3918
3951
|
elSeries
|
|
3919
3952
|
}) {
|
|
3920
|
-
var _a, _b
|
|
3953
|
+
var _a, _b;
|
|
3921
3954
|
const w = this.w;
|
|
3922
3955
|
const barYPosition = y + columnGroupIndex * barHeight;
|
|
3923
3956
|
let barXPosition;
|
|
@@ -3925,36 +3958,21 @@ class BarStacked extends Bar {
|
|
|
3925
3958
|
const j = indexes.j;
|
|
3926
3959
|
const realIndex = indexes.realIndex;
|
|
3927
3960
|
const translationsIndex = indexes.translationsIndex;
|
|
3928
|
-
|
|
3929
|
-
for (let k = 0; k < this.groupCtx.prevXF.length; k++) {
|
|
3930
|
-
prevBarW = prevBarW + this.groupCtx.prevXF[k][j];
|
|
3931
|
-
}
|
|
3932
|
-
const gsi = this.groupCtx.prevX.length;
|
|
3933
|
-
if (gsi > 0) {
|
|
3934
|
-
let bXP = zeroW;
|
|
3935
|
-
if (this.groupCtx.prevXVal[gsi - 1][j] < 0) {
|
|
3936
|
-
bXP = /** @type {any} */
|
|
3937
|
-
((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? this.groupCtx.prevX[gsi - 1][j] + prevBarW - (this.isReversed ? prevBarW : 0) * 2 : this.groupCtx.prevX[gsi - 1][j];
|
|
3938
|
-
} else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) {
|
|
3939
|
-
bXP = /** @type {any} */
|
|
3940
|
-
((_b = this.series[i]) == null ? void 0 : _b[j]) >= 0 ? this.groupCtx.prevX[gsi - 1][j] : this.groupCtx.prevX[gsi - 1][j] - prevBarW + (this.isReversed ? prevBarW : 0) * 2;
|
|
3941
|
-
}
|
|
3942
|
-
barXPosition = bXP;
|
|
3943
|
-
} else {
|
|
3944
|
-
barXPosition = zeroW;
|
|
3945
|
-
}
|
|
3946
|
-
if (
|
|
3961
|
+
const v = (
|
|
3947
3962
|
/** @type {any} */
|
|
3948
|
-
((
|
|
3949
|
-
)
|
|
3950
|
-
|
|
3963
|
+
(_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
|
|
3964
|
+
);
|
|
3965
|
+
const g = this.groupCtx;
|
|
3966
|
+
const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j;
|
|
3967
|
+
const top = g.tops.get(key);
|
|
3968
|
+
if (top) {
|
|
3969
|
+
const [prevX, prevVal, prevBarW] = top;
|
|
3970
|
+
const flip = (this.isReversed ? prevBarW : 0) * 2;
|
|
3971
|
+
barXPosition = prevVal < 0 ? v >= 0 ? prevX + prevBarW - flip : prevX : v >= 0 ? prevX : prevX - prevBarW + flip;
|
|
3951
3972
|
} else {
|
|
3952
|
-
|
|
3953
|
-
((_d = this.series[i]) == null ? void 0 : _d[j]) / this.invertedYRatio - (this.isReversed ? (
|
|
3954
|
-
/** @type {any} */
|
|
3955
|
-
((_e = this.series[i]) == null ? void 0 : _e[j]) / this.invertedYRatio
|
|
3956
|
-
) : 0) * 2;
|
|
3973
|
+
barXPosition = zeroW;
|
|
3957
3974
|
}
|
|
3975
|
+
x = barXPosition + v / this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
3958
3976
|
const paths = this.barHelpers.getBarpaths({
|
|
3959
3977
|
barYPosition,
|
|
3960
3978
|
barHeight,
|
|
@@ -3968,6 +3986,7 @@ class BarStacked extends Bar {
|
|
|
3968
3986
|
j,
|
|
3969
3987
|
w
|
|
3970
3988
|
});
|
|
3989
|
+
this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j);
|
|
3971
3990
|
this.barHelpers.barBackground({
|
|
3972
3991
|
j,
|
|
3973
3992
|
i,
|
|
@@ -4005,13 +4024,17 @@ class BarStacked extends Bar {
|
|
|
4005
4024
|
columnGroupIndex,
|
|
4006
4025
|
elSeries
|
|
4007
4026
|
}) {
|
|
4008
|
-
var _a, _b, _c
|
|
4027
|
+
var _a, _b, _c;
|
|
4009
4028
|
const w = this.w;
|
|
4010
4029
|
const i = indexes.i;
|
|
4011
4030
|
const j = indexes.j;
|
|
4012
4031
|
const bc = indexes.bc;
|
|
4013
4032
|
const realIndex = indexes.realIndex;
|
|
4014
4033
|
const translationsIndex = indexes.translationsIndex;
|
|
4034
|
+
const v = (
|
|
4035
|
+
/** @type {any} */
|
|
4036
|
+
(_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
|
|
4037
|
+
);
|
|
4015
4038
|
if (w.axisFlags.isXNumeric) {
|
|
4016
4039
|
let seriesVal = w.seriesData.seriesX[realIndex][j];
|
|
4017
4040
|
if (!seriesVal) seriesVal = 0;
|
|
@@ -4026,11 +4049,9 @@ class BarStacked extends Bar {
|
|
|
4026
4049
|
const [prevYValue, prevVal, prevBarH] = top;
|
|
4027
4050
|
let bYP;
|
|
4028
4051
|
if (prevVal < 0) {
|
|
4029
|
-
bYP =
|
|
4030
|
-
((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
|
|
4052
|
+
bYP = v >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
|
|
4031
4053
|
} else if (prevVal >= 0) {
|
|
4032
|
-
bYP =
|
|
4033
|
-
((_b = this.series[i]) == null ? void 0 : _b[j]) >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
|
|
4054
|
+
bYP = v >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
|
|
4034
4055
|
}
|
|
4035
4056
|
if (typeof bYP === "undefined") bYP = w.layout.gridHeight;
|
|
4036
4057
|
if (((_c = g.prevYF[0]) == null ? void 0 : _c.every((val) => val === 0)) && g.prevYF.slice(1).every(
|
|
@@ -4043,25 +4064,16 @@ class BarStacked extends Bar {
|
|
|
4043
4064
|
} else {
|
|
4044
4065
|
barYPosition = zeroH;
|
|
4045
4066
|
}
|
|
4046
|
-
|
|
4047
|
-
/** @type {any} */
|
|
4048
|
-
(_d = this.series[i]) == null ? void 0 : _d[j]
|
|
4049
|
-
) {
|
|
4050
|
-
y = barYPosition - /** @type {any} */
|
|
4051
|
-
((_e = this.series[i]) == null ? void 0 : _e[j]) / this.yRatio[translationsIndex] + (this.isReversed ? (
|
|
4052
|
-
/** @type {any} */
|
|
4053
|
-
((_f = this.series[i]) == null ? void 0 : _f[j]) / this.yRatio[translationsIndex]
|
|
4054
|
-
) : 0) * 2;
|
|
4055
|
-
} else {
|
|
4056
|
-
y = barYPosition;
|
|
4057
|
-
}
|
|
4067
|
+
y = barYPosition - v / this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
4058
4068
|
const paths = this.barHelpers.getColumnPaths({
|
|
4059
4069
|
barXPosition,
|
|
4060
4070
|
barWidth,
|
|
4061
4071
|
y1: barYPosition,
|
|
4062
4072
|
y2: y,
|
|
4063
4073
|
yRatio: this.yRatio[translationsIndex],
|
|
4064
|
-
|
|
4074
|
+
// the series' width even for an empty segment, so a hidden layer keeps
|
|
4075
|
+
// its place, but no inset at all when no stroke is drawn
|
|
4076
|
+
strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
|
|
4065
4077
|
isReversed: this.isReversed,
|
|
4066
4078
|
series: this.series,
|
|
4067
4079
|
realIndex: indexes.realIndex,
|
|
@@ -4069,17 +4081,7 @@ class BarStacked extends Bar {
|
|
|
4069
4081
|
j,
|
|
4070
4082
|
w
|
|
4071
4083
|
});
|
|
4072
|
-
|
|
4073
|
-
if (!isNaN(t)) {
|
|
4074
|
-
g.tops.set(key, [
|
|
4075
|
-
t,
|
|
4076
|
-
g.yArrjVal[j],
|
|
4077
|
-
(top ? top[2] : 0) + g.yArrjF[j],
|
|
4078
|
-
(top ? top[3] : 0) + (w.seriesData.series[realIndex][j] || 0),
|
|
4079
|
-
top ? Math.min(top[0], top[4]) : 1 / 0,
|
|
4080
|
-
top ? Math.max(top[0], top[5]) : -1 / 0
|
|
4081
|
-
]);
|
|
4082
|
-
}
|
|
4084
|
+
this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j);
|
|
4083
4085
|
this.barHelpers.barBackground({
|
|
4084
4086
|
bc,
|
|
4085
4087
|
j,
|
|
@@ -4098,13 +4100,32 @@ class BarStacked extends Bar {
|
|
|
4098
4100
|
zeroH,
|
|
4099
4101
|
realIndex,
|
|
4100
4102
|
j,
|
|
4101
|
-
|
|
4103
|
+
translationsIndex
|
|
4102
4104
|
),
|
|
4103
4105
|
barXPosition,
|
|
4104
4106
|
x: w.axisFlags.isXNumeric ? x : x + xDivision,
|
|
4105
4107
|
y
|
|
4106
4108
|
};
|
|
4107
4109
|
}
|
|
4110
|
+
/**
|
|
4111
|
+
* Record the segment just drawn as the top of its stack. Per key it holds
|
|
4112
|
+
* the top and value of the last segment drawn there, the summed lengths and
|
|
4113
|
+
* raw values of every segment so far (the total label's value), and the
|
|
4114
|
+
* extreme tops below that segment (the total label's position).
|
|
4115
|
+
* @param {any} key @param {any} top @param {number} t @param {any} val
|
|
4116
|
+
* @param {number} len @param {number} realIndex @param {number} j
|
|
4117
|
+
*/
|
|
4118
|
+
_setTop(key, top, t, val, len, realIndex, j) {
|
|
4119
|
+
if (isNaN(t)) return;
|
|
4120
|
+
this.groupCtx.tops.set(key, [
|
|
4121
|
+
t,
|
|
4122
|
+
val,
|
|
4123
|
+
(top ? top[2] : 0) + len,
|
|
4124
|
+
(top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
|
|
4125
|
+
top ? Math.min(top[0], top[4]) : 1 / 0,
|
|
4126
|
+
top ? Math.max(top[0], top[5]) : -1 / 0
|
|
4127
|
+
]);
|
|
4128
|
+
}
|
|
4108
4129
|
}
|
|
4109
4130
|
class RangeBar extends Bar {
|
|
4110
4131
|
/**
|
|
@@ -4112,14 +4133,14 @@ class RangeBar extends Bar {
|
|
|
4112
4133
|
* @param {number} seriesIndex
|
|
4113
4134
|
*/
|
|
4114
4135
|
draw(series, seriesIndex) {
|
|
4115
|
-
var _a, _b, _c, _d, _e, _f
|
|
4136
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4116
4137
|
const w = this.w;
|
|
4117
4138
|
const graphics = new Graphics(this.w);
|
|
4118
4139
|
this.rangeBarOptions = this.w.config.plotOptions.rangeBar;
|
|
4119
4140
|
this.series = series;
|
|
4120
4141
|
this.seriesRangeStart = w.rangeData.seriesRangeStart;
|
|
4121
4142
|
this.seriesRangeEnd = w.rangeData.seriesRangeEnd;
|
|
4122
|
-
this.barHelpers.initVariables(series);
|
|
4143
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
4123
4144
|
const ret = graphics.group({
|
|
4124
4145
|
class: "apexcharts-rangebar-series apexcharts-plot-series"
|
|
4125
4146
|
});
|
|
@@ -4141,6 +4162,9 @@ class RangeBar extends Bar {
|
|
|
4141
4162
|
this.visibleI = this.visibleI + 1;
|
|
4142
4163
|
}
|
|
4143
4164
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
4165
|
+
if (this.isHorizontal && w.labelData.timescaleLabels.length) {
|
|
4166
|
+
this.isReversed = false;
|
|
4167
|
+
}
|
|
4144
4168
|
const initPositions = this.barHelpers.initialPositions(realIndex);
|
|
4145
4169
|
const {
|
|
4146
4170
|
y: initY,
|
|
@@ -4150,10 +4174,8 @@ class RangeBar extends Bar {
|
|
|
4150
4174
|
zeroH
|
|
4151
4175
|
// zeroH is the baseline where 0 meets y axis
|
|
4152
4176
|
} = initPositions;
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
const yDivision = (_c = initPositions.yDivision) != null ? _c : 0;
|
|
4156
|
-
const xDivision = (_d = initPositions.xDivision) != null ? _d : 0;
|
|
4177
|
+
const yDivision = (_a = initPositions.yDivision) != null ? _a : 0;
|
|
4178
|
+
const xDivision = (_b = initPositions.xDivision) != null ? _b : 0;
|
|
4157
4179
|
y = initY;
|
|
4158
4180
|
x = initX;
|
|
4159
4181
|
const elDataLabelsWrap = graphics.group({
|
|
@@ -4163,10 +4185,16 @@ class RangeBar extends Bar {
|
|
|
4163
4185
|
const elGoalsMarkers = graphics.group({
|
|
4164
4186
|
class: "apexcharts-rangebar-goals-markers"
|
|
4165
4187
|
});
|
|
4188
|
+
const data = (
|
|
4189
|
+
/** @type {any} */
|
|
4190
|
+
w.config.series[realIndex].data
|
|
4191
|
+
);
|
|
4166
4192
|
for (let j = 0; j < w.globals.dataPoints; j++) {
|
|
4167
4193
|
const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex);
|
|
4168
|
-
|
|
4169
|
-
|
|
4194
|
+
let barWidth = (_c = initPositions.barWidth) != null ? _c : 0;
|
|
4195
|
+
let barHeight = (_d = initPositions.barHeight) != null ? _d : 0;
|
|
4196
|
+
const y1 = this.seriesRangeStart[realIndex][j];
|
|
4197
|
+
const y2 = this.seriesRangeEnd[realIndex][j];
|
|
4170
4198
|
let paths = (
|
|
4171
4199
|
/** @type {any} */
|
|
4172
4200
|
null
|
|
@@ -4178,20 +4206,16 @@ class RangeBar extends Bar {
|
|
|
4178
4206
|
if (w.config.plotOptions.bar.rangeBarGroupRows) {
|
|
4179
4207
|
seriesLen = 1;
|
|
4180
4208
|
}
|
|
4181
|
-
if (typeof
|
|
4182
|
-
((_e = w.config.series[i].data) == null ? void 0 : _e[j]) === "undefined") {
|
|
4209
|
+
if (typeof (data == null ? void 0 : data[j]) === "undefined") {
|
|
4183
4210
|
break;
|
|
4184
4211
|
}
|
|
4185
4212
|
if (this.isHorizontal) {
|
|
4186
4213
|
barYPosition = y + barHeight * /** @type {any} */
|
|
4187
4214
|
this.visibleI;
|
|
4188
4215
|
const srty = (yDivision - barHeight * seriesLen) / 2;
|
|
4189
|
-
if (
|
|
4190
|
-
/** @type {Record<string,any>} */
|
|
4191
|
-
(_g = (_f = w.config.series[i].data) == null ? void 0 : _f[j]) == null ? void 0 : _g.x
|
|
4192
|
-
) {
|
|
4216
|
+
if (((_e = data[j]) == null ? void 0 : _e.x) != null) {
|
|
4193
4217
|
const positions = this.detectOverlappingBars({
|
|
4194
|
-
i,
|
|
4218
|
+
i: realIndex,
|
|
4195
4219
|
j,
|
|
4196
4220
|
barYPosition,
|
|
4197
4221
|
srty,
|
|
@@ -4214,17 +4238,14 @@ class RangeBar extends Bar {
|
|
|
4214
4238
|
barWidth = paths.barWidth;
|
|
4215
4239
|
} else {
|
|
4216
4240
|
if (w.axisFlags.isXNumeric) {
|
|
4217
|
-
x = (w.seriesData.seriesX[
|
|
4241
|
+
x = (w.seriesData.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2;
|
|
4218
4242
|
}
|
|
4219
4243
|
barXPosition = x + barWidth * /** @type {any} */
|
|
4220
4244
|
this.visibleI;
|
|
4221
4245
|
const srtx = (xDivision - barWidth * seriesLen) / 2;
|
|
4222
|
-
if (
|
|
4223
|
-
/** @type {Record<string,any>} */
|
|
4224
|
-
(_i = (_h = w.config.series[i].data) == null ? void 0 : _h[j]) == null ? void 0 : _i.x
|
|
4225
|
-
) {
|
|
4246
|
+
if (((_f = data[j]) == null ? void 0 : _f.x) != null) {
|
|
4226
4247
|
const positions = this.detectOverlappingBars({
|
|
4227
|
-
i,
|
|
4248
|
+
i: realIndex,
|
|
4228
4249
|
j,
|
|
4229
4250
|
barXPosition,
|
|
4230
4251
|
srtx,
|
|
@@ -4243,9 +4264,10 @@ class RangeBar extends Bar {
|
|
|
4243
4264
|
xDivision
|
|
4244
4265
|
}, params));
|
|
4245
4266
|
barHeight = paths.barHeight;
|
|
4267
|
+
barXPosition = paths.barXPosition;
|
|
4246
4268
|
}
|
|
4247
4269
|
const barGoalLine = this.barHelpers.drawGoalLine({
|
|
4248
|
-
barXPosition
|
|
4270
|
+
barXPosition,
|
|
4249
4271
|
barYPosition,
|
|
4250
4272
|
goalX: paths.goalX,
|
|
4251
4273
|
goalY: paths.goalY,
|
|
@@ -4290,19 +4312,11 @@ class RangeBar extends Bar {
|
|
|
4290
4312
|
});
|
|
4291
4313
|
}
|
|
4292
4314
|
if (w.globals.previousPaths.length > 0) {
|
|
4293
|
-
const data = (
|
|
4294
|
-
/** @type {Record<string,any>} */
|
|
4295
|
-
w.config.series[i].data || []
|
|
4296
|
-
);
|
|
4297
|
-
const newKeys = [];
|
|
4298
|
-
for (let j = 0; j < data.length; j++) {
|
|
4299
|
-
newKeys.push(datumKey(w, realIndex, j));
|
|
4300
|
-
}
|
|
4301
4315
|
renderBarExitGhosts({
|
|
4302
4316
|
w,
|
|
4303
4317
|
elSeries,
|
|
4304
4318
|
record: this._prevRecord(realIndex),
|
|
4305
|
-
newKeys,
|
|
4319
|
+
newKeys: this._keys(realIndex),
|
|
4306
4320
|
isHorizontal: this.isHorizontal,
|
|
4307
4321
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
4308
4322
|
});
|
|
@@ -4354,11 +4368,11 @@ class RangeBar extends Bar {
|
|
|
4354
4368
|
);
|
|
4355
4369
|
if (overlaps.indexOf(rangeName) > -1) {
|
|
4356
4370
|
barHeight = initPositions.barHeight / overlaps.length;
|
|
4357
|
-
barYPosition
|
|
4371
|
+
barYPosition += barHeight * overlaps.indexOf(rangeName);
|
|
4358
4372
|
}
|
|
4359
4373
|
}
|
|
4360
4374
|
} else {
|
|
4361
|
-
if (rowIndex > -1 && !w.
|
|
4375
|
+
if (rowIndex > -1 && !w.axisFlags.isXNumeric) {
|
|
4362
4376
|
if (w.config.plotOptions.bar.rangeBarGroupRows) {
|
|
4363
4377
|
barXPosition = srtx + xDivision * rowIndex;
|
|
4364
4378
|
} else {
|
|
@@ -4372,7 +4386,7 @@ class RangeBar extends Bar {
|
|
|
4372
4386
|
);
|
|
4373
4387
|
if (overlaps.indexOf(rangeName) > -1) {
|
|
4374
4388
|
barWidth = initPositions.barWidth / overlaps.length;
|
|
4375
|
-
barXPosition
|
|
4389
|
+
barXPosition += barWidth * overlaps.indexOf(rangeName);
|
|
4376
4390
|
}
|
|
4377
4391
|
}
|
|
4378
4392
|
}
|
|
@@ -4395,7 +4409,7 @@ class RangeBar extends Bar {
|
|
|
4395
4409
|
var _a, _b;
|
|
4396
4410
|
const w = this.w;
|
|
4397
4411
|
const { i, j, realIndex, translationsIndex } = indexes;
|
|
4398
|
-
const yRatio = this.yRatio[translationsIndex];
|
|
4412
|
+
const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
4399
4413
|
const range = this.getRangeValue(realIndex, j);
|
|
4400
4414
|
let y1 = Math.min(range.start, range.end);
|
|
4401
4415
|
let y2 = Math.max(range.start, range.end);
|
|
@@ -4403,7 +4417,7 @@ class RangeBar extends Bar {
|
|
|
4403
4417
|
((_a = this.series[i]) == null ? void 0 : _a[j]) === "undefined" || /** @type {any} */
|
|
4404
4418
|
((_b = this.series[i]) == null ? void 0 : _b[j]) === null);
|
|
4405
4419
|
if (!hasValue) {
|
|
4406
|
-
y1 = zeroH;
|
|
4420
|
+
y1 = y2 = zeroH;
|
|
4407
4421
|
} else {
|
|
4408
4422
|
y1 = zeroH - y1 / yRatio;
|
|
4409
4423
|
y2 = zeroH - y2 / yRatio;
|
|
@@ -4464,6 +4478,30 @@ class RangeBar extends Bar {
|
|
|
4464
4478
|
barXPosition
|
|
4465
4479
|
};
|
|
4466
4480
|
}
|
|
4481
|
+
/**
|
|
4482
|
+
* Timeline datums key by their own row, not by the j-th label: a row can
|
|
4483
|
+
* hold several bars, so labels[j] names some other datum's row.
|
|
4484
|
+
* @param {number} realIndex
|
|
4485
|
+
* @returns {string[]}
|
|
4486
|
+
*/
|
|
4487
|
+
_keys(realIndex) {
|
|
4488
|
+
const c = (
|
|
4489
|
+
/** @type {any} */
|
|
4490
|
+
this._keyCache || (this._keyCache = {})
|
|
4491
|
+
);
|
|
4492
|
+
const data = (
|
|
4493
|
+
/** @type {any} */
|
|
4494
|
+
this.w.config.series[realIndex].data
|
|
4495
|
+
);
|
|
4496
|
+
return c[realIndex] || (c[realIndex] = uniquifyKeys(
|
|
4497
|
+
(data || []).map(
|
|
4498
|
+
(d, j) => {
|
|
4499
|
+
var _a;
|
|
4500
|
+
return "c:" + ((_a = d == null ? void 0 : d.x) != null ? _a : j);
|
|
4501
|
+
}
|
|
4502
|
+
)
|
|
4503
|
+
));
|
|
4504
|
+
}
|
|
4467
4505
|
/**
|
|
4468
4506
|
* @param {number} val
|
|
4469
4507
|
*/
|
|
@@ -4490,8 +4528,9 @@ class RangeBar extends Bar {
|
|
|
4490
4528
|
}) {
|
|
4491
4529
|
const w = this.w;
|
|
4492
4530
|
const { realIndex, j } = indexes;
|
|
4493
|
-
const
|
|
4494
|
-
const
|
|
4531
|
+
const ratio = this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
4532
|
+
const x1 = this.preventBarOverflow(zeroW + y1 / ratio);
|
|
4533
|
+
const x2 = this.preventBarOverflow(zeroW + y2 / ratio);
|
|
4495
4534
|
const range = this.getRangeValue(realIndex, j);
|
|
4496
4535
|
const barWidth = Math.abs(x2 - x1);
|
|
4497
4536
|
const paths = this.barHelpers.getBarpaths({
|