apexcharts 8.3.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/apexcharts.common.js +2 -2
- package/dist/apexcharts.core.js +20039 -19931
- package/dist/apexcharts.core.min.js +2 -2
- package/dist/apexcharts.css +3 -8
- package/dist/apexcharts.esm.js +950 -574
- package/dist/apexcharts.full.js +23401 -22504
- package/dist/apexcharts.full.min.js +2 -2
- package/dist/apexcharts.js +21723 -21287
- package/dist/apexcharts.min.js +2 -2
- package/dist/apexcharts.ssr.common.js +2 -2
- package/dist/apexcharts.ssr.esm.js +21758 -21242
- package/dist/area.common.js +2 -2
- package/dist/area.esm.js +118 -65
- package/dist/bar.common.js +2 -2
- package/dist/bar.esm.js +404 -218
- package/dist/bar.js +2 -2
- package/dist/boxPlot.common.js +2 -2
- package/dist/boxPlot.esm.js +379 -205
- package/dist/bubble.common.js +2 -2
- package/dist/bubble.esm.js +118 -65
- package/dist/candlestick.common.js +2 -2
- package/dist/candlestick.esm.js +379 -205
- package/dist/candlestick.js +2 -2
- package/dist/column.common.js +2 -2
- package/dist/column.esm.js +404 -218
- package/dist/core.common.js +2 -2
- package/dist/core.esm.js +20034 -19926
- package/dist/donut.common.js +2 -2
- package/dist/donut.esm.js +106 -11
- package/dist/dumbbell.common.js +2 -2
- package/dist/dumbbell.esm.js +404 -218
- package/dist/features/all.common.js +2 -2
- package/dist/features/all.esm.js +282 -184
- 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 +137 -124
- 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 +31 -15
- 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 +206 -119
- 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 +1 -1
- package/dist/features/keyboard.esm.js +1 -1
- package/dist/features/keyboard.js +1 -1
- package/dist/features/legend.common.js +2 -2
- package/dist/features/legend.esm.js +52 -28
- 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 +27 -14
- 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 +35 -21
- 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 +160 -55
- package/dist/features/streamgraph.js +2 -2
- package/dist/features/toolbar.common.js +2 -2
- package/dist/features/toolbar.esm.js +78 -28
- package/dist/features/toolbar.js +2 -2
- package/dist/features/trellis.common.js +2 -2
- package/dist/features/trellis.esm.js +876 -543
- package/dist/features/trellis.js +2 -2
- package/dist/features/waterfall.common.js +2 -2
- package/dist/features/waterfall.esm.js +14 -25
- package/dist/features/waterfall.js +2 -2
- 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 +1893 -1342
- package/dist/heatmap.common.js +2 -2
- package/dist/heatmap.esm.js +38 -54
- package/dist/heatmap.js +2 -2
- package/dist/histogram.common.js +2 -2
- package/dist/histogram.esm.js +455 -276
- package/dist/icicle.common.js +2 -2
- package/dist/icicle.esm.js +156 -91
- package/dist/icicle.js +2 -2
- package/dist/line.common.js +2 -2
- package/dist/line.esm.js +118 -65
- package/dist/line.js +2 -2
- package/dist/pictograms.common.js +2 -2
- package/dist/pictograms.esm.js +2 -2
- package/dist/pictograms.js +2 -2
- package/dist/pie.common.js +2 -2
- package/dist/pie.esm.js +106 -11
- package/dist/pie.js +2 -2
- package/dist/polarArea.common.js +2 -2
- package/dist/polarArea.esm.js +106 -11
- package/dist/radar.common.js +2 -2
- package/dist/radar.esm.js +23 -9
- package/dist/radar.js +2 -2
- package/dist/radialBar.common.js +2 -2
- package/dist/radialBar.esm.js +108 -14
- package/dist/radialBar.js +2 -2
- package/dist/raincloud.common.js +2 -2
- package/dist/raincloud.esm.js +39 -31
- package/dist/rangeArea.common.js +2 -2
- package/dist/rangeArea.esm.js +118 -65
- package/dist/rangeBar.common.js +2 -2
- package/dist/rangeBar.esm.js +404 -218
- package/dist/scatter.common.js +2 -2
- package/dist/scatter.esm.js +118 -65
- package/dist/streamgraph.common.js +2 -2
- package/dist/streamgraph.esm.js +276 -118
- package/dist/sunburst.common.js +2 -2
- package/dist/sunburst.esm.js +333 -116
- package/dist/sunburst.js +2 -2
- package/dist/treemap.common.js +2 -2
- package/dist/treemap.esm.js +155 -124
- package/dist/treemap.js +2 -2
- package/dist/unit-shapes.common.js +2 -2
- package/dist/unit-shapes.esm.js +2 -2
- package/dist/unit-shapes.js +2 -2
- package/dist/unit.common.js +2 -2
- package/dist/unit.esm.js +29 -27
- package/dist/unit.js +2 -2
- package/dist/violin.common.js +2 -2
- package/dist/violin.esm.js +14 -5
- package/dist/violin.js +2 -2
- package/dist/waterfall.common.js +2 -2
- package/dist/waterfall.esm.js +417 -242
- package/package.json +1 -1
- package/src/apexcharts.js +37 -60
- package/src/assets/apexcharts.css +3 -8
- package/src/charts/Bar.js +30 -12
- package/src/charts/BarStacked.js +10 -4
- package/src/charts/BoxCandleStick.js +8 -2
- package/src/charts/Icicle.js +60 -76
- package/src/charts/Line.js +58 -22
- package/src/charts/Pie.js +136 -14
- package/src/charts/Radar.js +6 -9
- package/src/charts/Radial.js +2 -6
- package/src/charts/RangeBar.js +13 -13
- package/src/charts/Scatter.js +5 -7
- package/src/charts/Sunburst.js +157 -135
- package/src/charts/Treemap.js +100 -56
- package/src/charts/common/Breadcrumb.js +37 -16
- package/src/charts/common/PreviousPaths.js +45 -0
- package/src/charts/common/Stats.js +30 -23
- package/src/charts/common/bar/DataLabels.js +85 -77
- package/src/charts/common/bar/Helpers.js +144 -56
- package/src/charts/common/line/Helpers.js +8 -11
- package/src/charts/common/partition/NodeTooltip.js +62 -22
- package/src/charts/common/partition/Partition.js +64 -19
- package/src/charts/common/partition/Tint.js +6 -3
- package/src/charts/common/partition/Transitions.js +108 -0
- package/src/charts/common/treemap/ColorScale.js +30 -14
- package/src/charts/common/treemap/Helpers.js +47 -68
- 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/modules/Animations.js +102 -95
- package/src/modules/AxisMapping.js +47 -12
- package/src/modules/Base.js +12 -14
- package/src/modules/CoreUtils.js +26 -46
- package/src/modules/Data.js +82 -55
- package/src/modules/DataLabels.js +14 -13
- package/src/modules/Exports.js +44 -19
- package/src/modules/Fill.js +17 -8
- package/src/modules/Filters.js +50 -50
- package/src/modules/Graphics.js +65 -84
- package/src/modules/Markers.js +57 -58
- package/src/modules/MorphPieces.js +16 -10
- package/src/modules/MorphTypeChange.js +21 -9
- package/src/modules/Range.js +32 -55
- package/src/modules/RendererController.js +4 -4
- package/src/modules/Responsive.js +5 -1
- package/src/modules/Scales.js +24 -15
- package/src/modules/Series.js +85 -73
- package/src/modules/Toolbar.js +3 -2
- package/src/modules/UnitLayoutRegistry.js +8 -5
- package/src/modules/UnitMarkRegistry.js +7 -10
- package/src/modules/ZoomPanSelection.js +4 -0
- package/src/modules/animations/AxisTransition.js +11 -4
- package/src/modules/animations/DataLabelTransition.js +30 -15
- package/src/modules/animations/Easing.js +2 -1
- package/src/modules/animations/LayoutTransition.js +43 -32
- package/src/modules/animations/LengthTransition.js +176 -84
- package/src/modules/annotations/Helpers.js +68 -52
- package/src/modules/axes/AxesUtils.js +14 -12
- package/src/modules/axes/Grid.js +21 -7
- package/src/modules/axes/XAxis.js +4 -4
- package/src/modules/axes/YAxis.js +12 -13
- 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 +11 -53
- package/src/modules/drilldown/Drilldown.js +151 -95
- package/src/modules/helpers/InitCtxVariables.js +2 -1
- package/src/modules/helpers/UpdateHelpers.js +165 -15
- package/src/modules/helpers/XKey.js +56 -0
- package/src/modules/highlightFilter/HighlightFilter.js +98 -49
- package/src/modules/highlightFilter/PiePart.js +6 -3
- package/src/modules/highlightFilter/RadialPart.js +41 -7
- package/src/modules/highlightFilter/TreemapPart.js +71 -44
- package/src/modules/highlightFilter/util.js +23 -7
- package/src/modules/legend/Helpers.js +6 -1
- package/src/modules/legend/Legend.js +39 -13
- package/src/modules/license/LicenseEnforcer.js +5 -0
- package/src/modules/settings/Defaults.js +62 -106
- package/src/modules/settings/Globals.js +5 -0
- package/src/modules/settings/Options.js +0 -7
- package/src/modules/settings/TypeAliases.js +33 -16
- package/src/modules/streamgraph/StreamData.js +81 -35
- package/src/modules/streamgraph/StreamLabels.js +44 -17
- package/src/modules/tooltip/Labels.js +80 -80
- package/src/modules/tooltip/Marker.js +25 -21
- package/src/modules/tooltip/Position.js +88 -51
- package/src/modules/tooltip/Tooltip.js +229 -253
- package/src/modules/tooltip/Utils.js +64 -131
- package/src/modules/tooltip/constants.js +5 -5
- package/src/modules/trellis/Trellis.js +402 -248
- package/src/modules/trellis/TrellisChrome.js +110 -44
- package/src/modules/trellis/TrellisExports.js +48 -13
- package/src/modules/trellis/TrellisFrames.js +11 -15
- package/src/modules/trellis/TrellisScales.js +201 -115
- package/src/modules/trellis/TrellisSplit.js +72 -36
- package/src/modules/trellis/TrellisSync.js +41 -13
- package/src/modules/trellis/TrellisTooltip.js +101 -78
- package/src/modules/trellis/pivotRows.js +20 -6
- package/src/modules/waterfall/WaterfallData.js +14 -30
- package/src/modules/weave/WeaveHost.js +18 -12
- package/src/pictograms/registry.js +2 -1
- package/src/renderers/Renderer.js +41 -37
- package/src/renderers/canvas/CanvasCompositor.js +4 -1
- package/src/renderers/canvas/CanvasGraphics.js +56 -24
- package/src/ssr/RenderShim.js +129 -20
- package/src/svg/SVGContainer.js +3 -2
- package/src/svg/SVGFilter.js +26 -17
- package/src/types/internal.d.ts +8 -6
- package/src/unit-shapes/registry.js +3 -1
- package/src/utils/DateTime.js +5 -20
- package/src/utils/Utils.js +0 -14
- package/src/utils/nameAsHtml.js +16 -0
- package/types/apexcharts.d.ts +72 -13
package/dist/treemap.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.4.0
|
|
22
22
|
* (c) 2018-2026 ApexCharts
|
|
23
23
|
*/
|
|
24
24
|
import * as _core from "apexcharts/core";
|
|
@@ -198,18 +198,14 @@ class TreemapHelpers {
|
|
|
198
198
|
this.ctx = ctx;
|
|
199
199
|
this.w = w;
|
|
200
200
|
}
|
|
201
|
+
/** Whether a colour range reaches zero or below. Runs once per draw. */
|
|
201
202
|
checkColorRange() {
|
|
202
203
|
const w = this.w;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
negRange = true;
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
return negRange;
|
|
204
|
+
this.rowExt = /** @type {number[][]} */
|
|
205
|
+
[];
|
|
206
|
+
return w.config.plotOptions[w.config.chart.type].colorScale.ranges.some(
|
|
207
|
+
(range) => range.from <= 0
|
|
208
|
+
);
|
|
213
209
|
}
|
|
214
210
|
/**
|
|
215
211
|
* @param {string} chartType
|
|
@@ -219,51 +215,30 @@ class TreemapHelpers {
|
|
|
219
215
|
*/
|
|
220
216
|
getShadeColor(chartType, i, j, negRange) {
|
|
221
217
|
const w = this.w;
|
|
222
|
-
|
|
223
|
-
const shadeIntensity =
|
|
218
|
+
const opts = w.config.plotOptions[chartType];
|
|
219
|
+
const shadeIntensity = opts.shadeIntensity;
|
|
220
|
+
const k = shadeIntensity * 1.25;
|
|
224
221
|
const colorProps = this.determineColor(chartType, i, j);
|
|
222
|
+
const p = colorProps.percent / 100;
|
|
223
|
+
let colorShadePercent;
|
|
225
224
|
if (
|
|
226
225
|
/** @type {any} */
|
|
227
226
|
w.globals.hasNegs || negRange
|
|
228
227
|
) {
|
|
229
|
-
|
|
230
|
-
if (colorProps.percent < 0) {
|
|
231
|
-
colorShadePercent = colorProps.percent / 100 * (shadeIntensity * 1.25);
|
|
232
|
-
} else {
|
|
233
|
-
colorShadePercent = (1 - colorProps.percent / 100) * (shadeIntensity * 1.25);
|
|
234
|
-
}
|
|
235
|
-
} else {
|
|
236
|
-
if (colorProps.percent <= 0) {
|
|
237
|
-
colorShadePercent = 1 - (1 + colorProps.percent / 100) * shadeIntensity;
|
|
238
|
-
} else {
|
|
239
|
-
colorShadePercent = (1 - colorProps.percent / 100) * shadeIntensity;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
228
|
+
colorShadePercent = opts.reverseNegativeShade ? (p < 0 ? p : 1 - p) * k : p <= 0 ? 1 - (1 + p) * shadeIntensity : (1 - p) * shadeIntensity;
|
|
242
229
|
} else {
|
|
243
|
-
colorShadePercent = 1 -
|
|
244
|
-
if (chartType === "treemap") {
|
|
245
|
-
colorShadePercent = (1 - colorProps.percent / 100) * (shadeIntensity * 1.25);
|
|
246
|
-
}
|
|
230
|
+
colorShadePercent = chartType === "treemap" ? (1 - p) * k : 1 - p;
|
|
247
231
|
}
|
|
248
232
|
let color = colorProps.color;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
w.config.fill.opacity
|
|
259
|
-
);
|
|
260
|
-
} else {
|
|
261
|
-
const shadeColor = utils.shadeColor(colorShadePercent, colorProps.color);
|
|
262
|
-
color = Utils.hexToRgba(
|
|
263
|
-
Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor),
|
|
264
|
-
w.config.fill.opacity
|
|
265
|
-
);
|
|
266
|
-
}
|
|
233
|
+
if (opts.enableShades) {
|
|
234
|
+
const shadeColor = new Utils().shadeColor(
|
|
235
|
+
w.config.theme.mode === "dark" ? -colorShadePercent : colorShadePercent,
|
|
236
|
+
color
|
|
237
|
+
);
|
|
238
|
+
color = Utils.hexToRgba(
|
|
239
|
+
Utils.isColorHex(shadeColor) ? shadeColor : Utils.rgb2hex(shadeColor),
|
|
240
|
+
w.config.fill.opacity
|
|
241
|
+
);
|
|
267
242
|
}
|
|
268
243
|
return { color, colorProps };
|
|
269
244
|
}
|
|
@@ -288,13 +263,22 @@ class TreemapHelpers {
|
|
|
288
263
|
min = w.globals.minY;
|
|
289
264
|
max = w.globals.maxY;
|
|
290
265
|
} else {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
266
|
+
let ext = (
|
|
267
|
+
/** @type {number[][]} */
|
|
268
|
+
this.rowExt[i]
|
|
269
|
+
);
|
|
270
|
+
if (!ext) {
|
|
271
|
+
const row = w.seriesData.series[i];
|
|
272
|
+
min = row.length ? row[0] : 0;
|
|
273
|
+
max = min;
|
|
274
|
+
for (let k = 1; k < row.length; k++) {
|
|
275
|
+
if (row[k] < min) min = row[k];
|
|
276
|
+
if (row[k] > max) max = row[k];
|
|
277
|
+
}
|
|
278
|
+
ext = /** @type {number[][]} */
|
|
279
|
+
this.rowExt[i] = [min, max];
|
|
297
280
|
}
|
|
281
|
+
[min, max] = ext;
|
|
298
282
|
}
|
|
299
283
|
const csMin = chartOpts.colorScale.min;
|
|
300
284
|
const csMax = chartOpts.colorScale.max;
|
|
@@ -355,6 +339,11 @@ class TreemapHelpers {
|
|
|
355
339
|
}
|
|
356
340
|
const Filters = _core.__apex_Filters;
|
|
357
341
|
const Series = _core.__apex_Series;
|
|
342
|
+
function nameAsHtml(name, out = name) {
|
|
343
|
+
const s = String(name != null ? name : "");
|
|
344
|
+
const tail = out === s ? "" : out === s + ": " ? ": " : null;
|
|
345
|
+
return tail === null ? out : s.replace(/&/g, "&").replace(/</g, "<") + tail;
|
|
346
|
+
}
|
|
358
347
|
const Environment = _core.__apex_Environment_Environment;
|
|
359
348
|
function drilldownById(w, id) {
|
|
360
349
|
const dd = w.config.drilldown;
|
|
@@ -478,8 +467,7 @@ function getTreemapRoots(w) {
|
|
|
478
467
|
if (stashed && stashed.length) {
|
|
479
468
|
return {
|
|
480
469
|
roots: stashed,
|
|
481
|
-
maxDepth: w.globals.treemapMaxDepth || 1
|
|
482
|
-
nested: true
|
|
470
|
+
maxDepth: w.globals.treemapMaxDepth || 1
|
|
483
471
|
};
|
|
484
472
|
}
|
|
485
473
|
const roots = buildSeriesRoots(w, w.config.series, {
|
|
@@ -488,14 +476,13 @@ function getTreemapRoots(w) {
|
|
|
488
476
|
});
|
|
489
477
|
roots.forEach(fillValues);
|
|
490
478
|
const { maxDepth } = annotate(roots);
|
|
491
|
-
return { roots, maxDepth
|
|
479
|
+
return { roots, maxDepth };
|
|
492
480
|
}
|
|
493
481
|
const BrowserAPIs = _core.__apex_BrowserAPIs_BrowserAPIs;
|
|
494
482
|
const resolveEasing = _core.__apex_Easing_resolveEasing;
|
|
495
|
-
function rafTween(w, duration, ease, onFrame, onDone) {
|
|
496
|
-
const startAt = performance.now();
|
|
483
|
+
function rafTween(w, duration, ease, onFrame, onDone, alive, startAt = performance.now()) {
|
|
497
484
|
const step = (now) => {
|
|
498
|
-
if (w.globals.isDestroyed) return;
|
|
485
|
+
if (w.globals.isDestroyed || alive && !alive()) return;
|
|
499
486
|
const raw = Math.max(0, Math.min(1, (now - startAt) / duration));
|
|
500
487
|
onFrame(ease(raw), raw);
|
|
501
488
|
if (raw < 1) {
|
|
@@ -505,6 +492,9 @@ function rafTween(w, duration, ease, onFrame, onDone) {
|
|
|
505
492
|
}
|
|
506
493
|
};
|
|
507
494
|
BrowserAPIs.requestAnimationFrame(step);
|
|
495
|
+
return () => {
|
|
496
|
+
alive = () => false;
|
|
497
|
+
};
|
|
508
498
|
}
|
|
509
499
|
const DEFAULT_DIVERGING = ["#cf4d3f", "#8f9499", "#26a75b"];
|
|
510
500
|
const lerp = (a, b, t) => a + (b - a) * t;
|
|
@@ -548,14 +538,12 @@ function colorValueOfDatum(w, datum, i, j) {
|
|
|
548
538
|
const n = Number(raw);
|
|
549
539
|
return Number.isFinite(n) ? n : null;
|
|
550
540
|
}
|
|
551
|
-
function resolveStops(cfg, min, max, midpoint) {
|
|
552
|
-
if (
|
|
541
|
+
function resolveStops(cfg, min, max, midpoint, explicit) {
|
|
542
|
+
if (explicit) {
|
|
553
543
|
return cfg.stops.filter((s) => s && Number.isFinite(Number(s.value))).map((s) => ({
|
|
554
544
|
value: Number(s.value),
|
|
555
545
|
color: normalizeHex(s.color)
|
|
556
|
-
})).sort(
|
|
557
|
-
(a, b) => a.value - b.value
|
|
558
|
-
);
|
|
546
|
+
})).sort((a, b) => a.value - b.value);
|
|
559
547
|
}
|
|
560
548
|
const colors = (Array.isArray(cfg.colors) && cfg.colors.length >= 2 ? cfg.colors : DEFAULT_DIVERGING).map(normalizeHex);
|
|
561
549
|
const n = colors.length;
|
|
@@ -607,8 +595,11 @@ function buildContinuousScale(w) {
|
|
|
607
595
|
dataMin = 0;
|
|
608
596
|
dataMax = 0;
|
|
609
597
|
}
|
|
610
|
-
|
|
611
|
-
|
|
598
|
+
const pin = (v) => Number.isFinite(Number(v)) ? Number(v) : null;
|
|
599
|
+
const pinMin = pin(cfg.min);
|
|
600
|
+
const pinMax = pin(cfg.max);
|
|
601
|
+
let min = pinMin != null ? pinMin : dataMin;
|
|
602
|
+
let max = pinMax != null ? pinMax : dataMax;
|
|
612
603
|
let midpoint = null;
|
|
613
604
|
if (cfg.midpoint === null) {
|
|
614
605
|
midpoint = null;
|
|
@@ -617,7 +608,7 @@ function buildContinuousScale(w) {
|
|
|
617
608
|
} else if (min < 0 && max > 0) {
|
|
618
609
|
midpoint = 0;
|
|
619
610
|
}
|
|
620
|
-
if (midpoint != null && cfg.symmetric !== false &&
|
|
611
|
+
if (midpoint != null && cfg.symmetric !== false && pinMin == null && pinMax == null) {
|
|
621
612
|
const reach = Math.max(Math.abs(min - midpoint), Math.abs(max - midpoint));
|
|
622
613
|
min = midpoint - reach;
|
|
623
614
|
max = midpoint + reach;
|
|
@@ -626,8 +617,13 @@ function buildContinuousScale(w) {
|
|
|
626
617
|
min -= 0.5;
|
|
627
618
|
max += 0.5;
|
|
628
619
|
}
|
|
629
|
-
const
|
|
620
|
+
const explicit = Array.isArray(cfg.stops) && cfg.stops.length >= 2;
|
|
621
|
+
const stops = resolveStops(cfg, min, max, midpoint, explicit);
|
|
630
622
|
if (stops.length < 2) return null;
|
|
623
|
+
if (explicit) {
|
|
624
|
+
if (pinMin == null) min = Math.min(min, stops[0].value);
|
|
625
|
+
if (pinMax == null) max = Math.max(max, stops[stops.length - 1].value);
|
|
626
|
+
}
|
|
631
627
|
const at = (v) => {
|
|
632
628
|
if (!Number.isFinite(v)) return stops[Math.floor(stops.length / 2)].color;
|
|
633
629
|
if (v <= stops[0].value) return stops[0].color;
|
|
@@ -645,10 +641,13 @@ function buildContinuousScale(w) {
|
|
|
645
641
|
return last.color;
|
|
646
642
|
};
|
|
647
643
|
const span = max - min;
|
|
648
|
-
const legendStops = stops.map((s) =>
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
644
|
+
const legendStops = stops.map((s) => {
|
|
645
|
+
const v = Math.min(max, Math.max(min, s.value));
|
|
646
|
+
return {
|
|
647
|
+
percent: span && (v - min) / span,
|
|
648
|
+
color: v === s.value ? s.color : at(v)
|
|
649
|
+
};
|
|
650
|
+
});
|
|
652
651
|
return { min, max, midpoint, stops, at, legendStops };
|
|
653
652
|
}
|
|
654
653
|
function readableOn(bg) {
|
|
@@ -659,15 +658,19 @@ const XHTML = "http://www.w3.org/1999/xhtml";
|
|
|
659
658
|
const BREADCRUMB_HEIGHT = 18;
|
|
660
659
|
function breadcrumbConfig(w, localCfg) {
|
|
661
660
|
const shared = w.config.drilldown && w.config.drilldown.breadcrumb || {};
|
|
662
|
-
return
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
661
|
+
return Object.assign(
|
|
662
|
+
{
|
|
663
|
+
show: true,
|
|
664
|
+
position: "top-left",
|
|
665
|
+
separator: " / ",
|
|
666
|
+
rootLabel: "All",
|
|
667
|
+
offsetX: 0,
|
|
668
|
+
offsetY: 0,
|
|
669
|
+
formatter: void 0
|
|
670
|
+
},
|
|
671
|
+
shared,
|
|
672
|
+
localCfg
|
|
673
|
+
);
|
|
671
674
|
}
|
|
672
675
|
function avoidChromeOverlap(w, nav) {
|
|
673
676
|
const chrome = (
|
|
@@ -783,6 +786,11 @@ function withFills(from, to, fillWas, fillNow) {
|
|
|
783
786
|
}
|
|
784
787
|
return [from, to];
|
|
785
788
|
}
|
|
789
|
+
const showsParents = (w) => {
|
|
790
|
+
var _a;
|
|
791
|
+
const show = w.config.plotOptions.treemap.parents.show;
|
|
792
|
+
return show === true || show !== false && !!((_a = w.globals.treemapRoots) == null ? void 0 : _a.length);
|
|
793
|
+
};
|
|
786
794
|
const headerLook = (el) => Series.treemapHeaderLook(el);
|
|
787
795
|
class TreemapChart {
|
|
788
796
|
/**
|
|
@@ -798,7 +806,6 @@ class TreemapChart {
|
|
|
798
806
|
this.labels = [];
|
|
799
807
|
this.roots = [];
|
|
800
808
|
this.drawn = [];
|
|
801
|
-
this.nested = false;
|
|
802
809
|
this.showParents = false;
|
|
803
810
|
this.scale = null;
|
|
804
811
|
this._levelCache = null;
|
|
@@ -825,13 +832,11 @@ class TreemapChart {
|
|
|
825
832
|
});
|
|
826
833
|
});
|
|
827
834
|
const tree = getTreemapRoots(w);
|
|
828
|
-
this.nested = tree.nested;
|
|
829
835
|
this.roots = tree.roots;
|
|
830
836
|
this.scale = buildContinuousScale(w);
|
|
831
837
|
const drawn = tree.roots.length === 1 ? tree.roots[0].children || [] : tree.roots;
|
|
832
838
|
this.drawn = drawn;
|
|
833
|
-
|
|
834
|
-
this.showParents = parentsCfg.show === true || parentsCfg.show !== false && this.nested;
|
|
839
|
+
this.showParents = showsParents(w);
|
|
835
840
|
const focus = this._resolveFocus(drawn);
|
|
836
841
|
const layoutRoots = focus ? [focus] : drawn;
|
|
837
842
|
TreemapSquared.generateNested(
|
|
@@ -1674,25 +1679,35 @@ class TreemapChart {
|
|
|
1674
1679
|
* Active means the feature is loaded as well as configured: without it the
|
|
1675
1680
|
* click navigates nowhere (the chart warns about the missing feature), so
|
|
1676
1681
|
* standing zoom down too would leave the click doing nothing at all.
|
|
1677
|
-
*
|
|
1682
|
+
*
|
|
1683
|
+
* Reads only `w`, so the layout, which runs before this renderer, asks it
|
|
1684
|
+
* through the type registry (`prototype.zoomLive`) and reserves the
|
|
1685
|
+
* breadcrumb band on the same answer: a flat treemap, with no parents to
|
|
1686
|
+
* click, used to keep an empty band. Not a static: one on this class cost
|
|
1687
|
+
* the default bundle about 290 B gzip.
|
|
1688
|
+
* @param {any} w
|
|
1689
|
+
* @param {any} drilldown the chart's drilldown feature, when loaded
|
|
1690
|
+
* @returns {any} the zoom config when live, null when drilldown is what
|
|
1691
|
+
* stands it down, else false
|
|
1678
1692
|
*/
|
|
1679
|
-
|
|
1693
|
+
zoomLive(w, drilldown) {
|
|
1680
1694
|
var _a;
|
|
1681
|
-
const w = this.w;
|
|
1682
1695
|
const z = w.config.plotOptions.treemap.zoom;
|
|
1683
|
-
if (!z
|
|
1696
|
+
if (!(z == null ? void 0 : z.enabled) || !showsParents(w)) return false;
|
|
1684
1697
|
const dd = w.config.drilldown;
|
|
1698
|
+
return drilldown && (dd == null ? void 0 : dd.enabled) && (((_a = dd.series) == null ? void 0 : _a.length) || dd.onDrillDown) ? null : z;
|
|
1699
|
+
}
|
|
1700
|
+
/** @returns {boolean} */
|
|
1701
|
+
_zoomEnabled() {
|
|
1685
1702
|
const d = this.ctx.drilldown;
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
}
|
|
1693
|
-
return false;
|
|
1703
|
+
const live = this.zoomLive(this.w, d);
|
|
1704
|
+
if (live === null && !d.zoomWarned) {
|
|
1705
|
+
d.zoomWarned = true;
|
|
1706
|
+
console.warn(
|
|
1707
|
+
"ApexCharts treemap: zoom is ignored while drilldown is active (plotOptions.treemap.zoom vs drilldown series or onDrillDown)."
|
|
1708
|
+
);
|
|
1694
1709
|
}
|
|
1695
|
-
return
|
|
1710
|
+
return !!live;
|
|
1696
1711
|
}
|
|
1697
1712
|
/**
|
|
1698
1713
|
* The focused branch for this render, looked up by the key stashed on the
|
|
@@ -2101,6 +2116,9 @@ class TreemapChart {
|
|
|
2101
2116
|
* that grows the font - where a readable chip over the tiles beats a
|
|
2102
2117
|
* breadcrumb clipped by the plot.
|
|
2103
2118
|
*
|
|
2119
|
+
* Breadcrumb.placeInReservedBand does the same plus a y-axis label ceiling
|
|
2120
|
+
* a treemap has no use for, which would cost the default bundle its bytes.
|
|
2121
|
+
*
|
|
2104
2122
|
* @param {any} nav
|
|
2105
2123
|
*/
|
|
2106
2124
|
_placeBreadcrumb(nav) {
|
|
@@ -2110,11 +2128,12 @@ class TreemapChart {
|
|
|
2110
2128
|
const dimHelpers = (_b = (_a = this.ctx) == null ? void 0 : _a.dimensions) == null ? void 0 : _b.dimHelpers;
|
|
2111
2129
|
const titleArea = dimHelpers ? dimHelpers.getTitleSubtitleCoords("title").height + dimHelpers.getTitleSubtitleCoords("subtitle").height : 0;
|
|
2112
2130
|
const navH = nav.getBoundingClientRect().height || BREADCRUMB_HEIGHT;
|
|
2131
|
+
const oy = this._breadcrumbCfg().offsetY || 0;
|
|
2113
2132
|
if (gridTop - titleArea >= navH + 1) {
|
|
2114
|
-
nav.style.top = `${gridTop - navH - 1}px`;
|
|
2133
|
+
nav.style.top = `${gridTop - navH - 1 + oy}px`;
|
|
2115
2134
|
return;
|
|
2116
2135
|
}
|
|
2117
|
-
nav.style.top = `${titleArea}px`;
|
|
2136
|
+
nav.style.top = `${titleArea + oy}px`;
|
|
2118
2137
|
const dark = w.config.theme.mode === "dark";
|
|
2119
2138
|
nav.style.background = dark ? "rgba(20,24,30,0.82)" : "rgba(255,255,255,0.86)";
|
|
2120
2139
|
nav.style.borderRadius = "4px";
|
|
@@ -2129,6 +2148,7 @@ class TreemapChart {
|
|
|
2129
2148
|
* @param {any} node
|
|
2130
2149
|
*/
|
|
2131
2150
|
_showParentTooltip(e, node) {
|
|
2151
|
+
var _a;
|
|
2132
2152
|
const w = this.w;
|
|
2133
2153
|
const t = this._tip();
|
|
2134
2154
|
if (!t) return;
|
|
@@ -2137,29 +2157,33 @@ class TreemapChart {
|
|
|
2137
2157
|
const pctTotal = total > 0 ? (node._area / total * 100).toFixed(1) : "0.0";
|
|
2138
2158
|
const pctParent = parentVal > 0 ? (node._area / parentVal * 100).toFixed(1) : pctTotal;
|
|
2139
2159
|
const cfg = this.w.config.plotOptions.treemap.parents;
|
|
2140
|
-
const custom = cfg && cfg.tooltip && cfg.tooltip.formatter;
|
|
2141
2160
|
const leafCount = this._countLeaves(node);
|
|
2142
|
-
let
|
|
2143
|
-
if (typeof
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2161
|
+
let fn = cfg && cfg.tooltip && cfg.tooltip.formatter;
|
|
2162
|
+
if (typeof fn !== "function") fn = w.config.tooltip.custom;
|
|
2163
|
+
let html = (_a = Array.isArray(fn) ? fn[node._si] : fn) == null ? void 0 : _a({
|
|
2164
|
+
name: node.name,
|
|
2165
|
+
value: node._area,
|
|
2166
|
+
depth: node.depth || 0,
|
|
2167
|
+
leafCount,
|
|
2168
|
+
percentOfParent: +pctParent,
|
|
2169
|
+
percentOfTotal: +pctTotal,
|
|
2170
|
+
node,
|
|
2171
|
+
w,
|
|
2172
|
+
series: w.seriesData.series,
|
|
2173
|
+
seriesIndex: node._si,
|
|
2174
|
+
dataPointIndex: -1,
|
|
2175
|
+
ctx: this.ctx
|
|
2176
|
+
});
|
|
2177
|
+
if (html == null || html === false) {
|
|
2155
2178
|
const marker = this._parentChrome(node.depth || 0).headerBg;
|
|
2156
2179
|
const groupBg = w.config.tooltip.fillSeriesColor ? `background-color:${marker};` : "";
|
|
2157
|
-
html = `<div class="apexcharts-tooltip-series-group apexcharts-active" style="display:flex;${groupBg}"><div class="apexcharts-tooltip-text"><div class="apexcharts-tooltip-y-group"><span class="apexcharts-tooltip-text-y-label">${
|
|
2180
|
+
html = `<div class="apexcharts-tooltip-series-group apexcharts-active" style="display:flex;${groupBg}"><div class="apexcharts-tooltip-text"><div class="apexcharts-tooltip-y-group"><span class="apexcharts-tooltip-text-y-label">${nameAsHtml(node.name)}: </span><span class="apexcharts-tooltip-text-y-value">${this._formatValue(
|
|
2158
2181
|
node._area,
|
|
2159
2182
|
node._si
|
|
2160
2183
|
)}</span></div><div class="apexcharts-tooltip-y-group"><span class="apexcharts-tooltip-text-y-label">${leafCount} items, </span><span class="apexcharts-tooltip-text-y-value">${pctParent}% of parent, ${pctTotal}% of total</span></div></div></div>`;
|
|
2161
2184
|
}
|
|
2162
|
-
|
|
2185
|
+
if (html == null ? void 0 : html.nodeName) t.replaceChildren(html.cloneNode(true));
|
|
2186
|
+
else t.innerHTML = html;
|
|
2163
2187
|
t.classList.add("apexcharts-active");
|
|
2164
2188
|
t.removeAttribute("aria-hidden");
|
|
2165
2189
|
this._positionTooltip(e);
|
|
@@ -2346,13 +2370,20 @@ class TreemapChart {
|
|
|
2346
2370
|
* @param {number} y2
|
|
2347
2371
|
*/
|
|
2348
2372
|
rotateToFitLabel(elText, fontSize, text, x1, y1, x2, y2) {
|
|
2349
|
-
const
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2373
|
+
const textRect = (
|
|
2374
|
+
/** @type {any} */
|
|
2375
|
+
this._labelRect(new Graphics(this.w), text, fontSize)
|
|
2376
|
+
);
|
|
2377
|
+
const t = elText.node.querySelector("text");
|
|
2378
|
+
if (t && textRect.width + this.w.config.stroke.width + 5 > x2 - x1 && textRect.width <= y2 - y1) {
|
|
2379
|
+
const a = t.getAttribute("text-anchor");
|
|
2380
|
+
const cx = +t.getAttribute("x") + /** @type {any} */
|
|
2381
|
+
((a === "start") - /** @type {any} */
|
|
2382
|
+
(a === "end")) * textRect.width / 2;
|
|
2383
|
+
const cy = +t.getAttribute("y") + textRect.centerOffset;
|
|
2353
2384
|
elText.node.setAttribute(
|
|
2354
2385
|
"transform",
|
|
2355
|
-
`rotate(-90 ${
|
|
2386
|
+
`rotate(-90 ${cx} ${cy}) translate(${textRect.height / 3})`
|
|
2356
2387
|
);
|
|
2357
2388
|
}
|
|
2358
2389
|
}
|
|
@@ -2405,9 +2436,9 @@ class TreemapChart {
|
|
|
2405
2436
|
* @returns {boolean}
|
|
2406
2437
|
*/
|
|
2407
2438
|
_morphKeyed() {
|
|
2408
|
-
var _a;
|
|
2439
|
+
var _a, _b;
|
|
2409
2440
|
const m = (_a = this.ctx) == null ? void 0 : _a.morphTypeChange;
|
|
2410
|
-
return !!(m && typeof m.hasKeyedMarks === "function" && m.hasKeyedMarks() && typeof m.getInitialPathForKey === "function");
|
|
2441
|
+
return (_b = this._keyed) != null ? _b : this._keyed = !!(m && typeof m.hasKeyedMarks === "function" && m.hasKeyedMarks() && typeof m.getInitialPathForKey === "function");
|
|
2411
2442
|
}
|
|
2412
2443
|
/**
|
|
2413
2444
|
* The captured shape a LEAF tile unrolls from, or null when the outgoing
|