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/dumbbell.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";
|
|
@@ -223,181 +223,6 @@ const resolveDataLabelOffset = (value, w, seriesIndex, dataPointIndex) => {
|
|
|
223
223
|
});
|
|
224
224
|
return Number.isFinite(resolved) ? resolved : 0;
|
|
225
225
|
};
|
|
226
|
-
const Animations = _core.__apex_Animations;
|
|
227
|
-
const computeStagger = _core.__apex_Animations_computeStagger;
|
|
228
|
-
const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
|
|
229
|
-
const Environment = _core.__apex_Environment_Environment;
|
|
230
|
-
function lengthTransitionEnabled(w) {
|
|
231
|
-
var _a;
|
|
232
|
-
const anim = w.config.chart.animations;
|
|
233
|
-
if (!anim || anim.enabled === false) return false;
|
|
234
|
-
if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
|
|
238
|
-
if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
|
|
239
|
-
return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
|
|
240
|
-
}
|
|
241
|
-
function datumKey(w, realIndex, j) {
|
|
242
|
-
var _a, _b, _c, _d;
|
|
243
|
-
if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
|
|
244
|
-
const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
|
|
245
|
-
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
246
|
-
}
|
|
247
|
-
const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
|
|
248
|
-
if (lbl != null && String(lbl) !== "") {
|
|
249
|
-
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
250
|
-
}
|
|
251
|
-
return "j:" + j;
|
|
252
|
-
}
|
|
253
|
-
function frameDatumKey(frame, realIndex, j) {
|
|
254
|
-
var _a, _b;
|
|
255
|
-
if (frame.isXNumeric) {
|
|
256
|
-
const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
|
|
257
|
-
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
258
|
-
}
|
|
259
|
-
const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
|
|
260
|
-
if (lbl != null && String(lbl) !== "") {
|
|
261
|
-
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
262
|
-
}
|
|
263
|
-
return "j:" + j;
|
|
264
|
-
}
|
|
265
|
-
function joinKeys(oldKeys, newKeys) {
|
|
266
|
-
const oldIndex = /* @__PURE__ */ new Map();
|
|
267
|
-
oldKeys.forEach((k, i) => {
|
|
268
|
-
if (!oldIndex.has(k)) oldIndex.set(k, i);
|
|
269
|
-
});
|
|
270
|
-
const toOld = new Array(newKeys.length);
|
|
271
|
-
const usedOld = /* @__PURE__ */ new Set();
|
|
272
|
-
let prev = -1;
|
|
273
|
-
let ordered = true;
|
|
274
|
-
let identity = oldKeys.length === newKeys.length;
|
|
275
|
-
newKeys.forEach((k, i) => {
|
|
276
|
-
const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
|
|
277
|
-
toOld[i] = oi;
|
|
278
|
-
if (oi !== -1) {
|
|
279
|
-
usedOld.add(oi);
|
|
280
|
-
if (oi < prev) ordered = false;
|
|
281
|
-
prev = oi;
|
|
282
|
-
}
|
|
283
|
-
if (oi !== i) identity = false;
|
|
284
|
-
});
|
|
285
|
-
const exits = [];
|
|
286
|
-
for (let i = 0; i < oldKeys.length; i++) {
|
|
287
|
-
if (!usedOld.has(i)) exits.push(i);
|
|
288
|
-
}
|
|
289
|
-
return { toOld, exits, ordered, changed: !identity };
|
|
290
|
-
}
|
|
291
|
-
function uniquifyKeys(keys) {
|
|
292
|
-
const seen = /* @__PURE__ */ new Map();
|
|
293
|
-
return keys.map((k) => {
|
|
294
|
-
const count = seen.get(k) || 0;
|
|
295
|
-
seen.set(k, count + 1);
|
|
296
|
-
return count === 0 ? k : `${k}#${count}`;
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
|
|
300
|
-
var _a, _b;
|
|
301
|
-
if (!lengthTransitionEnabled(w)) return null;
|
|
302
|
-
const frame = w.globals.prevStreamFrame;
|
|
303
|
-
if (!frame) return null;
|
|
304
|
-
const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
|
|
305
|
-
const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
|
|
306
|
-
if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
|
|
307
|
-
if (!oldY.length || !newY.length) return null;
|
|
308
|
-
const oldKeys = uniquifyKeys(
|
|
309
|
-
oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
|
|
310
|
-
);
|
|
311
|
-
const newKeys = uniquifyKeys(newY.map((_, j) => datumKey(w, realIndex, j)));
|
|
312
|
-
const join = joinKeys(oldKeys, newKeys);
|
|
313
|
-
if (!join.ordered && !allowReorder) return null;
|
|
314
|
-
if (!join.changed && !includeIdentity) return null;
|
|
315
|
-
return { join, oldKeys, newKeys };
|
|
316
|
-
}
|
|
317
|
-
function firstMove(d) {
|
|
318
|
-
const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
|
|
319
|
-
if (!m) return null;
|
|
320
|
-
const x = parseFloat(m[1]);
|
|
321
|
-
const y = parseFloat(m[2]);
|
|
322
|
-
return isFinite(x) && isFinite(y) ? { x, y } : null;
|
|
323
|
-
}
|
|
324
|
-
function renderBarExitGhosts({
|
|
325
|
-
w,
|
|
326
|
-
elSeries,
|
|
327
|
-
record,
|
|
328
|
-
newKeys,
|
|
329
|
-
isHorizontal,
|
|
330
|
-
speed
|
|
331
|
-
}) {
|
|
332
|
-
var _a;
|
|
333
|
-
if (!lengthTransitionEnabled(w)) return;
|
|
334
|
-
if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
|
|
335
|
-
const newKeySet = new Set(newKeys);
|
|
336
|
-
const exits = record.paths.filter(
|
|
337
|
-
(p) => p && p.d && p.key != null && !newKeySet.has(p.key)
|
|
338
|
-
);
|
|
339
|
-
if (!exits.length) return;
|
|
340
|
-
const graphics = new Graphics(w);
|
|
341
|
-
const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
|
|
342
|
-
exits.forEach((p) => {
|
|
343
|
-
let fill = p.fill || fallbackFill || "#c8c8c8";
|
|
344
|
-
if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
|
|
345
|
-
const ghost = graphics.drawPath({
|
|
346
|
-
d: p.d,
|
|
347
|
-
stroke: "none",
|
|
348
|
-
strokeWidth: 0,
|
|
349
|
-
fill,
|
|
350
|
-
fillOpacity: 1,
|
|
351
|
-
classes: "apexcharts-bar-ghost"
|
|
352
|
-
});
|
|
353
|
-
const node = ghost.node;
|
|
354
|
-
node.setAttribute("pointer-events", "none");
|
|
355
|
-
ghost.attr(
|
|
356
|
-
"clip-path",
|
|
357
|
-
`url(#gridRectBarMask${w.globals.cuid})`
|
|
358
|
-
);
|
|
359
|
-
elSeries.node.insertBefore(node, elSeries.node.firstChild);
|
|
360
|
-
const start = firstMove(p.d);
|
|
361
|
-
let origin = isHorizontal ? "left center" : "center bottom";
|
|
362
|
-
try {
|
|
363
|
-
const bb = node.getBBox();
|
|
364
|
-
if (start && bb) {
|
|
365
|
-
if (isHorizontal) {
|
|
366
|
-
origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
|
|
367
|
-
} else {
|
|
368
|
-
origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
} catch (_) {
|
|
372
|
-
}
|
|
373
|
-
const style = node.style;
|
|
374
|
-
style.transformBox = "fill-box";
|
|
375
|
-
style.transformOrigin = origin;
|
|
376
|
-
node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
|
|
377
|
-
try {
|
|
378
|
-
const bb = node.getBBox();
|
|
379
|
-
const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
|
|
380
|
-
if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
|
|
381
|
-
} catch (_) {
|
|
382
|
-
}
|
|
383
|
-
const duration = Math.max(1, speed || 1);
|
|
384
|
-
const startAt = performance.now();
|
|
385
|
-
const step = (now) => {
|
|
386
|
-
if (w.globals.isDestroyed || !node.parentNode) return;
|
|
387
|
-
const t = Math.max(0, Math.min(1, (now - startAt) / duration));
|
|
388
|
-
const eased = 1 - Math.pow(1 - t, 3);
|
|
389
|
-
const scale = 1 - eased;
|
|
390
|
-
style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
|
|
391
|
-
style.opacity = String(1 - eased);
|
|
392
|
-
if (t < 1) {
|
|
393
|
-
BrowserAPIs.requestAnimationFrame(step);
|
|
394
|
-
} else {
|
|
395
|
-
node.parentNode.removeChild(node);
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
BrowserAPIs.requestAnimationFrame(step);
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
226
|
class BarDataLabels {
|
|
402
227
|
/**
|
|
403
228
|
* @param {import('../../../charts/Bar').default} barCtx
|
|
@@ -433,7 +258,8 @@ class BarDataLabels {
|
|
|
433
258
|
barXPosition,
|
|
434
259
|
barYPosition,
|
|
435
260
|
visibleSeries,
|
|
436
|
-
hl
|
|
261
|
+
hl,
|
|
262
|
+
noLabel
|
|
437
263
|
} = opts;
|
|
438
264
|
const w = this.w;
|
|
439
265
|
const graphics = new Graphics(this.barCtx.w);
|
|
@@ -547,7 +373,7 @@ class BarDataLabels {
|
|
|
547
373
|
dataLabelsPos.dataLabelsX = (box.levelStart + box.levelEnd) / 2 + offX;
|
|
548
374
|
}
|
|
549
375
|
}
|
|
550
|
-
dataLabels = this.drawCalculatedDataLabels({
|
|
376
|
+
dataLabels = noLabel ? null : this.drawCalculatedDataLabels({
|
|
551
377
|
x: dataLabelsPos.dataLabelsX,
|
|
552
378
|
y: dataLabelsPos.dataLabelsY,
|
|
553
379
|
neg: params.neg,
|
|
@@ -633,8 +459,8 @@ class BarDataLabels {
|
|
|
633
459
|
return ctx && byGroups && byGroups[ctx.groupIndex] ? byGroups[ctx.groupIndex][j] : this.barCtx.stackedSeriesTotals[j];
|
|
634
460
|
}
|
|
635
461
|
/**
|
|
636
|
-
* The running stack at this
|
|
637
|
-
*
|
|
462
|
+
* The running stack at this bar's x (BarStacked `tops`) on a numeric axis,
|
|
463
|
+
* where bars stack by x rather than by index.
|
|
638
464
|
* @param {number} realIndex @param {number} j
|
|
639
465
|
*/
|
|
640
466
|
xStackTop(realIndex, j) {
|
|
@@ -643,6 +469,21 @@ class BarDataLabels {
|
|
|
643
469
|
return w.axisFlags.isXNumeric && /** @type {any} */
|
|
644
470
|
((_b = (_a = this.barCtx.stacks) == null ? void 0 : _a[w.labelData.seriesGroupIndex[realIndex]]) == null ? void 0 : _b.tops.get(w.seriesData.seriesX[realIndex][j]));
|
|
645
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* The stacked total's text box, measured in the total's own font.
|
|
474
|
+
* @param {number} realIndex @param {number} j
|
|
475
|
+
*/
|
|
476
|
+
totalRects(realIndex, j) {
|
|
477
|
+
const s = this.barCtx.barOptions.dataLabels.total.style;
|
|
478
|
+
return new Graphics(this.w).getTextRects(
|
|
479
|
+
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
480
|
+
s.fontSize,
|
|
481
|
+
s.fontFamily,
|
|
482
|
+
void 0,
|
|
483
|
+
true,
|
|
484
|
+
s.fontWeight
|
|
485
|
+
);
|
|
486
|
+
}
|
|
646
487
|
/** @param {{realIndex: any, j: any}} opts */
|
|
647
488
|
getStackedTotalDataLabel({ realIndex, j }) {
|
|
648
489
|
const w = this.w;
|
|
@@ -663,7 +504,6 @@ class BarDataLabels {
|
|
|
663
504
|
var _a;
|
|
664
505
|
const w = this.w;
|
|
665
506
|
let {
|
|
666
|
-
i,
|
|
667
507
|
j,
|
|
668
508
|
realIndex,
|
|
669
509
|
y,
|
|
@@ -673,7 +513,6 @@ class BarDataLabels {
|
|
|
673
513
|
textRects,
|
|
674
514
|
dataLabelsX,
|
|
675
515
|
dataLabelsY,
|
|
676
|
-
dataLabelsConfig,
|
|
677
516
|
barDataLabelsConfig,
|
|
678
517
|
barTotalDataLabelsConfig,
|
|
679
518
|
strokeWidth,
|
|
@@ -687,7 +526,7 @@ class BarDataLabels {
|
|
|
687
526
|
barHeight = Math.abs(barHeight);
|
|
688
527
|
const vertical = w.config.plotOptions.bar.dataLabels.orientation === "vertical";
|
|
689
528
|
const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
|
|
690
|
-
i,
|
|
529
|
+
i: realIndex,
|
|
691
530
|
j
|
|
692
531
|
});
|
|
693
532
|
bcx = bcx - strokeWidth / 2;
|
|
@@ -708,7 +547,7 @@ class BarDataLabels {
|
|
|
708
547
|
const offsetDLX = 2;
|
|
709
548
|
dataLabelsX = dataLabelsX + textRects.height / 2 - strokeWidth / 2 - offsetDLX;
|
|
710
549
|
}
|
|
711
|
-
const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[
|
|
550
|
+
const valIsNegative = (_a = opts.neg) != null ? _a : w.seriesData.series[realIndex][j] < 0;
|
|
712
551
|
let newY = y;
|
|
713
552
|
if (this.barCtx.isReversed) {
|
|
714
553
|
newY = y + (valIsNegative ? barHeight : -barHeight);
|
|
@@ -782,16 +621,11 @@ class BarDataLabels {
|
|
|
782
621
|
});
|
|
783
622
|
if (this.hlt) lowestPrevY = this.hlt.edge;
|
|
784
623
|
if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
|
|
785
|
-
const
|
|
786
|
-
const graphics = new Graphics(this.barCtx.w);
|
|
787
|
-
const totalLabeltextRects = graphics.getTextRects(
|
|
788
|
-
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
789
|
-
dataLabelsConfig.fontSize
|
|
790
|
-
);
|
|
624
|
+
const h = this.totalRects(realIndex, j).height;
|
|
791
625
|
if (valIsNegative) {
|
|
792
|
-
totalDataLabelsY = lowestPrevY
|
|
626
|
+
totalDataLabelsY = lowestPrevY + h * 0.77 - offY - barTotalDataLabelsConfig.offsetY;
|
|
793
627
|
} else {
|
|
794
|
-
totalDataLabelsY = lowestPrevY
|
|
628
|
+
totalDataLabelsY = lowestPrevY - h * 0.3 + offY + barTotalDataLabelsConfig.offsetY;
|
|
795
629
|
}
|
|
796
630
|
const xDivision = dataPointsDividedWidth;
|
|
797
631
|
totalDataLabelsX = totalDataLabelsBcx + (w.axisFlags.isXNumeric ? -barWidth / 2 : barWidth / 2 - xDivision) + barTotalDataLabelsConfig.offsetX;
|
|
@@ -821,7 +655,6 @@ class BarDataLabels {
|
|
|
821
655
|
const w = this.w;
|
|
822
656
|
let {
|
|
823
657
|
x,
|
|
824
|
-
i,
|
|
825
658
|
j,
|
|
826
659
|
realIndex,
|
|
827
660
|
bcy,
|
|
@@ -838,7 +671,7 @@ class BarDataLabels {
|
|
|
838
671
|
} = opts;
|
|
839
672
|
const dataPointsDividedHeight = w.layout.gridHeight / w.globals.dataPoints;
|
|
840
673
|
const { zeroEncounters } = this.barCtx.barHelpers.getZeroValueEncounters({
|
|
841
|
-
i,
|
|
674
|
+
i: realIndex,
|
|
842
675
|
j
|
|
843
676
|
});
|
|
844
677
|
barWidth = Math.abs(barWidth);
|
|
@@ -855,7 +688,7 @@ class BarDataLabels {
|
|
|
855
688
|
let totalDataLabelsX;
|
|
856
689
|
let totalDataLabelsY;
|
|
857
690
|
let totalDataLabelsAnchor = "start";
|
|
858
|
-
const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[
|
|
691
|
+
const valIsNegative = (_b = opts.neg) != null ? _b : w.seriesData.series[realIndex][j] < 0;
|
|
859
692
|
let newX = x;
|
|
860
693
|
if (this.barCtx.isReversed) {
|
|
861
694
|
newX = x + (valIsNegative ? -barWidth : barWidth);
|
|
@@ -890,10 +723,14 @@ class BarDataLabels {
|
|
|
890
723
|
}
|
|
891
724
|
let lowestPrevX = newX;
|
|
892
725
|
const totalGroupCtx = this.getTotalGroupContext(realIndex);
|
|
893
|
-
const
|
|
726
|
+
const top = this.xStackTop(realIndex, j);
|
|
727
|
+
const stacks = top ? [] : (
|
|
894
728
|
/** @type {any} */
|
|
895
729
|
this.barCtx.stacks || []
|
|
896
730
|
);
|
|
731
|
+
if (top) {
|
|
732
|
+
lowestPrevX = valIsNegative ? Math.min(newX, top[4]) : Math.max(newX, top[5]);
|
|
733
|
+
}
|
|
897
734
|
stacks.forEach((g, gi) => {
|
|
898
735
|
if (totalGroupCtx && gi !== totalGroupCtx.groupIndex) return;
|
|
899
736
|
g.prevX.forEach((arr) => {
|
|
@@ -906,11 +743,7 @@ class BarDataLabels {
|
|
|
906
743
|
});
|
|
907
744
|
if (this.hlt) lowestPrevX = this.hlt.edge;
|
|
908
745
|
if (this.drawsStackedTotal(realIndex) && barTotalDataLabelsConfig.enabled) {
|
|
909
|
-
const
|
|
910
|
-
const totalLabeltextRects = graphics.getTextRects(
|
|
911
|
-
this.getStackedTotalDataLabel({ realIndex, j }),
|
|
912
|
-
dataLabelsConfig.fontSize
|
|
913
|
-
);
|
|
746
|
+
const totalLabeltextRects = this.totalRects(realIndex, j);
|
|
914
747
|
if (valIsNegative) {
|
|
915
748
|
totalDataLabelsX = lowestPrevX - strokeWidth - offX - barTotalDataLabelsConfig.offsetX;
|
|
916
749
|
totalDataLabelsAnchor = "end";
|
|
@@ -979,8 +812,9 @@ class BarDataLabels {
|
|
|
979
812
|
let elDataLabelsWrap = null;
|
|
980
813
|
const isSeriesCollapsed = w.globals.collapsedSeriesIndices.indexOf(i) > -1;
|
|
981
814
|
const isSeriesCollapsing = (w.globals.collapsingSeriesIndices || []).indexOf(i) > -1;
|
|
815
|
+
const dlKey = `${i}::${this.barCtx._keys(i)[j]}`;
|
|
982
816
|
if (isSeriesCollapsing) {
|
|
983
|
-
const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(
|
|
817
|
+
const prev = (_a = w.globals.prevDataLabels) == null ? void 0 : _a.get(dlKey);
|
|
984
818
|
if (prev && isFinite(prev.val)) {
|
|
985
819
|
val = prev.val;
|
|
986
820
|
text = void 0;
|
|
@@ -993,10 +827,7 @@ class BarDataLabels {
|
|
|
993
827
|
});
|
|
994
828
|
const dlCfg = w.config.dataLabels;
|
|
995
829
|
if (((_b = dlCfg.animate) == null ? void 0 : _b.enabled) || ((_c = dlCfg.countUp) == null ? void 0 : _c.enabled)) {
|
|
996
|
-
elDataLabelsWrap.node.setAttribute(
|
|
997
|
-
"data:dlKey",
|
|
998
|
-
`${i}::${datumKey(w, i, j)}`
|
|
999
|
-
);
|
|
830
|
+
elDataLabelsWrap.node.setAttribute("data:dlKey", dlKey);
|
|
1000
831
|
elDataLabelsWrap.node.setAttribute("data:dlJ", String(j));
|
|
1001
832
|
if (typeof val === "number" && isFinite(val)) {
|
|
1002
833
|
elDataLabelsWrap.node.setAttribute("data:dlVal", String(val));
|
|
@@ -1014,29 +845,12 @@ class BarDataLabels {
|
|
|
1014
845
|
if (!val && w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
1015
846
|
text = "";
|
|
1016
847
|
}
|
|
1017
|
-
|
|
1018
|
-
const position = w.config.plotOptions.bar.dataLabels.position;
|
|
848
|
+
let anchor = dataLabelsConfig.textAnchor;
|
|
1019
849
|
if (w.config.plotOptions.bar.dataLabels.orientation === "vertical") {
|
|
1020
|
-
|
|
1021
|
-
if (valIsNegative) dataLabelsConfig.textAnchor = "end";
|
|
1022
|
-
else dataLabelsConfig.textAnchor = "start";
|
|
1023
|
-
}
|
|
1024
|
-
if (position === "center") {
|
|
1025
|
-
dataLabelsConfig.textAnchor = "middle";
|
|
1026
|
-
}
|
|
1027
|
-
if (position === "bottom") {
|
|
1028
|
-
if (valIsNegative) dataLabelsConfig.textAnchor = "end";
|
|
1029
|
-
else dataLabelsConfig.textAnchor = "start";
|
|
1030
|
-
}
|
|
850
|
+
anchor = w.config.plotOptions.bar.dataLabels.position === "center" ? "middle" : (neg != null ? neg : w.seriesData.series[i][j] < 0) ? "end" : "start";
|
|
1031
851
|
}
|
|
1032
|
-
if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels) {
|
|
1033
|
-
|
|
1034
|
-
text,
|
|
1035
|
-
parseFloat(dataLabelsConfig.style.fontSize).toString()
|
|
1036
|
-
);
|
|
1037
|
-
if (barWidth < txRect.width) {
|
|
1038
|
-
text = "";
|
|
1039
|
-
}
|
|
852
|
+
if (this.barCtx.isRangeBar && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && barWidth < textRects.width) {
|
|
853
|
+
text = "";
|
|
1040
854
|
}
|
|
1041
855
|
if (w.config.chart.stacked && this.barCtx.barOptions.dataLabels.hideOverflowingLabels && // A collapsing series is measured against its NEW extent, which is
|
|
1042
856
|
// already zero, so this would blank a label whose bar is still at full
|
|
@@ -1052,14 +866,14 @@ class BarDataLabels {
|
|
|
1052
866
|
}
|
|
1053
867
|
}
|
|
1054
868
|
}
|
|
1055
|
-
const modifiedDataLabelsConfig = __spreadValues({}, dataLabelsConfig)
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
869
|
+
const modifiedDataLabelsConfig = __spreadProps(__spreadValues({}, dataLabelsConfig), {
|
|
870
|
+
textAnchor: anchor
|
|
871
|
+
});
|
|
872
|
+
if (this.barCtx.isHorizontal && val < 0) {
|
|
873
|
+
if (anchor === "start") {
|
|
874
|
+
modifiedDataLabelsConfig.textAnchor = "end";
|
|
875
|
+
} else if (anchor === "end") {
|
|
876
|
+
modifiedDataLabelsConfig.textAnchor = "start";
|
|
1063
877
|
}
|
|
1064
878
|
}
|
|
1065
879
|
dataLabels.plotDataLabelsText({
|
|
@@ -1111,7 +925,7 @@ class BarDataLabels {
|
|
|
1111
925
|
const { groupIndex } = this.barCtx.barHelpers.getGroupIndex(realIndex);
|
|
1112
926
|
totalDataLabelText.node.setAttribute(
|
|
1113
927
|
"data:dlTotalKey",
|
|
1114
|
-
`${groupIndex}::${
|
|
928
|
+
`${groupIndex}::${this.barCtx._keys(realIndex)[j]}`
|
|
1115
929
|
);
|
|
1116
930
|
totalDataLabelText.node.setAttribute(
|
|
1117
931
|
"data:dlTotalSeries",
|
|
@@ -1127,6 +941,7 @@ class BarDataLabels {
|
|
|
1127
941
|
}
|
|
1128
942
|
const Series = _core.__apex_Series;
|
|
1129
943
|
const Fill = _core.__apex_Fill;
|
|
944
|
+
const CoreUtils = _core.__apex_CoreUtils;
|
|
1130
945
|
function isHistogramOverlay(w) {
|
|
1131
946
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1132
947
|
if (((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.chart) == null ? void 0 : _b.requestedType) !== "histogram") return false;
|
|
@@ -1143,9 +958,11 @@ class Helpers {
|
|
|
1143
958
|
}
|
|
1144
959
|
/**
|
|
1145
960
|
* @param {any[]} series
|
|
961
|
+
* @param {any} [seriesIndex] a combo's real indices of `series`
|
|
1146
962
|
*/
|
|
1147
|
-
initVariables(series) {
|
|
963
|
+
initVariables(series, seriesIndex) {
|
|
1148
964
|
const w = this.w;
|
|
965
|
+
this.seriesIndex = seriesIndex;
|
|
1149
966
|
this.barCtx.series = series;
|
|
1150
967
|
this.barCtx.totalItems = 0;
|
|
1151
968
|
this.barCtx.seriesLen = 0;
|
|
@@ -1166,6 +983,8 @@ class Helpers {
|
|
|
1166
983
|
this.barCtx.visibleItems = w.globals.dataPoints;
|
|
1167
984
|
}
|
|
1168
985
|
}
|
|
986
|
+
const labels = w.labelData.labels;
|
|
987
|
+
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;
|
|
1169
988
|
this.arrBorderRadius = this.createBorderRadiusArr(w.seriesData.series);
|
|
1170
989
|
if (Utils.isSafari()) {
|
|
1171
990
|
this.arrBorderRadius = this.arrBorderRadius.map(
|
|
@@ -1230,15 +1049,19 @@ class Helpers {
|
|
|
1230
1049
|
* Collapsed series count too, exactly as they did for `minXDiff`. Skipping
|
|
1231
1050
|
* them would widen every bar the moment someone hid the tightest-spaced
|
|
1232
1051
|
* series from the legend, so bar geometry would depend on legend state.
|
|
1052
|
+
* In a combo only this renderer's own series count: a line's x values say
|
|
1053
|
+
* nothing about how wide a column may be.
|
|
1233
1054
|
*
|
|
1234
1055
|
* @returns {number}
|
|
1235
1056
|
*/
|
|
1236
1057
|
_unionMinXGap() {
|
|
1237
1058
|
const w = this.w;
|
|
1238
1059
|
const seriesX = w.seriesData.seriesX || [];
|
|
1060
|
+
const own = this.seriesIndex;
|
|
1239
1061
|
const arrays = [];
|
|
1240
1062
|
for (let i = 0; i < seriesX.length; i++) {
|
|
1241
1063
|
const xs = seriesX[i];
|
|
1064
|
+
if (own && own.indexOf(i) < 0) continue;
|
|
1242
1065
|
if (Array.isArray(xs) && xs.length > 0) {
|
|
1243
1066
|
arrays.push(
|
|
1244
1067
|
xs.some((v, n) => v < xs[n - 1]) ? xs.filter((v) => v === +v).sort((a, b) => a - b) : xs
|
|
@@ -1279,6 +1102,15 @@ class Helpers {
|
|
|
1279
1102
|
}
|
|
1280
1103
|
return isFinite(min) ? min : 0;
|
|
1281
1104
|
}
|
|
1105
|
+
/**
|
|
1106
|
+
* The band a horizontal bar is drawn in: its x's band when the series do
|
|
1107
|
+
* not line up by index (see initVariables), else its index.
|
|
1108
|
+
* @param {number} realIndex @param {number} j
|
|
1109
|
+
*/
|
|
1110
|
+
barRow(realIndex, j) {
|
|
1111
|
+
var _a, _b, _c;
|
|
1112
|
+
return (_c = (_b = this.rows) == null ? void 0 : _b.get((_a = this.w.seriesData.seriesX[realIndex]) == null ? void 0 : _a[j])) != null ? _c : j;
|
|
1113
|
+
}
|
|
1282
1114
|
/**
|
|
1283
1115
|
* @param {number} realIndex
|
|
1284
1116
|
*/
|
|
@@ -1401,7 +1233,7 @@ class Helpers {
|
|
|
1401
1233
|
});
|
|
1402
1234
|
}
|
|
1403
1235
|
const connectorFill = this.getDumbbellConnectorFill(i, j);
|
|
1404
|
-
const datumFill = connectorFill || ((_a = w.config.series[
|
|
1236
|
+
const datumFill = connectorFill || ((_a = w.config.series[realIndex].data[j]) == null ? void 0 : _a.fill);
|
|
1405
1237
|
const connector = this.barCtx.barOptions.isDumbbell ? w.config.plotOptions.bar.dumbbell.connector : null;
|
|
1406
1238
|
let connectorOpacity;
|
|
1407
1239
|
if (connector && connector.color) {
|
|
@@ -1554,11 +1386,10 @@ class Helpers {
|
|
|
1554
1386
|
* @returns {string[][]}
|
|
1555
1387
|
*/
|
|
1556
1388
|
createBorderRadiusArr(series) {
|
|
1557
|
-
var _a;
|
|
1558
1389
|
const w = this.w;
|
|
1559
1390
|
const alwaysApplyRadius = !this.w.config.chart.stacked || w.config.plotOptions.bar.borderRadius <= 0;
|
|
1560
1391
|
const numSeries = series.length;
|
|
1561
|
-
const numColumns = (
|
|
1392
|
+
const numColumns = Math.max(0, ...series.map((s) => (s == null ? void 0 : s.length) | 0));
|
|
1562
1393
|
const output = Array.from(
|
|
1563
1394
|
{ length: numSeries },
|
|
1564
1395
|
() => Array(numColumns).fill(alwaysApplyRadius ? "top" : "none")
|
|
@@ -1714,7 +1545,7 @@ class Helpers {
|
|
|
1714
1545
|
j,
|
|
1715
1546
|
w
|
|
1716
1547
|
}) {
|
|
1717
|
-
var _a, _b;
|
|
1548
|
+
var _a, _b, _c;
|
|
1718
1549
|
const r = this.barRect({
|
|
1719
1550
|
a: barXPosition,
|
|
1720
1551
|
len: barWidth,
|
|
@@ -1745,7 +1576,7 @@ class Helpers {
|
|
|
1745
1576
|
const _ctx = this.barCtx.groupCtx;
|
|
1746
1577
|
_ctx.yArrj.push(y2 - strokeCenter * direction);
|
|
1747
1578
|
_ctx.yArrjF.push(Math.abs(y1 - y2 + r.strokeWidth * direction));
|
|
1748
|
-
_ctx.yArrjVal.push(this.barCtx.series[i][j]);
|
|
1579
|
+
_ctx.yArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
|
|
1749
1580
|
}
|
|
1750
1581
|
return {
|
|
1751
1582
|
pathTo,
|
|
@@ -1935,7 +1766,7 @@ class Helpers {
|
|
|
1935
1766
|
j,
|
|
1936
1767
|
w
|
|
1937
1768
|
}) {
|
|
1938
|
-
var _a, _b;
|
|
1769
|
+
var _a, _b, _c;
|
|
1939
1770
|
const graphics = new Graphics(this.barCtx.w);
|
|
1940
1771
|
const r = this.barRect({
|
|
1941
1772
|
a: barYPosition,
|
|
@@ -1971,7 +1802,7 @@ class Helpers {
|
|
|
1971
1802
|
const _ctx = this.barCtx.groupCtx;
|
|
1972
1803
|
_ctx.xArrj.push(x2 + strokeCenter * direction);
|
|
1973
1804
|
_ctx.xArrjF.push(Math.abs(x1 - x2 - r.strokeWidth * direction));
|
|
1974
|
-
_ctx.xArrjVal.push(this.barCtx.series[i][j]);
|
|
1805
|
+
_ctx.xArrjVal.push((_c = this.barCtx.series[i][j]) != null ? _c : null);
|
|
1975
1806
|
}
|
|
1976
1807
|
return {
|
|
1977
1808
|
pathTo,
|
|
@@ -2016,6 +1847,9 @@ class Helpers {
|
|
|
2016
1847
|
const w = this.w;
|
|
2017
1848
|
const goals = [];
|
|
2018
1849
|
const pushGoal = (value, attrs) => {
|
|
1850
|
+
if (!w.globals.invalidLogScale) {
|
|
1851
|
+
value = new CoreUtils(w).getLogValAtSeriesIndex(value, i);
|
|
1852
|
+
}
|
|
2019
1853
|
goals.push({
|
|
2020
1854
|
[type]: type === "x" ? this.getXForValue(value, zeroW, false) : this.getYForValue(value, zeroH, translationsIndex, false),
|
|
2021
1855
|
attrs
|
|
@@ -2270,11 +2104,11 @@ class Helpers {
|
|
|
2270
2104
|
let zeroEncounters = 0;
|
|
2271
2105
|
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)) || [];
|
|
2272
2106
|
seriesIndices.forEach((_si) => {
|
|
2273
|
-
const val = w.
|
|
2107
|
+
const val = w.seriesData.series[_si][j];
|
|
2274
2108
|
if (val) {
|
|
2275
2109
|
nonZeroColumns++;
|
|
2276
2110
|
}
|
|
2277
|
-
if (_si < i && val
|
|
2111
|
+
if (_si < i && !val) {
|
|
2278
2112
|
zeroEncounters++;
|
|
2279
2113
|
}
|
|
2280
2114
|
});
|
|
@@ -2311,8 +2145,187 @@ class Helpers {
|
|
|
2311
2145
|
return { groupIndex, columnGroupIndex };
|
|
2312
2146
|
}
|
|
2313
2147
|
}
|
|
2314
|
-
const CoreUtils = _core.__apex_CoreUtils;
|
|
2315
2148
|
const Filters = _core.__apex_Filters;
|
|
2149
|
+
const Animations = _core.__apex_Animations;
|
|
2150
|
+
const computeStagger = _core.__apex_Animations_computeStagger;
|
|
2151
|
+
const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
|
|
2152
|
+
const Environment = _core.__apex_Environment_Environment;
|
|
2153
|
+
function lengthTransitionEnabled(w) {
|
|
2154
|
+
var _a;
|
|
2155
|
+
const anim = w.config.chart.animations;
|
|
2156
|
+
if (!anim || anim.enabled === false) return false;
|
|
2157
|
+
if (!anim.dynamicAnimation || anim.dynamicAnimation.enabled === false) {
|
|
2158
|
+
return false;
|
|
2159
|
+
}
|
|
2160
|
+
const largeThreshold = (_a = anim.largeDatasetThreshold) != null ? _a : 0;
|
|
2161
|
+
if (largeThreshold > 0 && w.globals.dataPoints > largeThreshold) return false;
|
|
2162
|
+
return !!(Environment.isBrowser() && w.globals.dataChanged && w.globals.shouldAnimate);
|
|
2163
|
+
}
|
|
2164
|
+
function datumKey(w, realIndex, j) {
|
|
2165
|
+
var _a, _b, _c, _d;
|
|
2166
|
+
if ((_a = w.axisFlags) == null ? void 0 : _a.isXNumeric) {
|
|
2167
|
+
const sx = (_c = (_b = w.seriesData) == null ? void 0 : _b.seriesX) == null ? void 0 : _c[realIndex];
|
|
2168
|
+
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
2169
|
+
}
|
|
2170
|
+
const lbl = (_d = w.globals.labels) == null ? void 0 : _d[j];
|
|
2171
|
+
if (lbl != null && String(lbl) !== "") {
|
|
2172
|
+
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
2173
|
+
}
|
|
2174
|
+
return "j:" + j;
|
|
2175
|
+
}
|
|
2176
|
+
function frameDatumKey(frame, realIndex, j) {
|
|
2177
|
+
var _a, _b;
|
|
2178
|
+
if (frame.isXNumeric) {
|
|
2179
|
+
const sx = (_a = frame.seriesX) == null ? void 0 : _a[realIndex];
|
|
2180
|
+
if (sx && sx.length && sx[j] != null) return "x:" + sx[j];
|
|
2181
|
+
}
|
|
2182
|
+
const lbl = (_b = frame.labels) == null ? void 0 : _b[j];
|
|
2183
|
+
if (lbl != null && String(lbl) !== "") {
|
|
2184
|
+
return "c:" + (Array.isArray(lbl) ? lbl.join(" ") : String(lbl));
|
|
2185
|
+
}
|
|
2186
|
+
return "j:" + j;
|
|
2187
|
+
}
|
|
2188
|
+
function joinKeys(oldKeys, newKeys) {
|
|
2189
|
+
const oldIndex = /* @__PURE__ */ new Map();
|
|
2190
|
+
oldKeys.forEach((k, i) => {
|
|
2191
|
+
if (!oldIndex.has(k)) oldIndex.set(k, i);
|
|
2192
|
+
});
|
|
2193
|
+
const toOld = new Array(newKeys.length);
|
|
2194
|
+
const usedOld = /* @__PURE__ */ new Set();
|
|
2195
|
+
let prev = -1;
|
|
2196
|
+
let ordered = true;
|
|
2197
|
+
let identity = oldKeys.length === newKeys.length;
|
|
2198
|
+
newKeys.forEach((k, i) => {
|
|
2199
|
+
const oi = oldIndex.has(k) && !usedOld.has(oldIndex.get(k)) ? oldIndex.get(k) : -1;
|
|
2200
|
+
toOld[i] = oi;
|
|
2201
|
+
if (oi !== -1) {
|
|
2202
|
+
usedOld.add(oi);
|
|
2203
|
+
if (oi < prev) ordered = false;
|
|
2204
|
+
prev = oi;
|
|
2205
|
+
}
|
|
2206
|
+
if (oi !== i) identity = false;
|
|
2207
|
+
});
|
|
2208
|
+
const exits = [];
|
|
2209
|
+
for (let i = 0; i < oldKeys.length; i++) {
|
|
2210
|
+
if (!usedOld.has(i)) exits.push(i);
|
|
2211
|
+
}
|
|
2212
|
+
return { toOld, exits, ordered, changed: !identity };
|
|
2213
|
+
}
|
|
2214
|
+
function uniquifyKeys(keys) {
|
|
2215
|
+
const seen = /* @__PURE__ */ new Map();
|
|
2216
|
+
return keys.map((k) => {
|
|
2217
|
+
const count = seen.get(k) || 0;
|
|
2218
|
+
seen.set(k, count + 1);
|
|
2219
|
+
return count === 0 ? k : `${k}#${count}`;
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
function seriesKeys(w, realIndex, n = ((_a) => (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length)() | 0) {
|
|
2223
|
+
return uniquifyKeys(
|
|
2224
|
+
Array.from({ length: n }, (_, j) => datumKey(w, realIndex, j))
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
function seriesJoin(w, realIndex, includeIdentity = false, allowReorder = false) {
|
|
2228
|
+
var _a, _b;
|
|
2229
|
+
if (!lengthTransitionEnabled(w)) return null;
|
|
2230
|
+
const frame = w.globals.prevStreamFrame;
|
|
2231
|
+
if (!frame) return null;
|
|
2232
|
+
const oldY = (_a = frame.seriesY) == null ? void 0 : _a[realIndex];
|
|
2233
|
+
const newY = (_b = w.seriesData.series) == null ? void 0 : _b[realIndex];
|
|
2234
|
+
if (!Array.isArray(oldY) || !Array.isArray(newY)) return null;
|
|
2235
|
+
if (!oldY.length || !newY.length) return null;
|
|
2236
|
+
const oldKeys = uniquifyKeys(
|
|
2237
|
+
oldY.map((_, j) => frameDatumKey(frame, realIndex, j))
|
|
2238
|
+
);
|
|
2239
|
+
const newKeys = seriesKeys(w, realIndex);
|
|
2240
|
+
const join = joinKeys(oldKeys, newKeys);
|
|
2241
|
+
if (!join.ordered && !allowReorder) return null;
|
|
2242
|
+
if (!join.changed && !includeIdentity) return null;
|
|
2243
|
+
return { join, oldKeys, newKeys };
|
|
2244
|
+
}
|
|
2245
|
+
function firstMove(d) {
|
|
2246
|
+
const m = /^M\s*([+-]?[\d.eE]+)[\s,]+([+-]?[\d.eE]+)/.exec(d || "");
|
|
2247
|
+
if (!m) return null;
|
|
2248
|
+
const x = parseFloat(m[1]);
|
|
2249
|
+
const y = parseFloat(m[2]);
|
|
2250
|
+
return isFinite(x) && isFinite(y) ? { x, y } : null;
|
|
2251
|
+
}
|
|
2252
|
+
function renderBarExitGhosts({
|
|
2253
|
+
w,
|
|
2254
|
+
elSeries,
|
|
2255
|
+
record,
|
|
2256
|
+
newKeys,
|
|
2257
|
+
isHorizontal,
|
|
2258
|
+
speed
|
|
2259
|
+
}) {
|
|
2260
|
+
var _a;
|
|
2261
|
+
if (!lengthTransitionEnabled(w)) return;
|
|
2262
|
+
if (!record || !Array.isArray(record.paths) || !(elSeries == null ? void 0 : elSeries.node)) return;
|
|
2263
|
+
const newKeySet = new Set(newKeys);
|
|
2264
|
+
const exits = record.paths.filter(
|
|
2265
|
+
(p) => p && p.d && p.key != null && !newKeySet.has(p.key)
|
|
2266
|
+
);
|
|
2267
|
+
if (!exits.length) return;
|
|
2268
|
+
const graphics = new Graphics(w);
|
|
2269
|
+
const fallbackFill = (_a = w.globals.colors) == null ? void 0 : _a[parseInt(String(record.realIndex), 10)];
|
|
2270
|
+
exits.forEach((p) => {
|
|
2271
|
+
let fill = p.fill || fallbackFill || "#c8c8c8";
|
|
2272
|
+
if (String(fill).indexOf("url(") === 0) fill = fallbackFill || "#c8c8c8";
|
|
2273
|
+
const ghost = graphics.drawPath({
|
|
2274
|
+
d: p.d,
|
|
2275
|
+
stroke: "none",
|
|
2276
|
+
strokeWidth: 0,
|
|
2277
|
+
fill,
|
|
2278
|
+
fillOpacity: 1,
|
|
2279
|
+
classes: "apexcharts-bar-ghost"
|
|
2280
|
+
});
|
|
2281
|
+
const node = ghost.node;
|
|
2282
|
+
node.setAttribute("pointer-events", "none");
|
|
2283
|
+
ghost.attr(
|
|
2284
|
+
"clip-path",
|
|
2285
|
+
`url(#gridRectBarMask${w.globals.cuid})`
|
|
2286
|
+
);
|
|
2287
|
+
elSeries.node.insertBefore(node, elSeries.node.firstChild);
|
|
2288
|
+
const start = firstMove(p.d);
|
|
2289
|
+
let origin = isHorizontal ? "left center" : "center bottom";
|
|
2290
|
+
try {
|
|
2291
|
+
const bb = node.getBBox();
|
|
2292
|
+
if (start && bb) {
|
|
2293
|
+
if (isHorizontal) {
|
|
2294
|
+
origin = Math.abs(start.x - bb.x) <= Math.abs(start.x - (bb.x + bb.width)) ? "left center" : "right center";
|
|
2295
|
+
} else {
|
|
2296
|
+
origin = Math.abs(start.y - (bb.y + bb.height)) <= Math.abs(start.y - bb.y) ? "center bottom" : "center top";
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
} catch (_) {
|
|
2300
|
+
}
|
|
2301
|
+
const style = node.style;
|
|
2302
|
+
style.transformBox = "fill-box";
|
|
2303
|
+
style.transformOrigin = origin;
|
|
2304
|
+
node.setAttribute("data:ghostKey", `${record.realIndex}::${p.key}`);
|
|
2305
|
+
try {
|
|
2306
|
+
const bb = node.getBBox();
|
|
2307
|
+
const edge = isHorizontal ? origin.startsWith("left") ? bb.x : bb.x + bb.width : origin.endsWith("bottom") ? bb.y + bb.height : bb.y;
|
|
2308
|
+
if (isFinite(edge)) node.setAttribute("data:ghostEdge", String(edge));
|
|
2309
|
+
} catch (_) {
|
|
2310
|
+
}
|
|
2311
|
+
const duration = Math.max(1, speed || 1);
|
|
2312
|
+
const startAt = performance.now();
|
|
2313
|
+
const step = (now) => {
|
|
2314
|
+
if (w.globals.isDestroyed || !node.parentNode) return;
|
|
2315
|
+
const t = Math.max(0, Math.min(1, (now - startAt) / duration));
|
|
2316
|
+
const eased = 1 - Math.pow(1 - t, 3);
|
|
2317
|
+
const scale = 1 - eased;
|
|
2318
|
+
style.transform = isHorizontal ? `scaleX(${scale})` : `scaleY(${scale})`;
|
|
2319
|
+
style.opacity = String(1 - eased);
|
|
2320
|
+
if (t < 1) {
|
|
2321
|
+
BrowserAPIs.requestAnimationFrame(step);
|
|
2322
|
+
} else {
|
|
2323
|
+
node.parentNode.removeChild(node);
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
BrowserAPIs.requestAnimationFrame(step);
|
|
2327
|
+
});
|
|
2328
|
+
}
|
|
2316
2329
|
class AxisMapping {
|
|
2317
2330
|
/**
|
|
2318
2331
|
* Pixels per data-unit on the x-axis. Derived from `minX..maxX` so it is the
|
|
@@ -2343,22 +2356,55 @@ class AxisMapping {
|
|
|
2343
2356
|
return w.globals.minX + px * AxisMapping.xRatio(w);
|
|
2344
2357
|
}
|
|
2345
2358
|
/**
|
|
2346
|
-
*
|
|
2347
|
-
*
|
|
2348
|
-
*
|
|
2349
|
-
*
|
|
2350
|
-
*
|
|
2359
|
+
* The plot area on screen, in client px: its corner is where the plot's
|
|
2360
|
+
* group is translated to (translateX, translateY into the svg), and it is
|
|
2361
|
+
* gridWidth by gridHeight. The one screen-to-plot measurement: the tooltip,
|
|
2362
|
+
* zoom, selection and every other pointer reader map through it, so x and y
|
|
2363
|
+
* cannot disagree under CSS zoom.
|
|
2364
|
+
*
|
|
2365
|
+
* Never the `.apexcharts-grid` group's box: a group measures to the union
|
|
2366
|
+
* of what it happens to draw (fact 2 above). The plot's outline starts a
|
|
2367
|
+
* pixel down (`Grid.drawGridArea`), so unless gridlines or row bands reach
|
|
2368
|
+
* the top edge the box starts a pixel below the plot, and on a numeric-x bar
|
|
2369
|
+
* chart the horizontal gridlines run `barPadForNumericAxis` out past both
|
|
2370
|
+
* sides.
|
|
2371
|
+
*
|
|
2372
|
+
* `zoom` is the CSS zoom of any container the chart sits in (screen px per
|
|
2373
|
+
* plot px): the measured svg width over `svgWidth`, the unscaled width it
|
|
2374
|
+
* was drawn at. A distance measured on screen from this corner is divided
|
|
2375
|
+
* by it to land in plot px, the space the series are laid out and painted in.
|
|
2376
|
+
* With nothing mounted to measure, screen px are taken as svg px.
|
|
2377
|
+
*
|
|
2378
|
+
* @param {import('../types/internal').ChartStateW} w
|
|
2379
|
+
* @returns {{ left: number, top: number, width: number, height: number, zoom: number }}
|
|
2380
|
+
*/
|
|
2381
|
+
static plotRect(w) {
|
|
2382
|
+
var _a, _b, _c;
|
|
2383
|
+
const svg = ((_a = w.dom.Paper) == null ? void 0 : _a.node) || ((_b = w.dom.baseEl) == null ? void 0 : _b.querySelector(".apexcharts-svg"));
|
|
2384
|
+
const box = ((_c = svg || w.dom.elWrap) == null ? void 0 : _c.getBoundingClientRect()) || {
|
|
2385
|
+
left: 0,
|
|
2386
|
+
top: 0,
|
|
2387
|
+
width: 0
|
|
2388
|
+
};
|
|
2389
|
+
const zoom = (svg && w.globals.svgWidth ? box.width / w.globals.svgWidth : 1) || 1;
|
|
2390
|
+
return {
|
|
2391
|
+
left: box.left + w.layout.translateX * zoom,
|
|
2392
|
+
top: box.top + w.layout.translateY * zoom,
|
|
2393
|
+
width: w.layout.gridWidth * zoom,
|
|
2394
|
+
height: w.layout.gridHeight * zoom,
|
|
2395
|
+
zoom
|
|
2396
|
+
};
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Client (screen) x -> pixels from the plot origin of {@link plotRect}.
|
|
2400
|
+
* Pass the rect when the caller has already measured it.
|
|
2351
2401
|
* @param {import('../types/internal').ChartStateW} w
|
|
2352
2402
|
* @param {number} screenX
|
|
2403
|
+
* @param {{ left: number, zoom: number }} [plot]
|
|
2353
2404
|
* @returns {number}
|
|
2354
2405
|
*/
|
|
2355
|
-
static screenXToPlotPx(w, screenX) {
|
|
2356
|
-
|
|
2357
|
-
const svg = baseEl && baseEl.querySelector(".apexcharts-svg");
|
|
2358
|
-
if (!svg) return screenX - w.layout.translateX;
|
|
2359
|
-
const svgRect = svg.getBoundingClientRect();
|
|
2360
|
-
const zoom = w.globals.svgWidth ? svgRect.width / w.globals.svgWidth : 1;
|
|
2361
|
-
return (screenX - svgRect.left) / (zoom || 1) - w.layout.translateX;
|
|
2406
|
+
static screenXToPlotPx(w, screenX, plot = AxisMapping.plotRect(w)) {
|
|
2407
|
+
return (screenX - plot.left) / plot.zoom;
|
|
2362
2408
|
}
|
|
2363
2409
|
}
|
|
2364
2410
|
function seriesEmitter(ctx, graphics) {
|
|
@@ -2431,15 +2477,17 @@ class Bar {
|
|
|
2431
2477
|
/**
|
|
2432
2478
|
* Point the per-series axis state at this series' y axis. Every bar-family
|
|
2433
2479
|
* renderer calls it before initialPositions, which reads the baseline by
|
|
2434
|
-
* this.translationsIndex.
|
|
2480
|
+
* this.translationsIndex and flips it for a reversed axis.
|
|
2435
2481
|
* @param {number} realIndex
|
|
2436
2482
|
* @return {number} translationsIndex
|
|
2437
2483
|
*/
|
|
2438
2484
|
setSeriesAxis(realIndex) {
|
|
2485
|
+
var _a;
|
|
2439
2486
|
if (this.yRatio.length > 1) {
|
|
2440
2487
|
this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
|
|
2441
2488
|
this.translationsIndex = realIndex;
|
|
2442
2489
|
}
|
|
2490
|
+
this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
|
|
2443
2491
|
return this.translationsIndex;
|
|
2444
2492
|
}
|
|
2445
2493
|
/** primary draw method which is called on bar object
|
|
@@ -2456,7 +2504,7 @@ class Bar {
|
|
|
2456
2504
|
series = coreUtils.getLogSeries(series);
|
|
2457
2505
|
this.series = series;
|
|
2458
2506
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
2459
|
-
this.barHelpers.initVariables(series);
|
|
2507
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
2460
2508
|
const ret = graphics.group({
|
|
2461
2509
|
class: "apexcharts-bar-series apexcharts-plot-series"
|
|
2462
2510
|
});
|
|
@@ -2488,7 +2536,6 @@ class Bar {
|
|
|
2488
2536
|
this.visibleI = this.visibleI + 1;
|
|
2489
2537
|
}
|
|
2490
2538
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
2491
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
2492
2539
|
if (this.isPyramid) {
|
|
2493
2540
|
this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
|
|
2494
2541
|
}
|
|
@@ -2566,7 +2613,9 @@ class Bar {
|
|
|
2566
2613
|
elSeries
|
|
2567
2614
|
};
|
|
2568
2615
|
if (this.isHorizontal) {
|
|
2569
|
-
paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
|
|
2616
|
+
paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
|
|
2617
|
+
y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
2618
|
+
}), {
|
|
2570
2619
|
barHeight,
|
|
2571
2620
|
zeroW,
|
|
2572
2621
|
yDivision
|
|
@@ -2648,6 +2697,7 @@ class Bar {
|
|
|
2648
2697
|
series,
|
|
2649
2698
|
barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
|
|
2650
2699
|
barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
|
|
2700
|
+
barXPosition: paths.barXPosition,
|
|
2651
2701
|
elDataLabelsWrap,
|
|
2652
2702
|
elGoalsMarkers,
|
|
2653
2703
|
elBarShadows,
|
|
@@ -2658,15 +2708,11 @@ class Bar {
|
|
|
2658
2708
|
w.globals.seriesXvalues[realIndex] = xArrj;
|
|
2659
2709
|
w.globals.seriesYvalues[realIndex] = yArrj;
|
|
2660
2710
|
if (w.globals.previousPaths.length > 0) {
|
|
2661
|
-
const newKeys = [];
|
|
2662
|
-
for (let j = 0; j < series[i].length; j++) {
|
|
2663
|
-
newKeys.push(datumKey(w, realIndex, j));
|
|
2664
|
-
}
|
|
2665
2711
|
renderBarExitGhosts({
|
|
2666
2712
|
w,
|
|
2667
2713
|
elSeries,
|
|
2668
2714
|
record: this._prevRecord(realIndex),
|
|
2669
|
-
newKeys,
|
|
2715
|
+
newKeys: this._keys(realIndex),
|
|
2670
2716
|
isHorizontal: this.isHorizontal,
|
|
2671
2717
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
2672
2718
|
});
|
|
@@ -2675,7 +2721,7 @@ class Bar {
|
|
|
2675
2721
|
}
|
|
2676
2722
|
return ret;
|
|
2677
2723
|
}
|
|
2678
|
-
/** @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 */
|
|
2724
|
+
/** @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 */
|
|
2679
2725
|
renderSeries({
|
|
2680
2726
|
hl,
|
|
2681
2727
|
realIndex,
|
|
@@ -2707,7 +2753,9 @@ class Bar {
|
|
|
2707
2753
|
visibleSeries,
|
|
2708
2754
|
type,
|
|
2709
2755
|
classes,
|
|
2710
|
-
fadeReveal = false
|
|
2756
|
+
fadeReveal = false,
|
|
2757
|
+
noLabel
|
|
2758
|
+
// a datum's extra paths (box halves, box lane) label nothing
|
|
2711
2759
|
}) {
|
|
2712
2760
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2713
2761
|
const w = this.w;
|
|
@@ -2781,7 +2829,8 @@ class Bar {
|
|
|
2781
2829
|
barXPosition,
|
|
2782
2830
|
barYPosition,
|
|
2783
2831
|
visibleSeries,
|
|
2784
|
-
hl: hl == null ? void 0 : hl.label
|
|
2832
|
+
hl: hl == null ? void 0 : hl.label,
|
|
2833
|
+
noLabel
|
|
2785
2834
|
})
|
|
2786
2835
|
);
|
|
2787
2836
|
if (delayMs > 0) {
|
|
@@ -2797,19 +2846,18 @@ class Bar {
|
|
|
2797
2846
|
}
|
|
2798
2847
|
let leaving = false;
|
|
2799
2848
|
if (!w.globals.isBarHorizontal) {
|
|
2800
|
-
|
|
2849
|
+
const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
|
|
2850
|
+
const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
|
|
2851
|
+
if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
|
|
2801
2852
|
if (this._wasOnScreen(realIndex, j)) leaving = true;
|
|
2802
2853
|
else skipDrawing = true;
|
|
2803
2854
|
}
|
|
2804
2855
|
}
|
|
2805
|
-
|
|
2806
|
-
/** @type {
|
|
2807
|
-
w.config.series[
|
|
2808
|
-
|
|
2809
|
-
)
|
|
2810
|
-
lineFill = /** @type {Record<string,any>} */
|
|
2811
|
-
w.config.series[i].data[j].strokeColor;
|
|
2812
|
-
}
|
|
2856
|
+
const datum = (
|
|
2857
|
+
/** @type {any} */
|
|
2858
|
+
w.config.series[realIndex].data[j]
|
|
2859
|
+
);
|
|
2860
|
+
if (datum && datum.strokeColor) lineFill = datum.strokeColor;
|
|
2813
2861
|
const fill = pathFill;
|
|
2814
2862
|
if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
|
|
2815
2863
|
pathFill = "none";
|
|
@@ -2832,7 +2880,7 @@ class Bar {
|
|
|
2832
2880
|
pathTo,
|
|
2833
2881
|
stroke: lineFill,
|
|
2834
2882
|
strokeWidth,
|
|
2835
|
-
|
|
2883
|
+
strokeLinecap: w.config.stroke.lineCap,
|
|
2836
2884
|
fill: pathFill,
|
|
2837
2885
|
pathToInterp,
|
|
2838
2886
|
animationDelay: delay,
|
|
@@ -2884,12 +2932,12 @@ class Bar {
|
|
|
2884
2932
|
cy: dataLabelsObj.dataLabelsPos.bcy,
|
|
2885
2933
|
cx: dataLabelsObj.dataLabelsPos.bcx,
|
|
2886
2934
|
j,
|
|
2887
|
-
val: w.seriesData.series[
|
|
2935
|
+
val: w.seriesData.series[realIndex][j],
|
|
2888
2936
|
barHeight,
|
|
2889
2937
|
barWidth,
|
|
2890
2938
|
// Datum identity for the next update's keyed join (see
|
|
2891
2939
|
// LengthTransition): survivors match by key, not array position.
|
|
2892
|
-
"data:pathKey":
|
|
2940
|
+
"data:pathKey": this._keys(realIndex)[j]
|
|
2893
2941
|
});
|
|
2894
2942
|
hl == null ? void 0 : hl.paint(renderedPath, {
|
|
2895
2943
|
delay,
|
|
@@ -2965,7 +3013,10 @@ class Bar {
|
|
|
2965
3013
|
const j = indexes.j;
|
|
2966
3014
|
let barYPosition;
|
|
2967
3015
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
2968
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
3016
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
3017
|
+
i: indexes.realIndex,
|
|
3018
|
+
j
|
|
3019
|
+
});
|
|
2969
3020
|
if (nonZeroColumns > 0) {
|
|
2970
3021
|
barHeight = this.seriesLen * barHeight / nonZeroColumns;
|
|
2971
3022
|
}
|
|
@@ -3104,7 +3155,7 @@ class Bar {
|
|
|
3104
3155
|
barXPosition = xForNumericX.barXPosition;
|
|
3105
3156
|
} else {
|
|
3106
3157
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
3107
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
|
|
3158
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
|
|
3108
3159
|
if (nonZeroColumns > 0) {
|
|
3109
3160
|
barWidth = this.seriesLen * barWidth / nonZeroColumns;
|
|
3110
3161
|
}
|
|
@@ -3168,15 +3219,16 @@ class Bar {
|
|
|
3168
3219
|
/** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
|
|
3169
3220
|
getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
|
|
3170
3221
|
const w = this.w;
|
|
3222
|
+
const overlay = isHistogramOverlay(w);
|
|
3171
3223
|
let sxI = realIndex;
|
|
3172
3224
|
if (!w.seriesData.seriesX[realIndex].length) {
|
|
3173
3225
|
sxI = w.globals.maxValsInArrayIndex;
|
|
3174
3226
|
}
|
|
3175
3227
|
if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
|
|
3176
|
-
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
|
|
3228
|
+
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
|
|
3177
3229
|
}
|
|
3178
3230
|
return {
|
|
3179
|
-
barXPosition: x + (
|
|
3231
|
+
barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
|
|
3180
3232
|
x
|
|
3181
3233
|
};
|
|
3182
3234
|
}
|
|
@@ -3197,7 +3249,20 @@ class Bar {
|
|
|
3197
3249
|
_wasOnScreen(realIndex, j) {
|
|
3198
3250
|
if (!lengthTransitionEnabled(this.w)) return false;
|
|
3199
3251
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3200
|
-
return !!keyed && keyed.has(
|
|
3252
|
+
return !!keyed && keyed.has(this._keys(realIndex)[j]);
|
|
3253
|
+
}
|
|
3254
|
+
/**
|
|
3255
|
+
* This render's datum keys for a series (see seriesKeys), as stamped on
|
|
3256
|
+
* each bar and looked up in the previous render's.
|
|
3257
|
+
* @param {number} realIndex
|
|
3258
|
+
* @returns {string[]}
|
|
3259
|
+
*/
|
|
3260
|
+
_keys(realIndex) {
|
|
3261
|
+
const c = (
|
|
3262
|
+
/** @type {any} */
|
|
3263
|
+
this._keyCache || (this._keyCache = {})
|
|
3264
|
+
);
|
|
3265
|
+
return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
|
|
3201
3266
|
}
|
|
3202
3267
|
/**
|
|
3203
3268
|
* The captured previous-render record for a series (last match wins, same
|
|
@@ -3253,7 +3318,7 @@ class Bar {
|
|
|
3253
3318
|
* @returns {boolean}
|
|
3254
3319
|
*/
|
|
3255
3320
|
isLengthTransition(realIndex) {
|
|
3256
|
-
var _a, _b;
|
|
3321
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3257
3322
|
if (!this._ltCache) this._ltCache = {};
|
|
3258
3323
|
if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
|
|
3259
3324
|
const w = this.w;
|
|
@@ -3261,20 +3326,14 @@ class Bar {
|
|
|
3261
3326
|
if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
|
|
3262
3327
|
const record = this._prevRecord(realIndex);
|
|
3263
3328
|
const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
3329
|
+
const keyed = record && this._prevKeyedPaths(realIndex);
|
|
3264
3330
|
if (!record) {
|
|
3265
3331
|
result = dataLen > 0;
|
|
3266
|
-
} else if (
|
|
3267
|
-
|
|
3332
|
+
} else if (keyed) {
|
|
3333
|
+
const now = new Set(this._keys(realIndex));
|
|
3334
|
+
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));
|
|
3268
3335
|
} else {
|
|
3269
|
-
|
|
3270
|
-
if (keyed) {
|
|
3271
|
-
for (let j = 0; j < dataLen; j++) {
|
|
3272
|
-
if (!keyed.has(datumKey(w, realIndex, j))) {
|
|
3273
|
-
result = true;
|
|
3274
|
-
break;
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
|
-
}
|
|
3336
|
+
result = record.paths.length !== dataLen;
|
|
3278
3337
|
}
|
|
3279
3338
|
}
|
|
3280
3339
|
this._ltCache[realIndex] = result;
|
|
@@ -3334,7 +3393,7 @@ class Bar {
|
|
|
3334
3393
|
let isNewDatum = false;
|
|
3335
3394
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3336
3395
|
if (keyed) {
|
|
3337
|
-
const prev = keyed.get(
|
|
3396
|
+
const prev = keyed.get(this._keys(realIndex)[j]);
|
|
3338
3397
|
if (prev) {
|
|
3339
3398
|
oldD = prev.d;
|
|
3340
3399
|
} else {
|
|
@@ -3477,11 +3536,10 @@ class Bar {
|
|
|
3477
3536
|
* @returns {boolean | null} null when there is no previous record to consult
|
|
3478
3537
|
*/
|
|
3479
3538
|
getPreviousFlip(realIndex, j) {
|
|
3480
|
-
const w = this.w;
|
|
3481
3539
|
const record = this._prevRecord(realIndex);
|
|
3482
3540
|
if (!record) return null;
|
|
3483
3541
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3484
|
-
const prev = keyed ? keyed.get(
|
|
3542
|
+
const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
|
|
3485
3543
|
return prev ? !!prev.flip : null;
|
|
3486
3544
|
}
|
|
3487
3545
|
/**
|
|
@@ -3508,7 +3566,7 @@ class BarStacked extends Bar {
|
|
|
3508
3566
|
const coreUtils = new CoreUtils(this.w);
|
|
3509
3567
|
series = coreUtils.getLogSeries(series);
|
|
3510
3568
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
3511
|
-
this.barHelpers.initVariables(series);
|
|
3569
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
3512
3570
|
if (w.config.chart.stackType === "100%") {
|
|
3513
3571
|
series = w.globals.comboCharts ? (
|
|
3514
3572
|
/** @type {any} */
|
|
@@ -3539,7 +3597,6 @@ class BarStacked extends Bar {
|
|
|
3539
3597
|
const xArrValues = [];
|
|
3540
3598
|
const yArrValues = [];
|
|
3541
3599
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
3542
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
3543
3600
|
let elSeries = this.graphics.group({
|
|
3544
3601
|
class: `apexcharts-series`,
|
|
3545
3602
|
seriesName: Utils.escapeString(w.seriesData.seriesNames[realIndex]),
|
|
@@ -3609,7 +3666,9 @@ class BarStacked extends Bar {
|
|
|
3609
3666
|
null
|
|
3610
3667
|
);
|
|
3611
3668
|
if (this.isHorizontal) {
|
|
3612
|
-
paths = this.drawStackedBarPaths(__spreadProps(__spreadValues({}, commonPathOpts), {
|
|
3669
|
+
paths = this.drawStackedBarPaths(__spreadProps(__spreadValues(__spreadValues({}, commonPathOpts), this.barHelpers.rows && {
|
|
3670
|
+
y: initPositions.y + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
3671
|
+
}), {
|
|
3613
3672
|
zeroW,
|
|
3614
3673
|
barHeight,
|
|
3615
3674
|
yDivision
|
|
@@ -3683,6 +3742,7 @@ class BarStacked extends Bar {
|
|
|
3683
3742
|
series,
|
|
3684
3743
|
barHeight,
|
|
3685
3744
|
barWidth,
|
|
3745
|
+
barXPosition: paths.barXPosition,
|
|
3686
3746
|
elDataLabelsWrap,
|
|
3687
3747
|
elGoalsMarkers,
|
|
3688
3748
|
type: "bar",
|
|
@@ -3700,7 +3760,7 @@ class BarStacked extends Bar {
|
|
|
3700
3760
|
this.groupCtx.prevXVal.push(this.groupCtx.xArrjVal);
|
|
3701
3761
|
ret.add(elSeries);
|
|
3702
3762
|
}
|
|
3703
|
-
if (heldMirrors) this.settleHeldMirrors();
|
|
3763
|
+
if (heldMirrors) this.settleHeldMirrors(ret);
|
|
3704
3764
|
return ret;
|
|
3705
3765
|
}
|
|
3706
3766
|
/**
|
|
@@ -3721,15 +3781,21 @@ class BarStacked extends Bar {
|
|
|
3721
3781
|
* 'bottom' → 'top', where the endpoint really is rounded at the other end;
|
|
3722
3782
|
* everywhere else the mirror is an exact identity on the settled shape, so
|
|
3723
3783
|
* removing it changes nothing on screen.
|
|
3784
|
+
*
|
|
3785
|
+
* The marks are collected now, not when the timer fires: a query then also
|
|
3786
|
+
* stripped the mirrors a LATER update was still holding mid-tween.
|
|
3787
|
+
* @param {any} [ret] this draw's series group (default: the whole chart)
|
|
3724
3788
|
*/
|
|
3725
|
-
settleHeldMirrors() {
|
|
3789
|
+
settleHeldMirrors(ret) {
|
|
3726
3790
|
const w = this.w;
|
|
3727
3791
|
if (!Environment.isBrowser()) return;
|
|
3728
3792
|
const anim = w.config.chart.animations;
|
|
3729
3793
|
const hold = (anim.dynamicAnimation.speed || 0) + (anim.speed || 0) + 100;
|
|
3794
|
+
const held = (ret ? ret.node : w.dom.baseEl).querySelectorAll(
|
|
3795
|
+
".apexcharts-flip-held"
|
|
3796
|
+
);
|
|
3730
3797
|
setTimeout(() => {
|
|
3731
|
-
|
|
3732
|
-
w.dom.baseEl.querySelectorAll(".apexcharts-flip-held").forEach((el) => {
|
|
3798
|
+
held.forEach((el) => {
|
|
3733
3799
|
el.classList.remove(
|
|
3734
3800
|
"apexcharts-flip-held",
|
|
3735
3801
|
"apexcharts-flip-y",
|
|
@@ -3805,7 +3871,7 @@ class BarStacked extends Bar {
|
|
|
3805
3871
|
yDivision,
|
|
3806
3872
|
elSeries
|
|
3807
3873
|
}) {
|
|
3808
|
-
var _a, _b
|
|
3874
|
+
var _a, _b;
|
|
3809
3875
|
const w = this.w;
|
|
3810
3876
|
const barYPosition = y + columnGroupIndex * barHeight;
|
|
3811
3877
|
let barXPosition;
|
|
@@ -3813,36 +3879,21 @@ class BarStacked extends Bar {
|
|
|
3813
3879
|
const j = indexes.j;
|
|
3814
3880
|
const realIndex = indexes.realIndex;
|
|
3815
3881
|
const translationsIndex = indexes.translationsIndex;
|
|
3816
|
-
|
|
3817
|
-
for (let k = 0; k < this.groupCtx.prevXF.length; k++) {
|
|
3818
|
-
prevBarW = prevBarW + this.groupCtx.prevXF[k][j];
|
|
3819
|
-
}
|
|
3820
|
-
const gsi = this.groupCtx.prevX.length;
|
|
3821
|
-
if (gsi > 0) {
|
|
3822
|
-
let bXP = zeroW;
|
|
3823
|
-
if (this.groupCtx.prevXVal[gsi - 1][j] < 0) {
|
|
3824
|
-
bXP = /** @type {any} */
|
|
3825
|
-
((_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];
|
|
3826
|
-
} else if (this.groupCtx.prevXVal[gsi - 1][j] >= 0) {
|
|
3827
|
-
bXP = /** @type {any} */
|
|
3828
|
-
((_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;
|
|
3829
|
-
}
|
|
3830
|
-
barXPosition = bXP;
|
|
3831
|
-
} else {
|
|
3832
|
-
barXPosition = zeroW;
|
|
3833
|
-
}
|
|
3834
|
-
if (
|
|
3882
|
+
const v = (
|
|
3835
3883
|
/** @type {any} */
|
|
3836
|
-
((
|
|
3837
|
-
)
|
|
3838
|
-
|
|
3884
|
+
(_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
|
|
3885
|
+
);
|
|
3886
|
+
const g = this.groupCtx;
|
|
3887
|
+
const key = w.axisFlags.isXNumeric ? w.seriesData.seriesX[realIndex][j] : j;
|
|
3888
|
+
const top = g.tops.get(key);
|
|
3889
|
+
if (top) {
|
|
3890
|
+
const [prevX, prevVal, prevBarW] = top;
|
|
3891
|
+
const flip = (this.isReversed ? prevBarW : 0) * 2;
|
|
3892
|
+
barXPosition = prevVal < 0 ? v >= 0 ? prevX + prevBarW - flip : prevX : v >= 0 ? prevX : prevX - prevBarW + flip;
|
|
3839
3893
|
} else {
|
|
3840
|
-
|
|
3841
|
-
((_d = this.series[i]) == null ? void 0 : _d[j]) / this.invertedYRatio - (this.isReversed ? (
|
|
3842
|
-
/** @type {any} */
|
|
3843
|
-
((_e = this.series[i]) == null ? void 0 : _e[j]) / this.invertedYRatio
|
|
3844
|
-
) : 0) * 2;
|
|
3894
|
+
barXPosition = zeroW;
|
|
3845
3895
|
}
|
|
3896
|
+
x = barXPosition + v / this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
3846
3897
|
const paths = this.barHelpers.getBarpaths({
|
|
3847
3898
|
barYPosition,
|
|
3848
3899
|
barHeight,
|
|
@@ -3856,6 +3907,7 @@ class BarStacked extends Bar {
|
|
|
3856
3907
|
j,
|
|
3857
3908
|
w
|
|
3858
3909
|
});
|
|
3910
|
+
this._setTop(key, top, g.xArrj[j], g.xArrjVal[j], g.xArrjF[j], realIndex, j);
|
|
3859
3911
|
this.barHelpers.barBackground({
|
|
3860
3912
|
j,
|
|
3861
3913
|
i,
|
|
@@ -3893,13 +3945,17 @@ class BarStacked extends Bar {
|
|
|
3893
3945
|
columnGroupIndex,
|
|
3894
3946
|
elSeries
|
|
3895
3947
|
}) {
|
|
3896
|
-
var _a, _b, _c
|
|
3948
|
+
var _a, _b, _c;
|
|
3897
3949
|
const w = this.w;
|
|
3898
3950
|
const i = indexes.i;
|
|
3899
3951
|
const j = indexes.j;
|
|
3900
3952
|
const bc = indexes.bc;
|
|
3901
3953
|
const realIndex = indexes.realIndex;
|
|
3902
3954
|
const translationsIndex = indexes.translationsIndex;
|
|
3955
|
+
const v = (
|
|
3956
|
+
/** @type {any} */
|
|
3957
|
+
(_b = (_a = this.series[i]) == null ? void 0 : _a[j]) != null ? _b : null
|
|
3958
|
+
);
|
|
3903
3959
|
if (w.axisFlags.isXNumeric) {
|
|
3904
3960
|
let seriesVal = w.seriesData.seriesX[realIndex][j];
|
|
3905
3961
|
if (!seriesVal) seriesVal = 0;
|
|
@@ -3914,11 +3970,9 @@ class BarStacked extends Bar {
|
|
|
3914
3970
|
const [prevYValue, prevVal, prevBarH] = top;
|
|
3915
3971
|
let bYP;
|
|
3916
3972
|
if (prevVal < 0) {
|
|
3917
|
-
bYP =
|
|
3918
|
-
((_a = this.series[i]) == null ? void 0 : _a[j]) >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
|
|
3973
|
+
bYP = v >= 0 ? prevYValue - prevBarH + (this.isReversed ? prevBarH : 0) * 2 : prevYValue;
|
|
3919
3974
|
} else if (prevVal >= 0) {
|
|
3920
|
-
bYP =
|
|
3921
|
-
((_b = this.series[i]) == null ? void 0 : _b[j]) >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
|
|
3975
|
+
bYP = v >= 0 ? prevYValue : prevYValue + prevBarH - (this.isReversed ? prevBarH : 0) * 2;
|
|
3922
3976
|
}
|
|
3923
3977
|
if (typeof bYP === "undefined") bYP = w.layout.gridHeight;
|
|
3924
3978
|
if (((_c = g.prevYF[0]) == null ? void 0 : _c.every((val) => val === 0)) && g.prevYF.slice(1).every(
|
|
@@ -3931,25 +3985,16 @@ class BarStacked extends Bar {
|
|
|
3931
3985
|
} else {
|
|
3932
3986
|
barYPosition = zeroH;
|
|
3933
3987
|
}
|
|
3934
|
-
|
|
3935
|
-
/** @type {any} */
|
|
3936
|
-
(_d = this.series[i]) == null ? void 0 : _d[j]
|
|
3937
|
-
) {
|
|
3938
|
-
y = barYPosition - /** @type {any} */
|
|
3939
|
-
((_e = this.series[i]) == null ? void 0 : _e[j]) / this.yRatio[translationsIndex] + (this.isReversed ? (
|
|
3940
|
-
/** @type {any} */
|
|
3941
|
-
((_f = this.series[i]) == null ? void 0 : _f[j]) / this.yRatio[translationsIndex]
|
|
3942
|
-
) : 0) * 2;
|
|
3943
|
-
} else {
|
|
3944
|
-
y = barYPosition;
|
|
3945
|
-
}
|
|
3988
|
+
y = barYPosition - v / this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
3946
3989
|
const paths = this.barHelpers.getColumnPaths({
|
|
3947
3990
|
barXPosition,
|
|
3948
3991
|
barWidth,
|
|
3949
3992
|
y1: barYPosition,
|
|
3950
3993
|
y2: y,
|
|
3951
3994
|
yRatio: this.yRatio[translationsIndex],
|
|
3952
|
-
|
|
3995
|
+
// the series' width even for an empty segment, so a hidden layer keeps
|
|
3996
|
+
// its place, but no inset at all when no stroke is drawn
|
|
3997
|
+
strokeWidth: w.config.stroke.show ? this.strokeWidth : 0,
|
|
3953
3998
|
isReversed: this.isReversed,
|
|
3954
3999
|
series: this.series,
|
|
3955
4000
|
realIndex: indexes.realIndex,
|
|
@@ -3957,17 +4002,7 @@ class BarStacked extends Bar {
|
|
|
3957
4002
|
j,
|
|
3958
4003
|
w
|
|
3959
4004
|
});
|
|
3960
|
-
|
|
3961
|
-
if (!isNaN(t)) {
|
|
3962
|
-
g.tops.set(key, [
|
|
3963
|
-
t,
|
|
3964
|
-
g.yArrjVal[j],
|
|
3965
|
-
(top ? top[2] : 0) + g.yArrjF[j],
|
|
3966
|
-
(top ? top[3] : 0) + (w.seriesData.series[realIndex][j] || 0),
|
|
3967
|
-
top ? Math.min(top[0], top[4]) : 1 / 0,
|
|
3968
|
-
top ? Math.max(top[0], top[5]) : -1 / 0
|
|
3969
|
-
]);
|
|
3970
|
-
}
|
|
4005
|
+
this._setTop(key, top, g.yArrj[j], g.yArrjVal[j], g.yArrjF[j], realIndex, j);
|
|
3971
4006
|
this.barHelpers.barBackground({
|
|
3972
4007
|
bc,
|
|
3973
4008
|
j,
|
|
@@ -3986,13 +4021,32 @@ class BarStacked extends Bar {
|
|
|
3986
4021
|
zeroH,
|
|
3987
4022
|
realIndex,
|
|
3988
4023
|
j,
|
|
3989
|
-
|
|
4024
|
+
translationsIndex
|
|
3990
4025
|
),
|
|
3991
4026
|
barXPosition,
|
|
3992
4027
|
x: w.axisFlags.isXNumeric ? x : x + xDivision,
|
|
3993
4028
|
y
|
|
3994
4029
|
};
|
|
3995
4030
|
}
|
|
4031
|
+
/**
|
|
4032
|
+
* Record the segment just drawn as the top of its stack. Per key it holds
|
|
4033
|
+
* the top and value of the last segment drawn there, the summed lengths and
|
|
4034
|
+
* raw values of every segment so far (the total label's value), and the
|
|
4035
|
+
* extreme tops below that segment (the total label's position).
|
|
4036
|
+
* @param {any} key @param {any} top @param {number} t @param {any} val
|
|
4037
|
+
* @param {number} len @param {number} realIndex @param {number} j
|
|
4038
|
+
*/
|
|
4039
|
+
_setTop(key, top, t, val, len, realIndex, j) {
|
|
4040
|
+
if (isNaN(t)) return;
|
|
4041
|
+
this.groupCtx.tops.set(key, [
|
|
4042
|
+
t,
|
|
4043
|
+
val,
|
|
4044
|
+
(top ? top[2] : 0) + len,
|
|
4045
|
+
(top ? top[3] : 0) + (this.w.seriesData.series[realIndex][j] || 0),
|
|
4046
|
+
top ? Math.min(top[0], top[4]) : 1 / 0,
|
|
4047
|
+
top ? Math.max(top[0], top[5]) : -1 / 0
|
|
4048
|
+
]);
|
|
4049
|
+
}
|
|
3996
4050
|
}
|
|
3997
4051
|
class RangeBar extends Bar {
|
|
3998
4052
|
/**
|
|
@@ -4000,14 +4054,14 @@ class RangeBar extends Bar {
|
|
|
4000
4054
|
* @param {number} seriesIndex
|
|
4001
4055
|
*/
|
|
4002
4056
|
draw(series, seriesIndex) {
|
|
4003
|
-
var _a, _b, _c, _d, _e, _f
|
|
4057
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4004
4058
|
const w = this.w;
|
|
4005
4059
|
const graphics = new Graphics(this.w);
|
|
4006
4060
|
this.rangeBarOptions = this.w.config.plotOptions.rangeBar;
|
|
4007
4061
|
this.series = series;
|
|
4008
4062
|
this.seriesRangeStart = w.rangeData.seriesRangeStart;
|
|
4009
4063
|
this.seriesRangeEnd = w.rangeData.seriesRangeEnd;
|
|
4010
|
-
this.barHelpers.initVariables(series);
|
|
4064
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
4011
4065
|
const ret = graphics.group({
|
|
4012
4066
|
class: "apexcharts-rangebar-series apexcharts-plot-series"
|
|
4013
4067
|
});
|
|
@@ -4029,6 +4083,9 @@ class RangeBar extends Bar {
|
|
|
4029
4083
|
this.visibleI = this.visibleI + 1;
|
|
4030
4084
|
}
|
|
4031
4085
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
4086
|
+
if (this.isHorizontal && w.labelData.timescaleLabels.length) {
|
|
4087
|
+
this.isReversed = false;
|
|
4088
|
+
}
|
|
4032
4089
|
const initPositions = this.barHelpers.initialPositions(realIndex);
|
|
4033
4090
|
const {
|
|
4034
4091
|
y: initY,
|
|
@@ -4038,10 +4095,8 @@ class RangeBar extends Bar {
|
|
|
4038
4095
|
zeroH
|
|
4039
4096
|
// zeroH is the baseline where 0 meets y axis
|
|
4040
4097
|
} = initPositions;
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
const yDivision = (_c = initPositions.yDivision) != null ? _c : 0;
|
|
4044
|
-
const xDivision = (_d = initPositions.xDivision) != null ? _d : 0;
|
|
4098
|
+
const yDivision = (_a = initPositions.yDivision) != null ? _a : 0;
|
|
4099
|
+
const xDivision = (_b = initPositions.xDivision) != null ? _b : 0;
|
|
4045
4100
|
y = initY;
|
|
4046
4101
|
x = initX;
|
|
4047
4102
|
const elDataLabelsWrap = graphics.group({
|
|
@@ -4051,10 +4106,16 @@ class RangeBar extends Bar {
|
|
|
4051
4106
|
const elGoalsMarkers = graphics.group({
|
|
4052
4107
|
class: "apexcharts-rangebar-goals-markers"
|
|
4053
4108
|
});
|
|
4109
|
+
const data = (
|
|
4110
|
+
/** @type {any} */
|
|
4111
|
+
w.config.series[realIndex].data
|
|
4112
|
+
);
|
|
4054
4113
|
for (let j = 0; j < w.globals.dataPoints; j++) {
|
|
4055
4114
|
const strokeWidth = this.barHelpers.getStrokeWidth(i, j, realIndex);
|
|
4056
|
-
|
|
4057
|
-
|
|
4115
|
+
let barWidth = (_c = initPositions.barWidth) != null ? _c : 0;
|
|
4116
|
+
let barHeight = (_d = initPositions.barHeight) != null ? _d : 0;
|
|
4117
|
+
const y1 = this.seriesRangeStart[realIndex][j];
|
|
4118
|
+
const y2 = this.seriesRangeEnd[realIndex][j];
|
|
4058
4119
|
let paths = (
|
|
4059
4120
|
/** @type {any} */
|
|
4060
4121
|
null
|
|
@@ -4066,20 +4127,16 @@ class RangeBar extends Bar {
|
|
|
4066
4127
|
if (w.config.plotOptions.bar.rangeBarGroupRows) {
|
|
4067
4128
|
seriesLen = 1;
|
|
4068
4129
|
}
|
|
4069
|
-
if (typeof
|
|
4070
|
-
((_e = w.config.series[i].data) == null ? void 0 : _e[j]) === "undefined") {
|
|
4130
|
+
if (typeof (data == null ? void 0 : data[j]) === "undefined") {
|
|
4071
4131
|
break;
|
|
4072
4132
|
}
|
|
4073
4133
|
if (this.isHorizontal) {
|
|
4074
4134
|
barYPosition = y + barHeight * /** @type {any} */
|
|
4075
4135
|
this.visibleI;
|
|
4076
4136
|
const srty = (yDivision - barHeight * seriesLen) / 2;
|
|
4077
|
-
if (
|
|
4078
|
-
/** @type {Record<string,any>} */
|
|
4079
|
-
(_g = (_f = w.config.series[i].data) == null ? void 0 : _f[j]) == null ? void 0 : _g.x
|
|
4080
|
-
) {
|
|
4137
|
+
if (((_e = data[j]) == null ? void 0 : _e.x) != null) {
|
|
4081
4138
|
const positions = this.detectOverlappingBars({
|
|
4082
|
-
i,
|
|
4139
|
+
i: realIndex,
|
|
4083
4140
|
j,
|
|
4084
4141
|
barYPosition,
|
|
4085
4142
|
srty,
|
|
@@ -4102,17 +4159,14 @@ class RangeBar extends Bar {
|
|
|
4102
4159
|
barWidth = paths.barWidth;
|
|
4103
4160
|
} else {
|
|
4104
4161
|
if (w.axisFlags.isXNumeric) {
|
|
4105
|
-
x = (w.seriesData.seriesX[
|
|
4162
|
+
x = (w.seriesData.seriesX[realIndex][j] - w.globals.minX) / this.xRatio - barWidth / 2;
|
|
4106
4163
|
}
|
|
4107
4164
|
barXPosition = x + barWidth * /** @type {any} */
|
|
4108
4165
|
this.visibleI;
|
|
4109
4166
|
const srtx = (xDivision - barWidth * seriesLen) / 2;
|
|
4110
|
-
if (
|
|
4111
|
-
/** @type {Record<string,any>} */
|
|
4112
|
-
(_i = (_h = w.config.series[i].data) == null ? void 0 : _h[j]) == null ? void 0 : _i.x
|
|
4113
|
-
) {
|
|
4167
|
+
if (((_f = data[j]) == null ? void 0 : _f.x) != null) {
|
|
4114
4168
|
const positions = this.detectOverlappingBars({
|
|
4115
|
-
i,
|
|
4169
|
+
i: realIndex,
|
|
4116
4170
|
j,
|
|
4117
4171
|
barXPosition,
|
|
4118
4172
|
srtx,
|
|
@@ -4131,9 +4185,10 @@ class RangeBar extends Bar {
|
|
|
4131
4185
|
xDivision
|
|
4132
4186
|
}, params));
|
|
4133
4187
|
barHeight = paths.barHeight;
|
|
4188
|
+
barXPosition = paths.barXPosition;
|
|
4134
4189
|
}
|
|
4135
4190
|
const barGoalLine = this.barHelpers.drawGoalLine({
|
|
4136
|
-
barXPosition
|
|
4191
|
+
barXPosition,
|
|
4137
4192
|
barYPosition,
|
|
4138
4193
|
goalX: paths.goalX,
|
|
4139
4194
|
goalY: paths.goalY,
|
|
@@ -4178,19 +4233,11 @@ class RangeBar extends Bar {
|
|
|
4178
4233
|
});
|
|
4179
4234
|
}
|
|
4180
4235
|
if (w.globals.previousPaths.length > 0) {
|
|
4181
|
-
const data = (
|
|
4182
|
-
/** @type {Record<string,any>} */
|
|
4183
|
-
w.config.series[i].data || []
|
|
4184
|
-
);
|
|
4185
|
-
const newKeys = [];
|
|
4186
|
-
for (let j = 0; j < data.length; j++) {
|
|
4187
|
-
newKeys.push(datumKey(w, realIndex, j));
|
|
4188
|
-
}
|
|
4189
4236
|
renderBarExitGhosts({
|
|
4190
4237
|
w,
|
|
4191
4238
|
elSeries,
|
|
4192
4239
|
record: this._prevRecord(realIndex),
|
|
4193
|
-
newKeys,
|
|
4240
|
+
newKeys: this._keys(realIndex),
|
|
4194
4241
|
isHorizontal: this.isHorizontal,
|
|
4195
4242
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
4196
4243
|
});
|
|
@@ -4242,11 +4289,11 @@ class RangeBar extends Bar {
|
|
|
4242
4289
|
);
|
|
4243
4290
|
if (overlaps.indexOf(rangeName) > -1) {
|
|
4244
4291
|
barHeight = initPositions.barHeight / overlaps.length;
|
|
4245
|
-
barYPosition
|
|
4292
|
+
barYPosition += barHeight * overlaps.indexOf(rangeName);
|
|
4246
4293
|
}
|
|
4247
4294
|
}
|
|
4248
4295
|
} else {
|
|
4249
|
-
if (rowIndex > -1 && !w.
|
|
4296
|
+
if (rowIndex > -1 && !w.axisFlags.isXNumeric) {
|
|
4250
4297
|
if (w.config.plotOptions.bar.rangeBarGroupRows) {
|
|
4251
4298
|
barXPosition = srtx + xDivision * rowIndex;
|
|
4252
4299
|
} else {
|
|
@@ -4260,7 +4307,7 @@ class RangeBar extends Bar {
|
|
|
4260
4307
|
);
|
|
4261
4308
|
if (overlaps.indexOf(rangeName) > -1) {
|
|
4262
4309
|
barWidth = initPositions.barWidth / overlaps.length;
|
|
4263
|
-
barXPosition
|
|
4310
|
+
barXPosition += barWidth * overlaps.indexOf(rangeName);
|
|
4264
4311
|
}
|
|
4265
4312
|
}
|
|
4266
4313
|
}
|
|
@@ -4283,7 +4330,7 @@ class RangeBar extends Bar {
|
|
|
4283
4330
|
var _a, _b;
|
|
4284
4331
|
const w = this.w;
|
|
4285
4332
|
const { i, j, realIndex, translationsIndex } = indexes;
|
|
4286
|
-
const yRatio = this.yRatio[translationsIndex];
|
|
4333
|
+
const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
4287
4334
|
const range = this.getRangeValue(realIndex, j);
|
|
4288
4335
|
let y1 = Math.min(range.start, range.end);
|
|
4289
4336
|
let y2 = Math.max(range.start, range.end);
|
|
@@ -4291,7 +4338,7 @@ class RangeBar extends Bar {
|
|
|
4291
4338
|
((_a = this.series[i]) == null ? void 0 : _a[j]) === "undefined" || /** @type {any} */
|
|
4292
4339
|
((_b = this.series[i]) == null ? void 0 : _b[j]) === null);
|
|
4293
4340
|
if (!hasValue) {
|
|
4294
|
-
y1 = zeroH;
|
|
4341
|
+
y1 = y2 = zeroH;
|
|
4295
4342
|
} else {
|
|
4296
4343
|
y1 = zeroH - y1 / yRatio;
|
|
4297
4344
|
y2 = zeroH - y2 / yRatio;
|
|
@@ -4352,6 +4399,30 @@ class RangeBar extends Bar {
|
|
|
4352
4399
|
barXPosition
|
|
4353
4400
|
};
|
|
4354
4401
|
}
|
|
4402
|
+
/**
|
|
4403
|
+
* Timeline datums key by their own row, not by the j-th label: a row can
|
|
4404
|
+
* hold several bars, so labels[j] names some other datum's row.
|
|
4405
|
+
* @param {number} realIndex
|
|
4406
|
+
* @returns {string[]}
|
|
4407
|
+
*/
|
|
4408
|
+
_keys(realIndex) {
|
|
4409
|
+
const c = (
|
|
4410
|
+
/** @type {any} */
|
|
4411
|
+
this._keyCache || (this._keyCache = {})
|
|
4412
|
+
);
|
|
4413
|
+
const data = (
|
|
4414
|
+
/** @type {any} */
|
|
4415
|
+
this.w.config.series[realIndex].data
|
|
4416
|
+
);
|
|
4417
|
+
return c[realIndex] || (c[realIndex] = uniquifyKeys(
|
|
4418
|
+
(data || []).map(
|
|
4419
|
+
(d, j) => {
|
|
4420
|
+
var _a;
|
|
4421
|
+
return "c:" + ((_a = d == null ? void 0 : d.x) != null ? _a : j);
|
|
4422
|
+
}
|
|
4423
|
+
)
|
|
4424
|
+
));
|
|
4425
|
+
}
|
|
4355
4426
|
/**
|
|
4356
4427
|
* @param {number} val
|
|
4357
4428
|
*/
|
|
@@ -4378,8 +4449,9 @@ class RangeBar extends Bar {
|
|
|
4378
4449
|
}) {
|
|
4379
4450
|
const w = this.w;
|
|
4380
4451
|
const { realIndex, j } = indexes;
|
|
4381
|
-
const
|
|
4382
|
-
const
|
|
4452
|
+
const ratio = this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
4453
|
+
const x1 = this.preventBarOverflow(zeroW + y1 / ratio);
|
|
4454
|
+
const x2 = this.preventBarOverflow(zeroW + y2 / ratio);
|
|
4383
4455
|
const range = this.getRangeValue(realIndex, j);
|
|
4384
4456
|
const barWidth = Math.abs(x2 - x1);
|
|
4385
4457
|
const paths = this.barHelpers.getBarpaths({
|