apexcharts 8.2.0 → 8.3.1
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 +19793 -19713
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +38 -8
- package/dist/apexcharts.esm.js +1882 -1625
- package/dist/apexcharts.full.js +22044 -21634
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +21414 -21124
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +21413 -21123
- 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 +478 -406
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +409 -334
- 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 +409 -334
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +478 -406
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +19793 -19713
- package/dist/donut.common.js +2 -2
- package/dist/donut.esm.js +3 -9
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +478 -406
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +442 -324
- package/dist/features/annotations.common.js +2 -2
- package/dist/features/annotations.esm.js +65 -48
- package/dist/features/annotations.js +2 -2
- 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 +2 -2
- package/dist/features/exports.esm.js +10 -4
- package/dist/features/exports.js +2 -2
- 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 +64 -44
- 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 +2 -2
- package/dist/features/morph.esm.js +9 -5
- package/dist/features/morph.js +2 -2
- package/dist/features/perspectives.common.js +2 -2
- package/dist/features/perspectives.esm.js +4 -1
- package/dist/features/perspectives.js +2 -2
- package/dist/features/raincloud.common.js +2 -2
- package/dist/features/raincloud.esm.js +26 -27
- package/dist/features/raincloud.js +2 -2
- 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 +2 -2
- package/dist/features/stats.esm.js +52 -59
- package/dist/features/stats.js +2 -2
- package/dist/features/storyboard.common.js +2 -2
- package/dist/features/storyboard.esm.js +4 -1
- package/dist/features/storyboard.js +2 -2
- package/dist/features/streamgraph.common.js +2 -2
- package/dist/features/streamgraph.esm.js +48 -14
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +148 -18
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +150 -63
- 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 +2 -2
- package/dist/features/weave.esm.js +13 -12
- package/dist/features/weave.js +2 -2
- package/dist/full.common.js +2 -2
- package/dist/full.esm.js +1068 -842
- 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 +529 -464
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +80 -46
- 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 +2 -2
- package/dist/pie.esm.js +3 -9
- package/dist/pie.js +2 -2
- package/dist/polarArea.common.js +2 -2
- package/dist/polarArea.esm.js +3 -9
- 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 +2 -2
- package/dist/radialBar.esm.js +5 -12
- package/dist/radialBar.js +2 -2
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +97 -52
- 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 +478 -406
- 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 +138 -53
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +116 -94
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +138 -104
- 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 +477 -405
- package/package.json +1 -1
- package/src/apexcharts.js +40 -59
- package/src/assets/apexcharts.css +38 -8
- 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 +68 -47
- package/src/charts/Line.js +118 -42
- package/src/charts/Pie.js +2 -8
- package/src/charts/Radar.js +5 -7
- package/src/charts/Radial.js +2 -6
- package/src/charts/RangeBar.js +47 -43
- package/src/charts/Sunburst.js +101 -98
- package/src/charts/Treemap.js +150 -88
- 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/Stats.js +30 -23
- 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 +29 -7
- package/src/charts/common/partition/Partition.js +33 -1
- package/src/charts/common/treemap/Helpers.js +3 -11
- package/src/charts/common/treemap/Nested.js +2 -3
- package/src/features/raincloud.js +16 -10
- package/src/features/stats.js +67 -62
- package/src/locales/en.json +2 -1
- package/src/locales/ro.json +3 -2
- package/src/modules/Animations.js +102 -95
- package/src/modules/AxisMapping.js +47 -12
- 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/Exports.js +12 -5
- package/src/modules/Fill.js +17 -8
- package/src/modules/Filters.js +50 -50
- package/src/modules/Graphics.js +69 -51
- package/src/modules/Markers.js +3 -1
- package/src/modules/MorphTypeChange.js +13 -7
- 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 +41 -19
- package/src/modules/Theme.js +1 -1
- package/src/modules/Toolbar.js +3 -2
- package/src/modules/UnitMarkRegistry.js +0 -5
- package/src/modules/ZoomPanSelection.js +123 -2
- package/src/modules/accessibility/KeyboardNavigation.js +114 -186
- package/src/modules/animations/Easing.js +2 -1
- package/src/modules/animations/LengthTransition.js +22 -2
- package/src/modules/annotations/Helpers.js +68 -52
- package/src/modules/axes/Grid.js +21 -7
- package/src/modules/axes/YAxis.js +8 -9
- package/src/modules/dimensions/Dimensions.js +9 -3
- package/src/modules/dimensions/Grid.js +2 -2
- package/src/modules/dimensions/XAxis.js +2 -5
- package/src/modules/drilldown/Breadcrumb.js +5 -2
- package/src/modules/helpers/Destroy.js +1 -1
- package/src/modules/helpers/UpdateHelpers.js +33 -15
- 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 +8 -1
- package/src/modules/legend/Legend.js +11 -12
- package/src/modules/license/LicenseEnforcer.js +5 -0
- package/src/modules/settings/Defaults.js +28 -56
- package/src/modules/settings/Globals.js +5 -0
- package/src/modules/settings/Options.js +7 -7
- package/src/modules/settings/TypeAliases.js +33 -16
- package/src/modules/streamgraph/StreamLabels.js +1 -0
- package/src/modules/tooltip/Labels.js +73 -76
- package/src/modules/tooltip/Marker.js +25 -21
- package/src/modules/tooltip/Position.js +88 -51
- package/src/modules/tooltip/Tooltip.js +242 -255
- package/src/modules/tooltip/Utils.js +71 -130
- package/src/modules/tooltip/constants.js +5 -5
- 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/modules/trellis/TrellisTooltip.js +2 -11
- package/src/modules/weave/WeaveHost.js +18 -12
- package/src/renderers/canvas/CanvasGraphics.js +1 -0
- package/src/ssr/DOMShim.js +10 -0
- package/src/svg/SVGFilter.js +26 -17
- package/src/types/internal.d.ts +9 -3
- package/src/utils/Utils.js +0 -14
- package/types/apexcharts.d.ts +33 -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.1
|
|
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
|
|
@@ -2455,22 +2468,55 @@ class AxisMapping {
|
|
|
2455
2468
|
return w.globals.minX + px * AxisMapping.xRatio(w);
|
|
2456
2469
|
}
|
|
2457
2470
|
/**
|
|
2458
|
-
*
|
|
2459
|
-
*
|
|
2460
|
-
*
|
|
2461
|
-
*
|
|
2462
|
-
*
|
|
2471
|
+
* The plot area on screen, in client px: its corner is where the plot's
|
|
2472
|
+
* group is translated to (translateX, translateY into the svg), and it is
|
|
2473
|
+
* gridWidth by gridHeight. The one screen-to-plot measurement: the tooltip,
|
|
2474
|
+
* zoom, selection and every other pointer reader map through it, so x and y
|
|
2475
|
+
* cannot disagree under CSS zoom.
|
|
2476
|
+
*
|
|
2477
|
+
* Never the `.apexcharts-grid` group's box: a group measures to the union
|
|
2478
|
+
* of what it happens to draw (fact 2 above). The plot's outline starts a
|
|
2479
|
+
* pixel down (`Grid.drawGridArea`), so unless gridlines or row bands reach
|
|
2480
|
+
* the top edge the box starts a pixel below the plot, and on a numeric-x bar
|
|
2481
|
+
* chart the horizontal gridlines run `barPadForNumericAxis` out past both
|
|
2482
|
+
* sides.
|
|
2483
|
+
*
|
|
2484
|
+
* `zoom` is the CSS zoom of any container the chart sits in (screen px per
|
|
2485
|
+
* plot px): the measured svg width over `svgWidth`, the unscaled width it
|
|
2486
|
+
* was drawn at. A distance measured on screen from this corner is divided
|
|
2487
|
+
* by it to land in plot px, the space the series are laid out and painted in.
|
|
2488
|
+
* With nothing mounted to measure, screen px are taken as svg px.
|
|
2489
|
+
*
|
|
2490
|
+
* @param {import('../types/internal').ChartStateW} w
|
|
2491
|
+
* @returns {{ left: number, top: number, width: number, height: number, zoom: number }}
|
|
2492
|
+
*/
|
|
2493
|
+
static plotRect(w) {
|
|
2494
|
+
var _a, _b, _c;
|
|
2495
|
+
const svg = ((_a = w.dom.Paper) == null ? void 0 : _a.node) || ((_b = w.dom.baseEl) == null ? void 0 : _b.querySelector(".apexcharts-svg"));
|
|
2496
|
+
const box = ((_c = svg || w.dom.elWrap) == null ? void 0 : _c.getBoundingClientRect()) || {
|
|
2497
|
+
left: 0,
|
|
2498
|
+
top: 0,
|
|
2499
|
+
width: 0
|
|
2500
|
+
};
|
|
2501
|
+
const zoom = (svg && w.globals.svgWidth ? box.width / w.globals.svgWidth : 1) || 1;
|
|
2502
|
+
return {
|
|
2503
|
+
left: box.left + w.layout.translateX * zoom,
|
|
2504
|
+
top: box.top + w.layout.translateY * zoom,
|
|
2505
|
+
width: w.layout.gridWidth * zoom,
|
|
2506
|
+
height: w.layout.gridHeight * zoom,
|
|
2507
|
+
zoom
|
|
2508
|
+
};
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Client (screen) x -> pixels from the plot origin of {@link plotRect}.
|
|
2512
|
+
* Pass the rect when the caller has already measured it.
|
|
2463
2513
|
* @param {import('../types/internal').ChartStateW} w
|
|
2464
2514
|
* @param {number} screenX
|
|
2515
|
+
* @param {{ left: number, zoom: number }} [plot]
|
|
2465
2516
|
* @returns {number}
|
|
2466
2517
|
*/
|
|
2467
|
-
static screenXToPlotPx(w, screenX) {
|
|
2468
|
-
|
|
2469
|
-
const svg = baseEl && baseEl.querySelector(".apexcharts-svg");
|
|
2470
|
-
if (!svg) return screenX - w.layout.translateX;
|
|
2471
|
-
const svgRect = svg.getBoundingClientRect();
|
|
2472
|
-
const zoom = w.globals.svgWidth ? svgRect.width / w.globals.svgWidth : 1;
|
|
2473
|
-
return (screenX - svgRect.left) / (zoom || 1) - w.layout.translateX;
|
|
2518
|
+
static screenXToPlotPx(w, screenX, plot = AxisMapping.plotRect(w)) {
|
|
2519
|
+
return (screenX - plot.left) / plot.zoom;
|
|
2474
2520
|
}
|
|
2475
2521
|
}
|
|
2476
2522
|
function seriesEmitter(ctx, graphics) {
|
|
@@ -2543,15 +2589,17 @@ class Bar {
|
|
|
2543
2589
|
/**
|
|
2544
2590
|
* Point the per-series axis state at this series' y axis. Every bar-family
|
|
2545
2591
|
* renderer calls it before initialPositions, which reads the baseline by
|
|
2546
|
-
* this.translationsIndex.
|
|
2592
|
+
* this.translationsIndex and flips it for a reversed axis.
|
|
2547
2593
|
* @param {number} realIndex
|
|
2548
2594
|
* @return {number} translationsIndex
|
|
2549
2595
|
*/
|
|
2550
2596
|
setSeriesAxis(realIndex) {
|
|
2597
|
+
var _a;
|
|
2551
2598
|
if (this.yRatio.length > 1) {
|
|
2552
2599
|
this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
|
|
2553
2600
|
this.translationsIndex = realIndex;
|
|
2554
2601
|
}
|
|
2602
|
+
this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
|
|
2555
2603
|
return this.translationsIndex;
|
|
2556
2604
|
}
|
|
2557
2605
|
/** primary draw method which is called on bar object
|
|
@@ -2568,7 +2616,7 @@ class Bar {
|
|
|
2568
2616
|
series = coreUtils.getLogSeries(series);
|
|
2569
2617
|
this.series = series;
|
|
2570
2618
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
2571
|
-
this.barHelpers.initVariables(series);
|
|
2619
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
2572
2620
|
const ret = graphics.group({
|
|
2573
2621
|
class: "apexcharts-bar-series apexcharts-plot-series"
|
|
2574
2622
|
});
|
|
@@ -2600,7 +2648,6 @@ class Bar {
|
|
|
2600
2648
|
this.visibleI = this.visibleI + 1;
|
|
2601
2649
|
}
|
|
2602
2650
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
2603
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
2604
2651
|
if (this.isPyramid) {
|
|
2605
2652
|
this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
|
|
2606
2653
|
}
|
|
@@ -2678,7 +2725,9 @@ class Bar {
|
|
|
2678
2725
|
elSeries
|
|
2679
2726
|
};
|
|
2680
2727
|
if (this.isHorizontal) {
|
|
2681
|
-
paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
|
|
2728
|
+
paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
|
|
2729
|
+
y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
2730
|
+
}), {
|
|
2682
2731
|
barHeight,
|
|
2683
2732
|
zeroW,
|
|
2684
2733
|
yDivision
|
|
@@ -2760,6 +2809,7 @@ class Bar {
|
|
|
2760
2809
|
series,
|
|
2761
2810
|
barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
|
|
2762
2811
|
barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
|
|
2812
|
+
barXPosition: paths.barXPosition,
|
|
2763
2813
|
elDataLabelsWrap,
|
|
2764
2814
|
elGoalsMarkers,
|
|
2765
2815
|
elBarShadows,
|
|
@@ -2770,15 +2820,11 @@ class Bar {
|
|
|
2770
2820
|
w.globals.seriesXvalues[realIndex] = xArrj;
|
|
2771
2821
|
w.globals.seriesYvalues[realIndex] = yArrj;
|
|
2772
2822
|
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
2823
|
renderBarExitGhosts({
|
|
2778
2824
|
w,
|
|
2779
2825
|
elSeries,
|
|
2780
2826
|
record: this._prevRecord(realIndex),
|
|
2781
|
-
newKeys,
|
|
2827
|
+
newKeys: this._keys(realIndex),
|
|
2782
2828
|
isHorizontal: this.isHorizontal,
|
|
2783
2829
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
2784
2830
|
});
|
|
@@ -2787,7 +2833,7 @@ class Bar {
|
|
|
2787
2833
|
}
|
|
2788
2834
|
return ret;
|
|
2789
2835
|
}
|
|
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 */
|
|
2836
|
+
/** @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
2837
|
renderSeries({
|
|
2792
2838
|
hl,
|
|
2793
2839
|
realIndex,
|
|
@@ -2819,7 +2865,9 @@ class Bar {
|
|
|
2819
2865
|
visibleSeries,
|
|
2820
2866
|
type,
|
|
2821
2867
|
classes,
|
|
2822
|
-
fadeReveal = false
|
|
2868
|
+
fadeReveal = false,
|
|
2869
|
+
noLabel
|
|
2870
|
+
// a datum's extra paths (box halves, box lane) label nothing
|
|
2823
2871
|
}) {
|
|
2824
2872
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2825
2873
|
const w = this.w;
|
|
@@ -2893,7 +2941,8 @@ class Bar {
|
|
|
2893
2941
|
barXPosition,
|
|
2894
2942
|
barYPosition,
|
|
2895
2943
|
visibleSeries,
|
|
2896
|
-
hl: hl == null ? void 0 : hl.label
|
|
2944
|
+
hl: hl == null ? void 0 : hl.label,
|
|
2945
|
+
noLabel
|
|
2897
2946
|
})
|
|
2898
2947
|
);
|
|
2899
2948
|
if (delayMs > 0) {
|
|
@@ -2909,19 +2958,18 @@ class Bar {
|
|
|
2909
2958
|
}
|
|
2910
2959
|
let leaving = false;
|
|
2911
2960
|
if (!w.globals.isBarHorizontal) {
|
|
2912
|
-
|
|
2961
|
+
const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
|
|
2962
|
+
const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
|
|
2963
|
+
if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
|
|
2913
2964
|
if (this._wasOnScreen(realIndex, j)) leaving = true;
|
|
2914
2965
|
else skipDrawing = true;
|
|
2915
2966
|
}
|
|
2916
2967
|
}
|
|
2917
|
-
|
|
2918
|
-
/** @type {
|
|
2919
|
-
w.config.series[
|
|
2920
|
-
|
|
2921
|
-
)
|
|
2922
|
-
lineFill = /** @type {Record<string,any>} */
|
|
2923
|
-
w.config.series[i].data[j].strokeColor;
|
|
2924
|
-
}
|
|
2968
|
+
const datum = (
|
|
2969
|
+
/** @type {any} */
|
|
2970
|
+
w.config.series[realIndex].data[j]
|
|
2971
|
+
);
|
|
2972
|
+
if (datum && datum.strokeColor) lineFill = datum.strokeColor;
|
|
2925
2973
|
const fill = pathFill;
|
|
2926
2974
|
if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
|
|
2927
2975
|
pathFill = "none";
|
|
@@ -2944,7 +2992,7 @@ class Bar {
|
|
|
2944
2992
|
pathTo,
|
|
2945
2993
|
stroke: lineFill,
|
|
2946
2994
|
strokeWidth,
|
|
2947
|
-
|
|
2995
|
+
strokeLinecap: w.config.stroke.lineCap,
|
|
2948
2996
|
fill: pathFill,
|
|
2949
2997
|
pathToInterp,
|
|
2950
2998
|
animationDelay: delay,
|
|
@@ -2996,12 +3044,12 @@ class Bar {
|
|
|
2996
3044
|
cy: dataLabelsObj.dataLabelsPos.bcy,
|
|
2997
3045
|
cx: dataLabelsObj.dataLabelsPos.bcx,
|
|
2998
3046
|
j,
|
|
2999
|
-
val: w.seriesData.series[
|
|
3047
|
+
val: w.seriesData.series[realIndex][j],
|
|
3000
3048
|
barHeight,
|
|
3001
3049
|
barWidth,
|
|
3002
3050
|
// Datum identity for the next update's keyed join (see
|
|
3003
3051
|
// LengthTransition): survivors match by key, not array position.
|
|
3004
|
-
"data:pathKey":
|
|
3052
|
+
"data:pathKey": this._keys(realIndex)[j]
|
|
3005
3053
|
});
|
|
3006
3054
|
hl == null ? void 0 : hl.paint(renderedPath, {
|
|
3007
3055
|
delay,
|
|
@@ -3077,7 +3125,10 @@ class Bar {
|
|
|
3077
3125
|
const j = indexes.j;
|
|
3078
3126
|
let barYPosition;
|
|
3079
3127
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
3080
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
3128
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
3129
|
+
i: indexes.realIndex,
|
|
3130
|
+
j
|
|
3131
|
+
});
|
|
3081
3132
|
if (nonZeroColumns > 0) {
|
|
3082
3133
|
barHeight = this.seriesLen * barHeight / nonZeroColumns;
|
|
3083
3134
|
}
|
|
@@ -3216,7 +3267,7 @@ class Bar {
|
|
|
3216
3267
|
barXPosition = xForNumericX.barXPosition;
|
|
3217
3268
|
} else {
|
|
3218
3269
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
3219
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
|
|
3270
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
|
|
3220
3271
|
if (nonZeroColumns > 0) {
|
|
3221
3272
|
barWidth = this.seriesLen * barWidth / nonZeroColumns;
|
|
3222
3273
|
}
|
|
@@ -3280,15 +3331,16 @@ class Bar {
|
|
|
3280
3331
|
/** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
|
|
3281
3332
|
getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
|
|
3282
3333
|
const w = this.w;
|
|
3334
|
+
const overlay = isHistogramOverlay(w);
|
|
3283
3335
|
let sxI = realIndex;
|
|
3284
3336
|
if (!w.seriesData.seriesX[realIndex].length) {
|
|
3285
3337
|
sxI = w.globals.maxValsInArrayIndex;
|
|
3286
3338
|
}
|
|
3287
3339
|
if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
|
|
3288
|
-
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
|
|
3340
|
+
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
|
|
3289
3341
|
}
|
|
3290
3342
|
return {
|
|
3291
|
-
barXPosition: x + (
|
|
3343
|
+
barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
|
|
3292
3344
|
x
|
|
3293
3345
|
};
|
|
3294
3346
|
}
|
|
@@ -3309,7 +3361,20 @@ class Bar {
|
|
|
3309
3361
|
_wasOnScreen(realIndex, j) {
|
|
3310
3362
|
if (!lengthTransitionEnabled(this.w)) return false;
|
|
3311
3363
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3312
|
-
return !!keyed && keyed.has(
|
|
3364
|
+
return !!keyed && keyed.has(this._keys(realIndex)[j]);
|
|
3365
|
+
}
|
|
3366
|
+
/**
|
|
3367
|
+
* This render's datum keys for a series (see seriesKeys), as stamped on
|
|
3368
|
+
* each bar and looked up in the previous render's.
|
|
3369
|
+
* @param {number} realIndex
|
|
3370
|
+
* @returns {string[]}
|
|
3371
|
+
*/
|
|
3372
|
+
_keys(realIndex) {
|
|
3373
|
+
const c = (
|
|
3374
|
+
/** @type {any} */
|
|
3375
|
+
this._keyCache || (this._keyCache = {})
|
|
3376
|
+
);
|
|
3377
|
+
return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
|
|
3313
3378
|
}
|
|
3314
3379
|
/**
|
|
3315
3380
|
* The captured previous-render record for a series (last match wins, same
|
|
@@ -3365,7 +3430,7 @@ class Bar {
|
|
|
3365
3430
|
* @returns {boolean}
|
|
3366
3431
|
*/
|
|
3367
3432
|
isLengthTransition(realIndex) {
|
|
3368
|
-
var _a, _b;
|
|
3433
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3369
3434
|
if (!this._ltCache) this._ltCache = {};
|
|
3370
3435
|
if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
|
|
3371
3436
|
const w = this.w;
|
|
@@ -3373,20 +3438,14 @@ class Bar {
|
|
|
3373
3438
|
if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
|
|
3374
3439
|
const record = this._prevRecord(realIndex);
|
|
3375
3440
|
const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
3441
|
+
const keyed = record && this._prevKeyedPaths(realIndex);
|
|
3376
3442
|
if (!record) {
|
|
3377
3443
|
result = dataLen > 0;
|
|
3378
|
-
} else if (
|
|
3379
|
-
|
|
3444
|
+
} else if (keyed) {
|
|
3445
|
+
const now = new Set(this._keys(realIndex));
|
|
3446
|
+
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
3447
|
} 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
|
-
}
|
|
3448
|
+
result = record.paths.length !== dataLen;
|
|
3390
3449
|
}
|
|
3391
3450
|
}
|
|
3392
3451
|
this._ltCache[realIndex] = result;
|
|
@@ -3446,7 +3505,7 @@ class Bar {
|
|
|
3446
3505
|
let isNewDatum = false;
|
|
3447
3506
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3448
3507
|
if (keyed) {
|
|
3449
|
-
const prev = keyed.get(
|
|
3508
|
+
const prev = keyed.get(this._keys(realIndex)[j]);
|
|
3450
3509
|
if (prev) {
|
|
3451
3510
|
oldD = prev.d;
|
|
3452
3511
|
} else {
|
|
@@ -3589,11 +3648,10 @@ class Bar {
|
|
|
3589
3648
|
* @returns {boolean | null} null when there is no previous record to consult
|
|
3590
3649
|
*/
|
|
3591
3650
|
getPreviousFlip(realIndex, j) {
|
|
3592
|
-
const w = this.w;
|
|
3593
3651
|
const record = this._prevRecord(realIndex);
|
|
3594
3652
|
if (!record) return null;
|
|
3595
3653
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3596
|
-
const prev = keyed ? keyed.get(
|
|
3654
|
+
const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
|
|
3597
3655
|
return prev ? !!prev.flip : null;
|
|
3598
3656
|
}
|
|
3599
3657
|
/**
|
|
@@ -3620,7 +3678,7 @@ class BarStacked extends Bar {
|
|
|
3620
3678
|
const coreUtils = new CoreUtils(this.w);
|
|
3621
3679
|
series = coreUtils.getLogSeries(series);
|
|
3622
3680
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
3623
|
-
this.barHelpers.initVariables(series);
|
|
3681
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
3624
3682
|
if (w.config.chart.stackType === "100%") {
|
|
3625
3683
|
series = w.globals.comboCharts ? (
|
|
3626
3684
|
/** @type {any} */
|
|
@@ -3651,7 +3709,6 @@ class BarStacked extends Bar {
|
|
|
3651
3709
|
const xArrValues = [];
|
|
3652
3710
|
const yArrValues = [];
|
|
3653
3711
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
3654
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
3655
3712
|
let elSeries = this.graphics.group({
|
|
3656
3713
|
class: `apexcharts-series`,
|
|
3657
3714
|
seriesName: Utils.escapeString(w.seriesData.seriesNames[realIndex]),
|
|
@@ -3721,7 +3778,9 @@ class BarStacked extends Bar {
|
|
|
3721
3778
|
null
|
|
3722
3779
|
);
|
|
3723
3780
|
if (this.isHorizontal) {
|
|
3724
|
-
paths = this.drawStackedBarPaths(__spreadProps(__spreadValues({}, commonPathOpts), {
|
|
3781
|
+
paths = this.drawStackedBarPaths(__spreadProps(__spreadValues(__spreadValues({}, commonPathOpts), this.barHelpers.rows && {
|
|
3782
|
+
y: initPositions.y + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
3783
|
+
}), {
|
|
3725
3784
|
zeroW,
|
|
3726
3785
|
barHeight,
|
|
3727
3786
|
yDivision
|
|
@@ -3795,6 +3854,7 @@ class BarStacked extends Bar {
|
|
|
3795
3854
|
series,
|
|
3796
3855
|
barHeight,
|
|
3797
3856
|
barWidth,
|
|
3857
|
+
barXPosition: paths.barXPosition,
|
|
3798
3858
|
elDataLabelsWrap,
|
|
3799
3859
|
elGoalsMarkers,
|
|
3800
3860
|
type: "bar",
|
|
@@ -3812,7 +3872,7 @@ class BarStacked extends Bar {
|
|
|
3812
3872
|
this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal);
|
|
3813
3873
|
ret.add(elSeries);
|
|
3814
3874
|
}
|
|
3815
|
-
if (heldMirrors) this.settleHeldMirrors();
|
|
3875
|
+
if (heldMirrors) this.settleHeldMirrors(ret);
|
|
3816
3876
|
return ret;
|
|
3817
3877
|
}
|
|
3818
3878
|
/**
|
|
@@ -3833,15 +3893,21 @@ class BarStacked extends Bar {
|
|
|
3833
3893
|
* 'bottom' → 'top', where the endpoint really is rounded at the other end;
|
|
3834
3894
|
* everywhere else the mirror is an exact identity on the settled shape, so
|
|
3835
3895
|
* removing it changes nothing on screen.
|
|
3896
|
+
*
|
|
3897
|
+
* The marks are collected now, not when the timer fires: a query then also
|
|
3898
|
+
* stripped the mirrors a LATER update was still holding mid-tween.
|
|
3899
|
+
* @param {any} [ret] this draw's series group (default: the whole chart)
|
|
3836
3900
|
*/
|
|
3837
|
-
settleHeldMirrors() {
|
|
3901
|
+
settleHeldMirrors(ret) {
|
|
3838
3902
|
const w = this.w;
|
|
3839
3903
|
if (!Environment.isBrowser()) return;
|
|
3840
3904
|
const anim = w.config.chart.animations;
|
|
3841
3905
|
const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100;
|
|
3906
|
+
const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
|
|
3907
|
+
".apexcharts-flip-held"
|
|
3908
|
+
);
|
|
3842
3909
|
setTimeout(() => {
|
|
3843
|
-
|
|
3844
|
-
w.dom.baseEl.querySelectorAll(".apexcharts-flip-held").forEach((el) => {
|
|
3910
|
+
held.forEach((el) => {
|
|
3845
3911
|
el.classList.remove(
|
|
3846
3912
|
"apexcharts-flip-held",
|
|
3847
3913
|
"apexcharts-flip-y",
|
|
@@ -3917,7 +3983,7 @@ class BarStacked extends Bar {
|
|
|
3917
3983
|
yDivision,
|
|
3918
3984
|
elSeries
|
|
3919
3985
|
}) {
|
|
3920
|
-
var _a, _b
|
|
3986
|
+
var _a, _b;
|
|
3921
3987
|
const w = this.w;
|
|
3922
3988
|
const barYPosition = y + columnGroupIndex * barHeight;
|
|
3923
3989
|
let barXPosition;
|
|
@@ -3925,36 +3991,21 @@ class BarStacked extends Bar {
|
|
|
3925
3991
|
const j = indexes.j;
|
|
3926
3992
|
const realIndex = indexes.realIndex;
|
|
3927
3993
|
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 (
|
|
3994
|
+
const v = (
|
|
3947
3995
|
/** @type {any} */
|
|
3948
|
-
((
|
|
3949
|
-
)
|
|
3950
|
-
|
|
3996
|
+
(_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
|
|
3997
|
+
);
|
|
3998
|
+
const g = this.groupCtx;
|
|
3999
|
+
const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j;
|
|
4000
|
+
const top = g.tops.get(key);
|
|
4001
|
+
if (top) {
|
|
4002
|
+
const [prevX, prevVal, prevBarW] = top;
|
|
4003
|
+
const flip = (this.isReversed ? prevBarW : 0) * 2;
|
|
4004
|
+
barXPosition = prevVal < 0 ? v >= 0 ? prevX + prevBarW - flip : prevX : v >= 0 ? prevX : prevX - prevBarW + flip;
|
|
3951
4005
|
} 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;
|
|
4006
|
+
barXPosition = zeroW;
|
|
3957
4007
|
}
|
|
4008
|
+
x = barXPosition + v / this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
3958
4009
|
const paths = this.barHelpers.getBarpaths({
|
|
3959
4010
|
barYPosition,
|
|
3960
4011
|
barHeight,
|
|
@@ -3968,6 +4019,7 @@ class BarStacked extends Bar {
|
|
|
3968
4019
|
j,
|
|
3969
4020
|
w
|
|
3970
4021
|
});
|
|
4022
|
+
this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j);
|
|
3971
4023
|
this.barHelpers.barBackground({
|
|
3972
4024
|
j,
|
|
3973
4025
|
i,
|
|
@@ -4005,13 +4057,17 @@ class BarStacked extends Bar {
|
|
|
4005
4057
|
columnGroupIndex,
|
|
4006
4058
|
elSeries
|
|
4007
4059
|
}) {
|
|
4008
|
-
var _a, _b, _c
|
|
4060
|
+
var _a, _b, _c;
|
|
4009
4061
|
const w = this.w;
|
|
4010
4062
|
const i = indexes.i;
|
|
4011
4063
|
const j = indexes.j;
|
|
4012
4064
|
const bc = indexes.bc;
|
|
4013
4065
|
const realIndex = indexes.realIndex;
|
|
4014
4066
|
const translationsIndex = indexes.translationsIndex;
|
|
4067
|
+
const v = (
|
|
4068
|
+
/** @type {any} */
|
|
4069
|
+
(_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
|
|
4070
|
+
);
|
|
4015
4071
|
if (w.axisFlags.isXNumeric) {
|
|
4016
4072
|
let seriesVal = w.seriesData.seriesX[realIndex][j];
|
|
4017
4073
|
if (!seriesVal) seriesVal = 0;
|
|
@@ -4026,11 +4082,9 @@ class BarStacked extends Bar {
|
|
|
4026
4082
|
const [prevYValue, prevVal, prevBarH] = top;
|
|
4027
4083
|
let bYP;
|
|
4028
4084
|
if (prevVal < 0) {
|
|
4029
|
-
bYP =
|
|
4030
|
-
((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
|
|
4085
|
+
bYP = v >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
|
|
4031
4086
|
} 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;
|
|
4087
|
+
bYP = v >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
|
|
4034
4088
|
}
|
|
4035
4089
|
if (typeof bYP === "undefined") bYP = w.layout.gridHeight;
|
|
4036
4090
|
if (((_c = g.prevYF[0]) == null ? void 0 : _c.every((val) => val === 0)) && g.prevYF.slice(1).every(
|
|
@@ -4043,25 +4097,16 @@ class BarStacked extends Bar {
|
|
|
4043
4097
|
} else {
|
|
4044
4098
|
barYPosition = zeroH;
|
|
4045
4099
|
}
|
|
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
|
-
}
|
|
4100
|
+
y = barYPosition - v / this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
4058
4101
|
const paths = this.barHelpers.getColumnPaths({
|
|
4059
4102
|
barXPosition,
|
|
4060
4103
|
barWidth,
|
|
4061
4104
|
y1: barYPosition,
|
|
4062
4105
|
y2: y,
|
|
4063
4106
|
yRatio: this.yRatio[translationsIndex],
|
|
4064
|
-
|
|
4107
|
+
// the series' width even for an empty segment, so a hidden layer keeps
|
|
4108
|
+
// its place, but no inset at all when no stroke is drawn
|
|
4109
|
+
strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
|
|
4065
4110
|
isReversed: this.isReversed,
|
|
4066
4111
|
series: this.series,
|
|
4067
4112
|
realIndex: indexes.realIndex,
|
|
@@ -4069,17 +4114,7 @@ class BarStacked extends Bar {
|
|
|
4069
4114
|
j,
|
|
4070
4115
|
w
|
|
4071
4116
|
});
|
|
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
|
-
}
|
|
4117
|
+
this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j);
|
|
4083
4118
|
this.barHelpers.barBackground({
|
|
4084
4119
|
bc,
|
|
4085
4120
|
j,
|
|
@@ -4098,13 +4133,32 @@ class BarStacked extends Bar {
|
|
|
4098
4133
|
zeroH,
|
|
4099
4134
|
realIndex,
|
|
4100
4135
|
j,
|
|
4101
|
-
|
|
4136
|
+
translationsIndex
|
|
4102
4137
|
),
|
|
4103
4138
|
barXPosition,
|
|
4104
4139
|
x: w.axisFlags.isXNumeric ? x : x + xDivision,
|
|
4105
4140
|
y
|
|
4106
4141
|
};
|
|
4107
4142
|
}
|
|
4143
|
+
/**
|
|
4144
|
+
* Record the segment just drawn as the top of its stack. Per key it holds
|
|
4145
|
+
* the top and value of the last segment drawn there, the summed lengths and
|
|
4146
|
+
* raw values of every segment so far (the total label's value), and the
|
|
4147
|
+
* extreme tops below that segment (the total label's position).
|
|
4148
|
+
* @param {any} key @param {any} top @param {number} t @param {any} val
|
|
4149
|
+
* @param {number} len @param {number} realIndex @param {number} j
|
|
4150
|
+
*/
|
|
4151
|
+
_setTop(key, top, t, val, len, realIndex, j) {
|
|
4152
|
+
if (isNaN(t)) return;
|
|
4153
|
+
this.groupCtx.tops.set(key, [
|
|
4154
|
+
t,
|
|
4155
|
+
val,
|
|
4156
|
+
(top ? top[2] : 0) + len,
|
|
4157
|
+
(top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
|
|
4158
|
+
top ? Math.min(top[0], top[4]) : 1 / 0,
|
|
4159
|
+
top ? Math.max(top[0], top[5]) : -1 / 0
|
|
4160
|
+
]);
|
|
4161
|
+
}
|
|
4108
4162
|
}
|
|
4109
4163
|
class RangeBar extends Bar {
|
|
4110
4164
|
/**
|
|
@@ -4112,14 +4166,14 @@ class RangeBar extends Bar {
|
|
|
4112
4166
|
* @param {number} seriesIndex
|
|
4113
4167
|
*/
|
|
4114
4168
|
draw(series, seriesIndex) {
|
|
4115
|
-
var _a, _b, _c, _d, _e, _f
|
|
4169
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4116
4170
|
const w = this.w;
|
|
4117
4171
|
const graphics = new Graphics(this.w);
|
|
4118
4172
|
this.rangeBarOptions = this.w.config.plotOptions.rangeBar;
|
|
4119
4173
|
this.series = series;
|
|
4120
4174
|
this.seriesRangeStart = w.rangeData.seriesRangeStart;
|
|
4121
4175
|
this.seriesRangeEnd = w.rangeData.seriesRangeEnd;
|
|
4122
|
-
this.barHelpers.initVariables(series);
|
|
4176
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
4123
4177
|
const ret = graphics.group({
|
|
4124
4178
|
class: "apexcharts-rangebar-series apexcharts-plot-series"
|
|
4125
4179
|
});
|
|
@@ -4141,6 +4195,9 @@ class RangeBar extends Bar {
|
|
|
4141
4195
|
this.visibleI = this.visibleI + 1;
|
|
4142
4196
|
}
|
|
4143
4197
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
4198
|
+
if (this.isHorizontal && w.labelData.timescaleLabels.length) {
|
|
4199
|
+
this.isReversed = false;
|
|
4200
|
+
}
|
|
4144
4201
|
const initPositions = this.barHelpers.initialPositions(realIndex);
|
|
4145
4202
|
const {
|
|
4146
4203
|
y: initY,
|
|
@@ -4150,10 +4207,8 @@ class RangeBar extends Bar {
|
|
|
4150
4207
|
zeroH
|
|
4151
4208
|
// zeroH is the baseline where 0 meets y axis
|
|
4152
4209
|
} = initPositions;
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
const yDivision = (_c = initPositions.yDivision) != null ? _c : 0;
|
|
4156
|
-
const xDivision = (_d = initPositions.xDivision) != null ? _d : 0;
|
|
4210
|
+
const yDivision = (_a = initPositions.yDivision) != null ? _a : 0;
|
|
4211
|
+
const xDivision = (_b = initPositions.xDivision) != null ? _b : 0;
|
|
4157
4212
|
y = initY;
|
|
4158
4213
|
x = initX;
|
|
4159
4214
|
const elDataLabelsWrap = graphics.group({
|
|
@@ -4163,10 +4218,16 @@ class RangeBar extends Bar {
|
|
|
4163
4218
|
const elGoalsMarkers = graphics.group({
|
|
4164
4219
|
class: "apexcharts-rangebar-goals-markers"
|
|
4165
4220
|
});
|
|
4221
|
+
const data = (
|
|
4222
|
+
/** @type {any} */
|
|
4223
|
+
w.config.series[realIndex].data
|
|
4224
|
+
);
|
|
4166
4225
|
for (let j = 0; j < w.globals.dataPoints; j++) {
|
|
4167
4226
|
const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex);
|
|
4168
|
-
|
|
4169
|
-
|
|
4227
|
+
let barWidth = (_c = initPositions.barWidth) != null ? _c : 0;
|
|
4228
|
+
let barHeight = (_d = initPositions.barHeight) != null ? _d : 0;
|
|
4229
|
+
const y1 = this.seriesRangeStart[realIndex][j];
|
|
4230
|
+
const y2 = this.seriesRangeEnd[realIndex][j];
|
|
4170
4231
|
let paths = (
|
|
4171
4232
|
/** @type {any} */
|
|
4172
4233
|
null
|
|
@@ -4178,20 +4239,16 @@ class RangeBar extends Bar {
|
|
|
4178
4239
|
if (w.config.plotOptions.bar.rangeBarGroupRows) {
|
|
4179
4240
|
seriesLen = 1;
|
|
4180
4241
|
}
|
|
4181
|
-
if (typeof
|
|
4182
|
-
((_e = w.config.series[i].data) == null ? void 0 : _e[j]) === "undefined") {
|
|
4242
|
+
if (typeof (data == null ? void 0 : data[j]) === "undefined") {
|
|
4183
4243
|
break;
|
|
4184
4244
|
}
|
|
4185
4245
|
if (this.isHorizontal) {
|
|
4186
4246
|
barYPosition = y + barHeight * /** @type {any} */
|
|
4187
4247
|
this.visibleI;
|
|
4188
4248
|
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
|
-
) {
|
|
4249
|
+
if (((_e = data[j]) == null ? void 0 : _e.x) != null) {
|
|
4193
4250
|
const positions = this.detectOverlappingBars({
|
|
4194
|
-
i,
|
|
4251
|
+
i: realIndex,
|
|
4195
4252
|
j,
|
|
4196
4253
|
barYPosition,
|
|
4197
4254
|
srty,
|
|
@@ -4214,17 +4271,14 @@ class RangeBar extends Bar {
|
|
|
4214
4271
|
barWidth = paths.barWidth;
|
|
4215
4272
|
} else {
|
|
4216
4273
|
if (w.axisFlags.isXNumeric) {
|
|
4217
|
-
x = (w.seriesData.seriesX[
|
|
4274
|
+
x = (w.seriesData.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2;
|
|
4218
4275
|
}
|
|
4219
4276
|
barXPosition = x + barWidth * /** @type {any} */
|
|
4220
4277
|
this.visibleI;
|
|
4221
4278
|
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
|
-
) {
|
|
4279
|
+
if (((_f = data[j]) == null ? void 0 : _f.x) != null) {
|
|
4226
4280
|
const positions = this.detectOverlappingBars({
|
|
4227
|
-
i,
|
|
4281
|
+
i: realIndex,
|
|
4228
4282
|
j,
|
|
4229
4283
|
barXPosition,
|
|
4230
4284
|
srtx,
|
|
@@ -4243,9 +4297,10 @@ class RangeBar extends Bar {
|
|
|
4243
4297
|
xDivision
|
|
4244
4298
|
}, params));
|
|
4245
4299
|
barHeight = paths.barHeight;
|
|
4300
|
+
barXPosition = paths.barXPosition;
|
|
4246
4301
|
}
|
|
4247
4302
|
const barGoalLine = this.barHelpers.drawGoalLine({
|
|
4248
|
-
barXPosition
|
|
4303
|
+
barXPosition,
|
|
4249
4304
|
barYPosition,
|
|
4250
4305
|
goalX: paths.goalX,
|
|
4251
4306
|
goalY: paths.goalY,
|
|
@@ -4290,19 +4345,11 @@ class RangeBar extends Bar {
|
|
|
4290
4345
|
});
|
|
4291
4346
|
}
|
|
4292
4347
|
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
4348
|
renderBarExitGhosts({
|
|
4302
4349
|
w,
|
|
4303
4350
|
elSeries,
|
|
4304
4351
|
record: this._prevRecord(realIndex),
|
|
4305
|
-
newKeys,
|
|
4352
|
+
newKeys: this._keys(realIndex),
|
|
4306
4353
|
isHorizontal: this.isHorizontal,
|
|
4307
4354
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
4308
4355
|
});
|
|
@@ -4354,11 +4401,11 @@ class RangeBar extends Bar {
|
|
|
4354
4401
|
);
|
|
4355
4402
|
if (overlaps.indexOf(rangeName) > -1) {
|
|
4356
4403
|
barHeight = initPositions.barHeight / overlaps.length;
|
|
4357
|
-
barYPosition
|
|
4404
|
+
barYPosition += barHeight * overlaps.indexOf(rangeName);
|
|
4358
4405
|
}
|
|
4359
4406
|
}
|
|
4360
4407
|
} else {
|
|
4361
|
-
if (rowIndex > -1 && !w.
|
|
4408
|
+
if (rowIndex > -1 && !w.axisFlags.isXNumeric) {
|
|
4362
4409
|
if (w.config.plotOptions.bar.rangeBarGroupRows) {
|
|
4363
4410
|
barXPosition = srtx + xDivision * rowIndex;
|
|
4364
4411
|
} else {
|
|
@@ -4372,7 +4419,7 @@ class RangeBar extends Bar {
|
|
|
4372
4419
|
);
|
|
4373
4420
|
if (overlaps.indexOf(rangeName) > -1) {
|
|
4374
4421
|
barWidth = initPositions.barWidth / overlaps.length;
|
|
4375
|
-
barXPosition
|
|
4422
|
+
barXPosition += barWidth * overlaps.indexOf(rangeName);
|
|
4376
4423
|
}
|
|
4377
4424
|
}
|
|
4378
4425
|
}
|
|
@@ -4395,7 +4442,7 @@ class RangeBar extends Bar {
|
|
|
4395
4442
|
var _a, _b;
|
|
4396
4443
|
const w = this.w;
|
|
4397
4444
|
const { i, j, realIndex, translationsIndex } = indexes;
|
|
4398
|
-
const yRatio = this.yRatio[translationsIndex];
|
|
4445
|
+
const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
4399
4446
|
const range = this.getRangeValue(realIndex, j);
|
|
4400
4447
|
let y1 = Math.min(range.start, range.end);
|
|
4401
4448
|
let y2 = Math.max(range.start, range.end);
|
|
@@ -4403,7 +4450,7 @@ class RangeBar extends Bar {
|
|
|
4403
4450
|
((_a = this.series[i]) == null ? void 0 : _a[j]) === "undefined" || /** @type {any} */
|
|
4404
4451
|
((_b = this.series[i]) == null ? void 0 : _b[j]) === null);
|
|
4405
4452
|
if (!hasValue) {
|
|
4406
|
-
y1 = zeroH;
|
|
4453
|
+
y1 = y2 = zeroH;
|
|
4407
4454
|
} else {
|
|
4408
4455
|
y1 = zeroH - y1 / yRatio;
|
|
4409
4456
|
y2 = zeroH - y2 / yRatio;
|
|
@@ -4464,6 +4511,30 @@ class RangeBar extends Bar {
|
|
|
4464
4511
|
barXPosition
|
|
4465
4512
|
};
|
|
4466
4513
|
}
|
|
4514
|
+
/**
|
|
4515
|
+
* Timeline datums key by their own row, not by the j-th label: a row can
|
|
4516
|
+
* hold several bars, so labels[j] names some other datum's row.
|
|
4517
|
+
* @param {number} realIndex
|
|
4518
|
+
* @returns {string[]}
|
|
4519
|
+
*/
|
|
4520
|
+
_keys(realIndex) {
|
|
4521
|
+
const c = (
|
|
4522
|
+
/** @type {any} */
|
|
4523
|
+
this._keyCache || (this._keyCache = {})
|
|
4524
|
+
);
|
|
4525
|
+
const data = (
|
|
4526
|
+
/** @type {any} */
|
|
4527
|
+
this.w.config.series[realIndex].data
|
|
4528
|
+
);
|
|
4529
|
+
return c[realIndex] || (c[realIndex] = uniquifyKeys(
|
|
4530
|
+
(data || []).map(
|
|
4531
|
+
(d, j) => {
|
|
4532
|
+
var _a;
|
|
4533
|
+
return "c:" + ((_a = d == null ? void 0 : d.x) != null ? _a : j);
|
|
4534
|
+
}
|
|
4535
|
+
)
|
|
4536
|
+
));
|
|
4537
|
+
}
|
|
4467
4538
|
/**
|
|
4468
4539
|
* @param {number} val
|
|
4469
4540
|
*/
|
|
@@ -4490,8 +4561,9 @@ class RangeBar extends Bar {
|
|
|
4490
4561
|
}) {
|
|
4491
4562
|
const w = this.w;
|
|
4492
4563
|
const { realIndex, j } = indexes;
|
|
4493
|
-
const
|
|
4494
|
-
const
|
|
4564
|
+
const ratio = this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
4565
|
+
const x1 = this.preventBarOverflow(zeroW + y1 / ratio);
|
|
4566
|
+
const x2 = this.preventBarOverflow(zeroW + y2 / ratio);
|
|
4495
4567
|
const range = this.getRangeValue(realIndex, j);
|
|
4496
4568
|
const barWidth = Math.abs(x2 - x1);
|
|
4497
4569
|
const paths = this.barHelpers.getBarpaths({
|