billboard.js 4.0.0-next.2 → 4.0.0-next.4
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 +28 -0
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +944 -505
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +22 -22
- package/dist/billboard.pkgd.js +944 -505
- package/dist/billboard.pkgd.min.js +28 -28
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +22 -21
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +22 -21
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +33 -18
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +22 -21
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +9 -9
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +22 -21
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +33 -18
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +6 -6
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/Chart/Chart.js +1 -1
- package/dist-esm/Chart/api/axis.js +1 -1
- package/dist-esm/Chart/api/category.js +1 -1
- package/dist-esm/Chart/api/chart.js +6 -1
- package/dist-esm/Chart/api/color.js +1 -1
- package/dist-esm/Chart/api/data.js +1 -1
- package/dist-esm/Chart/api/export.js +1 -3
- package/dist-esm/Chart/api/flow.js +5 -1
- package/dist-esm/Chart/api/focus.js +37 -1
- package/dist-esm/Chart/api/grid.js +1 -1
- package/dist-esm/Chart/api/group.js +1 -1
- package/dist-esm/Chart/api/legend.js +1 -1
- package/dist-esm/Chart/api/load.js +10 -2
- package/dist-esm/Chart/api/regions.js +1 -1
- package/dist-esm/Chart/api/selection.js +1 -1
- package/dist-esm/Chart/api/show.js +1 -1
- package/dist-esm/Chart/api/stubs.js +53 -0
- package/dist-esm/Chart/api/subchart.js +5 -3
- package/dist-esm/Chart/api/tooltip.js +31 -1
- package/dist-esm/Chart/api/x.js +1 -1
- package/dist-esm/Chart/api/zoom.js +16 -7
- package/dist-esm/ChartInternal/Axis/Axis.js +5 -3
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +151 -95
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +2 -9
- package/dist-esm/ChartInternal/ChartInternal.js +17 -5
- package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
- package/dist-esm/ChartInternal/data/convert.js +10 -10
- package/dist-esm/ChartInternal/data/data.js +11 -10
- package/dist-esm/ChartInternal/data/load.js +21 -21
- package/dist-esm/ChartInternal/interactions/drag.js +3 -3
- package/dist-esm/ChartInternal/interactions/eventrect.js +10 -11
- package/dist-esm/ChartInternal/interactions/flow.js +1 -1
- package/dist-esm/ChartInternal/interactions/interaction.js +6 -3
- package/dist-esm/ChartInternal/interactions/subchart.js +4 -12
- package/dist-esm/ChartInternal/interactions/zoom.js +7 -1
- package/dist-esm/ChartInternal/internals/category.js +1 -1
- package/dist-esm/ChartInternal/internals/class.js +1 -1
- package/dist-esm/ChartInternal/internals/clip.js +2 -2
- package/dist-esm/ChartInternal/internals/color.js +1 -1
- package/dist-esm/ChartInternal/internals/domain.js +1 -1
- package/dist-esm/ChartInternal/internals/format.js +1 -1
- package/dist-esm/ChartInternal/internals/grid.js +29 -16
- package/dist-esm/ChartInternal/internals/legend.js +186 -39
- package/dist-esm/ChartInternal/internals/redraw.js +2 -2
- package/dist-esm/ChartInternal/internals/region.js +2 -1
- package/dist-esm/ChartInternal/internals/scale.js +1 -1
- package/dist-esm/ChartInternal/internals/selection.js +1 -1
- package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
- package/dist-esm/ChartInternal/internals/size.js +1 -1
- package/dist-esm/ChartInternal/internals/style.js +1 -1
- package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
- package/dist-esm/ChartInternal/internals/text.js +4 -4
- package/dist-esm/ChartInternal/internals/text.util.js +2 -2
- package/dist-esm/ChartInternal/internals/title.js +10 -2
- package/dist-esm/ChartInternal/internals/tooltip.js +3 -2
- package/dist-esm/ChartInternal/internals/transform.js +1 -1
- package/dist-esm/ChartInternal/internals/type.js +1 -1
- package/dist-esm/ChartInternal/shape/arc.js +36 -7
- package/dist-esm/ChartInternal/shape/area.js +1 -1
- package/dist-esm/ChartInternal/shape/bar.js +9 -7
- package/dist-esm/ChartInternal/shape/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
- package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
- package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
- package/dist-esm/ChartInternal/shape/core/path.js +7 -10
- package/dist-esm/ChartInternal/shape/core/point.js +1 -1
- package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
- package/dist-esm/ChartInternal/shape/funnel.js +4 -4
- package/dist-esm/ChartInternal/shape/gauge.js +1 -1
- package/dist-esm/ChartInternal/shape/line.js +7 -34
- package/dist-esm/ChartInternal/shape/point.js +2 -2
- package/dist-esm/ChartInternal/shape/polar.js +1 -1
- package/dist-esm/ChartInternal/shape/radar.js +1 -1
- package/dist-esm/ChartInternal/shape/shape.js +11 -5
- package/dist-esm/ChartInternal/shape/treemap.js +2 -2
- package/dist-esm/canvas/CanvasAxisRenderer.js +67 -26
- package/dist-esm/canvas/CanvasEngine.js +29 -12
- package/dist-esm/canvas/CanvasPainter.js +4 -2
- package/dist-esm/canvas/CanvasRenderer.js +156 -93
- package/dist-esm/canvas/CanvasTheme.js +1 -1
- package/dist-esm/canvas/HitDetector.js +34 -31
- package/dist-esm/canvas/axisTicks.js +3 -5
- package/dist-esm/canvas/classes.js +1 -1
- package/dist-esm/canvas/color.js +1 -1
- package/dist-esm/canvas/geometry.js +1 -1
- package/dist-esm/canvas/labels.js +17 -8
- package/dist-esm/canvas/pointPattern.js +1 -1
- package/dist-esm/canvas/util.js +14 -2
- package/dist-esm/config/Options/Options.js +1 -1
- package/dist-esm/config/Options/axis/axis.js +1 -1
- package/dist-esm/config/Options/axis/x.js +1 -1
- package/dist-esm/config/Options/axis/y.js +1 -1
- package/dist-esm/config/Options/axis/y2.js +1 -1
- package/dist-esm/config/Options/common/boost.js +1 -1
- package/dist-esm/config/Options/common/color.js +1 -1
- package/dist-esm/config/Options/common/grid.js +1 -1
- package/dist-esm/config/Options/common/legend.js +1 -1
- package/dist-esm/config/Options/common/main.js +2 -2
- package/dist-esm/config/Options/common/point.js +1 -1
- package/dist-esm/config/Options/common/title.js +1 -1
- package/dist-esm/config/Options/common/tooltip.js +1 -1
- package/dist-esm/config/Options/data/axis.js +1 -1
- package/dist-esm/config/Options/data/data.js +1 -1
- package/dist-esm/config/Options/data/selection.js +1 -1
- package/dist-esm/config/Options/interaction/interaction.js +1 -1
- package/dist-esm/config/Options/interaction/subchart.js +1 -1
- package/dist-esm/config/Options/interaction/zoom.js +1 -2
- package/dist-esm/config/Options/shape/arc.js +1 -1
- package/dist-esm/config/Options/shape/area.js +1 -1
- package/dist-esm/config/Options/shape/bar.js +1 -1
- package/dist-esm/config/Options/shape/bubble.js +1 -1
- package/dist-esm/config/Options/shape/candlestick.js +1 -1
- package/dist-esm/config/Options/shape/donut.js +1 -1
- package/dist-esm/config/Options/shape/funnel.js +1 -1
- package/dist-esm/config/Options/shape/gauge.js +1 -1
- package/dist-esm/config/Options/shape/line.js +1 -1
- package/dist-esm/config/Options/shape/pie.js +1 -1
- package/dist-esm/config/Options/shape/polar.js +1 -1
- package/dist-esm/config/Options/shape/radar.js +1 -1
- package/dist-esm/config/Options/shape/scatter.js +1 -1
- package/dist-esm/config/Options/shape/spline.js +1 -1
- package/dist-esm/config/Options/shape/treemap.js +1 -1
- package/dist-esm/config/Store/Element.js +1 -1
- package/dist-esm/config/Store/State.js +1 -1
- package/dist-esm/config/Store/Store.js +1 -1
- package/dist-esm/config/classes.js +2 -1
- package/dist-esm/config/config.js +1 -1
- package/dist-esm/config/const.js +31 -2
- package/dist-esm/config/resolver/axis.core.js +1 -1
- package/dist-esm/config/resolver/axis.js +1 -1
- package/dist-esm/config/resolver/canvas.js +163 -44
- package/dist-esm/config/resolver/canvasShape.js +1 -1
- package/dist-esm/config/resolver/category.js +1 -1
- package/dist-esm/config/resolver/export.js +1 -1
- package/dist-esm/config/resolver/flow.js +1 -1
- package/dist-esm/config/resolver/grid.js +1 -1
- package/dist-esm/config/resolver/interaction/selection.js +1 -1
- package/dist-esm/config/resolver/interaction/subchart.js +1 -1
- package/dist-esm/config/resolver/interaction/zoom.js +1 -1
- package/dist-esm/config/resolver/regions.js +1 -1
- package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/area.js +1 -1
- package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/bar.js +1 -1
- package/dist-esm/config/resolver/shape/bubble.js +1 -1
- package/dist-esm/config/resolver/shape/candlestick.js +1 -1
- package/dist-esm/config/resolver/shape/donut.js +1 -1
- package/dist-esm/config/resolver/shape/funnel.js +1 -1
- package/dist-esm/config/resolver/shape/gauge.js +1 -1
- package/dist-esm/config/resolver/shape/line.js +1 -1
- package/dist-esm/config/resolver/shape/pie.js +1 -1
- package/dist-esm/config/resolver/shape/polar.js +1 -1
- package/dist-esm/config/resolver/shape/radar.js +1 -1
- package/dist-esm/config/resolver/shape/scatter.js +1 -1
- package/dist-esm/config/resolver/shape/treemap.js +1 -1
- package/dist-esm/core.js +3 -3
- package/dist-esm/index.canvas.js +2 -1
- package/dist-esm/index.esm.js +2 -1
- package/dist-esm/module/Cache.js +4 -4
- package/dist-esm/module/browser.js +3 -3
- package/dist-esm/module/dsv.js +1 -1
- package/dist-esm/module/error.js +16 -3
- package/dist-esm/module/generator.js +10 -5
- package/dist-esm/module/sanitize.js +14 -18
- package/dist-esm/module/util/brush.js +1 -1
- package/dist-esm/module/util/dom.js +11 -6
- package/dist-esm/module/util/object.js +13 -7
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +61 -29
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +8 -5
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +9 -6
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +32 -21
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +37 -11
- package/src/Chart/api/chart.ts +6 -0
- package/src/Chart/api/export.ts +0 -4
- package/src/Chart/api/flow.ts +5 -0
- package/src/Chart/api/focus.ts +48 -0
- package/src/Chart/api/load.ts +13 -1
- package/src/Chart/api/subchart.ts +3 -1
- package/src/Chart/api/tooltip.ts +35 -0
- package/src/Chart/api/zoom.ts +13 -5
- package/src/ChartInternal/Axis/Axis.ts +5 -2
- package/src/ChartInternal/Axis/AxisRenderer.ts +180 -104
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -10
- package/src/ChartInternal/ChartInternal.ts +20 -3
- package/src/ChartInternal/data/convert.ts +8 -8
- package/src/ChartInternal/data/data.ts +13 -9
- package/src/ChartInternal/data/load.ts +25 -22
- package/src/ChartInternal/interactions/drag.ts +2 -2
- package/src/ChartInternal/interactions/eventrect.ts +11 -10
- package/src/ChartInternal/interactions/interaction.ts +6 -2
- package/src/ChartInternal/interactions/subchart.ts +3 -11
- package/src/ChartInternal/interactions/zoom.ts +11 -0
- package/src/ChartInternal/internals/clip.ts +1 -1
- package/src/ChartInternal/internals/grid.ts +35 -22
- package/src/ChartInternal/internals/legend.ts +219 -53
- package/src/ChartInternal/internals/redraw.ts +1 -1
- package/src/ChartInternal/internals/region.ts +1 -0
- package/src/ChartInternal/internals/text.ts +3 -3
- package/src/ChartInternal/internals/text.util.ts +1 -1
- package/src/ChartInternal/internals/title.ts +10 -1
- package/src/ChartInternal/internals/tooltip.ts +3 -1
- package/src/ChartInternal/shape/arc.ts +47 -12
- package/src/ChartInternal/shape/bar.ts +13 -11
- package/src/ChartInternal/shape/core/path.ts +6 -11
- package/src/ChartInternal/shape/funnel.ts +3 -3
- package/src/ChartInternal/shape/line.ts +8 -42
- package/src/ChartInternal/shape/point.ts +1 -1
- package/src/ChartInternal/shape/shape.ts +10 -4
- package/src/ChartInternal/shape/treemap.ts +1 -1
- package/src/Plugin/tableview/Options.ts +17 -1
- package/src/Plugin/tableview/index.ts +1 -1
- package/src/canvas/CanvasAxisRenderer.ts +76 -27
- package/src/canvas/CanvasEngine.ts +31 -12
- package/src/canvas/CanvasPainter.ts +2 -1
- package/src/canvas/CanvasRenderer.ts +199 -101
- package/src/canvas/HitDetector.ts +34 -34
- package/src/canvas/axisTicks.ts +2 -4
- package/src/canvas/labels.ts +17 -6
- package/src/canvas/util.ts +14 -0
- package/src/config/Options/common/main.ts +1 -1
- package/src/config/Options/interaction/zoom.ts +0 -1
- package/src/config/classes.ts +1 -0
- package/src/config/const.ts +15 -0
- package/src/config/resolver/canvas.ts +198 -59
- package/src/module/Cache.ts +3 -4
- package/src/module/generator.ts +11 -4
- package/src/module/sanitize.ts +13 -20
- package/src/module/util/dom.ts +13 -7
- package/src/module/util/object.ts +9 -5
- package/src/module/worker.ts +50 -32
- package/types/index.d.ts +0 -3
- package/types/plugin/tableview/options.d.ts +5 -0
package/dist/billboard.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0-next.
|
|
8
|
+
* @version 4.0.0-next.4
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -235,6 +235,16 @@ const AXIS_TICK_SIZE = 6;
|
|
|
235
235
|
const AXIS_TICK_PADDING = 3;
|
|
236
236
|
const AXIS_TICK_LENGTH = AXIS_TICK_SIZE + AXIS_TICK_PADDING;
|
|
237
237
|
const AXIS_TICK_LINE_OVERLAP_PADDING = 1;
|
|
238
|
+
const SUBCHART_BRUSH_HANDLE_PATH = {
|
|
239
|
+
x: {
|
|
240
|
+
start: "M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",
|
|
241
|
+
end: "M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"
|
|
242
|
+
},
|
|
243
|
+
y: {
|
|
244
|
+
start: "M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z",
|
|
245
|
+
end: "M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"
|
|
246
|
+
}
|
|
247
|
+
};
|
|
238
248
|
const TYPE_METHOD_NEEDED = {
|
|
239
249
|
AREA: "initArea",
|
|
240
250
|
AREA_LINE_RANGE: "initArea",
|
|
@@ -527,7 +537,7 @@ const DANGEROUS_CSS_PATTERNS = [
|
|
|
527
537
|
"-moz-binding:"
|
|
528
538
|
];
|
|
529
539
|
function decodeHTMLEntities(str) {
|
|
530
|
-
return str.replace(/:/gi, ":").replace(/&newline;/gi, "\n").replace(/&tab;/gi, " ").replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/&/gi, "&").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+)
|
|
540
|
+
return str.replace(/:/gi, ":").replace(/&newline;/gi, "\n").replace(/&tab;/gi, " ").replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/&/gi, "&").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 10))).replace(/&#x([0-9a-f]+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
|
|
531
541
|
}
|
|
532
542
|
function isSafeURI(uri) {
|
|
533
543
|
const decoded = decodeHTMLEntities(uri).trim();
|
|
@@ -535,15 +545,11 @@ function isSafeURI(uri) {
|
|
|
535
545
|
if (!normalized || normalized.startsWith("#")) {
|
|
536
546
|
return true;
|
|
537
547
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
const colonIndex = normalized.indexOf(":");
|
|
542
|
-
if (colonIndex > 0) {
|
|
543
|
-
const protocol = normalized.substring(0, colonIndex + 1);
|
|
544
|
-
return ALLOWED_URI_PROTOCOLS.has(protocol);
|
|
548
|
+
const schemeMatch = normalized.match(/^[^/?#]*:/);
|
|
549
|
+
if (schemeMatch) {
|
|
550
|
+
return ALLOWED_URI_PROTOCOLS.has(schemeMatch[0]);
|
|
545
551
|
}
|
|
546
|
-
return
|
|
552
|
+
return true;
|
|
547
553
|
}
|
|
548
554
|
function sanitizeStyleValue(style) {
|
|
549
555
|
const decoded = decodeHTMLEntities(style);
|
|
@@ -699,7 +705,7 @@ var __spreadValues = (a, b) => {
|
|
|
699
705
|
function _forEachValidItem(items, callback) {
|
|
700
706
|
for (let i = 0; i < items.length; i++) {
|
|
701
707
|
const item = items[i];
|
|
702
|
-
if (item) {
|
|
708
|
+
if (item !== null && isDefined(item)) {
|
|
703
709
|
callback(item, i);
|
|
704
710
|
}
|
|
705
711
|
}
|
|
@@ -721,7 +727,7 @@ function callFn(fn, thisArg, ...args) {
|
|
|
721
727
|
function endall(transition, cb) {
|
|
722
728
|
let n = 0;
|
|
723
729
|
const end = function(...args) {
|
|
724
|
-
!--n && cb.apply(this,
|
|
730
|
+
!--n && cb.apply(this, args);
|
|
725
731
|
};
|
|
726
732
|
if ("duration" in transition) {
|
|
727
733
|
transition.each(() => ++n).on("end", end);
|
|
@@ -737,7 +743,9 @@ function camelize(str, separator = "-") {
|
|
|
737
743
|
const toArray = (v) => [].slice.call(v);
|
|
738
744
|
function deepClone(...objectN) {
|
|
739
745
|
const clone = (v) => {
|
|
740
|
-
if (
|
|
746
|
+
if (isArray(v)) {
|
|
747
|
+
return v.map(clone);
|
|
748
|
+
} else if (isObject(v) && v.constructor) {
|
|
741
749
|
const r = new v.constructor();
|
|
742
750
|
for (const k in v) {
|
|
743
751
|
r[k] = clone(v[k]);
|
|
@@ -777,7 +785,9 @@ function mergeObj(target, ...objectN) {
|
|
|
777
785
|
Object.keys(source).forEach((key) => {
|
|
778
786
|
if (!/^(__proto__|constructor|prototype)$/i.test(key)) {
|
|
779
787
|
const value = source[key];
|
|
780
|
-
if (
|
|
788
|
+
if (value instanceof Date) {
|
|
789
|
+
target[key] = new Date(value.getTime());
|
|
790
|
+
} else if (isObject(value)) {
|
|
781
791
|
!target[key] && (target[key] = {});
|
|
782
792
|
target[key] = mergeObj(target[key], value);
|
|
783
793
|
} else {
|
|
@@ -823,7 +833,7 @@ function getMinMax(type, data) {
|
|
|
823
833
|
const getRange = (start, end, step = 1) => {
|
|
824
834
|
const res = [];
|
|
825
835
|
const n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
826
|
-
for (let i =
|
|
836
|
+
for (let i = 0; i < n; i++) {
|
|
827
837
|
res.push(start + i * step);
|
|
828
838
|
}
|
|
829
839
|
return res;
|
|
@@ -1133,6 +1143,11 @@ function getScale(type = "linear", min, max) {
|
|
|
1133
1143
|
;// ./src/canvas/util.ts
|
|
1134
1144
|
|
|
1135
1145
|
const DENSE_SCATTER_POINT_CULL_THRESHOLD = 1e5;
|
|
1146
|
+
function getFontSize(font) {
|
|
1147
|
+
const match = /(\d+(?:\.\d+)?)px/.exec(font);
|
|
1148
|
+
const size = match ? parseFloat(match[1]) : parseFloat(font);
|
|
1149
|
+
return Number.isFinite(size) ? size : 12;
|
|
1150
|
+
}
|
|
1136
1151
|
function getCanvasShapeIndices($$, shape, type, typeFilter) {
|
|
1137
1152
|
return shape.indices[type] || $$.getShapeIndices(typeFilter);
|
|
1138
1153
|
}
|
|
@@ -1537,7 +1552,7 @@ function getXTickValues($$, cull = true) {
|
|
|
1537
1552
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1538
1553
|
const { axis, config } = $$;
|
|
1539
1554
|
const targetScale = getXScale($$);
|
|
1540
|
-
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow(
|
|
1555
|
+
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow();
|
|
1541
1556
|
const cache = $$.state._canvasXTickValuesCache || ($$.state._canvasXTickValuesCache = /* @__PURE__ */ new Map());
|
|
1542
1557
|
const cacheKey = getXTickCacheKey($$, cull);
|
|
1543
1558
|
const cached = cache.get(cacheKey);
|
|
@@ -1603,7 +1618,7 @@ function getSubXTickValues($$) {
|
|
|
1603
1618
|
var _a, _b, _c, _d;
|
|
1604
1619
|
const { axis, config, scale } = $$;
|
|
1605
1620
|
const targetScale = scale.subX;
|
|
1606
|
-
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow(
|
|
1621
|
+
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow();
|
|
1607
1622
|
const cullMax = getSubXTickCullMax($$);
|
|
1608
1623
|
const cull = (ticks) => cullTicks(ticks, cullMax);
|
|
1609
1624
|
if (!targetScale || !(targetsToShow == null ? void 0 : targetsToShow.length)) {
|
|
@@ -1867,6 +1882,7 @@ function getYGridTickValues($$) {
|
|
|
1867
1882
|
var CanvasPainter_defProp = Object.defineProperty;
|
|
1868
1883
|
var CanvasPainter_defNormalProp = (obj, key, value) => key in obj ? CanvasPainter_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1869
1884
|
var __publicField = (obj, key, value) => CanvasPainter_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1885
|
+
|
|
1870
1886
|
class CanvasPainter {
|
|
1871
1887
|
/**
|
|
1872
1888
|
* Constructor.
|
|
@@ -2115,7 +2131,7 @@ class CanvasPainter {
|
|
|
2115
2131
|
textLines(text, x, y, style) {
|
|
2116
2132
|
this.withState((ctx) => {
|
|
2117
2133
|
const lines = text.split("\n");
|
|
2118
|
-
const lineHeight =
|
|
2134
|
+
const lineHeight = getFontSize((style == null ? void 0 : style.font) || ctx.font);
|
|
2119
2135
|
const firstLineY = lines.length > 1 ? -((lines.length - 1) * lineHeight) : 0;
|
|
2120
2136
|
this.applyStyle(style);
|
|
2121
2137
|
ctx.translate(x, y);
|
|
@@ -2283,7 +2299,9 @@ var CanvasAxisRenderer_publicField = (obj, key, value) => CanvasAxisRenderer_def
|
|
|
2283
2299
|
|
|
2284
2300
|
|
|
2285
2301
|
|
|
2286
|
-
|
|
2302
|
+
|
|
2303
|
+
const X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING = 20;
|
|
2304
|
+
const X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING = 15;
|
|
2287
2305
|
function getXTickTextDirection(isRotated) {
|
|
2288
2306
|
return isRotated ? -1 : 1;
|
|
2289
2307
|
}
|
|
@@ -2292,18 +2310,18 @@ function getYTickTextDirection(isRotated, isY2) {
|
|
|
2292
2310
|
}
|
|
2293
2311
|
function getHorizontalXAxisClipRect(margin, width, height) {
|
|
2294
2312
|
return {
|
|
2295
|
-
x: margin.left -
|
|
2313
|
+
x: margin.left - X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING,
|
|
2296
2314
|
y: 0,
|
|
2297
|
-
w: width +
|
|
2315
|
+
w: width + X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING * 2,
|
|
2298
2316
|
h: height
|
|
2299
2317
|
};
|
|
2300
2318
|
}
|
|
2301
2319
|
function getRotatedXAxisClipRect(margin, width, height) {
|
|
2302
2320
|
return {
|
|
2303
2321
|
x: 0,
|
|
2304
|
-
y: margin.top -
|
|
2322
|
+
y: margin.top - X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING,
|
|
2305
2323
|
w: width,
|
|
2306
|
-
h: height +
|
|
2324
|
+
h: height + X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING * 2
|
|
2307
2325
|
};
|
|
2308
2326
|
}
|
|
2309
2327
|
function getAxisTooltipBackgroundColor($$, id) {
|
|
@@ -2358,11 +2376,6 @@ function formatTick(format, tick) {
|
|
|
2358
2376
|
const value = format ? format(tick) : tick;
|
|
2359
2377
|
return value == null ? "" : String(value);
|
|
2360
2378
|
}
|
|
2361
|
-
function getFontSize(font) {
|
|
2362
|
-
const match = /(\d+(?:\.\d+)?)px/.exec(font);
|
|
2363
|
-
const size = match ? parseFloat(match[1]) : parseFloat(font);
|
|
2364
|
-
return Number.isFinite(size) ? size : 12;
|
|
2365
|
-
}
|
|
2366
2379
|
function getAxisTickFont(axisStyle, id) {
|
|
2367
2380
|
return axisStyle[`${id}TickFont`] || axisStyle.labelFont;
|
|
2368
2381
|
}
|
|
@@ -2373,6 +2386,13 @@ function getXTickTextLineHeight(painter, fontSize) {
|
|
|
2373
2386
|
const svgFallbackHeight = (fontSize || 10) * (11.5 / 10);
|
|
2374
2387
|
return Math.max(fontSize, fontBoxHeight, actualBoxHeight, svgFallbackHeight);
|
|
2375
2388
|
}
|
|
2389
|
+
function getRotatedXTickTextY(rotate) {
|
|
2390
|
+
const r2 = rotate / 15;
|
|
2391
|
+
return 11.5 - 2.5 * r2 * (rotate > 0 ? 1 : -1);
|
|
2392
|
+
}
|
|
2393
|
+
function getRotatedXTickTextDx(rotate) {
|
|
2394
|
+
return 8 * Math.sin(Math.PI * (rotate / 180));
|
|
2395
|
+
}
|
|
2376
2396
|
function resolveTextOffset(value, fontSize) {
|
|
2377
2397
|
if (typeof value === "number") {
|
|
2378
2398
|
return value;
|
|
@@ -2425,7 +2445,7 @@ function getXTickTextWidth($$, ticks, isRotated, targetScale) {
|
|
|
2425
2445
|
}
|
|
2426
2446
|
return 110;
|
|
2427
2447
|
}
|
|
2428
|
-
function getXTickTextLines($$, painter, format, tick, ticks = [], isRotated = false, targetScale = getXScale($$)) {
|
|
2448
|
+
function getXTickTextLines($$, painter, format, tick, ticks = [], isRotated = false, targetScale = getXScale($$), maxWidth) {
|
|
2429
2449
|
const value = format ? format(tick) : tick;
|
|
2430
2450
|
if (value == null) {
|
|
2431
2451
|
return [""];
|
|
@@ -2439,7 +2459,7 @@ function getXTickTextLines($$, painter, format, tick, ticks = [], isRotated = fa
|
|
|
2439
2459
|
}
|
|
2440
2460
|
return $$.config.axis_x_tick_multiline ? splitTickTextByWidth(
|
|
2441
2461
|
text,
|
|
2442
|
-
getXTickTextWidth($$, ticks, isRotated, targetScale),
|
|
2462
|
+
maxWidth != null ? maxWidth : getXTickTextWidth($$, ticks, isRotated, targetScale),
|
|
2443
2463
|
painter
|
|
2444
2464
|
) : [text];
|
|
2445
2465
|
}
|
|
@@ -2673,6 +2693,8 @@ class CanvasAxisRenderer {
|
|
|
2673
2693
|
ctx.textBaseline = isRotated ? "middle" : tickTextDirection > 0 ? "top" : "bottom";
|
|
2674
2694
|
ctx.strokeStyle = axis.tickColor;
|
|
2675
2695
|
ctx.lineWidth = axis.tickWidth;
|
|
2696
|
+
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
2697
|
+
const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, scale.subX);
|
|
2676
2698
|
for (const tick of ticks) {
|
|
2677
2699
|
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
2678
2700
|
const tx = margin2.left + tickPos;
|
|
@@ -2700,9 +2722,9 @@ class CanvasAxisRenderer {
|
|
|
2700
2722
|
tick,
|
|
2701
2723
|
ticks,
|
|
2702
2724
|
isRotated,
|
|
2703
|
-
scale.subX
|
|
2725
|
+
scale.subX,
|
|
2726
|
+
tickTextWidth
|
|
2704
2727
|
);
|
|
2705
|
-
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
2706
2728
|
let textX;
|
|
2707
2729
|
let textY;
|
|
2708
2730
|
if (isRotated) {
|
|
@@ -2733,6 +2755,7 @@ class CanvasAxisRenderer {
|
|
|
2733
2755
|
* @private
|
|
2734
2756
|
*/
|
|
2735
2757
|
drawTitle($$) {
|
|
2758
|
+
var _a, _b;
|
|
2736
2759
|
const { ctx, painter, theme: { style: { title } } } = this;
|
|
2737
2760
|
const { config, state: { current } } = $$;
|
|
2738
2761
|
if (!config.title_text) {
|
|
@@ -2742,12 +2765,13 @@ class CanvasAxisRenderer {
|
|
|
2742
2765
|
const fontSize = getFontSize(title.font);
|
|
2743
2766
|
const lineHeight = fontSize * 1.5;
|
|
2744
2767
|
const { x, align } = getTitleTextPosition(config.title_position, current.width);
|
|
2745
|
-
const
|
|
2768
|
+
const titleHeight = (_b = (_a = $$.getCanvasTitleHeight) == null ? void 0 : _a.call($$)) != null ? _b : fontSize;
|
|
2769
|
+
const y = (config.title_padding.top || 0) + titleHeight;
|
|
2746
2770
|
painter.withState(() => {
|
|
2747
2771
|
ctx.font = title.font;
|
|
2748
2772
|
ctx.fillStyle = title.color;
|
|
2749
2773
|
ctx.textAlign = align;
|
|
2750
|
-
ctx.textBaseline = "
|
|
2774
|
+
ctx.textBaseline = "alphabetic";
|
|
2751
2775
|
lines.forEach((line, i) => {
|
|
2752
2776
|
ctx.fillText(line, x, y + (i ? fontSize + (i - 1) * lineHeight : 0));
|
|
2753
2777
|
});
|
|
@@ -3145,14 +3169,20 @@ class CanvasAxisRenderer {
|
|
|
3145
3169
|
if (!axisOptions && !config.axis_x_tick_text_show) {
|
|
3146
3170
|
return;
|
|
3147
3171
|
}
|
|
3172
|
+
const tickFont = getAxisTickFont(axis, "x");
|
|
3173
|
+
const tickLineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
3174
|
+
const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, targetScale);
|
|
3148
3175
|
ticks.forEach((tick, tickIndex) => {
|
|
3149
3176
|
this.drawXAxisTickText($$, tick, format, axis.labelColor, {
|
|
3150
3177
|
isRotated,
|
|
3151
3178
|
rangeEnd,
|
|
3152
3179
|
rangeStart,
|
|
3153
3180
|
tickCount: ticks.length,
|
|
3181
|
+
tickFont,
|
|
3154
3182
|
tickIndex,
|
|
3183
|
+
tickLineHeight,
|
|
3155
3184
|
tickTextDirection,
|
|
3185
|
+
tickTextWidth,
|
|
3156
3186
|
tickRotate,
|
|
3157
3187
|
tickTextPosition,
|
|
3158
3188
|
targetScale,
|
|
@@ -3333,6 +3363,7 @@ class CanvasAxisRenderer {
|
|
|
3333
3363
|
* @private
|
|
3334
3364
|
*/
|
|
3335
3365
|
drawXAxisTickText($$, tick, format, fill, options) {
|
|
3366
|
+
var _a, _b;
|
|
3336
3367
|
const { ctx, painter, theme: { style: { axis } } } = this;
|
|
3337
3368
|
const { state: { margin } } = $$;
|
|
3338
3369
|
const {
|
|
@@ -3354,7 +3385,7 @@ class CanvasAxisRenderer {
|
|
|
3354
3385
|
if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
|
|
3355
3386
|
return;
|
|
3356
3387
|
}
|
|
3357
|
-
const tickFont = getAxisTickFont(axis, "x");
|
|
3388
|
+
const tickFont = (_a = options.tickFont) != null ? _a : getAxisTickFont(axis, "x");
|
|
3358
3389
|
ctx.font = tickFont;
|
|
3359
3390
|
ctx.fillStyle = fill;
|
|
3360
3391
|
const lines = getXTickTextLines(
|
|
@@ -3364,9 +3395,10 @@ class CanvasAxisRenderer {
|
|
|
3364
3395
|
tick,
|
|
3365
3396
|
ticks,
|
|
3366
3397
|
isRotated,
|
|
3367
|
-
targetScale
|
|
3398
|
+
targetScale,
|
|
3399
|
+
options.tickTextWidth
|
|
3368
3400
|
);
|
|
3369
|
-
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
3401
|
+
const lineHeight = (_b = options.tickLineHeight) != null ? _b : getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
3370
3402
|
let textX;
|
|
3371
3403
|
let textY;
|
|
3372
3404
|
if (isRotated) {
|
|
@@ -3374,6 +3406,21 @@ class CanvasAxisRenderer {
|
|
|
3374
3406
|
textY = ty + (tickTextPosition.y || 0);
|
|
3375
3407
|
ctx.textAlign = getXTickTextAlign($$, options);
|
|
3376
3408
|
ctx.textBaseline = "middle";
|
|
3409
|
+
} else if (tickRotate) {
|
|
3410
|
+
const fontSize = getFontSize(tickFont);
|
|
3411
|
+
const firstDy = tickTextPosition.y ? resolveTextOffset(tickTextPosition.y, fontSize) : 0.71 * fontSize;
|
|
3412
|
+
const textDx = getRotatedXTickTextDx(tickRotate) + (tickTextPosition.x || 0);
|
|
3413
|
+
const textY2 = getRotatedXTickTextY(tickRotate) + firstDy;
|
|
3414
|
+
ctx.textAlign = getXTickTextAlign($$, options);
|
|
3415
|
+
ctx.textBaseline = "alphabetic";
|
|
3416
|
+
painter.withState((textCtx) => {
|
|
3417
|
+
textCtx.translate(tx, y);
|
|
3418
|
+
textCtx.rotate(tickRotate * Math.PI / 180);
|
|
3419
|
+
lines.forEach((line, i) => {
|
|
3420
|
+
textCtx.fillText(line, textDx, textY2 + i * lineHeight);
|
|
3421
|
+
});
|
|
3422
|
+
});
|
|
3423
|
+
return;
|
|
3377
3424
|
} else {
|
|
3378
3425
|
textX = tx + (tickTextPosition.x || 0);
|
|
3379
3426
|
textY = y + (AXIS_TICK_SIZE + AXIS_TICK_PADDING) * tickTextDirection + (tickTextPosition.y || 0);
|
|
@@ -3524,6 +3571,7 @@ class CanvasEngine {
|
|
|
3524
3571
|
CanvasEngine_publicField(this, "dpr", 1);
|
|
3525
3572
|
CanvasEngine_publicField(this, "frame", null);
|
|
3526
3573
|
CanvasEngine_publicField(this, "frameCtx", null);
|
|
3574
|
+
CanvasEngine_publicField(this, "frameValid", false);
|
|
3527
3575
|
}
|
|
3528
3576
|
/**
|
|
3529
3577
|
* Create and attach the canvas element.
|
|
@@ -3535,10 +3583,6 @@ class CanvasEngine {
|
|
|
3535
3583
|
init(container, w, h) {
|
|
3536
3584
|
this.canvas = browser_doc.createElement("canvas");
|
|
3537
3585
|
this.canvas.className = $CANVAS.canvas;
|
|
3538
|
-
this.canvas.style.position = "absolute";
|
|
3539
|
-
this.canvas.style.top = "0";
|
|
3540
|
-
this.canvas.style.left = "0";
|
|
3541
|
-
this.canvas.style.zIndex = "0";
|
|
3542
3586
|
this.canvas.style.display = "block";
|
|
3543
3587
|
container.appendChild(this.canvas);
|
|
3544
3588
|
this.dpr = win.devicePixelRatio || 1;
|
|
@@ -3554,6 +3598,7 @@ class CanvasEngine {
|
|
|
3554
3598
|
resize(w, h) {
|
|
3555
3599
|
const width = Math.max(0, w);
|
|
3556
3600
|
const height = Math.max(0, h);
|
|
3601
|
+
this.dpr = win.devicePixelRatio || 1;
|
|
3557
3602
|
this.canvas.width = width * this.dpr;
|
|
3558
3603
|
this.canvas.height = height * this.dpr;
|
|
3559
3604
|
this.canvas.style.width = `${width}px`;
|
|
@@ -3561,13 +3606,14 @@ class CanvasEngine {
|
|
|
3561
3606
|
this.ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
|
|
3562
3607
|
this.frame = null;
|
|
3563
3608
|
this.frameCtx = null;
|
|
3609
|
+
this.frameValid = false;
|
|
3564
3610
|
}
|
|
3565
3611
|
/**
|
|
3566
3612
|
* Clear transient overlay drawings by restoring the captured frame.
|
|
3567
3613
|
* @private
|
|
3568
3614
|
*/
|
|
3569
3615
|
clearOverlay() {
|
|
3570
|
-
this.restoreFrame();
|
|
3616
|
+
this.frameValid && this.restoreFrame();
|
|
3571
3617
|
}
|
|
3572
3618
|
/**
|
|
3573
3619
|
* Draw transient overlay content on the single visible canvas.
|
|
@@ -3576,7 +3622,12 @@ class CanvasEngine {
|
|
|
3576
3622
|
*/
|
|
3577
3623
|
withOverlay(draw) {
|
|
3578
3624
|
const { ctx } = this;
|
|
3579
|
-
this.
|
|
3625
|
+
const hasFrame = this.frameValid;
|
|
3626
|
+
if (hasFrame) {
|
|
3627
|
+
this.clearOverlay();
|
|
3628
|
+
} else {
|
|
3629
|
+
this.captureFrame();
|
|
3630
|
+
}
|
|
3580
3631
|
ctx.save();
|
|
3581
3632
|
ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
|
|
3582
3633
|
try {
|
|
@@ -3593,6 +3644,7 @@ class CanvasEngine {
|
|
|
3593
3644
|
*/
|
|
3594
3645
|
beginFrame(w, h) {
|
|
3595
3646
|
const { ctx } = this;
|
|
3647
|
+
this.frameValid = false;
|
|
3596
3648
|
ctx.save();
|
|
3597
3649
|
ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
|
|
3598
3650
|
ctx.clearRect(0, 0, w, h);
|
|
@@ -3603,7 +3655,6 @@ class CanvasEngine {
|
|
|
3603
3655
|
*/
|
|
3604
3656
|
endFrame() {
|
|
3605
3657
|
this.ctx.restore();
|
|
3606
|
-
this.captureFrame();
|
|
3607
3658
|
}
|
|
3608
3659
|
/**
|
|
3609
3660
|
* Capture the rendered frame for focus overlay restoration.
|
|
@@ -3611,6 +3662,7 @@ class CanvasEngine {
|
|
|
3611
3662
|
*/
|
|
3612
3663
|
captureFrame() {
|
|
3613
3664
|
const { canvas } = this;
|
|
3665
|
+
this.frameValid = false;
|
|
3614
3666
|
if (canvas.width && canvas.height) {
|
|
3615
3667
|
let { frame, frameCtx } = this;
|
|
3616
3668
|
if (!frame) {
|
|
@@ -3623,11 +3675,15 @@ class CanvasEngine {
|
|
|
3623
3675
|
if (!frame || !frameCtx) {
|
|
3624
3676
|
return;
|
|
3625
3677
|
}
|
|
3626
|
-
frame.width = canvas.width;
|
|
3627
|
-
frame.height = canvas.height;
|
|
3628
3678
|
frameCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
3629
|
-
|
|
3679
|
+
if (frame.width !== canvas.width || frame.height !== canvas.height) {
|
|
3680
|
+
frame.width = canvas.width;
|
|
3681
|
+
frame.height = canvas.height;
|
|
3682
|
+
} else {
|
|
3683
|
+
frameCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
3684
|
+
}
|
|
3630
3685
|
frameCtx.drawImage(canvas, 0, 0);
|
|
3686
|
+
this.frameValid = true;
|
|
3631
3687
|
}
|
|
3632
3688
|
}
|
|
3633
3689
|
/**
|
|
@@ -3635,7 +3691,7 @@ class CanvasEngine {
|
|
|
3635
3691
|
* @private
|
|
3636
3692
|
*/
|
|
3637
3693
|
restoreFrame() {
|
|
3638
|
-
if (!this.frame || !this.frameCtx) {
|
|
3694
|
+
if (!this.frameValid || !this.frame || !this.frameCtx) {
|
|
3639
3695
|
return;
|
|
3640
3696
|
}
|
|
3641
3697
|
const { canvas, ctx } = this;
|
|
@@ -3655,6 +3711,7 @@ class CanvasEngine {
|
|
|
3655
3711
|
(_a = this.canvas) == null ? void 0 : _a.remove();
|
|
3656
3712
|
this.frame = null;
|
|
3657
3713
|
this.frameCtx = null;
|
|
3714
|
+
this.frameValid = false;
|
|
3658
3715
|
}
|
|
3659
3716
|
}
|
|
3660
3717
|
|
|
@@ -3897,12 +3954,8 @@ var path_spreadValues = (a, b) => {
|
|
|
3897
3954
|
};
|
|
3898
3955
|
var path_spreadProps = (a, b) => path_defProps(a, path_getOwnPropDescs(b));
|
|
3899
3956
|
|
|
3900
|
-
function getLineValues($$,
|
|
3901
|
-
|
|
3902
|
-
if ($$.isStepType(target)) {
|
|
3903
|
-
values = $$.convertValuesToStep(values);
|
|
3904
|
-
}
|
|
3905
|
-
return values;
|
|
3957
|
+
function getLineValues($$, d, values) {
|
|
3958
|
+
return $$.isStepType(d) ? $$.convertValuesToStep(values) : values;
|
|
3906
3959
|
}
|
|
3907
3960
|
function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
3908
3961
|
const { config, scale } = $$;
|
|
@@ -3936,7 +3989,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
3936
3989
|
}
|
|
3937
3990
|
path = $$.lineWithRegions(values, scale.zoom || x, y, regions);
|
|
3938
3991
|
} else {
|
|
3939
|
-
path = line.curve($$.getCurve(d))(getLineValues($$,
|
|
3992
|
+
path = line.curve($$.getCurve(d))(getLineValues($$, d, values));
|
|
3940
3993
|
}
|
|
3941
3994
|
} else {
|
|
3942
3995
|
if (values[0]) {
|
|
@@ -4119,14 +4172,15 @@ function getLabelImageUrl(option, d) {
|
|
|
4119
4172
|
ID: d.id
|
|
4120
4173
|
});
|
|
4121
4174
|
}
|
|
4122
|
-
function getLabelImagePosition($$, option, text, x, y) {
|
|
4123
|
-
var _a, _b;
|
|
4175
|
+
function getLabelImagePosition($$, option, text, x, y, d) {
|
|
4176
|
+
var _a, _b, _c;
|
|
4124
4177
|
const { width = 0, height = 0, pos } = option;
|
|
4125
4178
|
const w = width / 2;
|
|
4126
4179
|
const h = height / 2;
|
|
4127
4180
|
const textHeight = getLabelDecorationBox($$.canvasEngine.ctx, text, x, y).h;
|
|
4181
|
+
const fontSize = getFontSize($$.canvasEngine.ctx.font);
|
|
4128
4182
|
const imageX = x - w;
|
|
4129
|
-
const imageY = y - h - textHeight / 2;
|
|
4183
|
+
const imageY = y - h - (((_a = $$.isTreemapType) == null ? void 0 : _a.call($$, d)) ? fontSize * 0.7 : textHeight / 2);
|
|
4130
4184
|
let textX = x;
|
|
4131
4185
|
let textY = y;
|
|
4132
4186
|
if ($$.config.axis_rotated) {
|
|
@@ -4135,16 +4189,16 @@ function getLabelImagePosition($$, option, text, x, y) {
|
|
|
4135
4189
|
textY += h;
|
|
4136
4190
|
}
|
|
4137
4191
|
return {
|
|
4138
|
-
x: imageX + ((
|
|
4139
|
-
y: imageY + ((
|
|
4192
|
+
x: imageX + ((_b = pos == null ? void 0 : pos.x) != null ? _b : 0),
|
|
4193
|
+
y: imageY + ((_c = pos == null ? void 0 : pos.y) != null ? _c : 0),
|
|
4140
4194
|
textX,
|
|
4141
4195
|
textY
|
|
4142
4196
|
};
|
|
4143
4197
|
}
|
|
4144
4198
|
function getLabelColor($$, d, fallback) {
|
|
4145
|
-
var _a, _b;
|
|
4199
|
+
var _a, _b, _c;
|
|
4146
4200
|
const color = (_a = $$.updateTextColor) == null ? void 0 : _a.call($$, d);
|
|
4147
|
-
return typeof color === "string" ? color : ((_b = $$.
|
|
4201
|
+
return typeof color === "string" ? color : ((_b = $$.isTreemapType) == null ? void 0 : _b.call($$, d)) ? fallback : ((_c = $$.color) == null ? void 0 : _c.call($$, d)) || fallback;
|
|
4148
4202
|
}
|
|
4149
4203
|
function getLabelBackgroundColor($$, d) {
|
|
4150
4204
|
var _a;
|
|
@@ -4182,9 +4236,10 @@ function getLabelDecorationBox(ctx, text, x, y, padding = { top: 0, right: 0, bo
|
|
|
4182
4236
|
const lines = text.split("\n");
|
|
4183
4237
|
const metrics = lines.map((line) => ctx.measureText(line));
|
|
4184
4238
|
const width = Math.max(...metrics.map((metric) => metric.width), 0);
|
|
4185
|
-
const fontSize =
|
|
4239
|
+
const fontSize = getFontSize(ctx.font);
|
|
4186
4240
|
const lineHeight = fontSize * LABEL_LINE_HEIGHT_RATIO;
|
|
4187
4241
|
const fontBoundingHeight = metrics[0] ? (metrics[0].fontBoundingBoxAscent || 0) + (metrics[0].fontBoundingBoxDescent || 0) : 0;
|
|
4242
|
+
const baselineDescent = metrics[0] ? metrics[0].fontBoundingBoxDescent || metrics[0].actualBoundingBoxDescent || 0 : 0;
|
|
4188
4243
|
const height = lines.length > 1 ? lineHeight * lines.length : Math.max(
|
|
4189
4244
|
fontSize,
|
|
4190
4245
|
fontBoundingHeight,
|
|
@@ -4199,7 +4254,9 @@ function getLabelDecorationBox(ctx, text, x, y, padding = { top: 0, right: 0, bo
|
|
|
4199
4254
|
}
|
|
4200
4255
|
if (ctx.textBaseline === "middle") {
|
|
4201
4256
|
textY -= height / 2;
|
|
4202
|
-
} else if (ctx.textBaseline === "
|
|
4257
|
+
} else if (ctx.textBaseline === "alphabetic") {
|
|
4258
|
+
textY -= height - baselineDescent;
|
|
4259
|
+
} else if (ctx.textBaseline === "bottom" || ctx.textBaseline === "ideographic") {
|
|
4203
4260
|
textY -= height;
|
|
4204
4261
|
}
|
|
4205
4262
|
return {
|
|
@@ -4843,16 +4900,6 @@ const RENDERER_GROUPED_TYPE_FILTERS = [
|
|
|
4843
4900
|
isCanvasCandlestickType
|
|
4844
4901
|
];
|
|
4845
4902
|
const MAX_BATCHED_CIRCLE_POINTS = 1e3;
|
|
4846
|
-
const SUBCHART_BRUSH_HANDLE_PATH = {
|
|
4847
|
-
x: {
|
|
4848
|
-
start: "M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",
|
|
4849
|
-
end: "M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"
|
|
4850
|
-
},
|
|
4851
|
-
y: {
|
|
4852
|
-
start: "M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z",
|
|
4853
|
-
end: "M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"
|
|
4854
|
-
}
|
|
4855
|
-
};
|
|
4856
4903
|
const canvasFocusLookupCache = /* @__PURE__ */ new WeakMap();
|
|
4857
4904
|
const subchartBrushHandlePathCache = /* @__PURE__ */ new Map();
|
|
4858
4905
|
function applyCssMatrixTransform(ctx, transform) {
|
|
@@ -4869,6 +4916,29 @@ function applyCssMatrixTransform(ctx, transform) {
|
|
|
4869
4916
|
values.length === 16 && values.every(Number.isFinite) && ctx.transform(values[0], values[1], values[4], values[5], values[12], values[13]);
|
|
4870
4917
|
}
|
|
4871
4918
|
}
|
|
4919
|
+
function getPreservedAspectRatioRect(image, width, height) {
|
|
4920
|
+
const imageWidth = image.naturalWidth || image.width;
|
|
4921
|
+
const imageHeight = image.naturalHeight || image.height;
|
|
4922
|
+
if (!imageWidth || !imageHeight || !width || !height) {
|
|
4923
|
+
return { x: 0, y: 0, w: width, h: height };
|
|
4924
|
+
}
|
|
4925
|
+
const scale = Math.min(width / imageWidth, height / imageHeight);
|
|
4926
|
+
const w = imageWidth * scale;
|
|
4927
|
+
const h = imageHeight * scale;
|
|
4928
|
+
return {
|
|
4929
|
+
x: (width - w) / 2,
|
|
4930
|
+
y: (height - h) / 2,
|
|
4931
|
+
w,
|
|
4932
|
+
h
|
|
4933
|
+
};
|
|
4934
|
+
}
|
|
4935
|
+
function getBackgroundImageOffset($$) {
|
|
4936
|
+
const { state } = $$;
|
|
4937
|
+
return state.hasFunnel || state.hasTreemap ? { x: 0, y: 0 } : {
|
|
4938
|
+
x: asHalfPixel(state.margin.left),
|
|
4939
|
+
y: asHalfPixel(state.margin.top)
|
|
4940
|
+
};
|
|
4941
|
+
}
|
|
4872
4942
|
function drawCanvasLine($$, target, indices, painter, isSub = false) {
|
|
4873
4943
|
painter.strokePath((ctx) => {
|
|
4874
4944
|
generateDrawLinePath($$, indices, isSub, ctx)(target);
|
|
@@ -4879,6 +4949,12 @@ function drawCanvasArea($$, target, indices, painter, isSub = false) {
|
|
|
4879
4949
|
generateDrawAreaPath($$, indices, isSub, ctx)(target);
|
|
4880
4950
|
});
|
|
4881
4951
|
}
|
|
4952
|
+
function getVisibleCanvasTarget($$, target) {
|
|
4953
|
+
const range = getCanvasTargetVisibleRange($$, target);
|
|
4954
|
+
return range.start === 0 && range.end === target.values.length ? target : CanvasRenderer_spreadProps(CanvasRenderer_spreadValues({}, target), {
|
|
4955
|
+
values: target.values.slice(range.start, range.end)
|
|
4956
|
+
});
|
|
4957
|
+
}
|
|
4882
4958
|
function getFocusedCanvasDatum(focusData, d) {
|
|
4883
4959
|
if (!(focusData == null ? void 0 : focusData.length) || !(d == null ? void 0 : d.id)) {
|
|
4884
4960
|
return null;
|
|
@@ -5094,12 +5170,14 @@ function getPointFillStyle($$, ctx, d, x, y, r, fallback) {
|
|
|
5094
5170
|
const cy = isNumber(gradientOption.cy) ? gradientOption.cy : 0.3;
|
|
5095
5171
|
const radius = isNumber(gradientOption.r) ? gradientOption.r : 0.7;
|
|
5096
5172
|
const stops = Array.isArray(gradientOption.stops) ? gradientOption.stops : [[0.1, null, 1], [0.9, null, 0]];
|
|
5173
|
+
const gradientX = x + (cx - 0.5) * r * 2;
|
|
5174
|
+
const gradientY = y + (cy - 0.5) * r * 2;
|
|
5097
5175
|
const gradient = ctx.createRadialGradient(
|
|
5098
|
-
|
|
5099
|
-
|
|
5176
|
+
gradientX,
|
|
5177
|
+
gradientY,
|
|
5100
5178
|
0,
|
|
5101
|
-
|
|
5102
|
-
|
|
5179
|
+
gradientX,
|
|
5180
|
+
gradientY,
|
|
5103
5181
|
Math.max(1, r * radius * 2)
|
|
5104
5182
|
);
|
|
5105
5183
|
stops.forEach(([offset, stopColor, stopOpacity]) => {
|
|
@@ -5107,7 +5185,9 @@ function getPointFillStyle($$, ctx, d, x, y, r, fallback) {
|
|
|
5107
5185
|
if (!color) {
|
|
5108
5186
|
color = fallback;
|
|
5109
5187
|
}
|
|
5110
|
-
|
|
5188
|
+
const numericOffset = Number(offset);
|
|
5189
|
+
const parsedOffset = Number.isFinite(numericOffset) ? Math.max(0, Math.min(1, numericOffset)) : 0;
|
|
5190
|
+
gradient.addColorStop(parsedOffset, withOpacity(color, stopOpacity));
|
|
5111
5191
|
});
|
|
5112
5192
|
return gradient;
|
|
5113
5193
|
}
|
|
@@ -5334,13 +5414,21 @@ class CanvasRenderer {
|
|
|
5334
5414
|
if (classStyle.opacity !== void 0) {
|
|
5335
5415
|
ctx.globalAlpha *= classStyle.opacity;
|
|
5336
5416
|
}
|
|
5337
|
-
applyCssMatrixTransform(ctx, classStyle.transform);
|
|
5338
5417
|
if (bg.imgUrl) {
|
|
5339
5418
|
const entry = this.getBackgroundImage(bg.imgUrl, $$);
|
|
5340
5419
|
if (entry == null ? void 0 : entry.loaded) {
|
|
5341
|
-
|
|
5420
|
+
const offset = getBackgroundImageOffset($$);
|
|
5421
|
+
const rect = getPreservedAspectRatioRect(
|
|
5422
|
+
entry.image,
|
|
5423
|
+
current.width,
|
|
5424
|
+
current.height
|
|
5425
|
+
);
|
|
5426
|
+
ctx.translate(offset.x, offset.y);
|
|
5427
|
+
applyCssMatrixTransform(ctx, classStyle.transform);
|
|
5428
|
+
ctx.drawImage(entry.image, rect.x, rect.y, rect.w, rect.h);
|
|
5342
5429
|
}
|
|
5343
5430
|
} else if (bg.color) {
|
|
5431
|
+
applyCssMatrixTransform(ctx, classStyle.transform);
|
|
5344
5432
|
painter.fillRect({
|
|
5345
5433
|
x: margin.left,
|
|
5346
5434
|
y: margin.top,
|
|
@@ -5366,7 +5454,7 @@ class CanvasRenderer {
|
|
|
5366
5454
|
return { x, y };
|
|
5367
5455
|
}
|
|
5368
5456
|
const url = getLabelImageUrl(option, d);
|
|
5369
|
-
const position = getLabelImagePosition($$, option, text, x, y);
|
|
5457
|
+
const position = getLabelImagePosition($$, option, text, x, y, d);
|
|
5370
5458
|
const entry = this.getLabelImage(url, $$);
|
|
5371
5459
|
if (entry == null ? void 0 : entry.loaded) {
|
|
5372
5460
|
this.ctx.drawImage(
|
|
@@ -5497,7 +5585,7 @@ class CanvasRenderer {
|
|
|
5497
5585
|
const { ctx, painter, theme: { style } } = this;
|
|
5498
5586
|
const { margin2, width2, height2 } = state;
|
|
5499
5587
|
const rect = { x: margin2.left, y: margin2.top, w: width2, h: height2 };
|
|
5500
|
-
const targets = $$.filterTargetsToShow(
|
|
5588
|
+
const targets = $$.filterTargetsToShow().filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5501
5589
|
painter.withState(() => {
|
|
5502
5590
|
ctx.strokeStyle = style.axis.lineColor;
|
|
5503
5591
|
ctx.lineWidth = style.axis.lineWidth;
|
|
@@ -5567,7 +5655,7 @@ class CanvasRenderer {
|
|
|
5567
5655
|
ctx.lineWidth = style.shape.candlestickLineWidth;
|
|
5568
5656
|
for (const target of candlestickTargets) {
|
|
5569
5657
|
target.values.forEach((d, i) => {
|
|
5570
|
-
var _a2
|
|
5658
|
+
var _a2;
|
|
5571
5659
|
const value = (_a2 = $$.getCandlestickData) == null ? void 0 : _a2.call($$, d);
|
|
5572
5660
|
const geometry = value && getCanvasCandlestickGeometry(
|
|
5573
5661
|
$$,
|
|
@@ -5578,7 +5666,7 @@ class CanvasRenderer {
|
|
|
5578
5666
|
if (!geometry) {
|
|
5579
5667
|
return;
|
|
5580
5668
|
}
|
|
5581
|
-
const color =
|
|
5669
|
+
const color = getCandlestickColor($$, { id: target.id }, value);
|
|
5582
5670
|
ctx.strokeStyle = color;
|
|
5583
5671
|
ctx.fillStyle = color;
|
|
5584
5672
|
painter.strokePath(() => {
|
|
@@ -5724,7 +5812,7 @@ class CanvasRenderer {
|
|
|
5724
5812
|
const { ctx, painter, theme: { style } } = this;
|
|
5725
5813
|
const isBar = isCanvasBarType.bind(null, $$);
|
|
5726
5814
|
const isExpanded = getExpandedFocusMatcher($$, focusData, isCanvasBarType);
|
|
5727
|
-
const targets = $$.filterTargetsToShow(
|
|
5815
|
+
const targets = $$.filterTargetsToShow().filter(isBar).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5728
5816
|
const getPoints = $$.generateGetBarPoints(
|
|
5729
5817
|
getCanvasShapeIndices($$, shape, TYPE.BAR, isBar),
|
|
5730
5818
|
false
|
|
@@ -5813,7 +5901,7 @@ class CanvasRenderer {
|
|
|
5813
5901
|
const { ctx, painter, theme: { style } } = this;
|
|
5814
5902
|
const isCandlestick = isCanvasCandlestickType.bind(null, $$);
|
|
5815
5903
|
const isExpanded = getExpandedFocusMatcher($$, focusData, isCanvasCandlestickType);
|
|
5816
|
-
const targets = $$.filterTargetsToShow(
|
|
5904
|
+
const targets = $$.filterTargetsToShow().filter(isCandlestick).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5817
5905
|
const getPoints = (_a = $$.generateGetCandlestickPoints) == null ? void 0 : _a.call(
|
|
5818
5906
|
$$,
|
|
5819
5907
|
getCanvasShapeIndices($$, shape, TYPE.CANDLESTICK, isCandlestick),
|
|
@@ -5870,7 +5958,7 @@ class CanvasRenderer {
|
|
|
5870
5958
|
*/
|
|
5871
5959
|
hasExpandedShapeFocus($$, selectedData) {
|
|
5872
5960
|
return !!(selectedData == null ? void 0 : selectedData.some(
|
|
5873
|
-
(d) => d && (isCanvasBarType($$, d) || isCanvasCandlestickType($$, d)
|
|
5961
|
+
(d) => d && (isCanvasBarType($$, d) || isCanvasCandlestickType($$, d))
|
|
5874
5962
|
));
|
|
5875
5963
|
}
|
|
5876
5964
|
/**
|
|
@@ -5882,7 +5970,7 @@ class CanvasRenderer {
|
|
|
5882
5970
|
drawLines($$, shape) {
|
|
5883
5971
|
const { ctx, painter, theme: { style } } = this;
|
|
5884
5972
|
const isLine = isCanvasLineType.bind(null, $$);
|
|
5885
|
-
const targets = $$.filterTargetsToShow(
|
|
5973
|
+
const targets = $$.filterTargetsToShow().filter(isLine).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5886
5974
|
const indices = getCanvasShapeIndices($$, shape, TYPE.LINE, isLine);
|
|
5887
5975
|
const { margin } = $$.state;
|
|
5888
5976
|
if (!$$.generateGetLinePoints) {
|
|
@@ -5891,13 +5979,14 @@ class CanvasRenderer {
|
|
|
5891
5979
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
5892
5980
|
var _a;
|
|
5893
5981
|
for (const target of targets) {
|
|
5894
|
-
|
|
5982
|
+
const visibleTarget = getVisibleCanvasTarget($$, target);
|
|
5983
|
+
if (!visibleTarget.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5895
5984
|
continue;
|
|
5896
5985
|
}
|
|
5897
5986
|
ctx.globalAlpha = getCanvasTargetFocusOpacity($$, target);
|
|
5898
5987
|
ctx.lineWidth = isCanvasTargetFocused($$, target) ? style.shape.lineFocusedWidth : style.shape.lineWidth;
|
|
5899
5988
|
ctx.strokeStyle = $$.color(target.id);
|
|
5900
|
-
((_a = $$.config.data_regions) == null ? void 0 : _a[
|
|
5989
|
+
((_a = $$.config.data_regions) == null ? void 0 : _a[visibleTarget.id]) ? drawCanvasLineWithDataRegions($$, visibleTarget, painter) : drawCanvasLine($$, visibleTarget, indices, painter);
|
|
5901
5990
|
}
|
|
5902
5991
|
ctx.globalAlpha = 1;
|
|
5903
5992
|
});
|
|
@@ -5912,7 +6001,7 @@ class CanvasRenderer {
|
|
|
5912
6001
|
drawAreas($$, shape, focusData) {
|
|
5913
6002
|
const { ctx, painter, theme: { style } } = this;
|
|
5914
6003
|
const isArea = isCanvasAreaType.bind(null, $$);
|
|
5915
|
-
const targets = $$.filterTargetsToShow(
|
|
6004
|
+
const targets = $$.filterTargetsToShow().filter(isArea).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5916
6005
|
const indices = getCanvasShapeIndices($$, shape, TYPE.AREA, isArea);
|
|
5917
6006
|
const { margin } = $$.state;
|
|
5918
6007
|
if (!$$.generateGetAreaPoints) {
|
|
@@ -5920,20 +6009,23 @@ class CanvasRenderer {
|
|
|
5920
6009
|
}
|
|
5921
6010
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
5922
6011
|
for (const target of targets) {
|
|
5923
|
-
|
|
6012
|
+
const visibleTarget = getVisibleCanvasTarget($$, target);
|
|
6013
|
+
if (!visibleTarget.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5924
6014
|
continue;
|
|
5925
6015
|
}
|
|
5926
|
-
const color = getCanvasRenderColor($$,
|
|
6016
|
+
const color = getCanvasRenderColor($$, visibleTarget, focusData);
|
|
5927
6017
|
ctx.globalAlpha = style.shape.areaOpacity * getCanvasTargetFocusOpacity($$, target);
|
|
5928
6018
|
ctx.fillStyle = getCanvasLinearGradientFill(
|
|
5929
6019
|
$$,
|
|
5930
6020
|
ctx,
|
|
5931
|
-
|
|
6021
|
+
visibleTarget,
|
|
5932
6022
|
"area",
|
|
5933
|
-
|
|
6023
|
+
// Bounds computation walks visible rows, so skip it when no gradient is set.
|
|
6024
|
+
// Use the original target so the range cache stays aligned with unsliced values.
|
|
6025
|
+
$$.config.area_linearGradient ? getCanvasAreaBounds($$, target, indices) : null,
|
|
5934
6026
|
color
|
|
5935
6027
|
);
|
|
5936
|
-
drawCanvasArea($$,
|
|
6028
|
+
drawCanvasArea($$, visibleTarget, indices, painter);
|
|
5937
6029
|
}
|
|
5938
6030
|
ctx.globalAlpha = 1;
|
|
5939
6031
|
});
|
|
@@ -5960,7 +6052,7 @@ class CanvasRenderer {
|
|
|
5960
6052
|
}
|
|
5961
6053
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
5962
6054
|
var _a2, _b, _c;
|
|
5963
|
-
for (const target of $$.filterTargetsToShow(
|
|
6055
|
+
for (const target of $$.filterTargetsToShow()) {
|
|
5964
6056
|
if (!isCanvasPointType($$, target) || !isCanvasRenderableTarget($$, target) || isCanvasLineType($$, target) && !shouldDrawPoints($$, target)) {
|
|
5965
6057
|
continue;
|
|
5966
6058
|
}
|
|
@@ -6191,41 +6283,38 @@ class CanvasRenderer {
|
|
|
6191
6283
|
),
|
|
6192
6284
|
false
|
|
6193
6285
|
) : null;
|
|
6194
|
-
const targets = $$.filterTargetsToShow(
|
|
6286
|
+
const targets = $$.filterTargetsToShow().filter(
|
|
6195
6287
|
(target) => (isCanvasBarType($$, target) || isCanvasPointType($$, target) || isCanvasAreaType($$, target) || isCanvasCandlestickType($$, target)) && isCanvasRenderableTarget($$, target)
|
|
6196
6288
|
);
|
|
6197
|
-
const
|
|
6198
|
-
|
|
6289
|
+
const targetRows = [];
|
|
6290
|
+
let labelCount = 0;
|
|
6199
6291
|
targets.forEach((target) => {
|
|
6200
6292
|
const range = getCanvasTargetVisibleRange($$, target);
|
|
6201
|
-
$$.labelishData(target)
|
|
6293
|
+
const data = $$.labelishData(target);
|
|
6294
|
+
const rows = [];
|
|
6295
|
+
for (let i = 0; i < data.length; i++) {
|
|
6296
|
+
const d = data[i];
|
|
6202
6297
|
const text = getLabelText($$, d);
|
|
6203
6298
|
if (text && d.index >= range.start && d.index < range.end && hasCanvasDrawableValue($$, d)) {
|
|
6204
|
-
|
|
6205
|
-
labelTexts.set(getLabelRowKey(d), text);
|
|
6299
|
+
rows.push({ d, text });
|
|
6206
6300
|
}
|
|
6207
|
-
}
|
|
6301
|
+
}
|
|
6302
|
+
labelCount += rows.length;
|
|
6303
|
+
rows.length && targetRows.push(rows);
|
|
6208
6304
|
});
|
|
6209
6305
|
const texts = {
|
|
6210
|
-
size: () =>
|
|
6306
|
+
size: () => labelCount
|
|
6211
6307
|
};
|
|
6212
6308
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
6213
6309
|
ctx.font = style.label.font;
|
|
6214
6310
|
ctx.textAlign = "center";
|
|
6215
|
-
|
|
6216
|
-
var _a2;
|
|
6217
|
-
const
|
|
6218
|
-
const range = getCanvasTargetVisibleRange($$, target);
|
|
6219
|
-
for (let i = 0; i < data.length; i++) {
|
|
6220
|
-
const d = data[i];
|
|
6221
|
-
const text = labelTexts.get(getLabelRowKey(d));
|
|
6311
|
+
targetRows.forEach((rows) => {
|
|
6312
|
+
var _a2, _b;
|
|
6313
|
+
for (const { d, text } of rows) {
|
|
6222
6314
|
let x;
|
|
6223
6315
|
let y;
|
|
6224
|
-
if (!text || d.index < range.start || d.index >= range.end || !hasCanvasDrawableValue($$, d)) {
|
|
6225
|
-
continue;
|
|
6226
|
-
}
|
|
6227
6316
|
if (isCanvasBarType($$, d) && barPoints) {
|
|
6228
|
-
const geometry = getCanvasBarGeometry($$, barPoints, d,
|
|
6317
|
+
const geometry = getCanvasBarGeometry($$, barPoints, d, d.index);
|
|
6229
6318
|
if (!geometry) {
|
|
6230
6319
|
continue;
|
|
6231
6320
|
}
|
|
@@ -6244,19 +6333,21 @@ class CanvasRenderer {
|
|
|
6244
6333
|
$$,
|
|
6245
6334
|
candlestickPoints,
|
|
6246
6335
|
d,
|
|
6247
|
-
|
|
6336
|
+
d.index
|
|
6248
6337
|
);
|
|
6249
6338
|
const isUp = value == null ? void 0 : value._isUp;
|
|
6250
6339
|
if (!geometry) {
|
|
6251
6340
|
continue;
|
|
6252
6341
|
}
|
|
6253
|
-
const {
|
|
6254
|
-
|
|
6255
|
-
|
|
6342
|
+
const { wickEnd, wickStart } = geometry;
|
|
6343
|
+
const isInverted = $$.config[`axis_${(_b = $$.axis) == null ? void 0 : _b.getId(d.id)}_inverted`];
|
|
6344
|
+
x = $$.config.axis_rotated ? isUp ? wickEnd[0] + 4 : wickStart[0] - 4 : wickStart[0];
|
|
6345
|
+
y = $$.config.axis_rotated ? wickStart[1] + 3 : isUp ? wickEnd[1] - 3 : wickStart[1] + 12;
|
|
6346
|
+
!$$.config.axis_rotated && isInverted && (y += 15 * (isUp ? 1 : -1));
|
|
6256
6347
|
ctx.textAlign = $$.config.axis_rotated ? isUp ? "left" : "right" : "center";
|
|
6257
|
-
ctx.textBaseline =
|
|
6348
|
+
ctx.textBaseline = "alphabetic";
|
|
6258
6349
|
} else if (cx && cy) {
|
|
6259
|
-
({ x, y } = getShapePoint(shape.pos, d,
|
|
6350
|
+
({ x, y } = getShapePoint(shape.pos, d, d.index));
|
|
6260
6351
|
({ x, y } = getPointLabelAnchor($$, ctx, d, x, y));
|
|
6261
6352
|
}
|
|
6262
6353
|
x += getLabelPosition($$, d, "x", texts);
|
|
@@ -6276,7 +6367,7 @@ class CanvasRenderer {
|
|
|
6276
6367
|
*/
|
|
6277
6368
|
drawEmptyLabel($$) {
|
|
6278
6369
|
const text = $$.config.data_empty_label_text;
|
|
6279
|
-
const targetsToShow = $$.filterTargetsToShow(
|
|
6370
|
+
const targetsToShow = $$.filterTargetsToShow();
|
|
6280
6371
|
if (!text || targetsToShow.length) {
|
|
6281
6372
|
return;
|
|
6282
6373
|
}
|
|
@@ -6372,22 +6463,34 @@ class CanvasRenderer {
|
|
|
6372
6463
|
if (!config.treemap_label_show || (data.ratio || 0) < (config.treemap_label_threshold || 0)) {
|
|
6373
6464
|
continue;
|
|
6374
6465
|
}
|
|
6375
|
-
if ((_a2 = getLabelImageOption($$, data)) == null ? void 0 : _a2.url) {
|
|
6376
|
-
continue;
|
|
6377
|
-
}
|
|
6378
6466
|
const label = getTreemapLabelText($$, data, w, h);
|
|
6379
6467
|
if (!label) {
|
|
6380
6468
|
continue;
|
|
6381
6469
|
}
|
|
6382
6470
|
const lines = label.split("\n");
|
|
6383
|
-
const
|
|
6384
|
-
const centerY = y + h / 2 - (lines.length - 1) * lineHeight / 2;
|
|
6385
|
-
ctx.fillStyle = getLabelColor($$, data, style.label.color);
|
|
6471
|
+
const isCentered = !!config.data_labels.centered;
|
|
6386
6472
|
ctx.font = style.label.font;
|
|
6387
|
-
|
|
6388
|
-
ctx.
|
|
6473
|
+
const lineHeight = getFontSize(ctx.font);
|
|
6474
|
+
const metrics = ctx.measureText((_a2 = lines[0]) != null ? _a2 : "");
|
|
6475
|
+
const fontBoundingHeight = (metrics.fontBoundingBoxAscent || 0) + (metrics.fontBoundingBoxDescent || 0) || (metrics.actualBoundingBoxAscent || 0) + (metrics.actualBoundingBoxDescent || 0);
|
|
6476
|
+
const textHeight = Math.max(lineHeight, fontBoundingHeight) + (lines.length - 1) * lineHeight;
|
|
6477
|
+
const blockY = isCentered ? y + h / 2 : y + textHeight + 5;
|
|
6478
|
+
let textX = isCentered ? x + w / 2 : x + 5;
|
|
6479
|
+
let textY = blockY - (lines.length - 1) * lineHeight / (isCentered ? 2 : 1);
|
|
6480
|
+
ctx.textAlign = isCentered ? "center" : "left";
|
|
6481
|
+
ctx.textBaseline = isCentered ? "middle" : "alphabetic";
|
|
6482
|
+
({ x: textX, y: textY } = this.drawLabelImage($$, data, label, textX, textY));
|
|
6483
|
+
ctx.fillStyle = getLabelColor($$, data, style.label.color);
|
|
6484
|
+
drawLabelDecorations(
|
|
6485
|
+
$$,
|
|
6486
|
+
painter,
|
|
6487
|
+
data,
|
|
6488
|
+
label,
|
|
6489
|
+
textX,
|
|
6490
|
+
isCentered ? textY + (lines.length - 1) * lineHeight / 2 : blockY
|
|
6491
|
+
);
|
|
6389
6492
|
lines.forEach((line, i) => {
|
|
6390
|
-
painter.text(line,
|
|
6493
|
+
painter.text(line, textX, textY + i * lineHeight, {
|
|
6391
6494
|
maxWidth: Math.max(0, w - 8)
|
|
6392
6495
|
});
|
|
6393
6496
|
});
|
|
@@ -6472,16 +6575,26 @@ class CanvasRenderer {
|
|
|
6472
6575
|
const { x, y } = getRenderDataPoint($$, d);
|
|
6473
6576
|
const baseR = (_b = (_a = $$.pointR) == null ? void 0 : _a.call($$, d)) != null ? _b : 2.5;
|
|
6474
6577
|
const r = (_d = (_c = $$.pointExpandedR) == null ? void 0 : _c.call($$, d)) != null ? _d : baseR * 1.75;
|
|
6475
|
-
const
|
|
6578
|
+
const overColor = getCanvasOverColor($$, d);
|
|
6579
|
+
const color = overColor || $$.color(d.id);
|
|
6580
|
+
const fill = overColor || style.focusPoint.fill || style.shape.pointFillColor || color;
|
|
6581
|
+
const stroke = overColor || style.focusPoint.stroke || color;
|
|
6582
|
+
const lineWidth = style.focusPoint.lineWidth;
|
|
6583
|
+
const alpha = getPointOpacity($$, d);
|
|
6584
|
+
const hasStroke = !!stroke && (lineWidth != null ? lineWidth : 0) > 0;
|
|
6585
|
+
const mergeSameColorStroke = pointType === "circle" && hasStroke && isNumber(alpha) && alpha < 1 && fill === stroke;
|
|
6476
6586
|
if (!isFiniteCanvasCoordinate(x, y)) {
|
|
6477
6587
|
return;
|
|
6478
6588
|
}
|
|
6479
|
-
drawPointPattern(
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6589
|
+
drawPointPattern(
|
|
6590
|
+
painter,
|
|
6591
|
+
pointType,
|
|
6592
|
+
x,
|
|
6593
|
+
y,
|
|
6594
|
+
mergeSameColorStroke ? r + (lineWidth || 0) / 2 : r,
|
|
6595
|
+
hasStroke && !mergeSameColorStroke ? { fill, lineWidth, stroke, alpha } : { fill, alpha },
|
|
6596
|
+
baseR
|
|
6597
|
+
);
|
|
6485
6598
|
});
|
|
6486
6599
|
}
|
|
6487
6600
|
this.drawFocusLabels($$, selectedData);
|
|
@@ -7394,7 +7507,7 @@ class HitDetector {
|
|
|
7394
7507
|
rebuild($$, shape) {
|
|
7395
7508
|
var _a, _b, _c;
|
|
7396
7509
|
const { current, margin, width, height } = $$.state;
|
|
7397
|
-
const targets = $$.filterTargetsToShow(
|
|
7510
|
+
const targets = $$.filterTargetsToShow();
|
|
7398
7511
|
this.bars = [];
|
|
7399
7512
|
this.points = [];
|
|
7400
7513
|
this.indices = [];
|
|
@@ -7531,26 +7644,30 @@ class HitDetector {
|
|
|
7531
7644
|
this.indices = indexMap ? Array.from(indexMap.values()).sort((a, b) => a[this.indexAxis] - b[this.indexAxis]) : [];
|
|
7532
7645
|
}
|
|
7533
7646
|
/**
|
|
7534
|
-
*
|
|
7647
|
+
* Hit-test bars at the given canvas coordinates.
|
|
7535
7648
|
* @param {number} mx Mouse x coordinate
|
|
7536
7649
|
* @param {number} my Mouse y coordinate
|
|
7537
7650
|
* @returns {object|null} Matching data row
|
|
7538
7651
|
* @private
|
|
7539
7652
|
*/
|
|
7540
|
-
|
|
7541
|
-
var _a, _b;
|
|
7653
|
+
hitBar(mx, my) {
|
|
7542
7654
|
for (const item of getGridItems(this.barGrid, mx, my, BAR_CELL_SIZE)) {
|
|
7543
7655
|
const { w = 0, h = 0 } = item;
|
|
7544
7656
|
if (mx >= item.x && mx <= item.x + w && my >= item.y && my <= item.y + h) {
|
|
7545
7657
|
return item.data;
|
|
7546
7658
|
}
|
|
7547
7659
|
}
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7660
|
+
return null;
|
|
7661
|
+
}
|
|
7662
|
+
/**
|
|
7663
|
+
* Find the nearest point within sensitivity at the given canvas coordinates.
|
|
7664
|
+
* @param {number} mx Mouse x coordinate
|
|
7665
|
+
* @param {number} my Mouse y coordinate
|
|
7666
|
+
* @returns {object|null} Matching data row
|
|
7667
|
+
* @private
|
|
7668
|
+
*/
|
|
7669
|
+
hitPoint(mx, my) {
|
|
7670
|
+
var _a, _b;
|
|
7554
7671
|
let nearest = null;
|
|
7555
7672
|
let min = Number.POSITIVE_INFINITY;
|
|
7556
7673
|
for (const item of getGridItems(this.pointGrid, mx, my, this.pointCellSize, 1)) {
|
|
@@ -7566,33 +7683,35 @@ class HitDetector {
|
|
|
7566
7683
|
return (_b = nearest == null ? void 0 : nearest.data) != null ? _b : null;
|
|
7567
7684
|
}
|
|
7568
7685
|
/**
|
|
7569
|
-
* Find the nearest
|
|
7686
|
+
* Find the nearest data row for the given canvas coordinates.
|
|
7570
7687
|
* @param {number} mx Mouse x coordinate
|
|
7571
7688
|
* @param {number} my Mouse y coordinate
|
|
7572
7689
|
* @returns {object|null} Matching data row
|
|
7573
7690
|
* @private
|
|
7574
7691
|
*/
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7579
|
-
if (mx >= item.x && mx <= item.x + w && my >= item.y && my <= item.y + h) {
|
|
7580
|
-
return item.data;
|
|
7581
|
-
}
|
|
7692
|
+
findNearest(mx, my) {
|
|
7693
|
+
const bar = this.hitBar(mx, my);
|
|
7694
|
+
if (bar) {
|
|
7695
|
+
return bar;
|
|
7582
7696
|
}
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
const dy = item.y - my;
|
|
7588
|
-
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
7589
|
-
const sensitivity = (_a = item.sensitivity) != null ? _a : HIT_DISTANCE;
|
|
7590
|
-
if (dist <= sensitivity && dist < min) {
|
|
7591
|
-
min = dist;
|
|
7592
|
-
nearest = item;
|
|
7697
|
+
if (!this.pointBased && this.grouped && this.isWithinPlot(mx, my)) {
|
|
7698
|
+
const item = this.findNearestIndexItem(mx, my);
|
|
7699
|
+
if (item) {
|
|
7700
|
+
return item.data;
|
|
7593
7701
|
}
|
|
7594
7702
|
}
|
|
7595
|
-
return (
|
|
7703
|
+
return this.hitPoint(mx, my);
|
|
7704
|
+
}
|
|
7705
|
+
/**
|
|
7706
|
+
* Find the nearest directly hit shape row, excluding grouped index fallback.
|
|
7707
|
+
* @param {number} mx Mouse x coordinate
|
|
7708
|
+
* @param {number} my Mouse y coordinate
|
|
7709
|
+
* @returns {object|null} Matching data row
|
|
7710
|
+
* @private
|
|
7711
|
+
*/
|
|
7712
|
+
findNearestShape(mx, my) {
|
|
7713
|
+
var _a;
|
|
7714
|
+
return (_a = this.hitBar(mx, my)) != null ? _a : this.hitPoint(mx, my);
|
|
7596
7715
|
}
|
|
7597
7716
|
/**
|
|
7598
7717
|
* Find the nearest grouped x-index row for an axis-adjacent pointer coordinate.
|
|
@@ -7902,7 +8021,7 @@ const $ZOOM = {
|
|
|
7902
8021
|
buttonZoomReset: "bb-zoom-reset",
|
|
7903
8022
|
zoomBrush: "bb-zoom-brush"
|
|
7904
8023
|
};
|
|
7905
|
-
/* harmony default export */ var config_classes = (classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $FUNNEL), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $TREEMAP), $ZOOM));
|
|
8024
|
+
/* harmony default export */ var config_classes = (classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues(classes_spreadValues({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $FUNNEL), $GRID), $LEVEL), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $TREEMAP), $ZOOM));
|
|
7906
8025
|
|
|
7907
8026
|
;// ./src/config/Options/common/boost.ts
|
|
7908
8027
|
/* harmony default export */ var boost = ({
|
|
@@ -8501,7 +8620,7 @@ const $ZOOM = {
|
|
|
8501
8620
|
* @memberof Options
|
|
8502
8621
|
* @type {object}
|
|
8503
8622
|
* @property {object} [transition] transition object
|
|
8504
|
-
* @property {number} [transition.duration=
|
|
8623
|
+
* @property {number} [transition.duration=250] duration in milliseconds
|
|
8505
8624
|
* @example
|
|
8506
8625
|
* transition: {
|
|
8507
8626
|
* duration: 500
|
|
@@ -10369,8 +10488,7 @@ class Cache {
|
|
|
10369
10488
|
}
|
|
10370
10489
|
return targets;
|
|
10371
10490
|
} else {
|
|
10372
|
-
|
|
10373
|
-
return isValue(value) ? value : null;
|
|
10491
|
+
return this.cache.has(key) ? this.cache.get(key) : null;
|
|
10374
10492
|
}
|
|
10375
10493
|
}
|
|
10376
10494
|
/**
|
|
@@ -10487,11 +10605,12 @@ function getCssSelector(s) {
|
|
|
10487
10605
|
}
|
|
10488
10606
|
function _getRect(relativeViewport, node, forceEval = false) {
|
|
10489
10607
|
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
10608
|
+
const cacheKey = relativeViewport ? "rectClient" : "rectBBox";
|
|
10490
10609
|
if (forceEval) {
|
|
10491
10610
|
return _(node);
|
|
10492
10611
|
} else {
|
|
10493
|
-
const needEvaluate = !(
|
|
10494
|
-
return needEvaluate ? node
|
|
10612
|
+
const needEvaluate = !(cacheKey in node) || node.hasAttribute("width") && node[cacheKey].width !== +(node.getAttribute("width") || 0);
|
|
10613
|
+
return needEvaluate ? node[cacheKey] = _(node) : node[cacheKey];
|
|
10495
10614
|
}
|
|
10496
10615
|
}
|
|
10497
10616
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
@@ -10611,14 +10730,14 @@ function getElementPos(element, type) {
|
|
|
10611
10730
|
}
|
|
10612
10731
|
function hasViewBox(svg) {
|
|
10613
10732
|
const attr = svg.attr("viewBox");
|
|
10614
|
-
return attr ?
|
|
10733
|
+
return attr ? attr.trim().split(/[\s,]+/).length === 4 : false;
|
|
10615
10734
|
}
|
|
10616
10735
|
function hasStyle(node, condition, all = false) {
|
|
10617
10736
|
const isD3Node = !!node.node;
|
|
10618
10737
|
let has = false;
|
|
10619
10738
|
for (const [key, value] of Object.entries(condition)) {
|
|
10620
10739
|
has = isD3Node ? node.style(key) === value : node.style[key] === value;
|
|
10621
|
-
if (all
|
|
10740
|
+
if (all ? !has : has) {
|
|
10622
10741
|
break;
|
|
10623
10742
|
}
|
|
10624
10743
|
}
|
|
@@ -10734,23 +10853,28 @@ function generateResize(option) {
|
|
|
10734
10853
|
const callResizeFn = function() {
|
|
10735
10854
|
callResizeFn.clear();
|
|
10736
10855
|
if (option === false) {
|
|
10737
|
-
requestIdleCallback(() => {
|
|
10856
|
+
timeout = requestIdleCallback(() => {
|
|
10857
|
+
timeout = null;
|
|
10738
10858
|
fn.forEach((f) => f());
|
|
10739
10859
|
}, { timeout: 200 });
|
|
10740
10860
|
} else {
|
|
10741
10861
|
timeout = generator_setTimeout(() => {
|
|
10862
|
+
timeout = null;
|
|
10742
10863
|
fn.forEach((f) => f());
|
|
10743
10864
|
}, isNumber(option) ? option : 200);
|
|
10744
10865
|
}
|
|
10745
10866
|
};
|
|
10746
10867
|
callResizeFn.clear = () => {
|
|
10747
10868
|
if (timeout) {
|
|
10748
|
-
generator_clearTimeout(timeout);
|
|
10869
|
+
(option === false ? cancelIdleCallback : generator_clearTimeout)(timeout);
|
|
10749
10870
|
timeout = null;
|
|
10750
10871
|
}
|
|
10751
10872
|
};
|
|
10752
10873
|
callResizeFn.add = (f) => fn.push(f);
|
|
10753
|
-
callResizeFn.remove = (f) =>
|
|
10874
|
+
callResizeFn.remove = (f) => {
|
|
10875
|
+
const index = fn.indexOf(f);
|
|
10876
|
+
index !== -1 && fn.splice(index, 1);
|
|
10877
|
+
};
|
|
10754
10878
|
return callResizeFn;
|
|
10755
10879
|
}
|
|
10756
10880
|
function generateWait() {
|
|
@@ -10789,26 +10913,31 @@ function generateWait() {
|
|
|
10789
10913
|
;// ./src/module/worker.ts
|
|
10790
10914
|
|
|
10791
10915
|
const cache = {};
|
|
10916
|
+
let messageId = 0;
|
|
10792
10917
|
function getOrCreateWorkerResources(fn, depsFn) {
|
|
10793
10918
|
var _a;
|
|
10794
10919
|
const fnString = fn.toString();
|
|
10795
10920
|
const depsString = (_a = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _a : "";
|
|
10796
10921
|
const key = (fnString + depsString).replace(/(function|[\s\W\n])/g, "").substring(0, 30);
|
|
10797
10922
|
if (!(key in cache)) {
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10923
|
+
try {
|
|
10924
|
+
const blob = new win.Blob([
|
|
10925
|
+
`${depsString}
|
|
10926
|
+
|
|
10927
|
+
self.onmessage=function({data}) {
|
|
10928
|
+
const result = (${fnString}).apply(null, data.args);
|
|
10929
|
+
self.postMessage({id: data.id, result});
|
|
10930
|
+
};`
|
|
10931
|
+
], {
|
|
10932
|
+
type: "text/javascript"
|
|
10933
|
+
});
|
|
10934
|
+
cache[key] = {
|
|
10935
|
+
src: win.URL.createObjectURL(blob),
|
|
10936
|
+
worker: null
|
|
10937
|
+
};
|
|
10938
|
+
} catch (e) {
|
|
10939
|
+
return null;
|
|
10940
|
+
}
|
|
10812
10941
|
}
|
|
10813
10942
|
return { key, src: cache[key].src };
|
|
10814
10943
|
}
|
|
@@ -10818,7 +10947,11 @@ function getWorker(key, src) {
|
|
|
10818
10947
|
return null;
|
|
10819
10948
|
}
|
|
10820
10949
|
if (!cached.worker) {
|
|
10821
|
-
|
|
10950
|
+
try {
|
|
10951
|
+
cached.worker = new win.Worker(src);
|
|
10952
|
+
} catch (e) {
|
|
10953
|
+
return null;
|
|
10954
|
+
}
|
|
10822
10955
|
if (cached.worker) {
|
|
10823
10956
|
cached.worker.onerror = function(e) {
|
|
10824
10957
|
console.error ? console.error(e) : console.log(e);
|
|
@@ -10833,16 +10966,22 @@ function runWorker(useWorker = true, fn, callback, depsFn) {
|
|
|
10833
10966
|
callback(res);
|
|
10834
10967
|
};
|
|
10835
10968
|
if (win.Worker && useWorker) {
|
|
10836
|
-
const
|
|
10837
|
-
const worker = getWorker(key, src);
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10969
|
+
const workerResources = getOrCreateWorkerResources(fn, depsFn);
|
|
10970
|
+
const worker = workerResources && getWorker(workerResources.key, workerResources.src);
|
|
10971
|
+
if (worker) {
|
|
10972
|
+
runFn = function(...args) {
|
|
10973
|
+
const id = ++messageId;
|
|
10974
|
+
const handler = function(e) {
|
|
10975
|
+
var _a;
|
|
10976
|
+
if (((_a = e.data) == null ? void 0 : _a.id) === id) {
|
|
10977
|
+
worker.removeEventListener("message", handler);
|
|
10978
|
+
callback(e.data.result);
|
|
10979
|
+
}
|
|
10843
10980
|
};
|
|
10844
|
-
|
|
10845
|
-
|
|
10981
|
+
worker.addEventListener("message", handler);
|
|
10982
|
+
worker.postMessage({ id, args });
|
|
10983
|
+
};
|
|
10984
|
+
}
|
|
10846
10985
|
}
|
|
10847
10986
|
return runFn;
|
|
10848
10987
|
}
|
|
@@ -11112,8 +11251,8 @@ function _setXS(ids, data, params) {
|
|
|
11112
11251
|
if (params.xs.indexOf(xKey) >= 0) {
|
|
11113
11252
|
xsData = (params.appendXs && $$.data.xs[id] || []).concat(
|
|
11114
11253
|
data.map((d, i) => {
|
|
11115
|
-
const rawX =
|
|
11116
|
-
return rawX ? $$.generateTargetX(rawX, id, i) : false;
|
|
11254
|
+
const rawX = d[xKey];
|
|
11255
|
+
return isValue(rawX) ? $$.generateTargetX(rawX, id, i) : false;
|
|
11117
11256
|
}).filter((v) => v !== false)
|
|
11118
11257
|
);
|
|
11119
11258
|
} else if (config.data_x) {
|
|
@@ -11144,7 +11283,7 @@ function _setXS(ids, data, params) {
|
|
|
11144
11283
|
let data = args;
|
|
11145
11284
|
if (args.bindto) {
|
|
11146
11285
|
data = {};
|
|
11147
|
-
["url", "mimeType", "headers", "keys", "json", "
|
|
11286
|
+
["url", "mimeType", "headers", "keys", "json", "rows", "columns"].forEach((v) => {
|
|
11148
11287
|
const key = `data_${v}`;
|
|
11149
11288
|
if (key in args) {
|
|
11150
11289
|
data[v] = args[key];
|
|
@@ -11195,20 +11334,20 @@ function _setXS(ids, data, params) {
|
|
|
11195
11334
|
const params = {
|
|
11196
11335
|
appendXs,
|
|
11197
11336
|
xs,
|
|
11198
|
-
idConverter: config.data_idConverter.bind($$.api),
|
|
11199
11337
|
categorized: axis == null ? void 0 : axis.isCategorized(),
|
|
11200
11338
|
timeSeries: axis == null ? void 0 : axis.isTimeSeries(),
|
|
11201
11339
|
customX: axis == null ? void 0 : axis.isCustomX()
|
|
11202
11340
|
};
|
|
11203
11341
|
_setXS.bind($$)(ids, data, params);
|
|
11204
11342
|
const categoryIndexMap = params.customX && params.categorized && config.axis_x_categories.length ? new Map(config.axis_x_categories.map((cat, i) => [cat, i])) : null;
|
|
11343
|
+
const idConverter = config.data_idConverter.bind($$.api);
|
|
11205
11344
|
const targets = ids.map((id, index) => {
|
|
11206
|
-
const convertedId =
|
|
11345
|
+
const convertedId = idConverter(id);
|
|
11207
11346
|
const xKey = $$.getXKey(id);
|
|
11208
11347
|
const isCategory = params.customX && params.categorized;
|
|
11209
|
-
const hasCategory = isCategory && (() => {
|
|
11348
|
+
const hasCategory = isCategory && index === 0 && (() => {
|
|
11210
11349
|
const categorySet = toSet(config.axis_x_categories);
|
|
11211
|
-
return data.every((v) => categorySet.has(v
|
|
11350
|
+
return data.every((v) => categorySet.has(v[xKey]));
|
|
11212
11351
|
})();
|
|
11213
11352
|
const isDataAppend = data.__append__;
|
|
11214
11353
|
const xIndex = xKey === null && isDataAppend ? $$.api.data.values(id).length : 0;
|
|
@@ -11222,7 +11361,7 @@ function _setXS(ids, data, params) {
|
|
|
11222
11361
|
let x;
|
|
11223
11362
|
value = value !== null && !isNaN(value) && !isObject(value) ? +value : isArray(value) || isObject(value) ? value : null;
|
|
11224
11363
|
if ((isCategory || state.hasRadar) && index === 0 && !isUndefined(rawX)) {
|
|
11225
|
-
if (!hasCategory &&
|
|
11364
|
+
if (!hasCategory && i === 0 && !isDataAppend) {
|
|
11226
11365
|
config.axis_x_categories = [];
|
|
11227
11366
|
if (categoryIndexMap) {
|
|
11228
11367
|
categoryIndexMap.clear();
|
|
@@ -11284,6 +11423,10 @@ function _setXS(ids, data, params) {
|
|
|
11284
11423
|
|
|
11285
11424
|
|
|
11286
11425
|
|
|
11426
|
+
const rangedDataKeyIndex = {
|
|
11427
|
+
areaRange: { high: 0, mid: 1, low: 2 },
|
|
11428
|
+
candlestick: { open: 0, high: 1, low: 2, close: 3, volume: 4 }
|
|
11429
|
+
};
|
|
11287
11430
|
/* harmony default export */ var data_data = ({
|
|
11288
11431
|
isX(key) {
|
|
11289
11432
|
const $$ = this;
|
|
@@ -11559,7 +11702,7 @@ function _setXS(ids, data, params) {
|
|
|
11559
11702
|
if (!sum[i]) {
|
|
11560
11703
|
sum[i] = 0;
|
|
11561
11704
|
}
|
|
11562
|
-
sum[i] +=
|
|
11705
|
+
sum[i] += isNumber(v.value) ? v.value : 0;
|
|
11563
11706
|
});
|
|
11564
11707
|
});
|
|
11565
11708
|
$$.cache.add(cacheKey, sum);
|
|
@@ -11600,7 +11743,7 @@ function _setXS(ids, data, params) {
|
|
|
11600
11743
|
const { api, state: { hiddenTargetIds } } = $$;
|
|
11601
11744
|
let total = 0;
|
|
11602
11745
|
if (hiddenTargetIds.size) {
|
|
11603
|
-
total = api.data.values.bind(api)([...hiddenTargetIds]).reduce((p, c) => p + c);
|
|
11746
|
+
total = api.data.values.bind(api)([...hiddenTargetIds]).reduce((p, c) => p + c, 0);
|
|
11604
11747
|
}
|
|
11605
11748
|
return total;
|
|
11606
11749
|
},
|
|
@@ -12193,16 +12336,14 @@ function _setXS(ids, data, params) {
|
|
|
12193
12336
|
return current;
|
|
12194
12337
|
},
|
|
12195
12338
|
getRangedData(d, key = "", type = "areaRange") {
|
|
12339
|
+
var _a, _b;
|
|
12196
12340
|
const value = d == null ? void 0 : d.value;
|
|
12197
12341
|
if (isArray(value)) {
|
|
12198
12342
|
if (type === "bar") {
|
|
12199
12343
|
return value.reduce((a, c) => c - a);
|
|
12200
12344
|
} else {
|
|
12201
|
-
const index =
|
|
12202
|
-
|
|
12203
|
-
candlestick: ["open", "high", "low", "close", "volume"]
|
|
12204
|
-
}[type].indexOf(key);
|
|
12205
|
-
return index >= 0 && value ? value[index] : void 0;
|
|
12345
|
+
const index = (_b = (_a = rangedDataKeyIndex[type]) == null ? void 0 : _a[key]) != null ? _b : -1;
|
|
12346
|
+
return index >= 0 ? value[index] : void 0;
|
|
12206
12347
|
}
|
|
12207
12348
|
} else if (value && key) {
|
|
12208
12349
|
return value[key];
|
|
@@ -12267,7 +12408,9 @@ function _setXS(ids, data, params) {
|
|
|
12267
12408
|
if (hiddenIds.length) {
|
|
12268
12409
|
let hiddenSum = dataValues(hiddenIds, false);
|
|
12269
12410
|
if (hiddenSum.length) {
|
|
12270
|
-
hiddenSum = hiddenSum.reduce(
|
|
12411
|
+
hiddenSum = hiddenSum.reduce(
|
|
12412
|
+
(acc, curr) => acc.map((v, i) => (isNumber(v) ? v : 0) + curr[i])
|
|
12413
|
+
);
|
|
12271
12414
|
total = total.map((v, i) => v - hiddenSum[i]);
|
|
12272
12415
|
}
|
|
12273
12416
|
}
|
|
@@ -12376,25 +12519,22 @@ function callDone(fn, resizeAfter = false) {
|
|
|
12376
12519
|
$$.setTargetType(t.id, type);
|
|
12377
12520
|
});
|
|
12378
12521
|
}
|
|
12522
|
+
const incoming = new Map(targets.map((t) => [t.id, t]));
|
|
12379
12523
|
data.targets.forEach((d) => {
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
}
|
|
12387
|
-
} else {
|
|
12388
|
-
d.values = targets[i].values;
|
|
12524
|
+
const t = incoming.get(d.id);
|
|
12525
|
+
if (t) {
|
|
12526
|
+
if (append) {
|
|
12527
|
+
const values = t.values;
|
|
12528
|
+
for (let j = 0; j < values.length; j++) {
|
|
12529
|
+
d.values.push(values[j]);
|
|
12389
12530
|
}
|
|
12390
|
-
|
|
12391
|
-
|
|
12531
|
+
} else {
|
|
12532
|
+
d.values = t.values;
|
|
12392
12533
|
}
|
|
12534
|
+
incoming.delete(d.id);
|
|
12393
12535
|
}
|
|
12394
12536
|
});
|
|
12395
|
-
|
|
12396
|
-
data.targets.push(targets[i]);
|
|
12397
|
-
}
|
|
12537
|
+
incoming.forEach((t) => data.targets.push(t));
|
|
12398
12538
|
}
|
|
12399
12539
|
if ($$.state.isCanvasMode) {
|
|
12400
12540
|
$$.redraw({
|
|
@@ -12473,15 +12613,16 @@ function callDone(fn, resizeAfter = false) {
|
|
|
12473
12613
|
};
|
|
12474
12614
|
}
|
|
12475
12615
|
targetIds = targetIds.filter((id) => $$.hasTarget($$.data.targets, id));
|
|
12476
|
-
if (
|
|
12616
|
+
if (targetIds.length === 0) {
|
|
12477
12617
|
done();
|
|
12478
12618
|
return;
|
|
12479
12619
|
}
|
|
12620
|
+
const unloadIds = new Set(targetIds);
|
|
12480
12621
|
if (state.isCanvasMode) {
|
|
12481
12622
|
targetIds.forEach((id) => {
|
|
12482
12623
|
state.withoutFadeIn[id] = false;
|
|
12483
|
-
$$.data.targets = $$.data.targets.filter((t) => t.id !== id);
|
|
12484
12624
|
});
|
|
12625
|
+
$$.data.targets = $$.data.targets.filter((t) => !unloadIds.has(t.id));
|
|
12485
12626
|
$$.removeHiddenTargetIds(targetIds);
|
|
12486
12627
|
$$.removeHiddenLegendIds(targetIds);
|
|
12487
12628
|
$$.updateTypesElements();
|
|
@@ -12495,9 +12636,9 @@ function callDone(fn, resizeAfter = false) {
|
|
|
12495
12636
|
if ($el.legend) {
|
|
12496
12637
|
$el.legend.selectAll(`.${$LEGEND.legendItem}${suffixId}`).remove();
|
|
12497
12638
|
}
|
|
12498
|
-
$$.data.targets = $$.data.targets.filter((t) => t.id !== id);
|
|
12499
12639
|
hasLegendDefsPoint && ((_a2 = $el.defs) == null ? void 0 : _a2.select(`#${$$.getDefsPointId(suffixId)}`).remove());
|
|
12500
12640
|
});
|
|
12641
|
+
$$.data.targets = $$.data.targets.filter((t) => !unloadIds.has(t.id));
|
|
12501
12642
|
state.hasFunnel && $$.updateFunnel($$.data.targets);
|
|
12502
12643
|
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
12503
12644
|
$$.updateTypesElements();
|
|
@@ -12665,7 +12806,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
12665
12806
|
}
|
|
12666
12807
|
let x = left + (mouse ? mouse[0] : 0) + (isMultipleX || isRotated ? 0 : width / 2);
|
|
12667
12808
|
let y = top + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0);
|
|
12668
|
-
if (hasViewBox(svg)) {
|
|
12809
|
+
if (hasViewBox(svg) && $$.$el.eventRect) {
|
|
12669
12810
|
const ctm = getTransformCTM($$.$el.eventRect.node(), x, y, false);
|
|
12670
12811
|
x = ctm.x;
|
|
12671
12812
|
y = ctm.y;
|
|
@@ -12697,9 +12838,10 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
12697
12838
|
*/
|
|
12698
12839
|
unbindZoomEvent() {
|
|
12699
12840
|
const $$ = this;
|
|
12700
|
-
const { $el: { canvas, eventRect, zoomResetBtn } } = $$;
|
|
12841
|
+
const { $el: { canvas, eventRect, svg, zoomResetBtn } } = $$;
|
|
12701
12842
|
eventRect == null ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
|
|
12702
12843
|
canvas == null ? void 0 : canvas.on(".zoom wheel.zoom .drag", null);
|
|
12844
|
+
svg == null ? void 0 : svg.on("wheel", null);
|
|
12703
12845
|
zoomResetBtn == null ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
|
|
12704
12846
|
},
|
|
12705
12847
|
/**
|
|
@@ -13681,6 +13823,8 @@ function _getFormat($$, typeValue, v) {
|
|
|
13681
13823
|
|
|
13682
13824
|
|
|
13683
13825
|
|
|
13826
|
+
const LEGEND_TOUCH_TAP_THRESHOLD = 10;
|
|
13827
|
+
const LEGEND_TOUCH_CLICK_TIMEOUT = 750;
|
|
13684
13828
|
function _getLegendColor(id) {
|
|
13685
13829
|
const $$ = this;
|
|
13686
13830
|
const data = $$.getDataById(id);
|
|
@@ -13697,9 +13841,14 @@ function _getFormattedText(id, formatted = true) {
|
|
|
13697
13841
|
return text;
|
|
13698
13842
|
}
|
|
13699
13843
|
function _buildLegendItemMap($$, legendItems) {
|
|
13844
|
+
var _a;
|
|
13700
13845
|
if (!legendItems || legendItems.empty()) {
|
|
13701
13846
|
return;
|
|
13702
13847
|
}
|
|
13848
|
+
const allItems = (_a = $$.$el.legend) == null ? void 0 : _a.selectAll(`.${$LEGEND.legendItem}`);
|
|
13849
|
+
if (allItems && !allItems.empty()) {
|
|
13850
|
+
legendItems = allItems;
|
|
13851
|
+
}
|
|
13703
13852
|
const items = [];
|
|
13704
13853
|
legendItems.each(function(id) {
|
|
13705
13854
|
items.push({ id, node: this });
|
|
@@ -13711,6 +13860,54 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13711
13860
|
);
|
|
13712
13861
|
$$.cache.add(KEY.legendItemMap, itemMap);
|
|
13713
13862
|
}
|
|
13863
|
+
function _getLegendTouchPoint(event) {
|
|
13864
|
+
var _a, _b;
|
|
13865
|
+
return ((_a = event.changedTouches) == null ? void 0 : _a[0]) || ((_b = event.touches) == null ? void 0 : _b[0]);
|
|
13866
|
+
}
|
|
13867
|
+
function _setLegendTouchStart($$, id, event) {
|
|
13868
|
+
const touch = _getLegendTouchPoint(event);
|
|
13869
|
+
$$.state.legendTouch = touch ? {
|
|
13870
|
+
id,
|
|
13871
|
+
x: touch.clientX,
|
|
13872
|
+
y: touch.clientY,
|
|
13873
|
+
moved: false
|
|
13874
|
+
} : null;
|
|
13875
|
+
}
|
|
13876
|
+
function _updateLegendTouchMove($$, event) {
|
|
13877
|
+
const start = $$.state.legendTouch;
|
|
13878
|
+
const touch = start && _getLegendTouchPoint(event);
|
|
13879
|
+
if (touch) {
|
|
13880
|
+
start.moved = start.moved || Math.abs(touch.clientX - start.x) > LEGEND_TOUCH_TAP_THRESHOLD || Math.abs(touch.clientY - start.y) > LEGEND_TOUCH_TAP_THRESHOLD;
|
|
13881
|
+
}
|
|
13882
|
+
}
|
|
13883
|
+
function _isLegendTouchTap($$, id, event) {
|
|
13884
|
+
_updateLegendTouchMove($$, event);
|
|
13885
|
+
const start = $$.state.legendTouch;
|
|
13886
|
+
$$.state.legendTouch = null;
|
|
13887
|
+
return !!start && start.id === id && !start.moved;
|
|
13888
|
+
}
|
|
13889
|
+
function _markLegendTouchClick($$, id) {
|
|
13890
|
+
$$.state.legendLastTouchClickId = id;
|
|
13891
|
+
$$.state.legendLastTouchClickTime = Date.now();
|
|
13892
|
+
}
|
|
13893
|
+
function _isDuplicateLegendTouchClick($$, id) {
|
|
13894
|
+
const { state } = $$;
|
|
13895
|
+
const duplicate = state.legendLastTouchClickId === id && Date.now() - (state.legendLastTouchClickTime || 0) < LEGEND_TOUCH_CLICK_TIMEOUT;
|
|
13896
|
+
if (duplicate) {
|
|
13897
|
+
state.legendLastTouchClickId = null;
|
|
13898
|
+
state.legendLastTouchClickTime = 0;
|
|
13899
|
+
}
|
|
13900
|
+
return duplicate;
|
|
13901
|
+
}
|
|
13902
|
+
function _getLegendTouchOption($$) {
|
|
13903
|
+
var _a;
|
|
13904
|
+
const preventDefault = (_a = $$.config.interaction_inputType_touch) == null ? void 0 : _a.preventDefault;
|
|
13905
|
+
const isPrevented = isBoolean(preventDefault) && preventDefault || false;
|
|
13906
|
+
const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
|
|
13907
|
+
return {
|
|
13908
|
+
passive: !isPrevented && preventThreshold === null
|
|
13909
|
+
};
|
|
13910
|
+
}
|
|
13714
13911
|
/* harmony default export */ var internals_legend = ({
|
|
13715
13912
|
/**
|
|
13716
13913
|
* Initialize the legend.
|
|
@@ -13762,8 +13959,7 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13762
13959
|
} else if (!state.hasTreemap) {
|
|
13763
13960
|
$$.updateLegendElement(
|
|
13764
13961
|
targetIds || $$.mapToIds($$.data.targets),
|
|
13765
|
-
optionz
|
|
13766
|
-
transitions
|
|
13962
|
+
optionz
|
|
13767
13963
|
);
|
|
13768
13964
|
}
|
|
13769
13965
|
(_a = $el.legend) == null ? void 0 : _a.selectAll(`.${$LEGEND.legendItem}`).classed($LEGEND.legendItemHidden, function(id) {
|
|
@@ -13947,10 +14143,10 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13947
14143
|
const { config, $el: { legend } } = $$;
|
|
13948
14144
|
if (config.legend_show && isEmpty(targetIds)) {
|
|
13949
14145
|
config.legend_show = false;
|
|
13950
|
-
legend.style("visibility", "hidden");
|
|
14146
|
+
legend == null ? void 0 : legend.style("visibility", "hidden");
|
|
13951
14147
|
}
|
|
13952
14148
|
$$.addHiddenLegendIds(targetIds);
|
|
13953
|
-
legend.selectAll($$.selectorLegends(targetIds)).style("opacity", "0").style("visibility", "hidden");
|
|
14149
|
+
legend == null ? void 0 : legend.selectAll($$.selectorLegends(targetIds)).style("opacity", "0").style("visibility", "hidden");
|
|
13954
14150
|
},
|
|
13955
14151
|
/**
|
|
13956
14152
|
* Get legend item textbox dimension
|
|
@@ -13986,6 +14182,31 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13986
14182
|
const hasGauge = $$.hasType("gauge");
|
|
13987
14183
|
const useCssRule = config.boost_useCssRule;
|
|
13988
14184
|
const interaction = config.legend_item_interaction;
|
|
14185
|
+
const eventType = interaction.dblclick ? "dblclick" : "click";
|
|
14186
|
+
const hasClickInteraction = interaction || isFunction(config.legend_item_onclick);
|
|
14187
|
+
const touchOption = isTouch ? _getLegendTouchOption($$) : void 0;
|
|
14188
|
+
const handleLegendToggle = function(event, id) {
|
|
14189
|
+
var _a;
|
|
14190
|
+
if (!callFn(config.legend_item_onclick, api, id, !state.hiddenTargetIds.has(id))) {
|
|
14191
|
+
const { altKey, type } = event;
|
|
14192
|
+
const selected = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
14193
|
+
if (type === "dblclick" || altKey) {
|
|
14194
|
+
if (state.hiddenTargetIds.size && !selected.classed($LEGEND.legendItemHidden)) {
|
|
14195
|
+
api.show();
|
|
14196
|
+
} else {
|
|
14197
|
+
api.hide();
|
|
14198
|
+
api.show(id);
|
|
14199
|
+
}
|
|
14200
|
+
} else {
|
|
14201
|
+
api.toggle(id);
|
|
14202
|
+
selected.classed($FOCUS.legendItemFocused, false);
|
|
14203
|
+
}
|
|
14204
|
+
}
|
|
14205
|
+
if (isTouch) {
|
|
14206
|
+
$$.hideTooltip();
|
|
14207
|
+
(_a = $$.hideGridFocus) == null ? void 0 : _a.call($$, true);
|
|
14208
|
+
}
|
|
14209
|
+
};
|
|
13989
14210
|
item.attr("class", function(id) {
|
|
13990
14211
|
const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
13991
14212
|
const itemClass = !node.empty() && node.attr("class") || "";
|
|
@@ -14004,33 +14225,22 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
14004
14225
|
$$.setCssRule(false, selector, [props])($el.legend);
|
|
14005
14226
|
});
|
|
14006
14227
|
}
|
|
14007
|
-
item.on(
|
|
14008
|
-
|
|
14009
|
-
|
|
14010
|
-
|
|
14011
|
-
|
|
14012
|
-
|
|
14013
|
-
|
|
14014
|
-
|
|
14015
|
-
|
|
14016
|
-
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
|
|
14020
|
-
|
|
14021
|
-
|
|
14022
|
-
|
|
14023
|
-
api.hide();
|
|
14024
|
-
api.show(id);
|
|
14025
|
-
}
|
|
14026
|
-
} else {
|
|
14027
|
-
api.toggle(id);
|
|
14028
|
-
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, false);
|
|
14029
|
-
}
|
|
14030
|
-
}
|
|
14031
|
-
isTouch && $$.hideTooltip();
|
|
14032
|
-
} : null
|
|
14033
|
-
);
|
|
14228
|
+
item.on(eventType, hasClickInteraction ? function(event, id) {
|
|
14229
|
+
if (isTouch && event.type === "click" && _isDuplicateLegendTouchClick($$, id)) {
|
|
14230
|
+
return;
|
|
14231
|
+
}
|
|
14232
|
+
handleLegendToggle.call(this, event, id);
|
|
14233
|
+
} : null);
|
|
14234
|
+
isTouch && eventType === "click" && hasClickInteraction && item.on("touchstart", function(event, id) {
|
|
14235
|
+
_setLegendTouchStart($$, id, event);
|
|
14236
|
+
}, touchOption).on("touchmove", (event) => {
|
|
14237
|
+
_updateLegendTouchMove($$, event);
|
|
14238
|
+
}, touchOption).on("touchend", function(event, id) {
|
|
14239
|
+
if (_isLegendTouchTap($$, id, event)) {
|
|
14240
|
+
_markLegendTouchClick($$, id);
|
|
14241
|
+
handleLegendToggle.call(this, event, id);
|
|
14242
|
+
}
|
|
14243
|
+
}, touchOption);
|
|
14034
14244
|
!isTouch && item.on("mouseout", interaction || isFunction(config.legend_item_onout) ? function(event, id) {
|
|
14035
14245
|
if (!callFn(
|
|
14036
14246
|
config.legend_item_onout,
|
|
@@ -14327,30 +14537,34 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
14327
14537
|
const isRectangle = legendType !== "circle";
|
|
14328
14538
|
if (usePoint) {
|
|
14329
14539
|
const tiles = legend.selectAll(`.${$LEGEND.legendItemPoint}`).data(targetIdz);
|
|
14540
|
+
const isRectangleTile = config.legend_item_tile_type !== "circle";
|
|
14541
|
+
const tileWidth = isRectangleTile ? config.legend_item_tile_width : config.legend_item_tile_r * 2;
|
|
14542
|
+
const tileHeight = isRectangleTile ? config.legend_item_tile_height : config.legend_item_tile_r * 2;
|
|
14543
|
+
const iconWidth = tileWidth * 0.75;
|
|
14544
|
+
const iconHeight = tileHeight * 0.75;
|
|
14545
|
+
const customScaleX = tileWidth / 8;
|
|
14546
|
+
const customScaleY = tileHeight / 8;
|
|
14330
14547
|
$T(tiles, withTransition).each(function() {
|
|
14331
14548
|
const nodeName = this.nodeName.toLowerCase();
|
|
14332
|
-
const pointR = config.point_r;
|
|
14333
14549
|
let x = "x";
|
|
14334
14550
|
let y = "y";
|
|
14335
|
-
let xOffset = 2;
|
|
14336
|
-
let yOffset = 2.5;
|
|
14337
14551
|
let radius = null;
|
|
14338
14552
|
let width = null;
|
|
14339
14553
|
let height = null;
|
|
14340
14554
|
if (nodeName === "circle") {
|
|
14341
|
-
const size = pointR * 0.2;
|
|
14342
14555
|
x = "cx";
|
|
14343
14556
|
y = "cy";
|
|
14344
|
-
radius =
|
|
14345
|
-
xOffset = pointR * 2;
|
|
14346
|
-
yOffset = -size;
|
|
14557
|
+
radius = Math.min(iconWidth, iconHeight) / 2;
|
|
14347
14558
|
} else if (nodeName === "rect") {
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14559
|
+
width = iconWidth;
|
|
14560
|
+
height = iconHeight;
|
|
14561
|
+
}
|
|
14562
|
+
const tile = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr("transform", null).attr("x", null).attr("y", null).attr("cx", null).attr("cy", null).attr("r", radius).attr("width", width).attr("height", height);
|
|
14563
|
+
if (nodeName === "use") {
|
|
14564
|
+
tile.attr("transform", (d) => `translate(${posFn.x1Tile(d)} ${posFn.yTile(d) - tileHeight / 2}) scale(${customScaleX} ${customScaleY})`);
|
|
14565
|
+
} else {
|
|
14566
|
+
tile.attr(x, (d) => posFn.x1Tile(d) + (tileWidth - (width || 0)) / 2).attr(y, (d) => posFn.yTile(d) - (height || 0) / 2);
|
|
14352
14567
|
}
|
|
14353
|
-
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr(x, (d) => posFn.x1Tile(d) + xOffset).attr(y, (d) => posFn.yTile(d) - yOffset).attr("r", radius).attr("width", width).attr("height", height);
|
|
14354
14568
|
});
|
|
14355
14569
|
} else {
|
|
14356
14570
|
const tiles = legend.selectAll(`.${$LEGEND.legendItemTile}`).data(targetIdz);
|
|
@@ -14599,7 +14813,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
14599
14813
|
$$.updateSvgSize();
|
|
14600
14814
|
$$.transformAll(options.withTransitionForTransform, transitions);
|
|
14601
14815
|
}
|
|
14602
|
-
$$.redraw(options
|
|
14816
|
+
$$.redraw(options);
|
|
14603
14817
|
}
|
|
14604
14818
|
});
|
|
14605
14819
|
|
|
@@ -15146,7 +15360,7 @@ function batchGetBBox(elements) {
|
|
|
15146
15360
|
return toMap(
|
|
15147
15361
|
elements,
|
|
15148
15362
|
(element) => element,
|
|
15149
|
-
(element) => getBBox(element)
|
|
15363
|
+
(element) => getBBox(element, true)
|
|
15150
15364
|
);
|
|
15151
15365
|
}
|
|
15152
15366
|
|
|
@@ -15160,7 +15374,7 @@ function batchGetBBox(elements) {
|
|
|
15160
15374
|
/* harmony default export */ var internals_text = ({
|
|
15161
15375
|
opacityForText(d) {
|
|
15162
15376
|
const $$ = this;
|
|
15163
|
-
return $$.isBarType(d) && !meetsLabelThreshold.call($$, Math.abs($$.getRatio("bar", d)), "bar") ? "0" : $$.hasDataLabel ? null : "0";
|
|
15377
|
+
return $$.isBarType(d) && !meetsLabelThreshold.call($$, Math.abs($$.getRatio("bar", d)), "bar") ? "0" : $$.hasDataLabel() ? null : "0";
|
|
15164
15378
|
},
|
|
15165
15379
|
/**
|
|
15166
15380
|
* Initializes the text
|
|
@@ -15330,8 +15544,8 @@ function batchGetBBox(elements) {
|
|
|
15330
15544
|
);
|
|
15331
15545
|
const isInverted = config[`axis_${axis == null ? void 0 : axis.getId(d.id)}_inverted`];
|
|
15332
15546
|
let pos = {
|
|
15333
|
-
x: getX.
|
|
15334
|
-
y: getY.
|
|
15547
|
+
x: getX.call(this, d, i, labelDimension),
|
|
15548
|
+
y: getY.call(this, d, i, labelDimension)
|
|
15335
15549
|
};
|
|
15336
15550
|
if (angle) {
|
|
15337
15551
|
pos = setRotatePos.bind($$)(d, pos, anchorString, isRotated, isInverted);
|
|
@@ -15657,6 +15871,14 @@ function _getCanvasTitleHeight($$) {
|
|
|
15657
15871
|
title.attr("transform", `translate(${x}, ${y})`);
|
|
15658
15872
|
}
|
|
15659
15873
|
},
|
|
15874
|
+
/**
|
|
15875
|
+
* Get canvas title height using the same SVG text measurement as title padding.
|
|
15876
|
+
* @returns {number} Title height
|
|
15877
|
+
* @private
|
|
15878
|
+
*/
|
|
15879
|
+
getCanvasTitleHeight() {
|
|
15880
|
+
return _getCanvasTitleHeight(this);
|
|
15881
|
+
},
|
|
15660
15882
|
/**
|
|
15661
15883
|
* Get title padding
|
|
15662
15884
|
* @returns {number} padding value
|
|
@@ -15668,7 +15890,7 @@ function _getCanvasTitleHeight($$) {
|
|
|
15668
15890
|
const paddingTop = config.title_padding.top || 0;
|
|
15669
15891
|
const paddingBottom = config.title_padding.bottom || 0;
|
|
15670
15892
|
if (state.isCanvasMode && config.title_text) {
|
|
15671
|
-
return paddingTop +
|
|
15893
|
+
return paddingTop + $$.getCanvasTitleHeight() + paddingBottom;
|
|
15672
15894
|
}
|
|
15673
15895
|
if (!(title == null ? void 0 : title.node())) {
|
|
15674
15896
|
return paddingTop + paddingBottom;
|
|
@@ -15809,7 +16031,8 @@ const RE_TOOLTIP_TPL = /{{(.*)}}/;
|
|
|
15809
16031
|
let i;
|
|
15810
16032
|
for (i = 0; i < len; i++) {
|
|
15811
16033
|
row = d[i];
|
|
15812
|
-
|
|
16034
|
+
const rowValue = row && getRowValue(row);
|
|
16035
|
+
if (!row || !(rowValue || rowValue === 0)) {
|
|
15813
16036
|
continue;
|
|
15814
16037
|
}
|
|
15815
16038
|
if (isUndefined(text)) {
|
|
@@ -16608,7 +16831,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
16608
16831
|
const { hasRadar, hasTreemap } = $$.state;
|
|
16609
16832
|
const shape = { type: {}, indices: {}, pos: {} };
|
|
16610
16833
|
!hasTreemap && ["bar", "candlestick", "line", "area"].forEach((v) => {
|
|
16611
|
-
const name = capitalize(
|
|
16834
|
+
const name = capitalize(v);
|
|
16612
16835
|
if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) {
|
|
16613
16836
|
const indices = $$.getShapeIndices($$[`is${name}Type`]);
|
|
16614
16837
|
const drawFn = $$[`generateDraw${name}`];
|
|
@@ -16820,10 +17043,11 @@ function updateTargetsForShape(targets, config) {
|
|
|
16820
17043
|
const targets = $$.orderTargets(
|
|
16821
17044
|
$$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))
|
|
16822
17045
|
);
|
|
17046
|
+
const dataGeneration = $$.state.dataGeneration;
|
|
16823
17047
|
const targetIds = targets.map((t) => t.id).join("_");
|
|
16824
17048
|
const cacheKey = `${KEY.shapeOffset}_${targetIds}`;
|
|
16825
17049
|
const cachedData = $$.cache.get(cacheKey);
|
|
16826
|
-
if (cachedData) {
|
|
17050
|
+
if ((cachedData == null ? void 0 : cachedData.generation) === dataGeneration) {
|
|
16827
17051
|
return cachedData;
|
|
16828
17052
|
}
|
|
16829
17053
|
const isStackNormalized = $$.isStackNormalized();
|
|
@@ -16851,7 +17075,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
16851
17075
|
out[id] = index;
|
|
16852
17076
|
return out;
|
|
16853
17077
|
}, {});
|
|
16854
|
-
const result = { indexMapByTargetId, shapeOffsetTargets };
|
|
17078
|
+
const result = { generation: dataGeneration, indexMapByTargetId, shapeOffsetTargets };
|
|
16855
17079
|
$$.cache.add(cacheKey, result);
|
|
16856
17080
|
return result;
|
|
16857
17081
|
},
|
|
@@ -17525,7 +17749,7 @@ class ChartInternal {
|
|
|
17525
17749
|
);
|
|
17526
17750
|
}
|
|
17527
17751
|
initWithData(data2) {
|
|
17528
|
-
var _a, _b, _c, _d, _e;
|
|
17752
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17529
17753
|
const $$ = this;
|
|
17530
17754
|
const { config, scale: scale2, state, $el, org } = $$;
|
|
17531
17755
|
const { hasAxis, hasFunnel, hasTreemap } = state;
|
|
@@ -17600,15 +17824,21 @@ class ChartInternal {
|
|
|
17600
17824
|
if (hasInteraction && state.inputType) {
|
|
17601
17825
|
const isTouch = state.inputType === "touch";
|
|
17602
17826
|
const { onclick, onover, onout } = config;
|
|
17827
|
+
const preventDefault = (_a = config.interaction_inputType_touch) == null ? void 0 : _a.preventDefault;
|
|
17828
|
+
const isPrevented = isBoolean(preventDefault) && preventDefault || false;
|
|
17829
|
+
const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
|
|
17830
|
+
const touchOption = isTouch ? {
|
|
17831
|
+
passive: !isPrevented && preventThreshold === null
|
|
17832
|
+
} : void 0;
|
|
17603
17833
|
$el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
|
|
17604
17834
|
isTouch ? "touchstart" : "mouseenter",
|
|
17605
17835
|
(onover == null ? void 0 : onover.bind($$.api)) || null,
|
|
17606
|
-
|
|
17836
|
+
touchOption
|
|
17607
17837
|
).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
|
|
17608
17838
|
}
|
|
17609
17839
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
17610
17840
|
const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
17611
|
-
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((
|
|
17841
|
+
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_b = $$.hasLegendDefsPoint) == null ? void 0 : _b.call($$))) {
|
|
17612
17842
|
$el.defs = $el.svg.append("defs");
|
|
17613
17843
|
if (hasAxis) {
|
|
17614
17844
|
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
@@ -17632,16 +17862,16 @@ class ChartInternal {
|
|
|
17632
17862
|
main.append("text").attr("class", `${$TEXT.text} ${$COMMON.empty}`).attr("text-anchor", "middle").attr("dominant-baseline", "middle");
|
|
17633
17863
|
}
|
|
17634
17864
|
if (hasAxis) {
|
|
17635
|
-
config.regions.length && ((
|
|
17865
|
+
config.regions.length && ((_c = $$.initRegion) == null ? void 0 : _c.call($$));
|
|
17636
17866
|
!config.clipPath && $$.axis.init();
|
|
17637
17867
|
}
|
|
17638
17868
|
main.append("g").classed($COMMON.chart, true).attr("clip-path", hasAxis ? state.clip.path : null);
|
|
17639
17869
|
$$.callPluginHook("$init");
|
|
17640
17870
|
$$.initChartElements();
|
|
17641
17871
|
if (hasAxis) {
|
|
17642
|
-
hasInteraction && ((
|
|
17643
|
-
(
|
|
17644
|
-
config.clipPath && ((
|
|
17872
|
+
hasInteraction && ((_d = $$.initEventRect) == null ? void 0 : _d.call($$));
|
|
17873
|
+
(_e = $$.initGrid) == null ? void 0 : _e.call($$);
|
|
17874
|
+
config.clipPath && ((_f = $$.axis) == null ? void 0 : _f.init());
|
|
17645
17875
|
}
|
|
17646
17876
|
$$.updateTargets($$.data.targets);
|
|
17647
17877
|
$$.updateDimension();
|
|
@@ -17855,6 +18085,7 @@ class ChartInternal {
|
|
|
17855
18085
|
return $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
|
|
17856
18086
|
}
|
|
17857
18087
|
bindResize() {
|
|
18088
|
+
var _a, _b;
|
|
17858
18089
|
const $$ = this;
|
|
17859
18090
|
const { $el, config, state } = $$;
|
|
17860
18091
|
const resizeFunction = generateResize(config.resize_timer);
|
|
@@ -17863,7 +18094,7 @@ class ChartInternal {
|
|
|
17863
18094
|
list.push(() => callFn(config.onresize, $$.api));
|
|
17864
18095
|
if (/^(true|parent)$/.test(resize_auto)) {
|
|
17865
18096
|
list.push(() => {
|
|
17866
|
-
var
|
|
18097
|
+
var _a2;
|
|
17867
18098
|
const prevWidth = state.current.width;
|
|
17868
18099
|
const prevHeight = state.current.height;
|
|
17869
18100
|
$$.setContainerSize();
|
|
@@ -17873,7 +18104,7 @@ class ChartInternal {
|
|
|
17873
18104
|
state.resizing = true;
|
|
17874
18105
|
if (config.legend_show) {
|
|
17875
18106
|
$$.updateSizes();
|
|
17876
|
-
state.isCanvasMode ? (
|
|
18107
|
+
state.isCanvasMode ? (_a2 = $$.updateHtmlLegend) == null ? void 0 : _a2.call($$) : $$.updateLegend();
|
|
17877
18108
|
}
|
|
17878
18109
|
$$.api.flush(false);
|
|
17879
18110
|
});
|
|
@@ -17884,9 +18115,17 @@ class ChartInternal {
|
|
|
17884
18115
|
});
|
|
17885
18116
|
list.forEach((v) => resizeFunction.add(v));
|
|
17886
18117
|
$$.resizeFunction = resizeFunction;
|
|
17887
|
-
if (resize_auto === "parent") {
|
|
17888
|
-
($$.resizeFunction.resizeObserver = new ResizeObserver(
|
|
18118
|
+
if (resize_auto === "parent" && win.ResizeObserver) {
|
|
18119
|
+
($$.resizeFunction.resizeObserver = new win.ResizeObserver(
|
|
18120
|
+
$$.resizeFunction.bind($$)
|
|
18121
|
+
)).observe($el.chart.node().parentNode);
|
|
17889
18122
|
} else {
|
|
18123
|
+
if (resize_auto === "parent") {
|
|
18124
|
+
(_b = (_a = win.console) == null ? void 0 : _a.warn) == null ? void 0 : _b.call(
|
|
18125
|
+
_a,
|
|
18126
|
+
"[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize."
|
|
18127
|
+
);
|
|
18128
|
+
}
|
|
17890
18129
|
win.addEventListener("resize", $$.resizeFunction);
|
|
17891
18130
|
}
|
|
17892
18131
|
}
|
|
@@ -17951,6 +18190,8 @@ const CANVAS_SELECTABLE_TYPE_FILTERS = [
|
|
|
17951
18190
|
isCanvasCandlestickType,
|
|
17952
18191
|
isCanvasTreemapType
|
|
17953
18192
|
];
|
|
18193
|
+
const CANVAS_LEGEND_TOUCH_TAP_THRESHOLD = 10;
|
|
18194
|
+
const CANVAS_LEGEND_TOUCH_CLICK_TIMEOUT = 750;
|
|
17954
18195
|
const CANVAS_SUBCHART_HANDLE_SIZE = 6;
|
|
17955
18196
|
const CANVAS_SUBCHART_CLICK_TOLERANCE = 2;
|
|
17956
18197
|
const CANVAS_FLOW_ANIMATION_MAX_VALUES = 1e5;
|
|
@@ -17988,7 +18229,7 @@ function getCanvasLegendPointIcon($$, id) {
|
|
|
17988
18229
|
const pattern = getCanvasLegendPointPattern($$, id);
|
|
17989
18230
|
const svgAttrs = 'viewBox="0 0 8 8" aria-hidden="true" focusable="false" style="display:block;width:100%;height:100%;overflow:visible;pointer-events:none"';
|
|
17990
18231
|
const paintAttrs = `fill="${color}" stroke="${color}"`;
|
|
17991
|
-
if (/^rect(angle)?$/i.test(pattern)
|
|
18232
|
+
if (/^rect(angle)?$/i.test(pattern)) {
|
|
17992
18233
|
return `<svg ${svgAttrs}><rect x="1" y="1" width="6" height="6" ${paintAttrs}></rect></svg>`;
|
|
17993
18234
|
}
|
|
17994
18235
|
if (!pattern || /^circle$/i.test(pattern)) {
|
|
@@ -18043,15 +18284,58 @@ function revertCanvasLegendTargetFocus($$) {
|
|
|
18043
18284
|
state.defocusedTargetIds = /* @__PURE__ */ new Set();
|
|
18044
18285
|
changed && ((_c = $$.renderCanvasFrame) == null ? void 0 : _c.call($$, void 0, null, false));
|
|
18045
18286
|
}
|
|
18287
|
+
function getCanvasLegendTouchPoint(event) {
|
|
18288
|
+
var _a, _b;
|
|
18289
|
+
return ((_a = event.changedTouches) == null ? void 0 : _a[0]) || ((_b = event.touches) == null ? void 0 : _b[0]);
|
|
18290
|
+
}
|
|
18291
|
+
function setCanvasLegendTouchStart($$, id, event) {
|
|
18292
|
+
const touch = getCanvasLegendTouchPoint(event);
|
|
18293
|
+
$$.state.canvasLegendTouch = touch ? {
|
|
18294
|
+
id,
|
|
18295
|
+
x: touch.clientX,
|
|
18296
|
+
y: touch.clientY,
|
|
18297
|
+
moved: false
|
|
18298
|
+
} : null;
|
|
18299
|
+
}
|
|
18300
|
+
function updateCanvasLegendTouchMove($$, event) {
|
|
18301
|
+
const start = $$.state.canvasLegendTouch;
|
|
18302
|
+
const touch = start && getCanvasLegendTouchPoint(event);
|
|
18303
|
+
if (touch) {
|
|
18304
|
+
start.moved = start.moved || Math.abs(touch.clientX - start.x) > CANVAS_LEGEND_TOUCH_TAP_THRESHOLD || Math.abs(touch.clientY - start.y) > CANVAS_LEGEND_TOUCH_TAP_THRESHOLD;
|
|
18305
|
+
}
|
|
18306
|
+
}
|
|
18307
|
+
function isCanvasLegendTouchTap($$, id, event) {
|
|
18308
|
+
updateCanvasLegendTouchMove($$, event);
|
|
18309
|
+
const start = $$.state.canvasLegendTouch;
|
|
18310
|
+
$$.state.canvasLegendTouch = null;
|
|
18311
|
+
return !!start && start.id === id && !start.moved;
|
|
18312
|
+
}
|
|
18313
|
+
function markCanvasLegendTouchClick($$, id) {
|
|
18314
|
+
$$.state.canvasLegendLastTouchClickId = id;
|
|
18315
|
+
$$.state.canvasLegendLastTouchClickTime = Date.now();
|
|
18316
|
+
}
|
|
18317
|
+
function isDuplicateCanvasLegendTouchClick($$, id) {
|
|
18318
|
+
const { state } = $$;
|
|
18319
|
+
const duplicate = state.canvasLegendLastTouchClickId === id && Date.now() - (state.canvasLegendLastTouchClickTime || 0) < CANVAS_LEGEND_TOUCH_CLICK_TIMEOUT;
|
|
18320
|
+
if (duplicate) {
|
|
18321
|
+
state.canvasLegendLastTouchClickId = null;
|
|
18322
|
+
state.canvasLegendLastTouchClickTime = 0;
|
|
18323
|
+
}
|
|
18324
|
+
return duplicate;
|
|
18325
|
+
}
|
|
18046
18326
|
function bindCanvasHtmlLegendInteractions($$, item) {
|
|
18047
18327
|
const { api, config, state } = $$;
|
|
18048
|
-
item.on("click
|
|
18328
|
+
item.on("click dblclick mouseover mouseout touchstart touchmove touchend", null);
|
|
18049
18329
|
if (!config.interaction_enabled) {
|
|
18050
18330
|
return;
|
|
18051
18331
|
}
|
|
18052
18332
|
const interaction = config.legend_item_interaction;
|
|
18053
18333
|
const eventType = typeof interaction === "object" && (interaction == null ? void 0 : interaction.dblclick) ? "dblclick" : "click";
|
|
18054
|
-
|
|
18334
|
+
const isTouch = state.inputType === "touch";
|
|
18335
|
+
const hasClickInteraction = interaction || isFunction(config.legend_item_onclick);
|
|
18336
|
+
const touchOption = isTouch ? getCanvasTouchListenerOption(config) : void 0;
|
|
18337
|
+
const handleCanvasLegendToggle = function(event, id) {
|
|
18338
|
+
var _a;
|
|
18055
18339
|
if (!callFn(config.legend_item_onclick, api, id, !state.hiddenTargetIds.has(id))) {
|
|
18056
18340
|
const selected = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
18057
18341
|
if (event.type === "dblclick" || event.altKey) {
|
|
@@ -18067,15 +18351,30 @@ function bindCanvasHtmlLegendInteractions($$, item) {
|
|
|
18067
18351
|
}
|
|
18068
18352
|
revertCanvasLegendTargetFocus($$);
|
|
18069
18353
|
}
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18354
|
+
isTouch && ((_a = $$.hideTooltip) == null ? void 0 : _a.call($$));
|
|
18355
|
+
};
|
|
18356
|
+
item.on(eventType, hasClickInteraction ? function(event, id) {
|
|
18357
|
+
if (isTouch && event.type === "click" && isDuplicateCanvasLegendTouchClick($$, id)) {
|
|
18358
|
+
return;
|
|
18359
|
+
}
|
|
18360
|
+
handleCanvasLegendToggle.call(this, event, id);
|
|
18361
|
+
} : null);
|
|
18362
|
+
isTouch && eventType === "click" && hasClickInteraction && item.on("touchstart", function(event, id) {
|
|
18363
|
+
setCanvasLegendTouchStart($$, id, event);
|
|
18364
|
+
}, touchOption).on("touchmove", (event) => {
|
|
18365
|
+
updateCanvasLegendTouchMove($$, event);
|
|
18366
|
+
}, touchOption).on("touchend", function(event, id) {
|
|
18367
|
+
if (isCanvasLegendTouchTap($$, id, event)) {
|
|
18368
|
+
markCanvasLegendTouchClick($$, id);
|
|
18369
|
+
handleCanvasLegendToggle.call(this, event, id);
|
|
18370
|
+
}
|
|
18371
|
+
}, touchOption);
|
|
18372
|
+
!isTouch && item.on("mouseover", interaction || isFunction(config.legend_item_onover) ? function(event, id) {
|
|
18373
|
+
if (!callFn(config.legend_item_onover, api, id, !state.hiddenTargetIds.has(id))) {
|
|
18374
|
+
setCanvasHtmlLegendFocus($$, id);
|
|
18375
|
+
!state.transiting && $$.isTargetToShow(id) && setCanvasLegendTargetFocus($$, id);
|
|
18376
|
+
}
|
|
18377
|
+
} : null).on("mouseout", interaction || isFunction(config.legend_item_onout) ? function(event, id) {
|
|
18079
18378
|
if (!callFn(config.legend_item_onout, api, id, !state.hiddenTargetIds.has(id))) {
|
|
18080
18379
|
revertCanvasHtmlLegendFocus($$);
|
|
18081
18380
|
revertCanvasLegendTargetFocus($$);
|
|
@@ -19721,7 +20020,7 @@ const canvasInternal = {
|
|
|
19721
20020
|
return;
|
|
19722
20021
|
}
|
|
19723
20022
|
this.dispatchCanvasDataClick(event, true);
|
|
19724
|
-
this.
|
|
20023
|
+
this.dispatchCanvasDataOut(this.$el.canvas.node());
|
|
19725
20024
|
(_c = this.config.onout) == null ? void 0 : _c.bind(this.api)(event);
|
|
19726
20025
|
},
|
|
19727
20026
|
/**
|
|
@@ -19895,16 +20194,19 @@ const canvasInternal = {
|
|
|
19895
20194
|
state._canvasVisibleRangeCache = null;
|
|
19896
20195
|
state._canvasXTickValuesCache = null;
|
|
19897
20196
|
$$.canvasEngine.beginFrame(state.current.width, $$.getCanvasSurfaceHeight());
|
|
19898
|
-
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
20197
|
+
try {
|
|
20198
|
+
$$.canvasRenderer.drawBackground($$);
|
|
20199
|
+
$$.canvasAxisRenderer.drawTitle($$);
|
|
20200
|
+
state.hasAxis && $$.canvasAxisRenderer.draw($$);
|
|
20201
|
+
$$.canvasRenderer.draw($$, drawShape);
|
|
20202
|
+
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
20203
|
+
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
20204
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
20205
|
+
$$.canvasRenderer.drawEmptyLabel($$);
|
|
20206
|
+
rebuildHit && $$.hitDetector.rebuild($$, drawShape);
|
|
20207
|
+
} finally {
|
|
20208
|
+
$$.canvasEngine.endFrame();
|
|
20209
|
+
}
|
|
19908
20210
|
$$.canvasEngine.clearOverlay();
|
|
19909
20211
|
state.canvasFocusMainRedraw = false;
|
|
19910
20212
|
focusData && $$.renderCanvasFocus(focusData);
|
|
@@ -19923,15 +20225,18 @@ const canvasInternal = {
|
|
|
19923
20225
|
if (withMainRedraw) {
|
|
19924
20226
|
const drawShape = state.canvasShape || $$.getDrawShape();
|
|
19925
20227
|
$$.canvasEngine.beginFrame(state.current.width, $$.getCanvasSurfaceHeight());
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
|
|
19934
|
-
|
|
20228
|
+
try {
|
|
20229
|
+
$$.canvasRenderer.drawBackground($$);
|
|
20230
|
+
$$.canvasAxisRenderer.drawTitle($$);
|
|
20231
|
+
state.hasAxis && $$.canvasAxisRenderer.draw($$);
|
|
20232
|
+
$$.canvasRenderer.draw($$, drawShape, focusData);
|
|
20233
|
+
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
20234
|
+
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
20235
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
20236
|
+
$$.canvasRenderer.drawEmptyLabel($$);
|
|
20237
|
+
} finally {
|
|
20238
|
+
$$.canvasEngine.endFrame();
|
|
20239
|
+
}
|
|
19935
20240
|
}
|
|
19936
20241
|
state.canvasFocusMainRedraw = !!withMainRedraw;
|
|
19937
20242
|
$$.canvasEngine.withOverlay((ctx) => {
|
|
@@ -20073,6 +20378,7 @@ function loadConfig(config) {
|
|
|
20073
20378
|
;// ./src/Chart/api/chart.ts
|
|
20074
20379
|
|
|
20075
20380
|
|
|
20381
|
+
|
|
20076
20382
|
/* harmony default export */ var chart = ({
|
|
20077
20383
|
/**
|
|
20078
20384
|
* Resize the chart.
|
|
@@ -20164,22 +20470,25 @@ function loadConfig(config) {
|
|
|
20164
20470
|
* chart.destroy();
|
|
20165
20471
|
*/
|
|
20166
20472
|
destroy() {
|
|
20167
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
20473
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
20168
20474
|
const $$ = this.internal;
|
|
20169
20475
|
const { state, $el: { chart, style, svg } } = $$;
|
|
20170
20476
|
if (notEmpty($$)) {
|
|
20171
20477
|
$$.callPluginHook("$willDestroy");
|
|
20172
20478
|
(_a = $$.cache) == null ? void 0 : _a.remove(["setOverOut", "callOverOutForTouch"]);
|
|
20173
20479
|
$$.charts.splice($$.charts.indexOf(this), 1);
|
|
20480
|
+
$$.charts.length === 0 && cleanupWorkers();
|
|
20174
20481
|
$$.unbindAllEvents();
|
|
20175
20482
|
svg == null ? void 0 : svg.select("*").interrupt();
|
|
20176
20483
|
state.canvasFlowFrame !== null && ((_c = (_b = win).cancelAnimationFrame) == null ? void 0 : _c.call(_b, state.canvasFlowFrame));
|
|
20177
20484
|
state.canvasFlowFrame = null;
|
|
20178
20485
|
state.canvasFlowFinish = null;
|
|
20179
|
-
(_d =
|
|
20180
|
-
|
|
20181
|
-
(_f = $$.
|
|
20182
|
-
(
|
|
20486
|
+
state.pendingRaf !== null && ((_e = (_d = win).cancelAnimationFrame) == null ? void 0 : _e.call(_d, state.pendingRaf));
|
|
20487
|
+
state.pendingRaf = null;
|
|
20488
|
+
(_f = $$.canvasRenderer) == null ? void 0 : _f.destroy();
|
|
20489
|
+
(_g = $$.canvasEngine) == null ? void 0 : _g.destroy();
|
|
20490
|
+
(_h = $$.resizeFunction) == null ? void 0 : _h.clear();
|
|
20491
|
+
(_j = (_i = $$.resizeFunction) == null ? void 0 : _i.resizeObserver) == null ? void 0 : _j.disconnect();
|
|
20183
20492
|
$$.resizeFunction && win.removeEventListener("resize", $$.resizeFunction);
|
|
20184
20493
|
chart.classed("bb", false).style("position", null);
|
|
20185
20494
|
if (state.isCanvasMode) {
|
|
@@ -20451,9 +20760,22 @@ extend(api_data_data, {
|
|
|
20451
20760
|
* chart.focus();
|
|
20452
20761
|
*/
|
|
20453
20762
|
focus(targetIdsValue) {
|
|
20763
|
+
var _a;
|
|
20454
20764
|
const $$ = this.internal;
|
|
20455
20765
|
const { state } = $$;
|
|
20456
20766
|
const targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
20767
|
+
if (state.isCanvasMode) {
|
|
20768
|
+
const focusedIds = targetIds.filter($$.isTargetToShow, $$);
|
|
20769
|
+
const focusedSet = new Set(focusedIds);
|
|
20770
|
+
const defocusedIds = $$.mapToTargetIds().filter((id) => !focusedSet.has(id) && $$.isTargetToShow(id));
|
|
20771
|
+
$$.revertLegend();
|
|
20772
|
+
$$.toggleFocusLegend(defocusedIds, false);
|
|
20773
|
+
$$.toggleFocusLegend(focusedIds, true);
|
|
20774
|
+
state.focusedTargetIds = focusedSet;
|
|
20775
|
+
state.defocusedTargetIds = new Set(defocusedIds);
|
|
20776
|
+
(_a = $$.renderCanvasFrame) == null ? void 0 : _a.call($$, void 0, null, false);
|
|
20777
|
+
return;
|
|
20778
|
+
}
|
|
20457
20779
|
const candidates = $$.$el.svg.selectAll(
|
|
20458
20780
|
$$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))
|
|
20459
20781
|
);
|
|
@@ -20486,9 +20808,18 @@ extend(api_data_data, {
|
|
|
20486
20808
|
* chart.defocus();
|
|
20487
20809
|
*/
|
|
20488
20810
|
defocus(targetIdsValue) {
|
|
20811
|
+
var _a;
|
|
20489
20812
|
const $$ = this.internal;
|
|
20490
20813
|
const { state } = $$;
|
|
20491
20814
|
const targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
20815
|
+
if (state.isCanvasMode) {
|
|
20816
|
+
const defocusedIds = targetIds.filter($$.isTargetToShow, $$);
|
|
20817
|
+
$$.toggleFocusLegend(defocusedIds, false);
|
|
20818
|
+
defocusedIds.forEach((id) => state.focusedTargetIds.delete(id));
|
|
20819
|
+
state.defocusedTargetIds = new Set(defocusedIds);
|
|
20820
|
+
(_a = $$.renderCanvasFrame) == null ? void 0 : _a.call($$, void 0, null, false);
|
|
20821
|
+
return;
|
|
20822
|
+
}
|
|
20492
20823
|
const candidates = $$.$el.svg.selectAll(
|
|
20493
20824
|
$$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))
|
|
20494
20825
|
);
|
|
@@ -20519,9 +20850,23 @@ extend(api_data_data, {
|
|
|
20519
20850
|
* chart.revert();
|
|
20520
20851
|
*/
|
|
20521
20852
|
revert(targetIdsValue) {
|
|
20853
|
+
var _a, _b, _c;
|
|
20522
20854
|
const $$ = this.internal;
|
|
20523
20855
|
const { config, state, $el } = $$;
|
|
20524
20856
|
const targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
20857
|
+
if (state.isCanvasMode) {
|
|
20858
|
+
const changed = !!((_a = state.focusedTargetIds) == null ? void 0 : _a.size) || !!((_b = state.defocusedTargetIds) == null ? void 0 : _b.size);
|
|
20859
|
+
if (config.legend_show) {
|
|
20860
|
+
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
20861
|
+
$el.legend.selectAll($$.selectorLegends(targetIds)).filter(function() {
|
|
20862
|
+
return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused);
|
|
20863
|
+
}).classed($FOCUS.legendItemFocused, false);
|
|
20864
|
+
}
|
|
20865
|
+
state.focusedTargetIds = /* @__PURE__ */ new Set();
|
|
20866
|
+
state.defocusedTargetIds = /* @__PURE__ */ new Set();
|
|
20867
|
+
changed && ((_c = $$.renderCanvasFrame) == null ? void 0 : _c.call($$, void 0, null, false));
|
|
20868
|
+
return;
|
|
20869
|
+
}
|
|
20525
20870
|
const candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
|
|
20526
20871
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
|
|
20527
20872
|
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
@@ -20764,7 +21109,12 @@ const legend_legend = {
|
|
|
20764
21109
|
return;
|
|
20765
21110
|
}
|
|
20766
21111
|
if (hasUnload) {
|
|
20767
|
-
$$.
|
|
21112
|
+
const unloadIds = $$.mapToTargetIds(args.unload === true ? null : args.unload);
|
|
21113
|
+
$$.unload(unloadIds, () => {
|
|
21114
|
+
if (!$$.config || !$$.cache) {
|
|
21115
|
+
return;
|
|
21116
|
+
}
|
|
21117
|
+
$$.cache.remove(unloadIds);
|
|
20768
21118
|
requestIdleCallback(() => $$.loadFromArgs(args));
|
|
20769
21119
|
});
|
|
20770
21120
|
} else {
|
|
@@ -20809,6 +21159,9 @@ const legend_legend = {
|
|
|
20809
21159
|
$$.state.dirty.data = true;
|
|
20810
21160
|
$$.state._eventRectFingerprint = null;
|
|
20811
21161
|
$$.unload(ids, () => {
|
|
21162
|
+
if (!$$.config || !$$.cache) {
|
|
21163
|
+
return;
|
|
21164
|
+
}
|
|
20812
21165
|
$$.redraw({
|
|
20813
21166
|
withUpdateOrgXDomain: true,
|
|
20814
21167
|
withUpdateXDomain: true,
|
|
@@ -21015,7 +21368,7 @@ const tooltip_tooltip = {
|
|
|
21015
21368
|
* });
|
|
21016
21369
|
*/
|
|
21017
21370
|
show: function(args) {
|
|
21018
|
-
var _a, _b, _c;
|
|
21371
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
21019
21372
|
const $$ = this.internal;
|
|
21020
21373
|
const { $el, config, state: { eventReceiver, hasFunnel, hasTreemap, inputType } } = $$;
|
|
21021
21374
|
let index;
|
|
@@ -21042,6 +21395,24 @@ const tooltip_tooltip = {
|
|
|
21042
21395
|
} else if (isDefined(args.index)) {
|
|
21043
21396
|
index = args.index;
|
|
21044
21397
|
}
|
|
21398
|
+
if ($$.state.isCanvasMode) {
|
|
21399
|
+
const targets = ((_d = $$.filterTargetsToShow) == null ? void 0 : _d.call($$)) || $$.data.targets;
|
|
21400
|
+
const selectedData = ((_e = args.data) == null ? void 0 : _e.id) && !config.tooltip_grouped ? targets.filter((target) => target.id === args.data.id).map((target) => target.values[index != null ? index : args.data.index]).filter(Boolean) : targets.map((target) => target.values[index]).filter(Boolean);
|
|
21401
|
+
const canvas = (_g = (_f = $el.canvas) == null ? void 0 : _f.node) == null ? void 0 : _g.call(_f);
|
|
21402
|
+
const shape = $$.state.canvasShape || ((_h = $$.getDrawShape) == null ? void 0 : _h.call($$));
|
|
21403
|
+
const first = selectedData[0];
|
|
21404
|
+
const point = mouse || (first && ((_i = shape == null ? void 0 : shape.pos) == null ? void 0 : _i.cx) && ((_j = shape == null ? void 0 : shape.pos) == null ? void 0 : _j.cy) ? [
|
|
21405
|
+
$$.state.margin.left + shape.pos.cx(first),
|
|
21406
|
+
$$.state.margin.top + shape.pos.cy(first)
|
|
21407
|
+
] : void 0);
|
|
21408
|
+
if (!selectedData.length || !canvas) {
|
|
21409
|
+
return;
|
|
21410
|
+
}
|
|
21411
|
+
$$.state.canvasFocusKey = selectedData.map((v) => `${v.id}:${v.index}`).join("|");
|
|
21412
|
+
(_k = $$.renderCanvasFocus) == null ? void 0 : _k.call($$, selectedData, point);
|
|
21413
|
+
(_l = $$.showTooltip) == null ? void 0 : _l.call($$, selectedData, canvas);
|
|
21414
|
+
return;
|
|
21415
|
+
}
|
|
21045
21416
|
(inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach((eventName) => {
|
|
21046
21417
|
$$.dispatchEvent(eventName, index, mouse);
|
|
21047
21418
|
});
|
|
@@ -21058,6 +21429,7 @@ const tooltip_tooltip = {
|
|
|
21058
21429
|
const { state: { inputType, isCanvasMode }, $el: { tooltip: tooltip2 } } = $$;
|
|
21059
21430
|
const data = tooltip2 == null ? void 0 : tooltip2.datum();
|
|
21060
21431
|
if (isCanvasMode) {
|
|
21432
|
+
$$.state.canvasFocusKey = null;
|
|
21061
21433
|
$$.hideTooltip(true);
|
|
21062
21434
|
(_a = $$.clearCanvasFocus) == null ? void 0 : _a.call($$);
|
|
21063
21435
|
return;
|
|
@@ -21216,11 +21588,9 @@ function getGlyph(svg) {
|
|
|
21216
21588
|
};
|
|
21217
21589
|
};
|
|
21218
21590
|
if (t.childElementCount > 1) {
|
|
21219
|
-
const text = [];
|
|
21220
21591
|
toArray(t.querySelectorAll("tspan")).filter(filterFn).forEach((ts) => {
|
|
21221
21592
|
glyph.push(getStyleFn(ts));
|
|
21222
21593
|
});
|
|
21223
|
-
return text;
|
|
21224
21594
|
} else {
|
|
21225
21595
|
glyph.push(getStyleFn(t));
|
|
21226
21596
|
}
|
|
@@ -21477,6 +21847,9 @@ let exportApi = () => {
|
|
|
21477
21847
|
$$.data.targets.forEach((t) => {
|
|
21478
21848
|
for (let i = 0; i < notfoundIds.length; i++) {
|
|
21479
21849
|
if (t.id === notfoundIds[i]) {
|
|
21850
|
+
if (!t.values[t.values.length - 1]) {
|
|
21851
|
+
continue;
|
|
21852
|
+
}
|
|
21480
21853
|
tail = t.values[t.values.length - 1].index + 1;
|
|
21481
21854
|
for (let j = 0; j < length; j++) {
|
|
21482
21855
|
t.values.push({
|
|
@@ -21948,8 +22321,17 @@ extend(ygrids, {
|
|
|
21948
22321
|
|
|
21949
22322
|
|
|
21950
22323
|
|
|
22324
|
+
const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`;
|
|
21951
22325
|
const _getGridTextAnchor = (d) => isValue(d.position) || "end";
|
|
21952
22326
|
const _getGridTextDx = (d) => d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
|
22327
|
+
function _getGridFocusEl($$) {
|
|
22328
|
+
var _a;
|
|
22329
|
+
const { state, $el: { main } } = $$;
|
|
22330
|
+
const cached = state._gridFocusEl;
|
|
22331
|
+
const mainNode = main.node();
|
|
22332
|
+
const cachedNodes = ((_a = cached == null ? void 0 : cached.nodes) == null ? void 0 : _a.call(cached)) || [];
|
|
22333
|
+
return cachedNodes.length && cachedNodes.every((node) => mainNode == null ? void 0 : mainNode.contains(node)) ? cached : state._gridFocusEl = main.selectAll(GRID_FOCUS_SELECTOR);
|
|
22334
|
+
}
|
|
21953
22335
|
function _getGridTextX(isX, width, height) {
|
|
21954
22336
|
return (d) => {
|
|
21955
22337
|
let x = isX ? 0 : width;
|
|
@@ -22017,8 +22399,9 @@ function _smoothLines(el, type) {
|
|
|
22017
22399
|
grid.x.each(function() {
|
|
22018
22400
|
const grid2 = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
22019
22401
|
Object.keys(state.xgridAttr).forEach((id) => {
|
|
22020
|
-
grid2.attr(id, state.xgridAttr[id])
|
|
22402
|
+
grid2.attr(id, state.xgridAttr[id]);
|
|
22021
22403
|
});
|
|
22404
|
+
grid2.style("opacity", () => +grid2.attr(isRotated ? "y1" : "x1") === (isRotated ? state.height : 0) ? "0" : null);
|
|
22022
22405
|
});
|
|
22023
22406
|
}
|
|
22024
22407
|
},
|
|
@@ -22161,13 +22544,11 @@ function _smoothLines(el, type) {
|
|
|
22161
22544
|
* @private
|
|
22162
22545
|
*/
|
|
22163
22546
|
showGridFocus(data) {
|
|
22164
|
-
var _a
|
|
22547
|
+
var _a;
|
|
22165
22548
|
const $$ = this;
|
|
22166
|
-
const { config, state
|
|
22549
|
+
const { config, state: { width, height } } = $$;
|
|
22167
22550
|
const isRotated = config.axis_rotated;
|
|
22168
|
-
const focusEl = (
|
|
22169
|
-
`line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`
|
|
22170
|
-
);
|
|
22551
|
+
const focusEl = _getGridFocusEl($$);
|
|
22171
22552
|
const dataToShow = (data || [focusEl.datum()]).filter(
|
|
22172
22553
|
(d) => d && isValue($$.getBaseValue(d))
|
|
22173
22554
|
);
|
|
@@ -22220,18 +22601,16 @@ function _smoothLines(el, type) {
|
|
|
22220
22601
|
["x1", "y1", "x2", "y2"].forEach((v, i) => el.attr(v, xy[i]));
|
|
22221
22602
|
});
|
|
22222
22603
|
_smoothLines(focusEl, "grid");
|
|
22223
|
-
(
|
|
22604
|
+
(_a = $$.showCircleFocus) == null ? void 0 : _a.call($$, data);
|
|
22224
22605
|
},
|
|
22225
|
-
hideGridFocus() {
|
|
22226
|
-
var _a
|
|
22606
|
+
hideGridFocus(force = false) {
|
|
22607
|
+
var _a;
|
|
22227
22608
|
const $$ = this;
|
|
22228
|
-
const { state
|
|
22229
|
-
if (inputType === "mouse" || !resizing) {
|
|
22230
|
-
const focusEl = (
|
|
22231
|
-
`line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`
|
|
22232
|
-
);
|
|
22609
|
+
const { state: { inputType, resizing } } = $$;
|
|
22610
|
+
if (force || inputType === "mouse" || !resizing) {
|
|
22611
|
+
const focusEl = _getGridFocusEl($$);
|
|
22233
22612
|
focusEl.style("visibility", "hidden");
|
|
22234
|
-
(
|
|
22613
|
+
(_a = $$.hideCircleFocus) == null ? void 0 : _a.call($$);
|
|
22235
22614
|
}
|
|
22236
22615
|
},
|
|
22237
22616
|
updateGridFocus() {
|
|
@@ -22256,7 +22635,7 @@ function _smoothLines(el, type) {
|
|
|
22256
22635
|
const tickNum = $$.$el.main.select(`.${$AXIS.axisX}`).selectAll(".tick").size();
|
|
22257
22636
|
let gridData = [];
|
|
22258
22637
|
if (type === "year") {
|
|
22259
|
-
const xDomain = $$.getXDomain();
|
|
22638
|
+
const xDomain = $$.getXDomain($$.data.targets);
|
|
22260
22639
|
const [firstYear, lastYear] = xDomain.map((v) => v.getFullYear());
|
|
22261
22640
|
for (let i = firstYear; i <= lastYear; i++) {
|
|
22262
22641
|
gridData.push(/* @__PURE__ */ new Date(`${i}-01-01 00:00:00`));
|
|
@@ -22546,8 +22925,8 @@ function setSelection(isSelection = false, ids, indices, resetOther) {
|
|
|
22546
22925
|
let isWithin;
|
|
22547
22926
|
let toggle;
|
|
22548
22927
|
if (shape.classed($CIRCLE.circle)) {
|
|
22549
|
-
const x = +shape.attr("cx")
|
|
22550
|
-
const y = +shape.attr("cy")
|
|
22928
|
+
const x = +shape.attr("cx");
|
|
22929
|
+
const y = +shape.attr("cy");
|
|
22551
22930
|
toggle = $$.togglePoint;
|
|
22552
22931
|
isWithin = minX < x && x < maxX && minY < y && y < maxY;
|
|
22553
22932
|
} else if (shape.classed($BAR.bar)) {
|
|
@@ -22932,7 +23311,7 @@ const subchart = function(domainValue) {
|
|
|
22932
23311
|
$$.getZoomDomain("subX")
|
|
22933
23312
|
);
|
|
22934
23313
|
if (isWithinRange) {
|
|
22935
|
-
state.domain = domain;
|
|
23314
|
+
state.domain = domain.slice();
|
|
22936
23315
|
brush.move(
|
|
22937
23316
|
brush.getSelection(),
|
|
22938
23317
|
domain.map(subX)
|
|
@@ -23066,6 +23445,7 @@ extend(subchart, {
|
|
|
23066
23445
|
|
|
23067
23446
|
|
|
23068
23447
|
|
|
23448
|
+
|
|
23069
23449
|
/* harmony default export */ var interactions_subchart = ({
|
|
23070
23450
|
/**
|
|
23071
23451
|
* Initialize the brush.
|
|
@@ -23186,14 +23566,8 @@ extend(subchart, {
|
|
|
23186
23566
|
const isRotated = config.axis_rotated;
|
|
23187
23567
|
const initRange = config.subchart_init_range;
|
|
23188
23568
|
const customHandleClass = "handle--custom";
|
|
23189
|
-
const path = isRotated ?
|
|
23190
|
-
|
|
23191
|
-
"M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"
|
|
23192
|
-
] : [
|
|
23193
|
-
"M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z",
|
|
23194
|
-
"M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"
|
|
23195
|
-
];
|
|
23196
|
-
$$.brush.handle = brush.selectAll(`.${customHandleClass}`).data(isRotated ? [{ type: "n" }, { type: "s" }] : [{ type: "w" }, { type: "e" }]).enter().append("path").attr("class", customHandleClass).attr("cursor", `${isRotated ? "ns" : "ew"}-resize`).attr("d", (d) => path[+/[se]/.test(d.type)]).attr("display", initRange ? null : "none");
|
|
23569
|
+
const path = SUBCHART_BRUSH_HANDLE_PATH[isRotated ? "y" : "x"];
|
|
23570
|
+
$$.brush.handle = brush.selectAll(`.${customHandleClass}`).data(isRotated ? [{ type: "n" }, { type: "s" }] : [{ type: "w" }, { type: "e" }]).enter().append("path").attr("class", customHandleClass).attr("cursor", `${isRotated ? "ns" : "ew"}-resize`).attr("d", (d) => path[/[se]/.test(d.type) ? "end" : "start"]).attr("display", initRange ? null : "none");
|
|
23197
23571
|
},
|
|
23198
23572
|
/**
|
|
23199
23573
|
* Update sub chart
|
|
@@ -23398,7 +23772,7 @@ var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack
|
|
|
23398
23772
|
|
|
23399
23773
|
|
|
23400
23774
|
const zoom = function(domainValue) {
|
|
23401
|
-
var _a;
|
|
23775
|
+
var _a, _b;
|
|
23402
23776
|
const $$ = this.internal;
|
|
23403
23777
|
const { axis, config, org, scale, state } = $$;
|
|
23404
23778
|
let domain;
|
|
@@ -23418,12 +23792,16 @@ const zoom = function(domainValue) {
|
|
|
23418
23792
|
$$.getZoomDomain("zoom")
|
|
23419
23793
|
);
|
|
23420
23794
|
if (isWithinRange) {
|
|
23421
|
-
state.domain = domain;
|
|
23795
|
+
state.domain = domain.slice();
|
|
23422
23796
|
domain = $$.getZoomDomainValue(domain);
|
|
23423
23797
|
$$.api.tooltip.hide();
|
|
23424
23798
|
if (config.subchart_show) {
|
|
23425
|
-
|
|
23426
|
-
|
|
23799
|
+
if (state.isCanvasMode) {
|
|
23800
|
+
(_a = $$.setCanvasSubchartDomain) == null ? void 0 : _a.call($$, domain, true, false);
|
|
23801
|
+
} else {
|
|
23802
|
+
const x = scale.zoom || scale.x;
|
|
23803
|
+
$$.brush.getSelection().call($$.brush.move, domain.map(x));
|
|
23804
|
+
}
|
|
23427
23805
|
} else {
|
|
23428
23806
|
const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x;
|
|
23429
23807
|
$$.updateCurrentZoomTransform(x, domain);
|
|
@@ -23434,7 +23812,7 @@ const zoom = function(domainValue) {
|
|
|
23434
23812
|
domain = $$.zoom.getDomain();
|
|
23435
23813
|
}
|
|
23436
23814
|
}
|
|
23437
|
-
return (
|
|
23815
|
+
return (_b = state.domain) != null ? _b : domain;
|
|
23438
23816
|
};
|
|
23439
23817
|
extend(zoom, {
|
|
23440
23818
|
/**
|
|
@@ -23558,11 +23936,12 @@ extend(zoom, {
|
|
|
23558
23936
|
* chart.unzoom();
|
|
23559
23937
|
*/
|
|
23560
23938
|
unzoom() {
|
|
23939
|
+
var _a;
|
|
23561
23940
|
const $$ = this.internal;
|
|
23562
23941
|
const { config, $el: { canvas, eventRect, zoomResetBtn }, scale: { zoom: zoom2 }, state } = $$;
|
|
23563
23942
|
const target = state.isCanvasMode ? canvas : eventRect;
|
|
23564
|
-
if (zoom2) {
|
|
23565
|
-
config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity);
|
|
23943
|
+
if (zoom2 || state.isCanvasMode && config.subchart_show && state.domain) {
|
|
23944
|
+
config.subchart_show ? state.isCanvasMode ? (_a = $$.clearCanvasSubchartDomain) == null ? void 0 : _a.call($$, true, false) : $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity);
|
|
23566
23945
|
$$.updateZoom(true);
|
|
23567
23946
|
zoomResetBtn == null ? void 0 : zoomResetBtn.style("display", "none");
|
|
23568
23947
|
if ((target == null ? void 0 : target.node()) && (0,external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomTransform)(target.node()) !== external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity) {
|
|
@@ -23740,6 +24119,9 @@ function getZoomDragPointer($$, event, element) {
|
|
|
23740
24119
|
const useRAF = sourceEvent && isMousemove && config.zoom_type !== "wheel";
|
|
23741
24120
|
const executeRedraw = () => {
|
|
23742
24121
|
var _a;
|
|
24122
|
+
if (!$$.config) {
|
|
24123
|
+
return;
|
|
24124
|
+
}
|
|
23743
24125
|
$$.redraw({
|
|
23744
24126
|
withTransition: doTransition,
|
|
23745
24127
|
withY: config.zoom_rescale,
|
|
@@ -23872,6 +24254,10 @@ function getZoomDragPointer($$, event, element) {
|
|
|
23872
24254
|
if (!state.isCanvasMode && !zoomRect) {
|
|
23873
24255
|
zoomRect = $$.$el.main.append("rect").attr("clip-path", state.clip.path).attr("class", $ZOOM.zoomBrush).attr("width", isRotated ? state.width : 0).attr("height", isRotated ? 0 : state.height);
|
|
23874
24256
|
}
|
|
24257
|
+
zoomRect == null ? void 0 : zoomRect.attr(
|
|
24258
|
+
isRotated ? "width" : "height",
|
|
24259
|
+
isRotated ? state.width : state.height
|
|
24260
|
+
);
|
|
23875
24261
|
start = clampPointer(getZoomDragPointer($$, event, this)[prop.index]);
|
|
23876
24262
|
end = start;
|
|
23877
24263
|
state.isCanvasMode ? (_a = $$.renderCanvasZoomBrush) == null ? void 0 : _a.call($$, start, end) : zoomRect.attr(prop.axis, start).attr(prop.attr, 0);
|
|
@@ -23993,7 +24379,6 @@ function getZoomDragPointer($$, event, element) {
|
|
|
23993
24379
|
zoom_enabled: false,
|
|
23994
24380
|
zoom_type: "wheel",
|
|
23995
24381
|
zoom_extent: void 0,
|
|
23996
|
-
zoom_privileged: false,
|
|
23997
24382
|
zoom_rescale: false,
|
|
23998
24383
|
zoom_onzoom: void 0,
|
|
23999
24384
|
zoom_onzoomstart: void 0,
|
|
@@ -24675,32 +25060,6 @@ function _getStrokeDashArray(start, end, pattern, isLastX = false) {
|
|
|
24675
25060
|
$T(line, withTransition, getRandom()).attr("d", drawFn).style("stroke", this.color).style("opacity", null)
|
|
24676
25061
|
];
|
|
24677
25062
|
},
|
|
24678
|
-
/**
|
|
24679
|
-
* Get the curve interpolate
|
|
24680
|
-
* @param {Array} d Data object
|
|
24681
|
-
* @returns {function}
|
|
24682
|
-
* @private
|
|
24683
|
-
*/
|
|
24684
|
-
getCurve(d) {
|
|
24685
|
-
const $$ = this;
|
|
24686
|
-
const isRotatedStepType = $$.config.axis_rotated && $$.isStepType(d);
|
|
24687
|
-
return isRotatedStepType ? (context) => {
|
|
24688
|
-
const step = $$.getInterpolate(d)(context);
|
|
24689
|
-
step.orgPoint = step.point;
|
|
24690
|
-
step.pointRotated = function(x, y) {
|
|
24691
|
-
this._point === 1 && (this._point = 2);
|
|
24692
|
-
const y1 = this._y * (1 - this._t) + y * this._t;
|
|
24693
|
-
this._context.lineTo(this._x, y1);
|
|
24694
|
-
this._context.lineTo(x, y1);
|
|
24695
|
-
this._x = x;
|
|
24696
|
-
this._y = y;
|
|
24697
|
-
};
|
|
24698
|
-
step.point = function(x, y) {
|
|
24699
|
-
this._point === 0 ? this.orgPoint(x, y) : this.pointRotated(x, y);
|
|
24700
|
-
};
|
|
24701
|
-
return step;
|
|
24702
|
-
} : $$.getInterpolate(d);
|
|
24703
|
-
},
|
|
24704
25063
|
generateDrawLine(lineIndices, isSub) {
|
|
24705
25064
|
const $$ = this;
|
|
24706
25065
|
return generateDrawLinePath($$, lineIndices, isSub);
|
|
@@ -24759,6 +25118,9 @@ function _getStrokeDashArray(start, end, pattern, isLastX = false) {
|
|
|
24759
25118
|
};
|
|
24760
25119
|
const axisType = { x: $$.axis.getAxisType("x"), y: $$.axis.getAxisType("y") };
|
|
24761
25120
|
let path = "";
|
|
25121
|
+
if (!d.length) {
|
|
25122
|
+
return path;
|
|
25123
|
+
}
|
|
24762
25124
|
const target = $$.$el.line.filter(({ id }) => id === d[0].id);
|
|
24763
25125
|
const tempNode = target.clone().style("display", "none");
|
|
24764
25126
|
const getLength = (node, path2) => node.attr("d", path2).node().getTotalLength();
|
|
@@ -24829,9 +25191,9 @@ function _getStrokeDashArray(start, end, pattern, isLastX = false) {
|
|
|
24829
25191
|
}
|
|
24830
25192
|
if (dashArray.dash.length) {
|
|
24831
25193
|
!isLastX && dashArray.dash.push(getLength(tempNode, path));
|
|
24832
|
-
tempNode.remove();
|
|
24833
25194
|
target.attr("stroke-dasharray", dashArray.dash.join(" "));
|
|
24834
25195
|
}
|
|
25196
|
+
tempNode.remove();
|
|
24835
25197
|
return path;
|
|
24836
25198
|
},
|
|
24837
25199
|
isWithinRegions(withinX, withinRegions) {
|
|
@@ -25163,7 +25525,7 @@ function getPointBBox(node) {
|
|
|
25163
25525
|
if (mainCircles.attr("cx")) {
|
|
25164
25526
|
mainCircles = $$.$T(mainCircles, withTransition, getTransitionName());
|
|
25165
25527
|
}
|
|
25166
|
-
selectedCircles && $$.$T(
|
|
25528
|
+
selectedCircles && $$.$T(selectedCircles, withTransition, getTransitionName());
|
|
25167
25529
|
}
|
|
25168
25530
|
return mainCircles.attr("cx", xPosFn).attr("cy", yPosFn).style("fill", fillStyleFn);
|
|
25169
25531
|
}
|
|
@@ -25805,10 +26167,6 @@ class AxisRendererHelper {
|
|
|
25805
26167
|
} else {
|
|
25806
26168
|
ticks = scale.ticks(...this.config.tickArguments || []);
|
|
25807
26169
|
}
|
|
25808
|
-
ticks = ticks.map((v) => {
|
|
25809
|
-
const r = isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v;
|
|
25810
|
-
return r;
|
|
25811
|
-
});
|
|
25812
26170
|
}
|
|
25813
26171
|
return ticks;
|
|
25814
26172
|
}
|
|
@@ -25878,6 +26236,33 @@ class AxisRenderer {
|
|
|
25878
26236
|
this.params = params;
|
|
25879
26237
|
this.helper = new AxisRendererHelper(this);
|
|
25880
26238
|
}
|
|
26239
|
+
canReuseTickTextOnResize(isLeftRight) {
|
|
26240
|
+
const { config, params } = this;
|
|
26241
|
+
const { config: chartConfig, id, owner } = params;
|
|
26242
|
+
const isX = /^(x|subX)$/.test(id);
|
|
26243
|
+
const type = id === "subX" ? "x" : id;
|
|
26244
|
+
const customTickFormat = id === "subX" ? chartConfig.subchart_axis_x_tick_format || chartConfig.axis_x_tick_format : chartConfig[`axis_${type}_tick_format`];
|
|
26245
|
+
const categoryAutoWrap = params.tickMultiline && params.isCategory && !isLeftRight && !(params.tickWidth > 0);
|
|
26246
|
+
return !!(owner.state.resizing && !owner.state.flowing && !isFunction(chartConfig.axis_evalTextSize) && !customTickFormat && !params.tickTitle && !(isX && chartConfig.axis_x_tick_autorotate) && !categoryAutoWrap && config.withoutTransition);
|
|
26247
|
+
}
|
|
26248
|
+
canReuseTickNodesOnResize(tickNodes, ticks, isLeftRight, tickShow) {
|
|
26249
|
+
if (tickShow.tick || !tickShow.text || !this.canReuseTickTextOnResize(isLeftRight) || tickNodes.size() !== ticks.length) {
|
|
26250
|
+
return false;
|
|
26251
|
+
}
|
|
26252
|
+
const nodes = tickNodes.nodes();
|
|
26253
|
+
for (let i = 0; i < ticks.length; i++) {
|
|
26254
|
+
const current = nodes[i].__data__;
|
|
26255
|
+
const next = ticks[i];
|
|
26256
|
+
if (current instanceof Date || next instanceof Date) {
|
|
26257
|
+
if (+current !== +next) {
|
|
26258
|
+
return false;
|
|
26259
|
+
}
|
|
26260
|
+
} else if (current !== next) {
|
|
26261
|
+
return false;
|
|
26262
|
+
}
|
|
26263
|
+
}
|
|
26264
|
+
return true;
|
|
26265
|
+
}
|
|
25881
26266
|
/**
|
|
25882
26267
|
* Create axis element
|
|
25883
26268
|
* @param {d3.selection} g Axis selection
|
|
@@ -25922,70 +26307,106 @@ class AxisRenderer {
|
|
|
25922
26307
|
if (tickShow.tick || tickShow.text) {
|
|
25923
26308
|
const ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight || params.config.axis_rotated);
|
|
25924
26309
|
ctx.generatedTicks = ticks;
|
|
25925
|
-
let tick = g2.selectAll(".tick")
|
|
25926
|
-
const
|
|
25927
|
-
|
|
25928
|
-
|
|
25929
|
-
|
|
25930
|
-
|
|
25931
|
-
|
|
25932
|
-
|
|
25933
|
-
|
|
25934
|
-
|
|
25935
|
-
|
|
25936
|
-
|
|
25937
|
-
|
|
26310
|
+
let tick = g2.selectAll(".tick");
|
|
26311
|
+
const canReuseTickNodes = ctx.canReuseTickNodesOnResize(
|
|
26312
|
+
tick,
|
|
26313
|
+
ticks,
|
|
26314
|
+
isLeftRight || params.config.axis_rotated,
|
|
26315
|
+
tickShow
|
|
26316
|
+
);
|
|
26317
|
+
if (canReuseTickNodes) {
|
|
26318
|
+
tickTransform(tick, scale1);
|
|
26319
|
+
} else {
|
|
26320
|
+
tick = tick.data(ticks, scale1);
|
|
26321
|
+
const tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick");
|
|
26322
|
+
const tickExit = tick.exit().remove();
|
|
26323
|
+
tick = tickEnter.merge(tick);
|
|
26324
|
+
tickShow.tick && tickEnter.append("line");
|
|
26325
|
+
tickShow.text && tickEnter.append("text");
|
|
26326
|
+
const hasTickChange = !tickEnter.empty() || !tickExit.empty();
|
|
26327
|
+
const reuseTickText = tickShow.text && !hasTickChange && ctx.canReuseTickTextOnResize(isLeftRight || params.config.axis_rotated);
|
|
26328
|
+
let sizeFor1Char = { w: 0, h: 0 };
|
|
26329
|
+
let textUpdate = tick.selectAll("text.__bb-empty");
|
|
26330
|
+
if (tickShow.text && !reuseTickText) {
|
|
26331
|
+
const tickText = tick.select("text");
|
|
26332
|
+
const counts = [];
|
|
26333
|
+
textUpdate = tickText;
|
|
26334
|
+
if (isFunction(evalTextSize)) {
|
|
26335
|
+
sizeFor1Char = evalTextSize.bind(ctx.params.owner.api)(
|
|
26336
|
+
tickText.node(),
|
|
26337
|
+
id
|
|
26338
|
+
);
|
|
26339
|
+
if (this.classList.contains($COMMON.dummy)) {
|
|
26340
|
+
this.sizeFor1Char = sizeFor1Char;
|
|
26341
|
+
}
|
|
26342
|
+
}
|
|
26343
|
+
if (!sizeFor1Char || sizeFor1Char.w === 0 || sizeFor1Char.h === 0) {
|
|
26344
|
+
sizeFor1Char = ctx.helper.getSizeFor1Char(
|
|
26345
|
+
orient,
|
|
26346
|
+
tickText,
|
|
26347
|
+
!!evalTextSize
|
|
26348
|
+
);
|
|
26349
|
+
}
|
|
26350
|
+
let tspan = tickText.selectAll("tspan").data((d, index) => {
|
|
26351
|
+
let split;
|
|
26352
|
+
if (params.tickMultiline) {
|
|
26353
|
+
split = splitTickText(
|
|
26354
|
+
d,
|
|
26355
|
+
scale1,
|
|
26356
|
+
ticks,
|
|
26357
|
+
isLeftRight,
|
|
26358
|
+
sizeFor1Char.w
|
|
26359
|
+
);
|
|
26360
|
+
} else {
|
|
26361
|
+
const formatted = helper.textFormatted(d);
|
|
26362
|
+
split = isArray(formatted) ? formatted.concat() : [formatted];
|
|
26363
|
+
}
|
|
26364
|
+
counts[index] = split.length;
|
|
26365
|
+
return split.map((splitted) => ({ index, splitted }));
|
|
26366
|
+
});
|
|
26367
|
+
tspan.exit().remove();
|
|
26368
|
+
tspan = tspan.enter().append("tspan").merge(tspan).text((d) => d.splitted);
|
|
26369
|
+
tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", (() => {
|
|
26370
|
+
let dx = 0;
|
|
26371
|
+
if (/(top|bottom)/.test(orient) && rotate) {
|
|
26372
|
+
dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1);
|
|
26373
|
+
}
|
|
26374
|
+
return dx + (tickTextPos.x || 0);
|
|
26375
|
+
})()).attr("dy", (d, i) => {
|
|
26376
|
+
const defValue = ".71em";
|
|
26377
|
+
let dy = 0;
|
|
26378
|
+
if (orient !== "top") {
|
|
26379
|
+
dy = sizeFor1Char.h;
|
|
26380
|
+
if (i === 0) {
|
|
26381
|
+
dy = isLeftRight ? -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3) : tickTextPos.y === 0 ? defValue : 0;
|
|
26382
|
+
}
|
|
26383
|
+
}
|
|
26384
|
+
return isNumber(dy) && tickTextPos.y ? dy + tickTextPos.y : dy || defValue;
|
|
26385
|
+
});
|
|
25938
26386
|
}
|
|
25939
|
-
|
|
25940
|
-
|
|
25941
|
-
|
|
25942
|
-
|
|
25943
|
-
|
|
25944
|
-
|
|
25945
|
-
|
|
25946
|
-
|
|
25947
|
-
});
|
|
25948
|
-
tspan.exit().remove();
|
|
25949
|
-
tspan = tspan.enter().append("tspan").merge(tspan).text((d) => d.splitted);
|
|
25950
|
-
tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", (() => {
|
|
25951
|
-
let dx = 0;
|
|
25952
|
-
if (/(top|bottom)/.test(orient) && rotate) {
|
|
25953
|
-
dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1);
|
|
26387
|
+
const lineUpdate = tick.select("line");
|
|
26388
|
+
tickEnter.select("line").attr(`${axisPx}2`, innerTickSize * sign);
|
|
26389
|
+
tickEnter.select("text").attr(axisPx, tickLength * sign);
|
|
26390
|
+
ctx.setTickLineTextPosition(lineUpdate, textUpdate, sizeFor1Char);
|
|
26391
|
+
if (params.tickTitle) {
|
|
26392
|
+
const title = textUpdate.select("title");
|
|
26393
|
+
const tickTitle = params.tickTitle;
|
|
26394
|
+
(title.empty() ? textUpdate.append("title") : title).text((index) => tickTitle[Number(index)]);
|
|
25954
26395
|
}
|
|
25955
|
-
|
|
25956
|
-
|
|
25957
|
-
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
25961
|
-
|
|
25962
|
-
|
|
25963
|
-
|
|
26396
|
+
if (scale1.bandwidth) {
|
|
26397
|
+
const x = scale1;
|
|
26398
|
+
const dx = x.bandwidth() / 2;
|
|
26399
|
+
scale0 = (d) => x(d) + dx;
|
|
26400
|
+
scale1 = scale0;
|
|
26401
|
+
} else if (scale0.bandwidth) {
|
|
26402
|
+
scale0 = scale1;
|
|
26403
|
+
} else {
|
|
26404
|
+
tickTransform(tickExit, scale1);
|
|
25964
26405
|
}
|
|
25965
|
-
|
|
25966
|
-
|
|
25967
|
-
|
|
25968
|
-
const textUpdate = tick.select("text");
|
|
25969
|
-
tickEnter.select("line").attr(`${axisPx}2`, innerTickSize * sign);
|
|
25970
|
-
tickEnter.select("text").attr(axisPx, tickLength * sign);
|
|
25971
|
-
ctx.setTickLineTextPosition(lineUpdate, textUpdate, sizeFor1Char);
|
|
25972
|
-
if (params.tickTitle) {
|
|
25973
|
-
const title = textUpdate.select("title");
|
|
25974
|
-
(title.empty() ? textUpdate.append("title") : title).text((index) => params.tickTitle[index]);
|
|
26406
|
+
tick = params.owner.state.flowing ? helper.transitionise(tick) : params.owner.$T(tick);
|
|
26407
|
+
tickTransform(tickEnter, scale0);
|
|
26408
|
+
tickTransform(tick.style("opacity", null), scale1);
|
|
25975
26409
|
}
|
|
25976
|
-
if (scale1.bandwidth) {
|
|
25977
|
-
const x = scale1;
|
|
25978
|
-
const dx = x.bandwidth() / 2;
|
|
25979
|
-
scale0 = (d) => x(d) + dx;
|
|
25980
|
-
scale1 = scale0;
|
|
25981
|
-
} else if (scale0.bandwidth) {
|
|
25982
|
-
scale0 = scale1;
|
|
25983
|
-
} else {
|
|
25984
|
-
tickTransform(tickExit, scale1);
|
|
25985
|
-
}
|
|
25986
|
-
tick = params.owner.state.flowing ? helper.transitionise(tick) : params.owner.$T(tick);
|
|
25987
|
-
tickTransform(tickEnter, scale0);
|
|
25988
|
-
tickTransform(tick.style("opacity", null), scale1);
|
|
25989
26410
|
}
|
|
25990
26411
|
});
|
|
25991
26412
|
this.g = $g;
|
|
@@ -26068,7 +26489,7 @@ class AxisRenderer {
|
|
|
26068
26489
|
switch (orient) {
|
|
26069
26490
|
case "bottom":
|
|
26070
26491
|
lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", (d) => this.getTickSize.bind(this)(d) * (tickLineInner ? -1 : 1));
|
|
26071
|
-
textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor",
|
|
26492
|
+
textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", (d, i, { length }) => {
|
|
26072
26493
|
if (!isRotated && i === 0 && (inner === true || inner.first)) {
|
|
26073
26494
|
return "start";
|
|
26074
26495
|
} else if (!isRotated && i === length - 1 && (inner === true || inner.last)) {
|
|
@@ -26721,7 +27142,7 @@ class Axis_Axis {
|
|
|
26721
27142
|
const fit = config.axis_x_tick_fit;
|
|
26722
27143
|
let count = config.axis_x_tick_count;
|
|
26723
27144
|
let values;
|
|
26724
|
-
if (fit
|
|
27145
|
+
if (fit) {
|
|
26725
27146
|
values = $$.mapTargetsToUniqueXs(targets);
|
|
26726
27147
|
if (this.isCategorized() && count > values.length) {
|
|
26727
27148
|
count = values.length;
|
|
@@ -26982,7 +27403,7 @@ class Axis_Axis {
|
|
|
26982
27403
|
const isDomainSame = domain[0] === domain[1] && domain.every((v) => v > 0);
|
|
26983
27404
|
const isCurrentMaxTickDomainSame = isArray(currentTickMax.domain) && currentTickMax.domain[0] === currentTickMax.domain[1] && currentTickMax.domain.every((v) => v > 0);
|
|
26984
27405
|
if (isDomainSame || isCurrentMaxTickDomainSame) {
|
|
26985
|
-
return currentTickMax
|
|
27406
|
+
return currentTickMax;
|
|
26986
27407
|
} else {
|
|
26987
27408
|
currentTickMax.domain = domain;
|
|
26988
27409
|
}
|
|
@@ -27336,6 +27757,7 @@ class Axis_Axis {
|
|
|
27336
27757
|
break;
|
|
27337
27758
|
}
|
|
27338
27759
|
}
|
|
27760
|
+
intervalForCulling = intervalForCulling != null ? intervalForCulling : tickSize;
|
|
27339
27761
|
const tickIndexMap = /* @__PURE__ */ new Map();
|
|
27340
27762
|
for (let i = 0; i < tickValues.length; i++) {
|
|
27341
27763
|
tickIndexMap.set(tickValues[i], i);
|
|
@@ -27563,7 +27985,7 @@ var __pow = Math.pow;
|
|
|
27563
27985
|
const isRotated = config.axis_rotated;
|
|
27564
27986
|
const isMultipleX = $$.isMultipleX();
|
|
27565
27987
|
const xDomain = xScale == null ? void 0 : xScale.domain();
|
|
27566
|
-
const fingerprint = xDomain ? `${xDomain[0]}_${xDomain[1]}_${$$.data.targets.length}_${[...state.hiddenTargetIds].join(",")}` : null;
|
|
27988
|
+
const fingerprint = xDomain ? `${xDomain[0]}_${xDomain[1]}_${state.width}_${state.height}_${$$.data.targets.length}_${state.dataGeneration}_${[...state.hiddenTargetIds].join(",")}` : null;
|
|
27567
27989
|
if (fingerprint && fingerprint === state._eventRectFingerprint) {
|
|
27568
27990
|
return;
|
|
27569
27991
|
}
|
|
@@ -27590,7 +28012,6 @@ var __pow = Math.pow;
|
|
|
27590
28012
|
next: $$.getNextX(index)
|
|
27591
28013
|
});
|
|
27592
28014
|
rectW = (d) => {
|
|
27593
|
-
var _a, _b;
|
|
27594
28015
|
const x2 = getPrevNextX(d);
|
|
27595
28016
|
const xDomain2 = xScale.domain();
|
|
27596
28017
|
let val;
|
|
@@ -27601,8 +28022,6 @@ var __pow = Math.pow;
|
|
|
27601
28022
|
} else if (x2.next === null) {
|
|
27602
28023
|
val = xScale(xDomain2[1]) - (xScale(x2.prev) + xScale(d.x)) / 2;
|
|
27603
28024
|
} else {
|
|
27604
|
-
x2.prev = (_a = x2.prev) != null ? _a : xDomain2[0];
|
|
27605
|
-
x2.next = (_b = x2.next) != null ? _b : xDomain2[1];
|
|
27606
28025
|
val = Math.max(0, (xScale(x2.next) - xScale(x2.prev)) / 2);
|
|
27607
28026
|
}
|
|
27608
28027
|
return val;
|
|
@@ -27716,7 +28135,7 @@ var __pow = Math.pow;
|
|
|
27716
28135
|
(_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
|
|
27717
28136
|
const dist = $$.dist(closest, mouse);
|
|
27718
28137
|
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
27719
|
-
$$.$el.
|
|
28138
|
+
$$.$el.eventRect.style("cursor", "pointer");
|
|
27720
28139
|
if (triggerEvent && (!state.mouseover || state.mouseover.x !== closest.x || state.mouseover.id !== closest.id)) {
|
|
27721
28140
|
config.data_onover.call($$.api, closest);
|
|
27722
28141
|
state.mouseover = closest;
|
|
@@ -27728,7 +28147,7 @@ var __pow = Math.pow;
|
|
|
27728
28147
|
* @private
|
|
27729
28148
|
*/
|
|
27730
28149
|
unselectRect() {
|
|
27731
|
-
var _a, _b;
|
|
28150
|
+
var _a, _b, _c;
|
|
27732
28151
|
const $$ = this;
|
|
27733
28152
|
const { state, $el: { circle, tooltip } } = $$;
|
|
27734
28153
|
state._lastTooltipMouse = null;
|
|
@@ -27737,8 +28156,8 @@ var __pow = Math.pow;
|
|
|
27737
28156
|
tooltip && $$.hideTooltip();
|
|
27738
28157
|
return;
|
|
27739
28158
|
}
|
|
27740
|
-
$$.$el.
|
|
27741
|
-
(
|
|
28159
|
+
(_b = $$.$el.eventRect) == null ? void 0 : _b.style("cursor", null);
|
|
28160
|
+
(_c = $$.hideGridFocus) == null ? void 0 : _c.call($$);
|
|
27742
28161
|
if (tooltip) {
|
|
27743
28162
|
$$.hideTooltip();
|
|
27744
28163
|
$$._handleLinkedCharts(false);
|
|
@@ -27814,7 +28233,7 @@ var __pow = Math.pow;
|
|
|
27814
28233
|
$$.setOverOut(index !== -1, index);
|
|
27815
28234
|
}).on("mouseout", (event) => {
|
|
27816
28235
|
state.event = event;
|
|
27817
|
-
if (
|
|
28236
|
+
if (!$$.config || $$.hasArcType() || eventReceiver.currentIdx === -1 || !config.interaction_onout) {
|
|
27818
28237
|
return;
|
|
27819
28238
|
}
|
|
27820
28239
|
$$.hideAxisGridFocus();
|
|
@@ -27876,10 +28295,10 @@ var __pow = Math.pow;
|
|
|
27876
28295
|
}
|
|
27877
28296
|
const mouse = getPointer(state.event, this);
|
|
27878
28297
|
const closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
|
27879
|
-
const sensitivity = $$.getPointSensitivity(closest);
|
|
27880
28298
|
if (!closest) {
|
|
27881
28299
|
return;
|
|
27882
28300
|
}
|
|
28301
|
+
const sensitivity = $$.getPointSensitivity(closest);
|
|
27883
28302
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < sensitivity) {
|
|
27884
28303
|
$$.$el.main.selectAll(`.${$SHAPE.shapes}${$$.getTargetSelectorSuffix(closest.id)}`).selectAll(`.${$SHAPE.shape}-${closest.index}`).each(function() {
|
|
27885
28304
|
var _a;
|
|
@@ -27957,8 +28376,8 @@ var __pow = Math.pow;
|
|
|
27957
28376
|
if (defs && !clip.idXAxisTickTexts) {
|
|
27958
28377
|
const clipId = `${clip.id}-xaxisticktexts`;
|
|
27959
28378
|
$$.appendClip(defs, clipId);
|
|
27960
|
-
clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts);
|
|
27961
28379
|
clip.idXAxisTickTexts = clipId;
|
|
28380
|
+
clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts);
|
|
27962
28381
|
}
|
|
27963
28382
|
if (!config.axis_x_tick_multiline && $$.getAxisTickRotate("x") && newXAxisHeight !== xAxisHeight) {
|
|
27964
28383
|
$$.setXAxisTickClipWidth();
|
|
@@ -30314,15 +30733,15 @@ function _getConnectLineType(id) {
|
|
|
30314
30733
|
}
|
|
30315
30734
|
if (path.length > 1) {
|
|
30316
30735
|
barPath.push(path[1]);
|
|
30317
|
-
|
|
30318
|
-
|
|
30319
|
-
|
|
30320
|
-
|
|
30321
|
-
|
|
30322
|
-
)
|
|
30323
|
-
|
|
30324
|
-
|
|
30325
|
-
|
|
30736
|
+
}
|
|
30737
|
+
if (i === arr.length - 1 && barPath.length) {
|
|
30738
|
+
const barConnectLineNode = $$.$T(
|
|
30739
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode.querySelector(`.${$BAR.barConnectLine}`)),
|
|
30740
|
+
withTransition,
|
|
30741
|
+
getRandom()
|
|
30742
|
+
);
|
|
30743
|
+
$$.updateConnectLine(barConnectLineNode, connectLineType, barPath);
|
|
30744
|
+
barPath.splice(0);
|
|
30326
30745
|
}
|
|
30327
30746
|
return path[0];
|
|
30328
30747
|
}).style("fill", $$.updateBarColor.bind($$)).style("clip-path", (d) => d.clipPath).style("opacity", null)
|
|
@@ -31760,14 +32179,30 @@ function _getAttrTweenFn(fn) {
|
|
|
31760
32179
|
}
|
|
31761
32180
|
const gStart = $$.getStartingAngle();
|
|
31762
32181
|
const radius = config.gauge_fullCircle || forRange && !hasGauge ? $$.getArcLength() : gStart * -2;
|
|
31763
|
-
|
|
32182
|
+
const isSingleArcGauge = d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge();
|
|
32183
|
+
if (isSingleArcGauge) {
|
|
31764
32184
|
const { gauge_min: gMin, gauge_max: gMax } = config;
|
|
31765
32185
|
const totalSum = $$.getTotalDataSum(state.rendered);
|
|
31766
32186
|
const gEnd = radius * ((totalSum - gMin) / (gMax - gMin));
|
|
31767
32187
|
pie = pie.startAngle(gStart).endAngle(gEnd + gStart);
|
|
31768
32188
|
}
|
|
31769
32189
|
if (forRange === false) {
|
|
31770
|
-
|
|
32190
|
+
let layout;
|
|
32191
|
+
if (isSingleArcGauge) {
|
|
32192
|
+
layout = pie($$.filterTargetsToShow());
|
|
32193
|
+
} else {
|
|
32194
|
+
const cacheKey = "$arcPieLayout";
|
|
32195
|
+
let cached = $$.cache.get(cacheKey);
|
|
32196
|
+
if (!cached || cached.generation !== state.redrawGeneration) {
|
|
32197
|
+
cached = {
|
|
32198
|
+
generation: state.redrawGeneration,
|
|
32199
|
+
layout: pie($$.filterTargetsToShow())
|
|
32200
|
+
};
|
|
32201
|
+
$$.cache.add(cacheKey, cached);
|
|
32202
|
+
}
|
|
32203
|
+
layout = cached.layout;
|
|
32204
|
+
}
|
|
32205
|
+
layout.forEach((t, i) => {
|
|
31771
32206
|
var _a2;
|
|
31772
32207
|
if (!found && t.data.id === ((_a2 = d.data) == null ? void 0 : _a2.id)) {
|
|
31773
32208
|
found = true;
|
|
@@ -31854,7 +32289,7 @@ function _getAttrTweenFn(fn) {
|
|
|
31854
32289
|
}
|
|
31855
32290
|
const pieData = $$.pie(values).map((d, i) => (d.index = i, d));
|
|
31856
32291
|
let rangeText = arcs.selectAll(`.${$ARC.arcRange}`).data(values);
|
|
31857
|
-
rangeText.exit();
|
|
32292
|
+
rangeText.exit().remove();
|
|
31858
32293
|
rangeText = $T(rangeText.enter().append("text").attr("class", $ARC.arcRange).style("text-anchor", "middle").style("pointer-events", "none").style("opacity", "0").text((v) => {
|
|
31859
32294
|
const range = isPercent ? v / totalSum * 100 : v;
|
|
31860
32295
|
return isFunction(format) ? format(range) : `${range}${isPercent ? "%" : ""}`;
|
|
@@ -31933,7 +32368,7 @@ function _getAttrTweenFn(fn) {
|
|
|
31933
32368
|
const { state: { transiting }, $el } = $$;
|
|
31934
32369
|
if (transiting) {
|
|
31935
32370
|
const interval = setInterval(() => {
|
|
31936
|
-
if (
|
|
32371
|
+
if (!$$.state.transiting) {
|
|
31937
32372
|
clearInterval(interval);
|
|
31938
32373
|
$el.legend.selectAll(`.${$FOCUS.legendItemFocused}`).size() > 0 && $$.expandArc(targetIds);
|
|
31939
32374
|
}
|
|
@@ -32143,6 +32578,11 @@ function _getAttrTweenFn(fn) {
|
|
|
32143
32578
|
$$.updateLegendItemColor(d.data.id, path.style("fill"));
|
|
32144
32579
|
}
|
|
32145
32580
|
state.transiting = false;
|
|
32581
|
+
if (state.redrawing) {
|
|
32582
|
+
state.redrawing = false;
|
|
32583
|
+
state._targetsToShow = null;
|
|
32584
|
+
state._cachedDrawShape = null;
|
|
32585
|
+
}
|
|
32146
32586
|
callFn(config.onrendered, $$.api);
|
|
32147
32587
|
});
|
|
32148
32588
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
@@ -32220,7 +32660,7 @@ function _getAttrTweenFn(fn) {
|
|
|
32220
32660
|
const { gauge_min: min, gauge_max: max } = config;
|
|
32221
32661
|
radian = radius * ((value - min) / (max - min));
|
|
32222
32662
|
} else {
|
|
32223
|
-
radian = arcLength * (value / total);
|
|
32663
|
+
radian = total ? arcLength * (value / total) : 0;
|
|
32224
32664
|
}
|
|
32225
32665
|
return (startingAngle + radian) * (180 / Math.PI);
|
|
32226
32666
|
},
|
|
@@ -32600,7 +33040,7 @@ function _getSplineClipPath() {
|
|
|
32600
33040
|
const getTarget = (event) => {
|
|
32601
33041
|
var _a;
|
|
32602
33042
|
const target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) == null ? void 0 : _a.node();
|
|
32603
|
-
if (/^path$/i.test(target.tagName)) {
|
|
33043
|
+
if (target && /^path$/i.test(target.tagName)) {
|
|
32604
33044
|
state.event = event;
|
|
32605
33045
|
return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
|
32606
33046
|
}
|
|
@@ -32665,10 +33105,9 @@ function _getSplineClipPath() {
|
|
|
32665
33105
|
const { top, left, width, height } = _getSize.call($$);
|
|
32666
33106
|
const points = {};
|
|
32667
33107
|
let accumulated = 0;
|
|
32668
|
-
targets.each((d
|
|
32669
|
-
var _a;
|
|
33108
|
+
targets.each((d) => {
|
|
32670
33109
|
const start = accumulated;
|
|
32671
|
-
const ratio
|
|
33110
|
+
const { ratio } = d;
|
|
32672
33111
|
accumulated += ratio;
|
|
32673
33112
|
const offset = isRotated ? left : top;
|
|
32674
33113
|
const segmentStart = offset + start;
|
|
@@ -34049,7 +34488,7 @@ function position(group, root) {
|
|
|
34049
34488
|
var _a;
|
|
34050
34489
|
const target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) == null ? void 0 : _a.node();
|
|
34051
34490
|
let data;
|
|
34052
|
-
if (/^rect$/i.test(target.tagName)) {
|
|
34491
|
+
if (target && /^rect$/i.test(target.tagName)) {
|
|
34053
34492
|
state.event = event;
|
|
34054
34493
|
data = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
|
34055
34494
|
}
|
|
@@ -34269,7 +34708,7 @@ const bb = {
|
|
|
34269
34708
|
* bb.version; // "1.0.0"
|
|
34270
34709
|
* @memberof bb
|
|
34271
34710
|
*/
|
|
34272
|
-
version: "4.0.0-next.
|
|
34711
|
+
version: "4.0.0-next.4",
|
|
34273
34712
|
/**
|
|
34274
34713
|
* Generate chart
|
|
34275
34714
|
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|