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/candlestick.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.1
|
|
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
|
|
@@ -2157,22 +2170,55 @@ class AxisMapping {
|
|
|
2157
2170
|
return w.globals.minX + px * AxisMapping.xRatio(w);
|
|
2158
2171
|
}
|
|
2159
2172
|
/**
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2162
|
-
*
|
|
2163
|
-
*
|
|
2164
|
-
*
|
|
2173
|
+
* The plot area on screen, in client px: its corner is where the plot's
|
|
2174
|
+
* group is translated to (translateX, translateY into the svg), and it is
|
|
2175
|
+
* gridWidth by gridHeight. The one screen-to-plot measurement: the tooltip,
|
|
2176
|
+
* zoom, selection and every other pointer reader map through it, so x and y
|
|
2177
|
+
* cannot disagree under CSS zoom.
|
|
2178
|
+
*
|
|
2179
|
+
* Never the `.apexcharts-grid` group's box: a group measures to the union
|
|
2180
|
+
* of what it happens to draw (fact 2 above). The plot's outline starts a
|
|
2181
|
+
* pixel down (`Grid.drawGridArea`), so unless gridlines or row bands reach
|
|
2182
|
+
* the top edge the box starts a pixel below the plot, and on a numeric-x bar
|
|
2183
|
+
* chart the horizontal gridlines run `barPadForNumericAxis` out past both
|
|
2184
|
+
* sides.
|
|
2185
|
+
*
|
|
2186
|
+
* `zoom` is the CSS zoom of any container the chart sits in (screen px per
|
|
2187
|
+
* plot px): the measured svg width over `svgWidth`, the unscaled width it
|
|
2188
|
+
* was drawn at. A distance measured on screen from this corner is divided
|
|
2189
|
+
* by it to land in plot px, the space the series are laid out and painted in.
|
|
2190
|
+
* With nothing mounted to measure, screen px are taken as svg px.
|
|
2191
|
+
*
|
|
2192
|
+
* @param {import('../types/internal').ChartStateW} w
|
|
2193
|
+
* @returns {{ left: number, top: number, width: number, height: number, zoom: number }}
|
|
2194
|
+
*/
|
|
2195
|
+
static plotRect(w) {
|
|
2196
|
+
var _a, _b, _c;
|
|
2197
|
+
const svg = ((_a = w.dom.Paper) == null ? void 0 : _a.node) || ((_b = w.dom.baseEl) == null ? void 0 : _b.querySelector(".apexcharts-svg"));
|
|
2198
|
+
const box = ((_c = svg || w.dom.elWrap) == null ? void 0 : _c.getBoundingClientRect()) || {
|
|
2199
|
+
left: 0,
|
|
2200
|
+
top: 0,
|
|
2201
|
+
width: 0
|
|
2202
|
+
};
|
|
2203
|
+
const zoom = (svg && w.globals.svgWidth ? box.width / w.globals.svgWidth : 1) || 1;
|
|
2204
|
+
return {
|
|
2205
|
+
left: box.left + w.layout.translateX * zoom,
|
|
2206
|
+
top: box.top + w.layout.translateY * zoom,
|
|
2207
|
+
width: w.layout.gridWidth * zoom,
|
|
2208
|
+
height: w.layout.gridHeight * zoom,
|
|
2209
|
+
zoom
|
|
2210
|
+
};
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* Client (screen) x -> pixels from the plot origin of {@link plotRect}.
|
|
2214
|
+
* Pass the rect when the caller has already measured it.
|
|
2165
2215
|
* @param {import('../types/internal').ChartStateW} w
|
|
2166
2216
|
* @param {number} screenX
|
|
2217
|
+
* @param {{ left: number, zoom: number }} [plot]
|
|
2167
2218
|
* @returns {number}
|
|
2168
2219
|
*/
|
|
2169
|
-
static screenXToPlotPx(w, screenX) {
|
|
2170
|
-
|
|
2171
|
-
const svg = baseEl && baseEl.querySelector(".apexcharts-svg");
|
|
2172
|
-
if (!svg) return screenX - w.layout.translateX;
|
|
2173
|
-
const svgRect = svg.getBoundingClientRect();
|
|
2174
|
-
const zoom = w.globals.svgWidth ? svgRect.width / w.globals.svgWidth : 1;
|
|
2175
|
-
return (screenX - svgRect.left) / (zoom || 1) - w.layout.translateX;
|
|
2220
|
+
static screenXToPlotPx(w, screenX, plot = AxisMapping.plotRect(w)) {
|
|
2221
|
+
return (screenX - plot.left) / plot.zoom;
|
|
2176
2222
|
}
|
|
2177
2223
|
}
|
|
2178
2224
|
function seriesEmitter(ctx, graphics) {
|
|
@@ -2245,15 +2291,17 @@ class Bar {
|
|
|
2245
2291
|
/**
|
|
2246
2292
|
* Point the per-series axis state at this series' y axis. Every bar-family
|
|
2247
2293
|
* renderer calls it before initialPositions, which reads the baseline by
|
|
2248
|
-
* this.translationsIndex.
|
|
2294
|
+
* this.translationsIndex and flips it for a reversed axis.
|
|
2249
2295
|
* @param {number} realIndex
|
|
2250
2296
|
* @return {number} translationsIndex
|
|
2251
2297
|
*/
|
|
2252
2298
|
setSeriesAxis(realIndex) {
|
|
2299
|
+
var _a;
|
|
2253
2300
|
if (this.yRatio.length > 1) {
|
|
2254
2301
|
this.yaxisIndex = this.w.globals.seriesYAxisReverseMap[realIndex];
|
|
2255
2302
|
this.translationsIndex = realIndex;
|
|
2256
2303
|
}
|
|
2304
|
+
this.isReversed = (_a = this.w.config.yaxis[this.yaxisIndex]) == null ? void 0 : _a.reversed;
|
|
2257
2305
|
return this.translationsIndex;
|
|
2258
2306
|
}
|
|
2259
2307
|
/** primary draw method which is called on bar object
|
|
@@ -2270,7 +2318,7 @@ class Bar {
|
|
|
2270
2318
|
series = coreUtils.getLogSeries(series);
|
|
2271
2319
|
this.series = series;
|
|
2272
2320
|
this.yRatio = coreUtils.getLogYRatios(this.yRatio);
|
|
2273
|
-
this.barHelpers.initVariables(series);
|
|
2321
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
2274
2322
|
const ret = graphics.group({
|
|
2275
2323
|
class: "apexcharts-bar-series apexcharts-plot-series"
|
|
2276
2324
|
});
|
|
@@ -2302,7 +2350,6 @@ class Bar {
|
|
|
2302
2350
|
this.visibleI = this.visibleI + 1;
|
|
2303
2351
|
}
|
|
2304
2352
|
const translationsIndex = this.setSeriesAxis(realIndex);
|
|
2305
|
-
this.isReversed = w.config.yaxis[this.yaxisIndex] && w.config.yaxis[this.yaxisIndex].reversed;
|
|
2306
2353
|
if (this.isPyramid) {
|
|
2307
2354
|
this.pyramidLayout = this.barHelpers.computePyramidLayout(series[i]);
|
|
2308
2355
|
}
|
|
@@ -2380,7 +2427,9 @@ class Bar {
|
|
|
2380
2427
|
elSeries
|
|
2381
2428
|
};
|
|
2382
2429
|
if (this.isHorizontal) {
|
|
2383
|
-
paths = this.drawBarPaths(__spreadProps(__spreadValues({}, pathsParams), {
|
|
2430
|
+
paths = this.drawBarPaths(__spreadProps(__spreadValues(__spreadValues({}, pathsParams), this.barHelpers.rows && {
|
|
2431
|
+
y: initY + this.barHelpers.barRow(realIndex, j) * yDivision
|
|
2432
|
+
}), {
|
|
2384
2433
|
barHeight,
|
|
2385
2434
|
zeroW,
|
|
2386
2435
|
yDivision
|
|
@@ -2462,6 +2511,7 @@ class Bar {
|
|
|
2462
2511
|
series,
|
|
2463
2512
|
barHeight: Math.abs(paths.barHeight ? paths.barHeight : barHeight),
|
|
2464
2513
|
barWidth: Math.abs(paths.barWidth ? paths.barWidth : barWidth),
|
|
2514
|
+
barXPosition: paths.barXPosition,
|
|
2465
2515
|
elDataLabelsWrap,
|
|
2466
2516
|
elGoalsMarkers,
|
|
2467
2517
|
elBarShadows,
|
|
@@ -2472,15 +2522,11 @@ class Bar {
|
|
|
2472
2522
|
w.globals.seriesXvalues[realIndex] = xArrj;
|
|
2473
2523
|
w.globals.seriesYvalues[realIndex] = yArrj;
|
|
2474
2524
|
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
2525
|
renderBarExitGhosts({
|
|
2480
2526
|
w,
|
|
2481
2527
|
elSeries,
|
|
2482
2528
|
record: this._prevRecord(realIndex),
|
|
2483
|
-
newKeys,
|
|
2529
|
+
newKeys: this._keys(realIndex),
|
|
2484
2530
|
isHorizontal: this.isHorizontal,
|
|
2485
2531
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
2486
2532
|
});
|
|
@@ -2489,7 +2535,7 @@ class Bar {
|
|
|
2489
2535
|
}
|
|
2490
2536
|
return ret;
|
|
2491
2537
|
}
|
|
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 */
|
|
2538
|
+
/** @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
2539
|
renderSeries({
|
|
2494
2540
|
hl,
|
|
2495
2541
|
realIndex,
|
|
@@ -2521,7 +2567,9 @@ class Bar {
|
|
|
2521
2567
|
visibleSeries,
|
|
2522
2568
|
type,
|
|
2523
2569
|
classes,
|
|
2524
|
-
fadeReveal = false
|
|
2570
|
+
fadeReveal = false,
|
|
2571
|
+
noLabel
|
|
2572
|
+
// a datum's extra paths (box halves, box lane) label nothing
|
|
2525
2573
|
}) {
|
|
2526
2574
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2527
2575
|
const w = this.w;
|
|
@@ -2595,7 +2643,8 @@ class Bar {
|
|
|
2595
2643
|
barXPosition,
|
|
2596
2644
|
barYPosition,
|
|
2597
2645
|
visibleSeries,
|
|
2598
|
-
hl: hl == null ? void 0 : hl.label
|
|
2646
|
+
hl: hl == null ? void 0 : hl.label,
|
|
2647
|
+
noLabel
|
|
2599
2648
|
})
|
|
2600
2649
|
);
|
|
2601
2650
|
if (delayMs > 0) {
|
|
@@ -2611,19 +2660,18 @@ class Bar {
|
|
|
2611
2660
|
}
|
|
2612
2661
|
let leaving = false;
|
|
2613
2662
|
if (!w.globals.isBarHorizontal) {
|
|
2614
|
-
|
|
2663
|
+
const cx = barXPosition === void 0 ? dataLabelsObj.dataLabelsPos.dataLabelsX : barXPosition + barWidth / 2;
|
|
2664
|
+
const pad = Math.max(barWidth, w.globals.barPadForNumericAxis);
|
|
2665
|
+
if (cx + pad < 0 || cx - pad > w.layout.gridWidth) {
|
|
2615
2666
|
if (this._wasOnScreen(realIndex, j)) leaving = true;
|
|
2616
2667
|
else skipDrawing = true;
|
|
2617
2668
|
}
|
|
2618
2669
|
}
|
|
2619
|
-
|
|
2620
|
-
/** @type {
|
|
2621
|
-
w.config.series[
|
|
2622
|
-
|
|
2623
|
-
)
|
|
2624
|
-
lineFill = /** @type {Record<string,any>} */
|
|
2625
|
-
w.config.series[i].data[j].strokeColor;
|
|
2626
|
-
}
|
|
2670
|
+
const datum = (
|
|
2671
|
+
/** @type {any} */
|
|
2672
|
+
w.config.series[realIndex].data[j]
|
|
2673
|
+
);
|
|
2674
|
+
if (datum && datum.strokeColor) lineFill = datum.strokeColor;
|
|
2627
2675
|
const fill = pathFill;
|
|
2628
2676
|
if (this.isNullValue && w.globals.collapsingSeriesIndices.indexOf(realIndex) === -1) {
|
|
2629
2677
|
pathFill = "none";
|
|
@@ -2646,7 +2694,7 @@ class Bar {
|
|
|
2646
2694
|
pathTo,
|
|
2647
2695
|
stroke: lineFill,
|
|
2648
2696
|
strokeWidth,
|
|
2649
|
-
|
|
2697
|
+
strokeLinecap: w.config.stroke.lineCap,
|
|
2650
2698
|
fill: pathFill,
|
|
2651
2699
|
pathToInterp,
|
|
2652
2700
|
animationDelay: delay,
|
|
@@ -2698,12 +2746,12 @@ class Bar {
|
|
|
2698
2746
|
cy: dataLabelsObj.dataLabelsPos.bcy,
|
|
2699
2747
|
cx: dataLabelsObj.dataLabelsPos.bcx,
|
|
2700
2748
|
j,
|
|
2701
|
-
val: w.seriesData.series[
|
|
2749
|
+
val: w.seriesData.series[realIndex][j],
|
|
2702
2750
|
barHeight,
|
|
2703
2751
|
barWidth,
|
|
2704
2752
|
// Datum identity for the next update's keyed join (see
|
|
2705
2753
|
// LengthTransition): survivors match by key, not array position.
|
|
2706
|
-
"data:pathKey":
|
|
2754
|
+
"data:pathKey": this._keys(realIndex)[j]
|
|
2707
2755
|
});
|
|
2708
2756
|
hl == null ? void 0 : hl.paint(renderedPath, {
|
|
2709
2757
|
delay,
|
|
@@ -2779,7 +2827,10 @@ class Bar {
|
|
|
2779
2827
|
const j = indexes.j;
|
|
2780
2828
|
let barYPosition;
|
|
2781
2829
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
2782
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
2830
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({
|
|
2831
|
+
i: indexes.realIndex,
|
|
2832
|
+
j
|
|
2833
|
+
});
|
|
2783
2834
|
if (nonZeroColumns > 0) {
|
|
2784
2835
|
barHeight = this.seriesLen * barHeight / nonZeroColumns;
|
|
2785
2836
|
}
|
|
@@ -2918,7 +2969,7 @@ class Bar {
|
|
|
2918
2969
|
barXPosition = xForNumericX.barXPosition;
|
|
2919
2970
|
} else {
|
|
2920
2971
|
if (w.config.plotOptions.bar.hideZeroBarsWhenGrouped) {
|
|
2921
|
-
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i, j });
|
|
2972
|
+
const { nonZeroColumns, zeroEncounters } = this.barHelpers.getZeroValueEncounters({ i: realIndex, j });
|
|
2922
2973
|
if (nonZeroColumns > 0) {
|
|
2923
2974
|
barWidth = this.seriesLen * barWidth / nonZeroColumns;
|
|
2924
2975
|
}
|
|
@@ -2982,15 +3033,16 @@ class Bar {
|
|
|
2982
3033
|
/** @param {{x: any, barWidth: any, realIndex: any, j: any}} opts */
|
|
2983
3034
|
getBarXForNumericXAxis({ x, barWidth, realIndex, j }) {
|
|
2984
3035
|
const w = this.w;
|
|
3036
|
+
const overlay = isHistogramOverlay(w);
|
|
2985
3037
|
let sxI = realIndex;
|
|
2986
3038
|
if (!w.seriesData.seriesX[realIndex].length) {
|
|
2987
3039
|
sxI = w.globals.maxValsInArrayIndex;
|
|
2988
3040
|
}
|
|
2989
3041
|
if (Utils.isNumber(w.seriesData.seriesX[sxI][j])) {
|
|
2990
|
-
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * this.seriesLen / 2;
|
|
3042
|
+
x = AxisMapping.dataXToPx(w, w.seriesData.seriesX[sxI][j]) - barWidth * (overlay ? 1 : this.seriesLen) / 2;
|
|
2991
3043
|
}
|
|
2992
3044
|
return {
|
|
2993
|
-
barXPosition: x + (
|
|
3045
|
+
barXPosition: x + (overlay ? 0 : barWidth * this.visibleI),
|
|
2994
3046
|
x
|
|
2995
3047
|
};
|
|
2996
3048
|
}
|
|
@@ -3011,7 +3063,20 @@ class Bar {
|
|
|
3011
3063
|
_wasOnScreen(realIndex, j) {
|
|
3012
3064
|
if (!lengthTransitionEnabled(this.w)) return false;
|
|
3013
3065
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3014
|
-
return !!keyed && keyed.has(
|
|
3066
|
+
return !!keyed && keyed.has(this._keys(realIndex)[j]);
|
|
3067
|
+
}
|
|
3068
|
+
/**
|
|
3069
|
+
* This render's datum keys for a series (see seriesKeys), as stamped on
|
|
3070
|
+
* each bar and looked up in the previous render's.
|
|
3071
|
+
* @param {number} realIndex
|
|
3072
|
+
* @returns {string[]}
|
|
3073
|
+
*/
|
|
3074
|
+
_keys(realIndex) {
|
|
3075
|
+
const c = (
|
|
3076
|
+
/** @type {any} */
|
|
3077
|
+
this._keyCache || (this._keyCache = {})
|
|
3078
|
+
);
|
|
3079
|
+
return c[realIndex] || (c[realIndex] = seriesKeys(this.w, realIndex));
|
|
3015
3080
|
}
|
|
3016
3081
|
/**
|
|
3017
3082
|
* The captured previous-render record for a series (last match wins, same
|
|
@@ -3067,7 +3132,7 @@ class Bar {
|
|
|
3067
3132
|
* @returns {boolean}
|
|
3068
3133
|
*/
|
|
3069
3134
|
isLengthTransition(realIndex) {
|
|
3070
|
-
var _a, _b;
|
|
3135
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3071
3136
|
if (!this._ltCache) this._ltCache = {};
|
|
3072
3137
|
if (this._ltCache[realIndex] !== void 0) return this._ltCache[realIndex];
|
|
3073
3138
|
const w = this.w;
|
|
@@ -3075,20 +3140,14 @@ class Bar {
|
|
|
3075
3140
|
if (lengthTransitionEnabled(w) && w.globals.previousPaths.length > 0) {
|
|
3076
3141
|
const record = this._prevRecord(realIndex);
|
|
3077
3142
|
const dataLen = (_b = (_a = w.seriesData.series[realIndex]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
3143
|
+
const keyed = record && this._prevKeyedPaths(realIndex);
|
|
3078
3144
|
if (!record) {
|
|
3079
3145
|
result = dataLen > 0;
|
|
3080
|
-
} else if (
|
|
3081
|
-
|
|
3146
|
+
} else if (keyed) {
|
|
3147
|
+
const now = new Set(this._keys(realIndex));
|
|
3148
|
+
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
3149
|
} 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
|
-
}
|
|
3150
|
+
result = record.paths.length !== dataLen;
|
|
3092
3151
|
}
|
|
3093
3152
|
}
|
|
3094
3153
|
this._ltCache[realIndex] = result;
|
|
@@ -3148,7 +3207,7 @@ class Bar {
|
|
|
3148
3207
|
let isNewDatum = false;
|
|
3149
3208
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3150
3209
|
if (keyed) {
|
|
3151
|
-
const prev = keyed.get(
|
|
3210
|
+
const prev = keyed.get(this._keys(realIndex)[j]);
|
|
3152
3211
|
if (prev) {
|
|
3153
3212
|
oldD = prev.d;
|
|
3154
3213
|
} else {
|
|
@@ -3291,11 +3350,10 @@ class Bar {
|
|
|
3291
3350
|
* @returns {boolean | null} null when there is no previous record to consult
|
|
3292
3351
|
*/
|
|
3293
3352
|
getPreviousFlip(realIndex, j) {
|
|
3294
|
-
const w = this.w;
|
|
3295
3353
|
const record = this._prevRecord(realIndex);
|
|
3296
3354
|
if (!record) return null;
|
|
3297
3355
|
const keyed = this._prevKeyedPaths(realIndex);
|
|
3298
|
-
const prev = keyed ? keyed.get(
|
|
3356
|
+
const prev = keyed ? keyed.get(this._keys(realIndex)[j]) : record.paths[j];
|
|
3299
3357
|
return prev ? !!prev.flip : null;
|
|
3300
3358
|
}
|
|
3301
3359
|
/**
|
|
@@ -3311,9 +3369,20 @@ class Bar {
|
|
|
3311
3369
|
return matches ? matches.length : 0;
|
|
3312
3370
|
}
|
|
3313
3371
|
}
|
|
3372
|
+
function jitterExtent(pool, w) {
|
|
3373
|
+
let lo = Infinity;
|
|
3374
|
+
let hi = -Infinity;
|
|
3375
|
+
pool.slice(0, w.seriesData.series.length).flat(2).forEach((v) => {
|
|
3376
|
+
if (v === +v) {
|
|
3377
|
+
if (v < lo) lo = v;
|
|
3378
|
+
if (v > hi) hi = v;
|
|
3379
|
+
}
|
|
3380
|
+
});
|
|
3381
|
+
return [lo, hi];
|
|
3382
|
+
}
|
|
3314
3383
|
function buildJitterGroups({
|
|
3315
|
-
w,
|
|
3316
3384
|
points,
|
|
3385
|
+
extent,
|
|
3317
3386
|
seedA,
|
|
3318
3387
|
seedB,
|
|
3319
3388
|
center,
|
|
@@ -3324,6 +3393,7 @@ function buildJitterGroups({
|
|
|
3324
3393
|
clampAt,
|
|
3325
3394
|
sideSign
|
|
3326
3395
|
}) {
|
|
3396
|
+
var _a, _b;
|
|
3327
3397
|
const opts = options;
|
|
3328
3398
|
if (!opts || opts.show === false) return [];
|
|
3329
3399
|
if (!points || !points.length) return [];
|
|
@@ -3337,8 +3407,8 @@ function buildJitterGroups({
|
|
|
3337
3407
|
const scale = opts.colorScale;
|
|
3338
3408
|
const useScale = scale && Array.isArray(scale.colors) && scale.colors.length > 0;
|
|
3339
3409
|
const steps = useScale ? Math.max(2, scale.steps || 24) : 1;
|
|
3340
|
-
const sMin =
|
|
3341
|
-
const sMax =
|
|
3410
|
+
const sMin = (_a = scale == null ? void 0 : scale.min) != null ? _a : extent[0];
|
|
3411
|
+
const sMax = (_b = scale == null ? void 0 : scale.max) != null ? _b : extent[1];
|
|
3342
3412
|
const span = sMax - sMin || 1;
|
|
3343
3413
|
const buckets = useScale ? new Array(steps).fill("") : [""];
|
|
3344
3414
|
for (let k = 0; k < points.length; k += stride) {
|
|
@@ -3424,7 +3494,7 @@ function renderJitter({
|
|
|
3424
3494
|
elSeries.add(elPointsWrap);
|
|
3425
3495
|
}
|
|
3426
3496
|
function darkenColor(color, amount) {
|
|
3427
|
-
const rgb = Utils.
|
|
3497
|
+
const rgb = Utils.parseColor(color) || Utils.parseColor(Utils.resolveColor(color));
|
|
3428
3498
|
if (!rgb) return color;
|
|
3429
3499
|
const f = Math.max(0, 1 - amount);
|
|
3430
3500
|
return `rgb(${Math.round(rgb[0] * f)},${Math.round(rgb[1] * f)},${Math.round(rgb[2] * f)})`;
|
|
@@ -3489,7 +3559,7 @@ class BoxCandleStick extends Bar {
|
|
|
3489
3559
|
if (!keyed || keyed.size === 0 || !row || row.length === 0) return false;
|
|
3490
3560
|
let survivors = 0;
|
|
3491
3561
|
for (let j = 0; j < row.length; j++) {
|
|
3492
|
-
if (keyed.has(
|
|
3562
|
+
if (keyed.has(this._keys(realIndex)[j])) survivors++;
|
|
3493
3563
|
}
|
|
3494
3564
|
return survivors / keyed.size < 0.5;
|
|
3495
3565
|
}
|
|
@@ -3518,7 +3588,7 @@ class BoxCandleStick extends Bar {
|
|
|
3518
3588
|
}
|
|
3519
3589
|
this._prevHalves[realIndex] = map;
|
|
3520
3590
|
}
|
|
3521
|
-
const halves = map && map.get(
|
|
3591
|
+
const halves = map && map.get(this._keys(realIndex)[j]);
|
|
3522
3592
|
return halves && halves.length === 2 ? halves[pi] : null;
|
|
3523
3593
|
}
|
|
3524
3594
|
/**
|
|
@@ -3528,7 +3598,7 @@ class BoxCandleStick extends Bar {
|
|
|
3528
3598
|
*/
|
|
3529
3599
|
// @ts-ignore -- BoxCandleStick.draw has an extra ctype param compared to Bar.draw
|
|
3530
3600
|
draw(series, ctype, seriesIndex) {
|
|
3531
|
-
var _a;
|
|
3601
|
+
var _a, _b;
|
|
3532
3602
|
const w = this.w;
|
|
3533
3603
|
const graphics = new Graphics(this.w);
|
|
3534
3604
|
const type = w.globals.comboCharts ? ctype : w.config.chart.type;
|
|
@@ -3536,16 +3606,17 @@ class BoxCandleStick extends Bar {
|
|
|
3536
3606
|
this.candlestickOptions = this.w.config.plotOptions.candlestick;
|
|
3537
3607
|
this.boxOptions = this.w.config.plotOptions.boxPlot;
|
|
3538
3608
|
this.isHorizontal = w.config.plotOptions.bar.horizontal;
|
|
3539
|
-
this.isOHLC = this.candlestickOptions && this.candlestickOptions.type === "ohlc";
|
|
3540
3609
|
this.coreUtils = new CoreUtils(this.w);
|
|
3541
3610
|
series = this.coreUtils.getLogSeries(series);
|
|
3542
3611
|
this.series = series;
|
|
3543
3612
|
this.yRatio = this.coreUtils.getLogYRatios(this.yRatio);
|
|
3544
|
-
this.barHelpers.initVariables(series);
|
|
3613
|
+
this.barHelpers.initVariables(series, seriesIndex);
|
|
3545
3614
|
const ret = graphics.group({
|
|
3546
3615
|
class: `apexcharts-${type}-series apexcharts-plot-series`
|
|
3547
3616
|
});
|
|
3548
3617
|
this.isBoxPlot = type === "boxPlot";
|
|
3618
|
+
this.isOHLC = !this.isBoxPlot && ((_a = this.candlestickOptions) == null ? void 0 : _a.type) === "ohlc";
|
|
3619
|
+
const jx = jitterExtent(w.candleData.seriesBoxPoints, w);
|
|
3549
3620
|
for (let i = 0; i < series.length; i++) {
|
|
3550
3621
|
let x;
|
|
3551
3622
|
let y;
|
|
@@ -3671,6 +3742,7 @@ class BoxCandleStick extends Bar {
|
|
|
3671
3742
|
i,
|
|
3672
3743
|
pathFrom: (_a2 = this._prevBoxHalf(realIndex, j, pi)) != null ? _a2 : paths.pathFrom,
|
|
3673
3744
|
fadeReveal,
|
|
3745
|
+
noLabel: pi > 0,
|
|
3674
3746
|
pathTo,
|
|
3675
3747
|
strokeWidth,
|
|
3676
3748
|
elSeries,
|
|
@@ -3692,7 +3764,7 @@ class BoxCandleStick extends Bar {
|
|
|
3692
3764
|
}
|
|
3693
3765
|
);
|
|
3694
3766
|
if (boxPointsOpts && boxPointsOpts.show !== false) {
|
|
3695
|
-
const pts = (
|
|
3767
|
+
const pts = (_b = w.candleData.seriesBoxPoints[realIndex]) == null ? void 0 : _b[j];
|
|
3696
3768
|
if (pts && pts.length) {
|
|
3697
3769
|
const logVal = (v) => (
|
|
3698
3770
|
/** @type {any} */
|
|
@@ -3703,14 +3775,14 @@ class BoxCandleStick extends Bar {
|
|
|
3703
3775
|
);
|
|
3704
3776
|
let center, halfExtent, alongFn;
|
|
3705
3777
|
if (this.isHorizontal) {
|
|
3706
|
-
const yRatio = this.invertedYRatio;
|
|
3778
|
+
const yRatio = this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
3707
3779
|
const bh = barHeight != null ? barHeight : 0;
|
|
3708
3780
|
const z = zeroW != null ? zeroW : 0;
|
|
3709
3781
|
center = paths.barYPosition + bh / 2;
|
|
3710
3782
|
halfExtent = bh / 2;
|
|
3711
3783
|
alongFn = (v) => z + logVal(v) / yRatio;
|
|
3712
3784
|
} else {
|
|
3713
|
-
const yRatio = this.yRatio[translationsIndex];
|
|
3785
|
+
const yRatio = this.yRatio[translationsIndex] * (this.isReversed ? -1 : 1);
|
|
3714
3786
|
const bw = barWidth != null ? barWidth : 0;
|
|
3715
3787
|
const z = zeroH != null ? zeroH : 0;
|
|
3716
3788
|
center = paths.barXPosition + bw / 2;
|
|
@@ -3718,8 +3790,8 @@ class BoxCandleStick extends Bar {
|
|
|
3718
3790
|
alongFn = (v) => z - logVal(v) / yRatio;
|
|
3719
3791
|
}
|
|
3720
3792
|
const groups = buildJitterGroups({
|
|
3721
|
-
w,
|
|
3722
3793
|
points: pts,
|
|
3794
|
+
extent: jx,
|
|
3723
3795
|
seedA: realIndex,
|
|
3724
3796
|
seedB: j,
|
|
3725
3797
|
center,
|
|
@@ -3748,15 +3820,13 @@ class BoxCandleStick extends Bar {
|
|
|
3748
3820
|
w.globals.seriesXvalues[realIndex] = xArrj;
|
|
3749
3821
|
w.globals.seriesYvalues[realIndex] = yArrj;
|
|
3750
3822
|
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
3823
|
renderBarExitGhosts({
|
|
3756
3824
|
w,
|
|
3757
3825
|
elSeries,
|
|
3758
3826
|
record: this._prevRecord(realIndex),
|
|
3759
|
-
newKeys
|
|
3827
|
+
newKeys: this._keys(realIndex).filter(
|
|
3828
|
+
(_, j) => series[i][j] != null
|
|
3829
|
+
),
|
|
3760
3830
|
isHorizontal: this.isHorizontal,
|
|
3761
3831
|
speed: w.config.chart.animations.dynamicAnimation.speed
|
|
3762
3832
|
});
|
|
@@ -3775,7 +3845,7 @@ class BoxCandleStick extends Bar {
|
|
|
3775
3845
|
strokeWidth,
|
|
3776
3846
|
cullBounds = null
|
|
3777
3847
|
}) {
|
|
3778
|
-
var _a, _b, _c
|
|
3848
|
+
var _a, _b, _c;
|
|
3779
3849
|
const w = this.w;
|
|
3780
3850
|
const graphics = new Graphics(this.w);
|
|
3781
3851
|
const i = indexes.i;
|
|
@@ -3786,7 +3856,7 @@ class BoxCandleStick extends Bar {
|
|
|
3786
3856
|
const getColor = (color2) => Array.isArray(color2) ? color2[realIndex] : color2;
|
|
3787
3857
|
const colorPos = getColor(candleColors.upward);
|
|
3788
3858
|
const colorNeg = getColor(candleColors.downward);
|
|
3789
|
-
const yRatio = this.yRatio[indexes.translationsIndex];
|
|
3859
|
+
const yRatio = this.yRatio[indexes.translationsIndex] * (this.isReversed ? -1 : 1);
|
|
3790
3860
|
const ohlc = this.getOHLCValue(realIndex, j);
|
|
3791
3861
|
let l1 = zeroH;
|
|
3792
3862
|
let l2 = zeroH;
|
|
@@ -3803,9 +3873,11 @@ class BoxCandleStick extends Bar {
|
|
|
3803
3873
|
x = pos.x;
|
|
3804
3874
|
barXPosition = pos.barXPosition;
|
|
3805
3875
|
}
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3876
|
+
const hole = (
|
|
3877
|
+
/** @type {any} */
|
|
3878
|
+
((_a = this.series[i]) == null ? void 0 : _a[j]) == null
|
|
3879
|
+
);
|
|
3880
|
+
if (hole) {
|
|
3809
3881
|
y1 = zeroH;
|
|
3810
3882
|
y2 = zeroH;
|
|
3811
3883
|
} else {
|
|
@@ -3815,7 +3887,7 @@ class BoxCandleStick extends Bar {
|
|
|
3815
3887
|
l2 = zeroH - ohlc.l / yRatio;
|
|
3816
3888
|
m = zeroH - ohlc.m / yRatio;
|
|
3817
3889
|
}
|
|
3818
|
-
if (cullBounds && (barXPosition + barWidth < cullBounds.lo || barXPosition > cullBounds.hi) && !this._wasOnScreen(realIndex, j)) {
|
|
3890
|
+
if (hole || cullBounds && (barXPosition + barWidth < cullBounds.lo || barXPosition > cullBounds.hi) && !this._wasOnScreen(realIndex, j)) {
|
|
3819
3891
|
return {
|
|
3820
3892
|
pathTo: null,
|
|
3821
3893
|
pathFrom: null,
|
|
@@ -3845,7 +3917,7 @@ class BoxCandleStick extends Bar {
|
|
|
3845
3917
|
];
|
|
3846
3918
|
}
|
|
3847
3919
|
let pathFrom = null;
|
|
3848
|
-
const morphFrom = (
|
|
3920
|
+
const morphFrom = (_c = (_b = this.ctx) == null ? void 0 : _b.morphTypeChange) == null ? void 0 : _c.getInitialPathFor(realIndex, j);
|
|
3849
3921
|
if (morphFrom) {
|
|
3850
3922
|
pathFrom = morphFrom;
|
|
3851
3923
|
} else if (w.globals.previousPaths.length > 0) {
|
|
@@ -3884,7 +3956,7 @@ class BoxCandleStick extends Bar {
|
|
|
3884
3956
|
zeroW,
|
|
3885
3957
|
strokeWidth
|
|
3886
3958
|
}) {
|
|
3887
|
-
var _a, _b, _c
|
|
3959
|
+
var _a, _b, _c;
|
|
3888
3960
|
const w = this.w;
|
|
3889
3961
|
const graphics = new Graphics(this.w);
|
|
3890
3962
|
const i = indexes.i;
|
|
@@ -3893,7 +3965,7 @@ class BoxCandleStick extends Bar {
|
|
|
3893
3965
|
const { colors: candleColors } = w.config.plotOptions.candlestick;
|
|
3894
3966
|
const { colors: boxColors } = this.boxOptions;
|
|
3895
3967
|
const getColor = (color2) => Array.isArray(color2) ? color2[realIndex] : color2;
|
|
3896
|
-
const yRatio = this.invertedYRatio;
|
|
3968
|
+
const yRatio = this.invertedYRatio * (this.isReversed ? -1 : 1);
|
|
3897
3969
|
const ohlc = this.getOHLCValue(realIndex, j);
|
|
3898
3970
|
let color = ohlc.o < ohlc.c ? [getColor(candleColors.upward)] : [getColor(candleColors.downward)];
|
|
3899
3971
|
if (this.isBoxPlot) {
|
|
@@ -3905,9 +3977,11 @@ class BoxCandleStick extends Bar {
|
|
|
3905
3977
|
let x2 = Math.max(ohlc.o, ohlc.c);
|
|
3906
3978
|
let m = ohlc.m;
|
|
3907
3979
|
const barYPosition = y + barHeight * this.visibleI;
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3980
|
+
const hole = (
|
|
3981
|
+
/** @type {any} */
|
|
3982
|
+
((_a = this.series[i]) == null ? void 0 : _a[j]) == null
|
|
3983
|
+
);
|
|
3984
|
+
if (hole) {
|
|
3911
3985
|
x1 = zeroW;
|
|
3912
3986
|
x2 = zeroW;
|
|
3913
3987
|
} else {
|
|
@@ -3922,7 +3996,7 @@ class BoxCandleStick extends Bar {
|
|
|
3922
3996
|
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
3997
|
];
|
|
3924
3998
|
let pathFrom = null;
|
|
3925
|
-
const morphFrom = (
|
|
3999
|
+
const morphFrom = (_c = (_b = this.ctx) == null ? void 0 : _b.morphTypeChange) == null ? void 0 : _c.getInitialPathFor(realIndex, j);
|
|
3926
4000
|
if (morphFrom) {
|
|
3927
4001
|
pathFrom = morphFrom;
|
|
3928
4002
|
} else if (w.globals.previousPaths.length > 0) {
|
|
@@ -3947,7 +4021,8 @@ class BoxCandleStick extends Bar {
|
|
|
3947
4021
|
0
|
|
3948
4022
|
),
|
|
3949
4023
|
barYPosition,
|
|
3950
|
-
color
|
|
4024
|
+
color,
|
|
4025
|
+
culled: hole
|
|
3951
4026
|
};
|
|
3952
4027
|
}
|
|
3953
4028
|
/**
|