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/boxPlot.esm.js
CHANGED
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
/*!
|
|
21
|
-
* ApexCharts v8.
|
|
21
|
+
* ApexCharts v8.3.0
|
|
22
22
|
* (c) 2018-2026 ApexCharts
|
|
23
23
|
*/
|
|
24
24
|
import * as _core from "apexcharts/core";
|
|
@@ -37,181 +37,6 @@ const resolveDataLabelOffset = (value, w, seriesIndex, dataPointIndex) => {
|
|
|
37
37
|
});
|
|
38
38
|
return Number.isFinite(resolved) ? resolved : 0;
|
|
39
39
|
};
|
|
40
|
-
const Animations = _core.__apex_Animations;
|
|
41
|
-
const computeStagger = _core.__apex_Animations_computeStagger;
|
|
42
|
-
const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
|
|
43
|
-
const Environment = _core.__apex_Environment_Environment;
|
|
44
|
-
function lengthTransitionEnabled(w) {
|
|
45
|
-
var _a;
|
|
46
|
-
const anim = w.config.chart.animations;
|
|
47
|
-
if (!anim || anim.enabled === false) return false;
|
|
48
|
-
if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
|
|
52
|
-
if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
|
|
53
|
-
return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
|
|
54
|
-
}
|
|
55
|
-
function datumKey(w, realIndex, j) {
|
|
56
|
-
var _a, _b, _c, _d;
|
|
57
|
-
if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
|
|
58
|
-
const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
|
|
59
|
-
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
60
|
-
}
|
|
61
|
-
const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
|
|
62
|
-
if (lbl != null && String(lbl) !== "") {
|
|
63
|
-
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
64
|
-
}
|
|
65
|
-
return "j:" + j;
|
|
66
|
-
}
|
|
67
|
-
function frameDatumKey(frame, realIndex, j) {
|
|
68
|
-
var _a, _b;
|
|
69
|
-
if (frame.isXNumeric) {
|
|
70
|
-
const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
|
|
71
|
-
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
72
|
-
}
|
|
73
|
-
const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
|
|
74
|
-
if (lbl != null && String(lbl) !== "") {
|
|
75
|
-
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
76
|
-
}
|
|
77
|
-
return "j:" + j;
|
|
78
|
-
}
|
|
79
|
-
function joinKeys(oldKeys, newKeys) {
|
|
80
|
-
const oldIndex = /* @__PURE__ */ new Map();
|
|
81
|
-
oldKeys.forEach((k, i) => {
|
|
82
|
-
if (!oldIndex.has(k)) oldIndex.set(k, i);
|
|
83
|
-
});
|
|
84
|
-
const toOld = new Array(newKeys.length);
|
|
85
|
-
const usedOld = /* @__PURE__ */ new Set();
|
|
86
|
-
let prev = -1;
|
|
87
|
-
let ordered = true;
|
|
88
|
-
let identity = oldKeys.length === newKeys.length;
|
|
89
|
-
newKeys.forEach((k, i) => {
|
|
90
|
-
const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
|
|
91
|
-
toOld[i] = oi;
|
|
92
|
-
if (oi !== -1) {
|
|
93
|
-
usedOld.add(oi);
|
|
94
|
-
if (oi < prev) ordered = false;
|
|
95
|
-
prev = oi;
|
|
96
|
-
}
|
|
97
|
-
if (oi !== i) identity = false;
|
|
98
|
-
});
|
|
99
|
-
const exits = [];
|
|
100
|
-
for (let i = 0; i < oldKeys.length; i++) {
|
|
101
|
-
if (!usedOld.has(i)) exits.push(i);
|
|
102
|
-
}
|
|
103
|
-
return { toOld, exits, ordered, changed: !identity };
|
|
104
|
-
}
|
|
105
|
-
function uniquifyKeys(keys) {
|
|
106
|
-
const seen = /* @__PURE__ */ new Map();
|
|
107
|
-
return keys.map((k) => {
|
|
108
|
-
const count = seen.get(k) || 0;
|
|
109
|
-
seen.set(k, count + 1);
|
|
110
|
-
return count === 0 ? k : `${k}#${count}`;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
|
|
114
|
-
var _a, _b;
|
|
115
|
-
if (!lengthTransitionEnabled(w)) return null;
|
|
116
|
-
const frame = w.globals.prevStreamFrame;
|
|
117
|
-
if (!frame) return null;
|
|
118
|
-
const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
|
|
119
|
-
const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
|
|
120
|
-
if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
|
|
121
|
-
if (!oldY.length || !newY.length) return null;
|
|
122
|
-
const oldKeys = uniquifyKeys(
|
|
123
|
-
oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
|
|
124
|
-
);
|
|
125
|
-
const newKeys = uniquifyKeys(newY.map((_, j) => datumKey(w, realIndex, j)));
|
|
126
|
-
const join = joinKeys(oldKeys, newKeys);
|
|
127
|
-
if (!join.ordered && !allowReorder) return null;
|
|
128
|
-
if (!join.changed && !includeIdentity) return null;
|
|
129
|
-
return { join, oldKeys, newKeys };
|
|
130
|
-
}
|
|
131
|
-
function firstMove(d) {
|
|
132
|
-
const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
|
|
133
|
-
if (!m) return null;
|
|
134
|
-
const x = parseFloat(m[1]);
|
|
135
|
-
const y = parseFloat(m[2]);
|
|
136
|
-
return isFinite(x) && isFinite(y) ? { x, y } : null;
|
|
137
|
-
}
|
|
138
|
-
function renderBarExitGhosts({
|
|
139
|
-
w,
|
|
140
|
-
elSeries,
|
|
141
|
-
record,
|
|
142
|
-
newKeys,
|
|
143
|
-
isHorizontal,
|
|
144
|
-
speed
|
|
145
|
-
}) {
|
|
146
|
-
var _a;
|
|
147
|
-
if (!lengthTransitionEnabled(w)) return;
|
|
148
|
-
if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
|
|
149
|
-
const newKeySet = new Set(newKeys);
|
|
150
|
-
const exits = record.paths.filter(
|
|
151
|
-
(p) => p && p.d && p.key != null && !newKeySet.has(p.key)
|
|
152
|
-
);
|
|
153
|
-
if (!exits.length) return;
|
|
154
|
-
const graphics = new Graphics(w);
|
|
155
|
-
const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
|
|
156
|
-
exits.forEach((p) => {
|
|
157
|
-
let fill = p.fill || fallbackFill || "#c8c8c8";
|
|
158
|
-
if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
|
|
159
|
-
const ghost = graphics.drawPath({
|
|
160
|
-
d: p.d,
|
|
161
|
-
stroke: "none",
|
|
162
|
-
strokeWidth: 0,
|
|
163
|
-
fill,
|
|
164
|
-
fillOpacity: 1,
|
|
165
|
-
classes: "apexcharts-bar-ghost"
|
|
166
|
-
});
|
|
167
|
-
const node = ghost.node;
|
|
168
|
-
node.setAttribute("pointer-events", "none");
|
|
169
|
-
ghost.attr(
|
|
170
|
-
"clip-path",
|
|
171
|
-
`url(#gridRectBarMask${w.globals.cuid})`
|
|
172
|
-
);
|
|
173
|
-
elSeries.node.insertBefore(node, elSeries.node.firstChild);
|
|
174
|
-
const start = firstMove(p.d);
|
|
175
|
-
let origin = isHorizontal ? "left center" : "center bottom";
|
|
176
|
-
try {
|
|
177
|
-
const bb = node.getBBox();
|
|
178
|
-
if (start && bb) {
|
|
179
|
-
if (isHorizontal) {
|
|
180
|
-
origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
|
|
181
|
-
} else {
|
|
182
|
-
origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
} catch (_) {
|
|
186
|
-
}
|
|
187
|
-
const style = node.style;
|
|
188
|
-
style.transformBox = "fill-box";
|
|
189
|
-
style.transformOrigin = origin;
|
|
190
|
-
node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
|
|
191
|
-
try {
|
|
192
|
-
const bb = node.getBBox();
|
|
193
|
-
const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
|
|
194
|
-
if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
|
|
195
|
-
} catch (_) {
|
|
196
|
-
}
|
|
197
|
-
const duration = Math.max(1, speed || 1);
|
|
198
|
-
const startAt = performance.now();
|
|
199
|
-
const step = (now) => {
|
|
200
|
-
if (w.globals.isDestroyed || !node.parentNode) return;
|
|
201
|
-
const t = Math.max(0, Math.min(1, (now - startAt) / duration));
|
|
202
|
-
const eased = 1 - Math.pow(1 - t, 3);
|
|
203
|
-
const scale = 1 - eased;
|
|
204
|
-
style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
|
|
205
|
-
style.opacity = String(1 - eased);
|
|
206
|
-
if (t < 1) {
|
|
207
|
-
BrowserAPIs.requestAnimationFrame(step);
|
|
208
|
-
} else {
|
|
209
|
-
node.parentNode.removeChild(node);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
BrowserAPIs.requestAnimationFrame(step);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
40
|
class BarDataLabels {
|
|
216
41
|
/**
|
|
217
42
|
* @param {import('../../../charts/Bar').default} barCtx
|
|
@@ -247,7 +72,8 @@ class BarDataLabels {
|
|
|
247
72
|
barXPosition,
|
|
248
73
|
barYPosition,
|
|
249
74
|
visibleSeries,
|
|
250
|
-
hl
|
|
75
|
+
hl,
|
|
76
|
+
noLabel
|
|
251
77
|
} = opts;
|
|
252
78
|
const w = this.w;
|
|
253
79
|
const graphics = new Graphics(this.barCtx.w);
|
|
@@ -361,7 +187,7 @@ class BarDataLabels {
|
|
|
361
187
|
dataLabelsPos.dataLabelsX = (box.levelStart + box.levelEnd) / 2 + offX;
|
|
362
188
|
}
|
|
363
189
|
}
|
|
364
|
-
dataLabels = this.drawCalculatedDataLabels({
|
|
190
|
+
dataLabels = noLabel ? null : this.drawCalculatedDataLabels({
|
|
365
191
|
x: dataLabelsPos.dataLabelsX,
|
|
366
192
|
y: dataLabelsPos.dataLabelsY,
|
|
367
193
|
neg: params.neg,
|
|
@@ -447,8 +273,8 @@ class BarDataLabels {
|
|
|
447
273
|
return ctx && byGroups && byGroups[ctx.groupIndex] ? byGroups[ctx.groupIndex][j] : this.barCtx.stackedSeriesTotals[j];
|
|
448
274
|
}
|
|
449
275
|
/**
|
|
450
|
-
* The running stack at this
|
|
451
|
-
*
|
|
276
|
+
* The running stack at this bar's x (BarStacked `tops`) on a numeric axis,
|
|
277
|
+
* where bars stack by x rather than by index.
|
|
452
278
|
* @param {number} realIndex @param {number} j
|
|
453
279
|
*/
|
|
454
280
|
xStackTop(realIndex, j) {
|
|
@@ -457,6 +283,21 @@ class BarDataLabels {
|
|
|
457
283
|
return w.axisFlags.isXNumeric && /** @type {any} */
|
|
458
284
|
((_b = (_a = this.barCtx.stacks) == null ? void 0 : _a[w.labelData.seriesGroupIndex[realIndex]]) == null ? void 0 : _b.tops.get(w.seriesData.seriesX[realIndex][j]));
|
|
459
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* The stacked total's text box, measured in the total's own font.
|
|
288
|
+
* @param {number} realIndex @param {number} j
|
|
289
|
+
*/
|
|
290
|
+
totalRects(realIndex, j) {
|
|
291
|
+
const s = this.barCtx.barOptions.dataLabels.total.style;
|
|
292
|
+
return new Graphics(this.w).getTextRects(
|
|
293
|
+
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
294
|
+
s.fontSize,
|
|
295
|
+
s.fontFamily,
|
|
296
|
+
void 0,
|
|
297
|
+
true,
|
|
298
|
+
s.fontWeight
|
|
299
|
+
);
|
|
300
|
+
}
|
|
460
301
|
/** @param {{realIndex: any, j: any}} opts */
|
|
461
302
|
getStackedTotalDataLabel({ realIndex, j }) {
|
|
462
303
|
const w = this.w;
|
|
@@ -477,7 +318,6 @@ class BarDataLabels {
|
|
|
477
318
|
var _a;
|
|
478
319
|
const w = this.w;
|
|
479
320
|
let {
|
|
480
|
-
i,
|
|
481
321
|
j,
|
|
482
322
|
realIndex,
|
|
483
323
|
y,
|
|
@@ -487,7 +327,6 @@ class BarDataLabels {
|
|
|
487
327
|
textRects,
|
|
488
328
|
dataLabelsX,
|
|
489
329
|
dataLabelsY,
|
|
490
|
-
dataLabelsConfig,
|
|
491
330
|
barDataLabelsConfig,
|
|
492
331
|
barTotalDataLabelsConfig,
|
|
493
332
|
strokeWidth,
|
|
@@ -501,7 +340,7 @@ class BarDataLabels {
|
|
|
501
340
|
barHeight = Math.abs(barHeight);
|
|
502
341
|
const vertical = w.config.plotOptions.bar.dataLabels.orientation === "vertical";
|
|
503
342
|
const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
|
|
504
|
-
i,
|
|
343
|
+
i: realIndex,
|
|
505
344
|
j
|
|
506
345
|
});
|
|
507
346
|
bcx = bcx - strokeWidth / 2;
|
|
@@ -522,7 +361,7 @@ class BarDataLabels {
|
|
|
522
361
|
const offsetDLX = 2;
|
|
523
362
|
dataLabelsX = dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX;
|
|
524
363
|
}
|
|
525
|
-
const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[
|
|
364
|
+
const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[realIndex][j] < 0;
|
|
526
365
|
let newY = y;
|
|
527
366
|
if (this.barCtx.isReversed) {
|
|
528
367
|
newY = y + (valIsNegative ? barHeight : -barHeight);
|
|
@@ -596,16 +435,11 @@ class BarDataLabels {
|
|
|
596
435
|
});
|
|
597
436
|
if (this.hlt) lowestPrevY = this.hlt.edge;
|
|
598
437
|
if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
|
|
599
|
-
const
|
|
600
|
-
const graphics = new Graphics(this.barCtx.w);
|
|
601
|
-
const totalLabeltextRects = graphics.getTextRects(
|
|
602
|
-
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
603
|
-
dataLabelsConfig.fontSize
|
|
604
|
-
);
|
|
438
|
+
const h = this.totalRects(realIndex, j).height;
|
|
605
439
|
if (valIsNegative) {
|
|
606
|
-
totalDataLabelsY = lowestPrevY
|
|
440
|
+
totalDataLabelsY = lowestPrevY + h * 0.77 - offY - barTotalDataLabelsConfig.offsetY;
|
|
607
441
|
} else {
|
|
608
|
-
totalDataLabelsY = lowestPrevY
|
|
442
|
+
totalDataLabelsY = lowestPrevY - h * 0.3 + offY + barTotalDataLabelsConfig.offsetY;
|
|
609
443
|
}
|
|
610
444
|
const xDivision = dataPointsDividedWidth;
|
|
611
445
|
totalDataLabelsX = totalDataLabelsBcx + (w.axisFlags.isXNumeric ? -barWidth / 2 : barWidth / 2 - xDivision) + barTotalDataLabelsConfig.offsetX;
|
|
@@ -635,7 +469,6 @@ class BarDataLabels {
|
|
|
635
469
|
const w = this.w;
|
|
636
470
|
let {
|
|
637
471
|
x,
|
|
638
|
-
i,
|
|
639
472
|
j,
|
|
640
473
|
realIndex,
|
|
641
474
|
bcy,
|
|
@@ -652,7 +485,7 @@ class BarDataLabels {
|
|
|
652
485
|
} = opts;
|
|
653
486
|
const dataPointsDividedHeight = w.layout.gridHeight / w.globals.dataPoints;
|
|
654
487
|
const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
|
|
655
|
-
i,
|
|
488
|
+
i: realIndex,
|
|
656
489
|
j
|
|
657
490
|
});
|
|
658
491
|
barWidth = Math.abs(barWidth);
|
|
@@ -669,7 +502,7 @@ class BarDataLabels {
|
|
|
669
502
|
let totalDataLabelsX;
|
|
670
503
|
let totalDataLabelsY;
|
|
671
504
|
let totalDataLabelsAnchor = "start";
|
|
672
|
-
const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[
|
|
505
|
+
const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[realIndex][j] < 0;
|
|
673
506
|
let newX = x;
|
|
674
507
|
if (this.barCtx.isReversed) {
|
|
675
508
|
newX = x + (valIsNegative ? -barWidth : barWidth);
|
|
@@ -704,10 +537,14 @@ class BarDataLabels {
|
|
|
704
537
|
}
|
|
705
538
|
let lowestPrevX = newX;
|
|
706
539
|
const totalGroupCtx = this.getTotalGroupContext(realIndex);
|
|
707
|
-
const
|
|
540
|
+
const top = this.xStackTop(realIndex, j);
|
|
541
|
+
const stacks = top ? [] : (
|
|
708
542
|
/** @type {any} */
|
|
709
543
|
this.barCtx.stacks || []
|
|
710
544
|
);
|
|
545
|
+
if (top) {
|
|
546
|
+
lowestPrevX = valIsNegative ? Math.min(newX, top[4]) : Math.max(newX, top[5]);
|
|
547
|
+
}
|
|
711
548
|
stacks.forEach((g, gi) => {
|
|
712
549
|
if (totalGroupCtx && gi !== totalGroupCtx.groupIndex) return;
|
|
713
550
|
g.prevX.forEach((arr) => {
|
|
@@ -720,11 +557,7 @@ class BarDataLabels {
|
|
|
720
557
|
});
|
|
721
558
|
if (this.hlt) lowestPrevX = this.hlt.edge;
|
|
722
559
|
if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
|
|
723
|
-
const
|
|
724
|
-
const totalLabeltextRects = graphics.getTextRects(
|
|
725
|
-
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
726
|
-
dataLabelsConfig.fontSize
|
|
727
|
-
);
|
|
560
|
+
const totalLabeltextRects = this.totalRects(realIndex, j);
|
|
728
561
|
if (valIsNegative) {
|
|
729
562
|
totalDataLabelsX = lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX;
|
|
730
563
|
totalDataLabelsAnchor = "end";
|
|
@@ -793,8 +626,9 @@ class BarDataLabels {
|
|
|
793
626
|
let elDataLabelsWrap = null;
|
|
794
627
|
const isSeriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) > -1;
|
|
795
628
|
const isSeriesCollapsing = (w.globals.collapsingSeriesIndices || []).indexOf(i) > -1;
|
|
629
|
+
const dlKey = `${i}::${this.barCtx._keys(i)[j]}`;
|
|
796
630
|
if (isSeriesCollapsing) {
|
|
797
|
-
const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(
|
|
631
|
+
const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(dlKey);
|
|
798
632
|
if (prev && isFinite(prev.val)) {
|
|
799
633
|
val = prev.val;
|
|
800
634
|
text = void 0;
|
|
@@ -807,10 +641,7 @@ class BarDataLabels {
|
|
|
807
641
|
});
|
|
808
642
|
const dlCfg = w.config.dataLabels;
|
|
809
643
|
if (((_b = dlCfg.animate) == null ? void 0 : _b.enabled) || ((_c = dlCfg.countUp) == null ? void 0 : _c.enabled)) {
|
|
810
|
-
elDataLabelsWrap.node.setAttribute(
|
|
811
|
-
"data:dlKey",
|
|
812
|
-
`${i}::${datumKey(w, i, j)}`
|
|
813
|
-
);
|
|
644
|
+
elDataLabelsWrap.node.setAttribute("data:dlKey", dlKey);
|
|
814
645
|
elDataLabelsWrap.node.setAttribute("data:dlJ", String(j));
|
|
815
646
|
if (typeof val === "number" && isFinite(val)) {
|
|
816
647
|
elDataLabelsWrap.node.setAttribute("data:dlVal", String(val));
|
|
@@ -828,29 +659,12 @@ class BarDataLabels {
|
|
|
828
659
|
if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
829
660
|
text = "";
|
|
830
661
|
}
|
|
831
|
-
|
|
832
|
-
const position = w.config.plotOptions.bar.dataLabels.position;
|
|
662
|
+
let anchor = dataLabelsConfig.textAnchor;
|
|
833
663
|
if (w.config.plotOptions.bar.dataLabels.orientation === "vertical") {
|
|
834
|
-
|
|
835
|
-
if (valIsNegative) dataLabelsConfig.textAnchor = "end";
|
|
836
|
-
else dataLabelsConfig.textAnchor = "start";
|
|
837
|
-
}
|
|
838
|
-
if (position === "center") {
|
|
839
|
-
dataLabelsConfig.textAnchor = "middle";
|
|
840
|
-
}
|
|
841
|
-
if (position === "bottom") {
|
|
842
|
-
if (valIsNegative) dataLabelsConfig.textAnchor = "end";
|
|
843
|
-
else dataLabelsConfig.textAnchor = "start";
|
|
844
|
-
}
|
|
664
|
+
anchor = w.config.plotOptions.bar.dataLabels.position === "center" ? "middle" : (neg != null ? neg : w.seriesData.series[i][j] < 0) ? "end" : "start";
|
|
845
665
|
}
|
|
846
|
-
if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) {
|
|
847
|
-
|
|
848
|
-
text,
|
|
849
|
-
parseFloat(dataLabelsConfig.style.fontSize).toString()
|
|
850
|
-
);
|
|
851
|
-
if (barWidth < txRect.width) {
|
|
852
|
-
text = "";
|
|
853
|
-
}
|
|
666
|
+
if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && barWidth < textRects.width) {
|
|
667
|
+
text = "";
|
|
854
668
|
}
|
|
855
669
|
if (w.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && // A collapsing series is measured against its NEW extent, which is
|
|
856
670
|
// already zero, so this would blank a label whose bar is still at full
|
|
@@ -866,14 +680,14 @@ class BarDataLabels {
|
|
|
866
680
|
}
|
|
867
681
|
}
|
|
868
682
|
}
|
|
869
|
-
const modifiedDataLabelsConfig = __spreadValues({}, dataLabelsConfig)
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
683
|
+
const modifiedDataLabelsConfig = __spreadProps(__spreadValues({}, dataLabelsConfig), {
|
|
684
|
+
textAnchor: anchor
|
|
685
|
+
});
|
|
686
|
+
if (this.barCtx.isHorizontal && val < 0) {
|
|
687
|
+
if (anchor === "start") {
|
|
688
|
+
modifiedDataLabelsConfig.textAnchor = "end";
|
|
689
|
+
} else if (anchor === "end") {
|
|
690
|
+
modifiedDataLabelsConfig.textAnchor = "start";
|
|
877
691
|
}
|
|
878
692
|
}
|
|
879
693
|
dataLabels.plotDataLabelsText({
|
|
@@ -925,7 +739,7 @@ class BarDataLabels {
|
|
|
925
739
|
const { groupIndex } = this.barCtx.barHelpers.getGroupIndex(realIndex);
|
|
926
740
|
totalDataLabelText.node.setAttribute(
|
|
927
741
|
"data:dlTotalKey",
|
|
928
|
-
`${groupIndex}::${
|
|
742
|
+
`${groupIndex}::${this.barCtx._keys(realIndex)[j]}`
|
|
929
743
|
);
|
|
930
744
|
totalDataLabelText.node.setAttribute(
|
|
931
745
|
"data:dlTotalSeries",
|
|
@@ -958,9 +772,11 @@ class Helpers {
|
|
|
958
772
|
}
|
|
959
773
|
/**
|
|
960
774
|
* @param {any[]} series
|
|
775
|
+
* @param {any} [seriesIndex] a combo's real indices of `series`
|
|
961
776
|
*/
|
|
962
|
-
initVariables(series) {
|
|
777
|
+
initVariables(series, seriesIndex) {
|
|
963
778
|
const w = this.w;
|
|
779
|
+
this.seriesIndex = seriesIndex;
|
|
964
780
|
this.barCtx.series = series;
|
|
965
781
|
this.barCtx.totalItems = 0;
|
|
966
782
|
this.barCtx.seriesLen = 0;
|
|
@@ -981,6 +797,8 @@ class Helpers {
|
|
|
981
797
|
this.barCtx.visibleItems = w.globals.dataPoints;
|
|
982
798
|
}
|
|
983
799
|
}
|
|
800
|
+
const labels = w.labelData.labels;
|
|
801
|
+
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;
|
|
984
802
|
this.arrBorderRadius = this.createBorderRadiusArr(w.seriesData.series);
|
|
985
803
|
if (Utils.isSafari()) {
|
|
986
804
|
this.arrBorderRadius = this.arrBorderRadius.map(
|
|
@@ -1045,15 +863,19 @@ class Helpers {
|
|
|
1045
863
|
* Collapsed series count too, exactly as they did for `minXDiff`. Skipping
|
|
1046
864
|
* them would widen every bar the moment someone hid the tightest-spaced
|
|
1047
865
|
* series from the legend, so bar geometry would depend on legend state.
|
|
866
|
+
* In a combo only this renderer's own series count: a line's x values say
|
|
867
|
+
* nothing about how wide a column may be.
|
|
1048
868
|
*
|
|
1049
869
|
* @returns {number}
|
|
1050
870
|
*/
|
|
1051
871
|
_unionMinXGap() {
|
|
1052
872
|
const w = this.w;
|
|
1053
873
|
const seriesX = w.seriesData.seriesX || [];
|
|
874
|
+
const own = this.seriesIndex;
|
|
1054
875
|
const arrays = [];
|
|
1055
876
|
for (let i = 0; i < seriesX.length; i++) {
|
|
1056
877
|
const xs = seriesX[i];
|
|
878
|
+
if (own && own.indexOf(i) < 0) continue;
|
|
1057
879
|
if (Array.isArray(xs) && xs.length > 0) {
|
|
1058
880
|
arrays.push(
|
|
1059
881
|
xs.some((v, n) => v < xs[n - 1]) ? xs.filter((v) => v === +v).sort((a, b) => a - b) : xs
|
|
@@ -1094,6 +916,15 @@ class Helpers {
|
|
|
1094
916
|
}
|
|
1095
917
|
return isFinite(min) ? min : 0;
|
|
1096
918
|
}
|
|
919
|
+
/**
|
|
920
|
+
* The band a horizontal bar is drawn in: its x's band when the series do
|
|
921
|
+
* not line up by index (see initVariables), else its index.
|
|
922
|
+
* @param {number} realIndex @param {number} j
|
|
923
|
+
*/
|
|
924
|
+
barRow(realIndex, j) {
|
|
925
|
+
var _a, _b, _c;
|
|
926
|
+
return (_c = (_b = this.rows) == null ? void 0 : _b.get((_a = this.w.seriesData.seriesX[realIndex]) == null ? void 0 : _a[j])) != null ? _c : j;
|
|
927
|
+
}
|
|
1097
928
|
/**
|
|
1098
929
|
* @param {number} realIndex
|
|
1099
930
|
*/
|
|
@@ -1216,7 +1047,7 @@ class Helpers {
|
|
|
1216
1047
|
});
|
|
1217
1048
|
}
|
|
1218
1049
|
const connectorFill = this.getDumbbellConnectorFill(i, j);
|
|
1219
|
-
const datumFill = connectorFill || ((_a = w.config.series[
|
|
1050
|
+
const datumFill = connectorFill || ((_a = w.config.series[realIndex].data[j]) == null ? void 0 : _a.fill);
|
|
1220
1051
|
const connector = this.barCtx.barOptions.isDumbbell ? w.config.plotOptions.bar.dumbbell.connector : null;
|
|
1221
1052
|
let connectorOpacity;
|
|
1222
1053
|
if (connector && connector.color) {
|
|
@@ -1369,11 +1200,10 @@ class Helpers {
|
|
|
1369
1200
|
* @returns {string[][]}
|
|
1370
1201
|
*/
|
|
1371
1202
|
createBorderRadiusArr(series) {
|
|
1372
|
-
var _a;
|
|
1373
1203
|
const w = this.w;
|
|
1374
1204
|
const alwaysApplyRadius = !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0;
|
|
1375
1205
|
const numSeries = series.length;
|
|
1376
|
-
const numColumns = (
|
|
1206
|
+
const numColumns = Math.max(0, ...series.map((s) => (s == null ? void 0 : s.length) | 0));
|
|
1377
1207
|
const output = Array.from(
|
|
1378
1208
|
{ length: numSeries },
|
|
1379
1209
|
() => Array(numColumns).fill(alwaysApplyRadius ? "top" : "none")
|
|
@@ -1529,7 +1359,7 @@ class Helpers {
|
|
|
1529
1359
|
j,
|
|
1530
1360
|
w
|
|
1531
1361
|
}) {
|
|
1532
|
-
var _a, _b;
|
|
1362
|
+
var _a, _b, _c;
|
|
1533
1363
|
const r = this.barRect({
|
|
1534
1364
|
a: barXPosition,
|
|
1535
1365
|
len: barWidth,
|
|
@@ -1560,7 +1390,7 @@ class Helpers {
|
|
|
1560
1390
|
const _ctx = this.barCtx.groupCtx;
|
|
1561
1391
|
_ctx.yArrj.push(y2 - strokeCenter * direction);
|
|
1562
1392
|
_ctx.yArrjF.push(Math.abs(y1 - y2 + r.strokeWidth * direction));
|
|
1563
|
-
_ctx.yArrjVal.push(this.barCtx.series[i][j]);
|
|
1393
|
+
_ctx.yArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
|
|
1564
1394
|
}
|
|
1565
1395
|
return {
|
|
1566
1396
|
pathTo,
|
|
@@ -1750,7 +1580,7 @@ class Helpers {
|
|
|
1750
1580
|
j,
|
|
1751
1581
|
w
|
|
1752
1582
|
}) {
|
|
1753
|
-
var _a, _b;
|
|
1583
|
+
var _a, _b, _c;
|
|
1754
1584
|
const graphics = new Graphics(this.barCtx.w);
|
|
1755
1585
|
const r = this.barRect({
|
|
1756
1586
|
a: barYPosition,
|
|
@@ -1786,7 +1616,7 @@ class Helpers {
|
|
|
1786
1616
|
const _ctx = this.barCtx.groupCtx;
|
|
1787
1617
|
_ctx.xArrj.push(x2 + strokeCenter * direction);
|
|
1788
1618
|
_ctx.xArrjF.push(Math.abs(x1 - x2 - r.strokeWidth * direction));
|
|
1789
|
-
_ctx.xArrjVal.push(this.barCtx.series[i][j]);
|
|
1619
|
+
_ctx.xArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
|
|
1790
1620
|
}
|
|
1791
1621
|
return {
|
|
1792
1622
|
pathTo,
|
|
@@ -1831,6 +1661,9 @@ class Helpers {
|
|
|
1831
1661
|
const w = this.w;
|
|
1832
1662
|
const goals = [];
|
|
1833
1663
|
const pushGoal = (value, attrs) => {
|
|
1664
|
+
if (!w.globals.invalidLogScale) {
|
|
1665
|
+
value = new CoreUtils(w).getLogValAtSeriesIndex(value, i);
|
|
1666
|
+
}
|
|
1834
1667
|
goals.push({
|
|
1835
1668
|
[type]: type === "x" ? this.getXForValue(value, zeroW, false) : this.getYForValue(value, zeroH, translationsIndex, false),
|
|
1836
1669
|
attrs
|
|
@@ -2085,11 +1918,11 @@ class Helpers {
|
|
|
2085
1918
|
let zeroEncounters = 0;
|
|
2086
1919
|
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)) || [];
|
|
2087
1920
|
seriesIndices.forEach((_si) => {
|
|
2088
|
-
const val = w.
|
|
1921
|
+
const val = w.seriesData.series[_si][j];
|
|
2089
1922
|
if (val) {
|
|
2090
1923
|
nonZeroColumns++;
|
|
2091
1924
|
}
|
|
2092
|
-
if (_si < i && val
|
|
1925
|
+
if (_si < i && !val) {
|
|
2093
1926
|
zeroEncounters++;
|
|
2094
1927
|
}
|
|
2095
1928
|
});
|
|
@@ -2127,6 +1960,186 @@ class Helpers {
|
|
|
2127
1960
|
}
|
|
2128
1961
|
}
|
|
2129
1962
|
const Filters = _core.__apex_Filters;
|
|
1963
|
+
const Animations = _core.__apex_Animations;
|
|
1964
|
+
const computeStagger = _core.__apex_Animations_computeStagger;
|
|
1965
|
+
const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
|
|
1966
|
+
const Environment = _core.__apex_Environment_Environment;
|
|
1967
|
+
function lengthTransitionEnabled(w) {
|
|
1968
|
+
var _a;
|
|
1969
|
+
const anim = w.config.chart.animations;
|
|
1970
|
+
if (!anim || anim.enabled === false) return false;
|
|
1971
|
+
if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
|
|
1972
|
+
return false;
|
|
1973
|
+
}
|
|
1974
|
+
const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
|
|
1975
|
+
if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
|
|
1976
|
+
return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
|
|
1977
|
+
}
|
|
1978
|
+
function datumKey(w, realIndex, j) {
|
|
1979
|
+
var _a, _b, _c, _d;
|
|
1980
|
+
if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
|
|
1981
|
+
const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
|
|
1982
|
+
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
1983
|
+
}
|
|
1984
|
+
const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
|
|
1985
|
+
if (lbl != null && String(lbl) !== "") {
|
|
1986
|
+
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
1987
|
+
}
|
|
1988
|
+
return "j:" + j;
|
|
1989
|
+
}
|
|
1990
|
+
function frameDatumKey(frame, realIndex, j) {
|
|
1991
|
+
var _a, _b;
|
|
1992
|
+
if (frame.isXNumeric) {
|
|
1993
|
+
const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
|
|
1994
|
+
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
1995
|
+
}
|
|
1996
|
+
const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
|
|
1997
|
+
if (lbl != null && String(lbl) !== "") {
|
|
1998
|
+
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
1999
|
+
}
|
|
2000
|
+
return "j:" + j;
|
|
2001
|
+
}
|
|
2002
|
+
function joinKeys(oldKeys, newKeys) {
|
|
2003
|
+
const oldIndex = /* @__PURE__ */ new Map();
|
|
2004
|
+
oldKeys.forEach((k, i) => {
|
|
2005
|
+
if (!oldIndex.has(k)) oldIndex.set(k, i);
|
|
2006
|
+
});
|
|
2007
|
+
const toOld = new Array(newKeys.length);
|
|
2008
|
+
const usedOld = /* @__PURE__ */ new Set();
|
|
2009
|
+
let prev = -1;
|
|
2010
|
+
let ordered = true;
|
|
2011
|
+
let identity = oldKeys.length === newKeys.length;
|
|
2012
|
+
newKeys.forEach((k, i) => {
|
|
2013
|
+
const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
|
|
2014
|
+
toOld[i] = oi;
|
|
2015
|
+
if (oi !== -1) {
|
|
2016
|
+
usedOld.add(oi);
|
|
2017
|
+
if (oi < prev) ordered = false;
|
|
2018
|
+
prev = oi;
|
|
2019
|
+
}
|
|
2020
|
+
if (oi !== i) identity = false;
|
|
2021
|
+
});
|
|
2022
|
+
const exits = [];
|
|
2023
|
+
for (let i = 0; i < oldKeys.length; i++) {
|
|
2024
|
+
if (!usedOld.has(i)) exits.push(i);
|
|
2025
|
+
}
|
|
2026
|
+
return { toOld, exits, ordered, changed: !identity };
|
|
2027
|
+
}
|
|
2028
|
+
function uniquifyKeys(keys) {
|
|
2029
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2030
|
+
return keys.map((k) => {
|
|
2031
|
+
const count = seen.get(k) || 0;
|
|
2032
|
+
seen.set(k, count + 1);
|
|
2033
|
+
return count === 0 ? k : `${k}#${count}`;
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
function seriesKeys(w, realIndex, n = ((_a) => (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length)() | 0) {
|
|
2037
|
+
return uniquifyKeys(
|
|
2038
|
+
Array.from({ length: n }, (_, j) => datumKey(w, realIndex, j))
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
|
|
2042
|
+
var _a, _b;
|
|
2043
|
+
if (!lengthTransitionEnabled(w)) return null;
|
|
2044
|
+
const frame = w.globals.prevStreamFrame;
|
|
2045
|
+
if (!frame) return null;
|
|
2046
|
+
const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
|
|
2047
|
+
const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
|
|
2048
|
+
if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
|
|
2049
|
+
if (!oldY.length || !newY.length) return null;
|
|
2050
|
+
const oldKeys = uniquifyKeys(
|
|
2051
|
+
oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
|
|
2052
|
+
);
|
|
2053
|
+
const newKeys = seriesKeys(w, realIndex);
|
|
2054
|
+
const join = joinKeys(oldKeys, newKeys);
|
|
2055
|
+
if (!join.ordered && !allowReorder) return null;
|
|
2056
|
+
if (!join.changed && !includeIdentity) return null;
|
|
2057
|
+
return { join, oldKeys, newKeys };
|
|
2058
|
+
}
|
|
2059
|
+
function firstMove(d) {
|
|
2060
|
+
const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
|
|
2061
|
+
if (!m) return null;
|
|
2062
|
+
const x = parseFloat(m[1]);
|
|
2063
|
+
const y = parseFloat(m[2]);
|
|
2064
|
+
return isFinite(x) && isFinite(y) ? { x, y } : null;
|
|
2065
|
+
}
|
|
2066
|
+
function renderBarExitGhosts({
|
|
2067
|
+
w,
|
|
2068
|
+
elSeries,
|
|
2069
|
+
record,
|
|
2070
|
+
newKeys,
|
|
2071
|
+
isHorizontal,
|
|
2072
|
+
speed
|
|
2073
|
+
}) {
|
|
2074
|
+
var _a;
|
|
2075
|
+
if (!lengthTransitionEnabled(w)) return;
|
|
2076
|
+
if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
|
|
2077
|
+
const newKeySet = new Set(newKeys);
|
|
2078
|
+
const exits = record.paths.filter(
|
|
2079
|
+
(p) => p && p.d && p.key != null && !newKeySet.has(p.key)
|
|
2080
|
+
);
|
|
2081
|
+
if (!exits.length) return;
|
|
2082
|
+
const graphics = new Graphics(w);
|
|
2083
|
+
const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
|
|
2084
|
+
exits.forEach((p) => {
|
|
2085
|
+
let fill = p.fill || fallbackFill || "#c8c8c8";
|
|
2086
|
+
if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
|
|
2087
|
+
const ghost = graphics.drawPath({
|
|
2088
|
+
d: p.d,
|
|
2089
|
+
stroke: "none",
|
|
2090
|
+
strokeWidth: 0,
|
|
2091
|
+
fill,
|
|
2092
|
+
fillOpacity: 1,
|
|
2093
|
+
classes: "apexcharts-bar-ghost"
|
|
2094
|
+
});
|
|
2095
|
+
const node = ghost.node;
|
|
2096
|
+
node.setAttribute("pointer-events", "none");
|
|
2097
|
+
ghost.attr(
|
|
2098
|
+
"clip-path",
|
|
2099
|
+
`url(#gridRectBarMask${w.globals.cuid})`
|
|
2100
|
+
);
|
|
2101
|
+
elSeries.node.insertBefore(node, elSeries.node.firstChild);
|
|
2102
|
+
const start = firstMove(p.d);
|
|
2103
|
+
let origin = isHorizontal ? "left center" : "center bottom";
|
|
2104
|
+
try {
|
|
2105
|
+
const bb = node.getBBox();
|
|
2106
|
+
if (start && bb) {
|
|
2107
|
+
if (isHorizontal) {
|
|
2108
|
+
origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
|
|
2109
|
+
} else {
|
|
2110
|
+
origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
} catch (_) {
|
|
2114
|
+
}
|
|
2115
|
+
const style = node.style;
|
|
2116
|
+
style.transformBox = "fill-box";
|
|
2117
|
+
style.transformOrigin = origin;
|
|
2118
|
+
node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
|
|
2119
|
+
try {
|
|
2120
|
+
const bb = node.getBBox();
|
|
2121
|
+
const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
|
|
2122
|
+
if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
|
|
2123
|
+
} catch (_) {
|
|
2124
|
+
}
|
|
2125
|
+
const duration = Math.max(1, speed || 1);
|
|
2126
|
+
const startAt = performance.now();
|
|
2127
|
+
const step = (now) => {
|
|
2128
|
+
if (w.globals.isDestroyed || !node.parentNode) return;
|
|
2129
|
+
const t = Math.max(0, Math.min(1, (now - startAt) / duration));
|
|
2130
|
+
const eased = 1 - Math.pow(1 - t, 3);
|
|
2131
|
+
const scale = 1 - eased;
|
|
2132
|
+
style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
|
|
2133
|
+
style.opacity = String(1 - eased);
|
|
2134
|
+
if (t < 1) {
|
|
2135
|
+
BrowserAPIs.requestAnimationFrame(step);
|
|
2136
|
+
} else {
|
|
2137
|
+
node.parentNode.removeChild(node);
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
BrowserAPIs.requestAnimationFrame(step);
|
|
2141
|
+
});
|
|
2142
|
+
}
|
|
2130
2143
|
class AxisMapping {
|
|
2131
2144
|
/**
|
|
2132
2145
|
* Pixels per data-unit on the x-axis. Derived from `minX..maxX` so it is the
|
|
@@ -2245,15 +2258,17 @@ class Bar {
|
|
|
2245
2258
|
/**
|
|
2246
2259
|
* Point the per-series axis state at this series' y axis. Every bar-family
|
|
2247
2260
|
* renderer calls it before initialPositions, which reads the baseline by
|
|
2248
|
-
* this.translationsIndex.
|
|
2261
|
+
* this.translationsIndex and flips it for a reversed axis.
|
|
2249
2262
|
* @param {number} realIndex
|
|
2250
2263
|
* @return {number} translationsIndex
|
|
2251
2264
|
*/
|
|
2252
2265
|
setSeriesAxis(realIndex) {
|
|
2266
|
+
var _a;
|
|
2253
2267
|
if (this.yRatio.length > 1) {
|
|
2254
2268
|
this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
|
|
2255
2269
|
this.translationsIndex = realIndex;
|
|
2256
2270
|
}
|
|
2271
|
+
this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
|
|
2257
2272
|
return this.translationsIndex;
|
|
2258
2273
|
}
|
|
2259
2274
|
/** primary draw method which is called on bar object
|
|
@@ -2270,7 +2285,7 @@ class Bar {
|
|
|
2270
2285
|
series = coreUtils.getLogSeries(series);
|
|
2271
2286
|
this.series = series;
|
|
2272
2287
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
2273
|
-
this.barHelpers.initVariables(series);
|
|
2288
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
2274
2289
|
const ret = graphics.group({
|
|
2275
2290
|
class: "apexcharts-bar-series apexcharts-plot-series"
|
|
2276
2291
|
});
|
|
@@ -2302,7 +2317,6 @@ class Bar {
|
|
|
2302
2317
|
this.visibleI = this.visibleI + 1;
|
|
2303
2318
|
}
|
|
2304
2319
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
2305
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
2306
2320
|
if (this.isPyramid) {
|
|
2307
2321
|
this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
|
|
2308
2322
|
}
|
|
@@ -2380,7 +2394,9 @@ class Bar {
|
|
|
2380
2394
|
elSeries
|
|
2381
2395
|
};
|
|
2382
2396
|
if (this.isHorizontal) {
|
|
2383
|
-
paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
|
|
2397
|
+
paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
|
|
2398
|
+
y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
2399
|
+
}), {
|
|
2384
2400
|
barHeight,
|
|
2385
2401
|
zeroW,
|
|
2386
2402
|
yDivision
|
|
@@ -2462,6 +2478,7 @@ class Bar {
|
|
|
2462
2478
|
series,
|
|
2463
2479
|
barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
|
|
2464
2480
|
barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
|
|
2481
|
+
barXPosition: paths.barXPosition,
|
|
2465
2482
|
elDataLabelsWrap,
|
|
2466
2483
|
elGoalsMarkers,
|
|
2467
2484
|
elBarShadows,
|
|
@@ -2472,15 +2489,11 @@ class Bar {
|
|
|
2472
2489
|
w.globals.seriesXvalues[realIndex] = xArrj;
|
|
2473
2490
|
w.globals.seriesYvalues[realIndex] = yArrj;
|
|
2474
2491
|
if (w.globals.previousPaths.length > 0) {
|
|
2475
|
-
const newKeys = [];
|
|
2476
|
-
for (let j = 0; j < series[i].length; j++) {
|
|
2477
|
-
newKeys.push(datumKey(w, realIndex, j));
|
|
2478
|
-
}
|
|
2479
2492
|
renderBarExitGhosts({
|
|
2480
2493
|
w,
|
|
2481
2494
|
elSeries,
|
|
2482
2495
|
record: this._prevRecord(realIndex),
|
|
2483
|
-
newKeys,
|
|
2496
|
+
newKeys: this._keys(realIndex),
|
|
2484
2497
|
isHorizontal: this.isHorizontal,
|
|
2485
2498
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
2486
2499
|
});
|
|
@@ -2489,7 +2502,7 @@ class Bar {
|
|
|
2489
2502
|
}
|
|
2490
2503
|
return ret;
|
|
2491
2504
|
}
|
|
2492
|
-
/** @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 */
|
|
2505
|
+
/** @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 */
|
|
2493
2506
|
renderSeries({
|
|
2494
2507
|
hl,
|
|
2495
2508
|
realIndex,
|
|
@@ -2521,7 +2534,9 @@ class Bar {
|
|
|
2521
2534
|
visibleSeries,
|
|
2522
2535
|
type,
|
|
2523
2536
|
classes,
|
|
2524
|
-
fadeReveal = false
|
|
2537
|
+
fadeReveal = false,
|
|
2538
|
+
noLabel
|
|
2539
|
+
// a datum's extra paths (box halves, box lane) label nothing
|
|
2525
2540
|
}) {
|
|
2526
2541
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2527
2542
|
const w = this.w;
|
|
@@ -2595,7 +2610,8 @@ class Bar {
|
|
|
2595
2610
|
barXPosition,
|
|
2596
2611
|
barYPosition,
|
|
2597
2612
|
visibleSeries,
|
|
2598
|
-
hl: hl == null ? void 0 : hl.label
|
|
2613
|
+
hl: hl == null ? void 0 : hl.label,
|
|
2614
|
+
noLabel
|
|
2599
2615
|
})
|
|
2600
2616
|
);
|
|
2601
2617
|
if (delayMs > 0) {
|
|
@@ -2611,19 +2627,18 @@ class Bar {
|
|
|
2611
2627
|
}
|
|
2612
2628
|
let leaving = false;
|
|
2613
2629
|
if (!w.globals.isBarHorizontal) {
|
|
2614
|
-
|
|
2630
|
+
const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
|
|
2631
|
+
const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
|
|
2632
|
+
if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
|
|
2615
2633
|
if (this._wasOnScreen(realIndex, j)) leaving = true;
|
|
2616
2634
|
else skipDrawing = true;
|
|
2617
2635
|
}
|
|
2618
2636
|
}
|
|
2619
|
-
|
|
2620
|
-
/** @type {
|
|
2621
|
-
w.config.series[
|
|
2622
|
-
|
|
2623
|
-
)
|
|
2624
|
-
lineFill = /** @type {Record<string,any>} */
|
|
2625
|
-
w.config.series[i].data[j].strokeColor;
|
|
2626
|
-
}
|
|
2637
|
+
const datum = (
|
|
2638
|
+
/** @type {any} */
|
|
2639
|
+
w.config.series[realIndex].data[j]
|
|
2640
|
+
);
|
|
2641
|
+
if (datum && datum.strokeColor) lineFill = datum.strokeColor;
|
|
2627
2642
|
const fill = pathFill;
|
|
2628
2643
|
if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
|
|
2629
2644
|
pathFill = "none";
|
|
@@ -2646,7 +2661,7 @@ class Bar {
|
|
|
2646
2661
|
pathTo,
|
|
2647
2662
|
stroke: lineFill,
|
|
2648
2663
|
strokeWidth,
|
|
2649
|
-
|
|
2664
|
+
strokeLinecap: w.config.stroke.lineCap,
|
|
2650
2665
|
fill: pathFill,
|
|
2651
2666
|
pathToInterp,
|
|
2652
2667
|
animationDelay: delay,
|
|
@@ -2698,12 +2713,12 @@ class Bar {
|
|
|
2698
2713
|
cy: dataLabelsObj.dataLabelsPos.bcy,
|
|
2699
2714
|
cx: dataLabelsObj.dataLabelsPos.bcx,
|
|
2700
2715
|
j,
|
|
2701
|
-
val: w.seriesData.series[
|
|
2716
|
+
val: w.seriesData.series[realIndex][j],
|
|
2702
2717
|
barHeight,
|
|
2703
2718
|
barWidth,
|
|
2704
2719
|
// Datum identity for the next update's keyed join (see
|
|
2705
2720
|
// LengthTransition): survivors match by key, not array position.
|
|
2706
|
-
"data:pathKey":
|
|
2721
|
+
"data:pathKey": this._keys(realIndex)[j]
|
|
2707
2722
|
});
|
|
2708
2723
|
hl == null ? void 0 : hl.paint(renderedPath, {
|
|
2709
2724
|
delay,
|
|
@@ -2779,7 +2794,10 @@ class Bar {
|
|
|
2779
2794
|
const j = indexes.j;
|
|
2780
2795
|
let barYPosition;
|
|
2781
2796
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
2782
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
2797
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
2798
|
+
i: indexes.realIndex,
|
|
2799
|
+
j
|
|
2800
|
+
});
|
|
2783
2801
|
if (nonZeroColumns > 0) {
|
|
2784
2802
|
barHeight = this.seriesLen * barHeight / nonZeroColumns;
|
|
2785
2803
|
}
|
|
@@ -2918,7 +2936,7 @@ class Bar {
|
|
|
2918
2936
|
barXPosition = xForNumericX.barXPosition;
|
|
2919
2937
|
} else {
|
|
2920
2938
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
2921
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
|
|
2939
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
|
|
2922
2940
|
if (nonZeroColumns > 0) {
|
|
2923
2941
|
barWidth = this.seriesLen * barWidth / nonZeroColumns;
|
|
2924
2942
|
}
|
|
@@ -2982,15 +3000,16 @@ class Bar {
|
|
|
2982
3000
|
/** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
|
|
2983
3001
|
getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
|
|
2984
3002
|
const w = this.w;
|
|
3003
|
+
const overlay = isHistogramOverlay(w);
|
|
2985
3004
|
let sxI = realIndex;
|
|
2986
3005
|
if (!w.seriesData.seriesX[realIndex].length) {
|
|
2987
3006
|
sxI = w.globals.maxValsInArrayIndex;
|
|
2988
3007
|
}
|
|
2989
3008
|
if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
|
|
2990
|
-
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
|
|
3009
|
+
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
|
|
2991
3010
|
}
|
|
2992
3011
|
return {
|
|
2993
|
-
barXPosition: x + (
|
|
3012
|
+
barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
|
|
2994
3013
|
x
|
|
2995
3014
|
};
|
|
2996
3015
|
}
|
|
@@ -3011,7 +3030,20 @@ class Bar {
|
|
|
3011
3030
|
_wasOnScreen(realIndex, j) {
|
|
3012
3031
|
if (!lengthTransitionEnabled(this.w)) return false;
|
|
3013
3032
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3014
|
-
return !!keyed && keyed.has(
|
|
3033
|
+
return !!keyed && keyed.has(this._keys(realIndex)[j]);
|
|
3034
|
+
}
|
|
3035
|
+
/**
|
|
3036
|
+
* This render's datum keys for a series (see seriesKeys), as stamped on
|
|
3037
|
+
* each bar and looked up in the previous render's.
|
|
3038
|
+
* @param {number} realIndex
|
|
3039
|
+
* @returns {string[]}
|
|
3040
|
+
*/
|
|
3041
|
+
_keys(realIndex) {
|
|
3042
|
+
const c = (
|
|
3043
|
+
/** @type {any} */
|
|
3044
|
+
this._keyCache || (this._keyCache = {})
|
|
3045
|
+
);
|
|
3046
|
+
return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
|
|
3015
3047
|
}
|
|
3016
3048
|
/**
|
|
3017
3049
|
* The captured previous-render record for a series (last match wins, same
|
|
@@ -3067,7 +3099,7 @@ class Bar {
|
|
|
3067
3099
|
* @returns {boolean}
|
|
3068
3100
|
*/
|
|
3069
3101
|
isLengthTransition(realIndex) {
|
|
3070
|
-
var _a, _b;
|
|
3102
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3071
3103
|
if (!this._ltCache) this._ltCache = {};
|
|
3072
3104
|
if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
|
|
3073
3105
|
const w = this.w;
|
|
@@ -3075,20 +3107,14 @@ class Bar {
|
|
|
3075
3107
|
if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
|
|
3076
3108
|
const record = this._prevRecord(realIndex);
|
|
3077
3109
|
const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
3110
|
+
const keyed = record && this._prevKeyedPaths(realIndex);
|
|
3078
3111
|
if (!record) {
|
|
3079
3112
|
result = dataLen > 0;
|
|
3080
|
-
} else if (
|
|
3081
|
-
|
|
3113
|
+
} else if (keyed) {
|
|
3114
|
+
const now = new Set(this._keys(realIndex));
|
|
3115
|
+
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));
|
|
3082
3116
|
} else {
|
|
3083
|
-
|
|
3084
|
-
if (keyed) {
|
|
3085
|
-
for (let j = 0; j < dataLen; j++) {
|
|
3086
|
-
if (!keyed.has(datumKey(w, realIndex, j))) {
|
|
3087
|
-
result = true;
|
|
3088
|
-
break;
|
|
3089
|
-
}
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3117
|
+
result = record.paths.length !== dataLen;
|
|
3092
3118
|
}
|
|
3093
3119
|
}
|
|
3094
3120
|
this._ltCache[realIndex] = result;
|
|
@@ -3148,7 +3174,7 @@ class Bar {
|
|
|
3148
3174
|
let isNewDatum = false;
|
|
3149
3175
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3150
3176
|
if (keyed) {
|
|
3151
|
-
const prev = keyed.get(
|
|
3177
|
+
const prev = keyed.get(this._keys(realIndex)[j]);
|
|
3152
3178
|
if (prev) {
|
|
3153
3179
|
oldD = prev.d;
|
|
3154
3180
|
} else {
|
|
@@ -3291,11 +3317,10 @@ class Bar {
|
|
|
3291
3317
|
* @returns {boolean | null} null when there is no previous record to consult
|
|
3292
3318
|
*/
|
|
3293
3319
|
getPreviousFlip(realIndex, j) {
|
|
3294
|
-
const w = this.w;
|
|
3295
3320
|
const record = this._prevRecord(realIndex);
|
|
3296
3321
|
if (!record) return null;
|
|
3297
3322
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3298
|
-
const prev = keyed ? keyed.get(
|
|
3323
|
+
const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
|
|
3299
3324
|
return prev ? !!prev.flip : null;
|
|
3300
3325
|
}
|
|
3301
3326
|
/**
|
|
@@ -3311,9 +3336,20 @@ class Bar {
|
|
|
3311
3336
|
return matches ? matches.length : 0;
|
|
3312
3337
|
}
|
|
3313
3338
|
}
|
|
3339
|
+
function jitterExtent(pool, w) {
|
|
3340
|
+
let lo = Infinity;
|
|
3341
|
+
let hi = -Infinity;
|
|
3342
|
+
pool.slice(0, w.seriesData.series.length).flat(2).forEach((v) => {
|
|
3343
|
+
if (v === +v) {
|
|
3344
|
+
if (v < lo) lo = v;
|
|
3345
|
+
if (v > hi) hi = v;
|
|
3346
|
+
}
|
|
3347
|
+
});
|
|
3348
|
+
return [lo, hi];
|
|
3349
|
+
}
|
|
3314
3350
|
function buildJitterGroups({
|
|
3315
|
-
w,
|
|
3316
3351
|
points,
|
|
3352
|
+
extent,
|
|
3317
3353
|
seedA,
|
|
3318
3354
|
seedB,
|
|
3319
3355
|
center,
|
|
@@ -3324,6 +3360,7 @@ function buildJitterGroups({
|
|
|
3324
3360
|
clampAt,
|
|
3325
3361
|
sideSign
|
|
3326
3362
|
}) {
|
|
3363
|
+
var _a, _b;
|
|
3327
3364
|
const opts = options;
|
|
3328
3365
|
if (!opts || opts.show === false) return [];
|
|
3329
3366
|
if (!points || !points.length) return [];
|
|
@@ -3337,8 +3374,8 @@ function buildJitterGroups({
|
|
|
3337
3374
|
const scale = opts.colorScale;
|
|
3338
3375
|
const useScale = scale && Array.isArray(scale.colors) && scale.colors.length > 0;
|
|
3339
3376
|
const steps = useScale ? Math.max(2, scale.steps || 24) : 1;
|
|
3340
|
-
const sMin =
|
|
3341
|
-
const sMax =
|
|
3377
|
+
const sMin = (_a = scale == null ? void 0 : scale.min) != null ? _a : extent[0];
|
|
3378
|
+
const sMax = (_b = scale == null ? void 0 : scale.max) != null ? _b : extent[1];
|
|
3342
3379
|
const span = sMax - sMin || 1;
|
|
3343
3380
|
const buckets = useScale ? new Array(steps).fill("") : [""];
|
|
3344
3381
|
for (let k = 0; k < points.length; k += stride) {
|
|
@@ -3424,7 +3461,7 @@ function renderJitter({
|
|
|
3424
3461
|
elSeries.add(elPointsWrap);
|
|
3425
3462
|
}
|
|
3426
3463
|
function darkenColor(color, amount) {
|
|
3427
|
-
const rgb = Utils.
|
|
3464
|
+
const rgb = Utils.parseColor(color) || Utils.parseColor(Utils.resolveColor(color));
|
|
3428
3465
|
if (!rgb) return color;
|
|
3429
3466
|
const f = Math.max(0, 1 - amount);
|
|
3430
3467
|
return `rgb(${Math.round(rgb[0] * f)},${Math.round(rgb[1] * f)},${Math.round(rgb[2] * f)})`;
|
|
@@ -3489,7 +3526,7 @@ class BoxCandleStick extends Bar {
|
|
|
3489
3526
|
if (!keyed || keyed.size === 0 || !row || row.length === 0) return false;
|
|
3490
3527
|
let survivors = 0;
|
|
3491
3528
|
for (let j = 0; j < row.length; j++) {
|
|
3492
|
-
if (keyed.has(
|
|
3529
|
+
if (keyed.has(this._keys(realIndex)[j])) survivors++;
|
|
3493
3530
|
}
|
|
3494
3531
|
return survivors / keyed.size < 0.5;
|
|
3495
3532
|
}
|
|
@@ -3518,7 +3555,7 @@ class BoxCandleStick extends Bar {
|
|
|
3518
3555
|
}
|
|
3519
3556
|
this._prevHalves[realIndex] = map;
|
|
3520
3557
|
}
|
|
3521
|
-
const halves = map && map.get(
|
|
3558
|
+
const halves = map && map.get(this._keys(realIndex)[j]);
|
|
3522
3559
|
return halves && halves.length === 2 ? halves[pi] : null;
|
|
3523
3560
|
}
|
|
3524
3561
|
/**
|
|
@@ -3528,7 +3565,7 @@ class BoxCandleStick extends Bar {
|
|
|
3528
3565
|
*/
|
|
3529
3566
|
// @ts-ignore -- BoxCandleStick.draw has an extra ctype param compared to Bar.draw
|
|
3530
3567
|
draw(series, ctype, seriesIndex) {
|
|
3531
|
-
var _a;
|
|
3568
|
+
var _a, _b;
|
|
3532
3569
|
const w = this.w;
|
|
3533
3570
|
const graphics = new Graphics(this.w);
|
|
3534
3571
|
const type = w.globals.comboCharts ? ctype : w.config.chart.type;
|
|
@@ -3536,16 +3573,17 @@ class BoxCandleStick extends Bar {
|
|
|
3536
3573
|
this.candlestickOptions = this.w.config.plotOptions.candlestick;
|
|
3537
3574
|
this.boxOptions = this.w.config.plotOptions.boxPlot;
|
|
3538
3575
|
this.isHorizontal = w.config.plotOptions.bar.horizontal;
|
|
3539
|
-
this.isOHLC = this.candlestickOptions && this.candlestickOptions.type === "ohlc";
|
|
3540
3576
|
this.coreUtils = new CoreUtils(this.w);
|
|
3541
3577
|
series = this.coreUtils.getLogSeries(series);
|
|
3542
3578
|
this.series = series;
|
|
3543
3579
|
this.yRatio = this.coreUtils.getLogYRatios(this.yRatio);
|
|
3544
|
-
this.barHelpers.initVariables(series);
|
|
3580
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
3545
3581
|
const ret = graphics.group({
|
|
3546
3582
|
class: `apexcharts-${type}-series apexcharts-plot-series`
|
|
3547
3583
|
});
|
|
3548
3584
|
this.isBoxPlot = type === "boxPlot";
|
|
3585
|
+
this.isOHLC = !this.isBoxPlot && ((_a = this.candlestickOptions) == null ? void 0 : _a.type) === "ohlc";
|
|
3586
|
+
const jx = jitterExtent(w.candleData.seriesBoxPoints, w);
|
|
3549
3587
|
for (let i = 0; i < series.length; i++) {
|
|
3550
3588
|
let x;
|
|
3551
3589
|
let y;
|
|
@@ -3671,6 +3709,7 @@ class BoxCandleStick extends Bar {
|
|
|
3671
3709
|
i,
|
|
3672
3710
|
pathFrom: (_a2 = this._prevBoxHalf(realIndex, j, pi)) != null ? _a2 : paths.pathFrom,
|
|
3673
3711
|
fadeReveal,
|
|
3712
|
+
noLabel: pi > 0,
|
|
3674
3713
|
pathTo,
|
|
3675
3714
|
strokeWidth,
|
|
3676
3715
|
elSeries,
|
|
@@ -3692,7 +3731,7 @@ class BoxCandleStick extends Bar {
|
|
|
3692
3731
|
}
|
|
3693
3732
|
);
|
|
3694
3733
|
if (boxPointsOpts && boxPointsOpts.show !== false) {
|
|
3695
|
-
const pts = (
|
|
3734
|
+
const pts = (_b = w.candleData.seriesBoxPoints[realIndex]) == null ? void 0 : _b[j];
|
|
3696
3735
|
if (pts && pts.length) {
|
|
3697
3736
|
const logVal = (v) => (
|
|
3698
3737
|
/** @type {any} */
|
|
@@ -3703,14 +3742,14 @@ class BoxCandleStick extends Bar {
|
|
|
3703
3742
|
);
|
|
3704
3743
|
let center, halfExtent, alongFn;
|
|
3705
3744
|
if (this.isHorizontal) {
|
|
3706
|
-
const yRatio = this.invertedYRatio;
|
|
3745
|
+
const yRatio = this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
3707
3746
|
const bh = barHeight != null ? barHeight : 0;
|
|
3708
3747
|
const z = zeroW != null ? zeroW : 0;
|
|
3709
3748
|
center = paths.barYPosition + bh / 2;
|
|
3710
3749
|
halfExtent = bh / 2;
|
|
3711
3750
|
alongFn = (v) => z + logVal(v) / yRatio;
|
|
3712
3751
|
} else {
|
|
3713
|
-
const yRatio = this.yRatio[translationsIndex];
|
|
3752
|
+
const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
3714
3753
|
const bw = barWidth != null ? barWidth : 0;
|
|
3715
3754
|
const z = zeroH != null ? zeroH : 0;
|
|
3716
3755
|
center = paths.barXPosition + bw / 2;
|
|
@@ -3718,8 +3757,8 @@ class BoxCandleStick extends Bar {
|
|
|
3718
3757
|
alongFn = (v) => z - logVal(v) / yRatio;
|
|
3719
3758
|
}
|
|
3720
3759
|
const groups = buildJitterGroups({
|
|
3721
|
-
w,
|
|
3722
3760
|
points: pts,
|
|
3761
|
+
extent: jx,
|
|
3723
3762
|
seedA: realIndex,
|
|
3724
3763
|
seedB: j,
|
|
3725
3764
|
center,
|
|
@@ -3748,15 +3787,13 @@ class BoxCandleStick extends Bar {
|
|
|
3748
3787
|
w.globals.seriesXvalues[realIndex] = xArrj;
|
|
3749
3788
|
w.globals.seriesYvalues[realIndex] = yArrj;
|
|
3750
3789
|
if (w.globals.previousPaths.length > 0 && !fadeReveal) {
|
|
3751
|
-
const newKeys = [];
|
|
3752
|
-
for (let j = 0; j < series[i].length; j++) {
|
|
3753
|
-
newKeys.push(datumKey(w, realIndex, j));
|
|
3754
|
-
}
|
|
3755
3790
|
renderBarExitGhosts({
|
|
3756
3791
|
w,
|
|
3757
3792
|
elSeries,
|
|
3758
3793
|
record: this._prevRecord(realIndex),
|
|
3759
|
-
newKeys
|
|
3794
|
+
newKeys: this._keys(realIndex).filter(
|
|
3795
|
+
(_, j) => series[i][j] != null
|
|
3796
|
+
),
|
|
3760
3797
|
isHorizontal: this.isHorizontal,
|
|
3761
3798
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
3762
3799
|
});
|
|
@@ -3775,7 +3812,7 @@ class BoxCandleStick extends Bar {
|
|
|
3775
3812
|
strokeWidth,
|
|
3776
3813
|
cullBounds = null
|
|
3777
3814
|
}) {
|
|
3778
|
-
var _a, _b, _c
|
|
3815
|
+
var _a, _b, _c;
|
|
3779
3816
|
const w = this.w;
|
|
3780
3817
|
const graphics = new Graphics(this.w);
|
|
3781
3818
|
const i = indexes.i;
|
|
@@ -3786,7 +3823,7 @@ class BoxCandleStick extends Bar {
|
|
|
3786
3823
|
const getColor = (color2) => Array.isArray(color2) ? color2[realIndex] : color2;
|
|
3787
3824
|
const colorPos = getColor(candleColors.upward);
|
|
3788
3825
|
const colorNeg = getColor(candleColors.downward);
|
|
3789
|
-
const yRatio = this.yRatio[indexes.translationsIndex];
|
|
3826
|
+
const yRatio = this.yRatio[indexes.translationsIndex] * (this.isReversed ? -1 : 1);
|
|
3790
3827
|
const ohlc = this.getOHLCValue(realIndex, j);
|
|
3791
3828
|
let l1 = zeroH;
|
|
3792
3829
|
let l2 = zeroH;
|
|
@@ -3803,9 +3840,11 @@ class BoxCandleStick extends Bar {
|
|
|
3803
3840
|
x = pos.x;
|
|
3804
3841
|
barXPosition = pos.barXPosition;
|
|
3805
3842
|
}
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3843
|
+
const hole = (
|
|
3844
|
+
/** @type {any} */
|
|
3845
|
+
((_a = this.series[i]) == null ? void 0 : _a[j]) == null
|
|
3846
|
+
);
|
|
3847
|
+
if (hole) {
|
|
3809
3848
|
y1 = zeroH;
|
|
3810
3849
|
y2 = zeroH;
|
|
3811
3850
|
} else {
|
|
@@ -3815,7 +3854,7 @@ class BoxCandleStick extends Bar {
|
|
|
3815
3854
|
l2 = zeroH - ohlc.l / yRatio;
|
|
3816
3855
|
m = zeroH - ohlc.m / yRatio;
|
|
3817
3856
|
}
|
|
3818
|
-
if (cullBounds && (barXPosition + barWidth < cullBounds.lo || barXPosition > cullBounds.hi) && !this._wasOnScreen(realIndex, j)) {
|
|
3857
|
+
if (hole || cullBounds && (barXPosition + barWidth < cullBounds.lo || barXPosition > cullBounds.hi) && !this._wasOnScreen(realIndex, j)) {
|
|
3819
3858
|
return {
|
|
3820
3859
|
pathTo: null,
|
|
3821
3860
|
pathFrom: null,
|
|
@@ -3845,7 +3884,7 @@ class BoxCandleStick extends Bar {
|
|
|
3845
3884
|
];
|
|
3846
3885
|
}
|
|
3847
3886
|
let pathFrom = null;
|
|
3848
|
-
const morphFrom = (
|
|
3887
|
+
const morphFrom = (_c = (_b = this.ctx) == null ? void 0 : _b.morphTypeChange) == null ? void 0 : _c.getInitialPathFor(realIndex, j);
|
|
3849
3888
|
if (morphFrom) {
|
|
3850
3889
|
pathFrom = morphFrom;
|
|
3851
3890
|
} else if (w.globals.previousPaths.length > 0) {
|
|
@@ -3884,7 +3923,7 @@ class BoxCandleStick extends Bar {
|
|
|
3884
3923
|
zeroW,
|
|
3885
3924
|
strokeWidth
|
|
3886
3925
|
}) {
|
|
3887
|
-
var _a, _b, _c
|
|
3926
|
+
var _a, _b, _c;
|
|
3888
3927
|
const w = this.w;
|
|
3889
3928
|
const graphics = new Graphics(this.w);
|
|
3890
3929
|
const i = indexes.i;
|
|
@@ -3893,7 +3932,7 @@ class BoxCandleStick extends Bar {
|
|
|
3893
3932
|
const { colors: candleColors } = w.config.plotOptions.candlestick;
|
|
3894
3933
|
const { colors: boxColors } = this.boxOptions;
|
|
3895
3934
|
const getColor = (color2) => Array.isArray(color2) ? color2[realIndex] : color2;
|
|
3896
|
-
const yRatio = this.invertedYRatio;
|
|
3935
|
+
const yRatio = this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
3897
3936
|
const ohlc = this.getOHLCValue(realIndex, j);
|
|
3898
3937
|
let color = ohlc.o < ohlc.c ? [getColor(candleColors.upward)] : [getColor(candleColors.downward)];
|
|
3899
3938
|
if (this.isBoxPlot) {
|
|
@@ -3905,9 +3944,11 @@ class BoxCandleStick extends Bar {
|
|
|
3905
3944
|
let x2 = Math.max(ohlc.o, ohlc.c);
|
|
3906
3945
|
let m = ohlc.m;
|
|
3907
3946
|
const barYPosition = y + barHeight * this.visibleI;
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3947
|
+
const hole = (
|
|
3948
|
+
/** @type {any} */
|
|
3949
|
+
((_a = this.series[i]) == null ? void 0 : _a[j]) == null
|
|
3950
|
+
);
|
|
3951
|
+
if (hole) {
|
|
3911
3952
|
x1 = zeroW;
|
|
3912
3953
|
x2 = zeroW;
|
|
3913
3954
|
} else {
|
|
@@ -3922,7 +3963,7 @@ class BoxCandleStick extends Bar {
|
|
|
3922
3963
|
graphics.move(m, barYPosition) + graphics.line(m, barYPosition + barHeight) + graphics.line(x2, barYPosition + barHeight) + graphics.line(x2, barYPosition + barHeight / 2) + graphics.line(l2, barYPosition + barHeight / 2) + graphics.line(l2, barYPosition + barHeight - barHeight / 4) + graphics.line(l2, barYPosition + barHeight / 4) + graphics.line(l2, barYPosition + barHeight / 2) + graphics.line(x2, barYPosition + barHeight / 2) + graphics.line(x2, barYPosition) + graphics.line(m, barYPosition) + "z"
|
|
3923
3964
|
];
|
|
3924
3965
|
let pathFrom = null;
|
|
3925
|
-
const morphFrom = (
|
|
3966
|
+
const morphFrom = (_c = (_b = this.ctx) == null ? void 0 : _b.morphTypeChange) == null ? void 0 : _c.getInitialPathFor(realIndex, j);
|
|
3926
3967
|
if (morphFrom) {
|
|
3927
3968
|
pathFrom = morphFrom;
|
|
3928
3969
|
} else if (w.globals.previousPaths.length > 0) {
|
|
@@ -3947,7 +3988,8 @@ class BoxCandleStick extends Bar {
|
|
|
3947
3988
|
0
|
|
3948
3989
|
),
|
|
3949
3990
|
barYPosition,
|
|
3950
|
-
color
|
|
3991
|
+
color,
|
|
3992
|
+
culled: hole
|
|
3951
3993
|
};
|
|
3952
3994
|
}
|
|
3953
3995
|
/**
|