billboard.js 4.0.0-next.2 → 4.0.0-next.3
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 +722 -386
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +21 -21
- package/dist/billboard.pkgd.js +722 -386
- package/dist/billboard.pkgd.min.js +26 -26
- 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 +13 -10
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +13 -10
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +7 -5
- 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 +13 -10
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +6 -6
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +13 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +7 -5
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- 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/subchart.js +4 -2
- 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 +15 -6
- package/dist-esm/ChartInternal/Axis/Axis.js +5 -3
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +9 -6
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +2 -9
- package/dist-esm/ChartInternal/ChartInternal.js +11 -3
- 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 +6 -2
- package/dist-esm/ChartInternal/shape/treemap.js +2 -2
- package/dist-esm/canvas/CanvasAxisRenderer.js +67 -26
- package/dist-esm/canvas/CanvasEngine.js +12 -8
- package/dist-esm/canvas/CanvasPainter.js +4 -2
- package/dist-esm/canvas/CanvasRenderer.js +106 -66
- 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 +16 -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 +1 -1
- package/dist-esm/index.esm.js +1 -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 +1 -1
- package/dist-esm/module/generator.js +10 -5
- package/dist-esm/module/sanitize.js +1 -1
- 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 +7 -4
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +32 -10
- 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 +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +1 -1
- 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 +9 -7
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -10
- package/src/ChartInternal/ChartInternal.ts +10 -1
- 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 +9 -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 +5 -1
- package/src/ChartInternal/shape/treemap.ts +1 -1
- package/src/canvas/CanvasAxisRenderer.ts +76 -27
- package/src/canvas/CanvasEngine.ts +13 -7
- package/src/canvas/CanvasPainter.ts +2 -1
- package/src/canvas/CanvasRenderer.ts +136 -73
- 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/util/dom.ts +13 -7
- package/src/module/util/object.ts +5 -3
- package/src/module/worker.ts +17 -9
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.3
|
|
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",
|
|
@@ -721,7 +731,7 @@ function callFn(fn, thisArg, ...args) {
|
|
|
721
731
|
function endall(transition, cb) {
|
|
722
732
|
let n = 0;
|
|
723
733
|
const end = function(...args) {
|
|
724
|
-
!--n && cb.apply(this,
|
|
734
|
+
!--n && cb.apply(this, args);
|
|
725
735
|
};
|
|
726
736
|
if ("duration" in transition) {
|
|
727
737
|
transition.each(() => ++n).on("end", end);
|
|
@@ -737,7 +747,9 @@ function camelize(str, separator = "-") {
|
|
|
737
747
|
const toArray = (v) => [].slice.call(v);
|
|
738
748
|
function deepClone(...objectN) {
|
|
739
749
|
const clone = (v) => {
|
|
740
|
-
if (
|
|
750
|
+
if (isArray(v)) {
|
|
751
|
+
return v.map(clone);
|
|
752
|
+
} else if (isObject(v) && v.constructor) {
|
|
741
753
|
const r = new v.constructor();
|
|
742
754
|
for (const k in v) {
|
|
743
755
|
r[k] = clone(v[k]);
|
|
@@ -823,7 +835,7 @@ function getMinMax(type, data) {
|
|
|
823
835
|
const getRange = (start, end, step = 1) => {
|
|
824
836
|
const res = [];
|
|
825
837
|
const n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
826
|
-
for (let i =
|
|
838
|
+
for (let i = 0; i < n; i++) {
|
|
827
839
|
res.push(start + i * step);
|
|
828
840
|
}
|
|
829
841
|
return res;
|
|
@@ -1133,6 +1145,11 @@ function getScale(type = "linear", min, max) {
|
|
|
1133
1145
|
;// ./src/canvas/util.ts
|
|
1134
1146
|
|
|
1135
1147
|
const DENSE_SCATTER_POINT_CULL_THRESHOLD = 1e5;
|
|
1148
|
+
function getFontSize(font) {
|
|
1149
|
+
const match = /(\d+(?:\.\d+)?)px/.exec(font);
|
|
1150
|
+
const size = match ? parseFloat(match[1]) : parseFloat(font);
|
|
1151
|
+
return Number.isFinite(size) ? size : 12;
|
|
1152
|
+
}
|
|
1136
1153
|
function getCanvasShapeIndices($$, shape, type, typeFilter) {
|
|
1137
1154
|
return shape.indices[type] || $$.getShapeIndices(typeFilter);
|
|
1138
1155
|
}
|
|
@@ -1537,7 +1554,7 @@ function getXTickValues($$, cull = true) {
|
|
|
1537
1554
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1538
1555
|
const { axis, config } = $$;
|
|
1539
1556
|
const targetScale = getXScale($$);
|
|
1540
|
-
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow(
|
|
1557
|
+
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow();
|
|
1541
1558
|
const cache = $$.state._canvasXTickValuesCache || ($$.state._canvasXTickValuesCache = /* @__PURE__ */ new Map());
|
|
1542
1559
|
const cacheKey = getXTickCacheKey($$, cull);
|
|
1543
1560
|
const cached = cache.get(cacheKey);
|
|
@@ -1603,7 +1620,7 @@ function getSubXTickValues($$) {
|
|
|
1603
1620
|
var _a, _b, _c, _d;
|
|
1604
1621
|
const { axis, config, scale } = $$;
|
|
1605
1622
|
const targetScale = scale.subX;
|
|
1606
|
-
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow(
|
|
1623
|
+
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow();
|
|
1607
1624
|
const cullMax = getSubXTickCullMax($$);
|
|
1608
1625
|
const cull = (ticks) => cullTicks(ticks, cullMax);
|
|
1609
1626
|
if (!targetScale || !(targetsToShow == null ? void 0 : targetsToShow.length)) {
|
|
@@ -1867,6 +1884,7 @@ function getYGridTickValues($$) {
|
|
|
1867
1884
|
var CanvasPainter_defProp = Object.defineProperty;
|
|
1868
1885
|
var CanvasPainter_defNormalProp = (obj, key, value) => key in obj ? CanvasPainter_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1869
1886
|
var __publicField = (obj, key, value) => CanvasPainter_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1887
|
+
|
|
1870
1888
|
class CanvasPainter {
|
|
1871
1889
|
/**
|
|
1872
1890
|
* Constructor.
|
|
@@ -2115,7 +2133,7 @@ class CanvasPainter {
|
|
|
2115
2133
|
textLines(text, x, y, style) {
|
|
2116
2134
|
this.withState((ctx) => {
|
|
2117
2135
|
const lines = text.split("\n");
|
|
2118
|
-
const lineHeight =
|
|
2136
|
+
const lineHeight = getFontSize((style == null ? void 0 : style.font) || ctx.font);
|
|
2119
2137
|
const firstLineY = lines.length > 1 ? -((lines.length - 1) * lineHeight) : 0;
|
|
2120
2138
|
this.applyStyle(style);
|
|
2121
2139
|
ctx.translate(x, y);
|
|
@@ -2283,7 +2301,9 @@ var CanvasAxisRenderer_publicField = (obj, key, value) => CanvasAxisRenderer_def
|
|
|
2283
2301
|
|
|
2284
2302
|
|
|
2285
2303
|
|
|
2286
|
-
|
|
2304
|
+
|
|
2305
|
+
const X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING = 20;
|
|
2306
|
+
const X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING = 15;
|
|
2287
2307
|
function getXTickTextDirection(isRotated) {
|
|
2288
2308
|
return isRotated ? -1 : 1;
|
|
2289
2309
|
}
|
|
@@ -2292,18 +2312,18 @@ function getYTickTextDirection(isRotated, isY2) {
|
|
|
2292
2312
|
}
|
|
2293
2313
|
function getHorizontalXAxisClipRect(margin, width, height) {
|
|
2294
2314
|
return {
|
|
2295
|
-
x: margin.left -
|
|
2315
|
+
x: margin.left - X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING,
|
|
2296
2316
|
y: 0,
|
|
2297
|
-
w: width +
|
|
2317
|
+
w: width + X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING * 2,
|
|
2298
2318
|
h: height
|
|
2299
2319
|
};
|
|
2300
2320
|
}
|
|
2301
2321
|
function getRotatedXAxisClipRect(margin, width, height) {
|
|
2302
2322
|
return {
|
|
2303
2323
|
x: 0,
|
|
2304
|
-
y: margin.top -
|
|
2324
|
+
y: margin.top - X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING,
|
|
2305
2325
|
w: width,
|
|
2306
|
-
h: height +
|
|
2326
|
+
h: height + X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING * 2
|
|
2307
2327
|
};
|
|
2308
2328
|
}
|
|
2309
2329
|
function getAxisTooltipBackgroundColor($$, id) {
|
|
@@ -2358,11 +2378,6 @@ function formatTick(format, tick) {
|
|
|
2358
2378
|
const value = format ? format(tick) : tick;
|
|
2359
2379
|
return value == null ? "" : String(value);
|
|
2360
2380
|
}
|
|
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
2381
|
function getAxisTickFont(axisStyle, id) {
|
|
2367
2382
|
return axisStyle[`${id}TickFont`] || axisStyle.labelFont;
|
|
2368
2383
|
}
|
|
@@ -2373,6 +2388,13 @@ function getXTickTextLineHeight(painter, fontSize) {
|
|
|
2373
2388
|
const svgFallbackHeight = (fontSize || 10) * (11.5 / 10);
|
|
2374
2389
|
return Math.max(fontSize, fontBoxHeight, actualBoxHeight, svgFallbackHeight);
|
|
2375
2390
|
}
|
|
2391
|
+
function getRotatedXTickTextY(rotate) {
|
|
2392
|
+
const r2 = rotate / 15;
|
|
2393
|
+
return 11.5 - 2.5 * r2 * (rotate > 0 ? 1 : -1);
|
|
2394
|
+
}
|
|
2395
|
+
function getRotatedXTickTextDx(rotate) {
|
|
2396
|
+
return 8 * Math.sin(Math.PI * (rotate / 180));
|
|
2397
|
+
}
|
|
2376
2398
|
function resolveTextOffset(value, fontSize) {
|
|
2377
2399
|
if (typeof value === "number") {
|
|
2378
2400
|
return value;
|
|
@@ -2425,7 +2447,7 @@ function getXTickTextWidth($$, ticks, isRotated, targetScale) {
|
|
|
2425
2447
|
}
|
|
2426
2448
|
return 110;
|
|
2427
2449
|
}
|
|
2428
|
-
function getXTickTextLines($$, painter, format, tick, ticks = [], isRotated = false, targetScale = getXScale($$)) {
|
|
2450
|
+
function getXTickTextLines($$, painter, format, tick, ticks = [], isRotated = false, targetScale = getXScale($$), maxWidth) {
|
|
2429
2451
|
const value = format ? format(tick) : tick;
|
|
2430
2452
|
if (value == null) {
|
|
2431
2453
|
return [""];
|
|
@@ -2439,7 +2461,7 @@ function getXTickTextLines($$, painter, format, tick, ticks = [], isRotated = fa
|
|
|
2439
2461
|
}
|
|
2440
2462
|
return $$.config.axis_x_tick_multiline ? splitTickTextByWidth(
|
|
2441
2463
|
text,
|
|
2442
|
-
getXTickTextWidth($$, ticks, isRotated, targetScale),
|
|
2464
|
+
maxWidth != null ? maxWidth : getXTickTextWidth($$, ticks, isRotated, targetScale),
|
|
2443
2465
|
painter
|
|
2444
2466
|
) : [text];
|
|
2445
2467
|
}
|
|
@@ -2673,6 +2695,8 @@ class CanvasAxisRenderer {
|
|
|
2673
2695
|
ctx.textBaseline = isRotated ? "middle" : tickTextDirection > 0 ? "top" : "bottom";
|
|
2674
2696
|
ctx.strokeStyle = axis.tickColor;
|
|
2675
2697
|
ctx.lineWidth = axis.tickWidth;
|
|
2698
|
+
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
2699
|
+
const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, scale.subX);
|
|
2676
2700
|
for (const tick of ticks) {
|
|
2677
2701
|
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
2678
2702
|
const tx = margin2.left + tickPos;
|
|
@@ -2700,9 +2724,9 @@ class CanvasAxisRenderer {
|
|
|
2700
2724
|
tick,
|
|
2701
2725
|
ticks,
|
|
2702
2726
|
isRotated,
|
|
2703
|
-
scale.subX
|
|
2727
|
+
scale.subX,
|
|
2728
|
+
tickTextWidth
|
|
2704
2729
|
);
|
|
2705
|
-
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
2706
2730
|
let textX;
|
|
2707
2731
|
let textY;
|
|
2708
2732
|
if (isRotated) {
|
|
@@ -2733,6 +2757,7 @@ class CanvasAxisRenderer {
|
|
|
2733
2757
|
* @private
|
|
2734
2758
|
*/
|
|
2735
2759
|
drawTitle($$) {
|
|
2760
|
+
var _a, _b;
|
|
2736
2761
|
const { ctx, painter, theme: { style: { title } } } = this;
|
|
2737
2762
|
const { config, state: { current } } = $$;
|
|
2738
2763
|
if (!config.title_text) {
|
|
@@ -2742,12 +2767,13 @@ class CanvasAxisRenderer {
|
|
|
2742
2767
|
const fontSize = getFontSize(title.font);
|
|
2743
2768
|
const lineHeight = fontSize * 1.5;
|
|
2744
2769
|
const { x, align } = getTitleTextPosition(config.title_position, current.width);
|
|
2745
|
-
const
|
|
2770
|
+
const titleHeight = (_b = (_a = $$.getCanvasTitleHeight) == null ? void 0 : _a.call($$)) != null ? _b : fontSize;
|
|
2771
|
+
const y = (config.title_padding.top || 0) + titleHeight;
|
|
2746
2772
|
painter.withState(() => {
|
|
2747
2773
|
ctx.font = title.font;
|
|
2748
2774
|
ctx.fillStyle = title.color;
|
|
2749
2775
|
ctx.textAlign = align;
|
|
2750
|
-
ctx.textBaseline = "
|
|
2776
|
+
ctx.textBaseline = "alphabetic";
|
|
2751
2777
|
lines.forEach((line, i) => {
|
|
2752
2778
|
ctx.fillText(line, x, y + (i ? fontSize + (i - 1) * lineHeight : 0));
|
|
2753
2779
|
});
|
|
@@ -3145,14 +3171,20 @@ class CanvasAxisRenderer {
|
|
|
3145
3171
|
if (!axisOptions && !config.axis_x_tick_text_show) {
|
|
3146
3172
|
return;
|
|
3147
3173
|
}
|
|
3174
|
+
const tickFont = getAxisTickFont(axis, "x");
|
|
3175
|
+
const tickLineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
3176
|
+
const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, targetScale);
|
|
3148
3177
|
ticks.forEach((tick, tickIndex) => {
|
|
3149
3178
|
this.drawXAxisTickText($$, tick, format, axis.labelColor, {
|
|
3150
3179
|
isRotated,
|
|
3151
3180
|
rangeEnd,
|
|
3152
3181
|
rangeStart,
|
|
3153
3182
|
tickCount: ticks.length,
|
|
3183
|
+
tickFont,
|
|
3154
3184
|
tickIndex,
|
|
3185
|
+
tickLineHeight,
|
|
3155
3186
|
tickTextDirection,
|
|
3187
|
+
tickTextWidth,
|
|
3156
3188
|
tickRotate,
|
|
3157
3189
|
tickTextPosition,
|
|
3158
3190
|
targetScale,
|
|
@@ -3333,6 +3365,7 @@ class CanvasAxisRenderer {
|
|
|
3333
3365
|
* @private
|
|
3334
3366
|
*/
|
|
3335
3367
|
drawXAxisTickText($$, tick, format, fill, options) {
|
|
3368
|
+
var _a, _b;
|
|
3336
3369
|
const { ctx, painter, theme: { style: { axis } } } = this;
|
|
3337
3370
|
const { state: { margin } } = $$;
|
|
3338
3371
|
const {
|
|
@@ -3354,7 +3387,7 @@ class CanvasAxisRenderer {
|
|
|
3354
3387
|
if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
|
|
3355
3388
|
return;
|
|
3356
3389
|
}
|
|
3357
|
-
const tickFont = getAxisTickFont(axis, "x");
|
|
3390
|
+
const tickFont = (_a = options.tickFont) != null ? _a : getAxisTickFont(axis, "x");
|
|
3358
3391
|
ctx.font = tickFont;
|
|
3359
3392
|
ctx.fillStyle = fill;
|
|
3360
3393
|
const lines = getXTickTextLines(
|
|
@@ -3364,9 +3397,10 @@ class CanvasAxisRenderer {
|
|
|
3364
3397
|
tick,
|
|
3365
3398
|
ticks,
|
|
3366
3399
|
isRotated,
|
|
3367
|
-
targetScale
|
|
3400
|
+
targetScale,
|
|
3401
|
+
options.tickTextWidth
|
|
3368
3402
|
);
|
|
3369
|
-
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
3403
|
+
const lineHeight = (_b = options.tickLineHeight) != null ? _b : getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
3370
3404
|
let textX;
|
|
3371
3405
|
let textY;
|
|
3372
3406
|
if (isRotated) {
|
|
@@ -3374,6 +3408,21 @@ class CanvasAxisRenderer {
|
|
|
3374
3408
|
textY = ty + (tickTextPosition.y || 0);
|
|
3375
3409
|
ctx.textAlign = getXTickTextAlign($$, options);
|
|
3376
3410
|
ctx.textBaseline = "middle";
|
|
3411
|
+
} else if (tickRotate) {
|
|
3412
|
+
const fontSize = getFontSize(tickFont);
|
|
3413
|
+
const firstDy = tickTextPosition.y ? resolveTextOffset(tickTextPosition.y, fontSize) : 0.71 * fontSize;
|
|
3414
|
+
const textDx = getRotatedXTickTextDx(tickRotate) + (tickTextPosition.x || 0);
|
|
3415
|
+
const textY2 = getRotatedXTickTextY(tickRotate) + firstDy;
|
|
3416
|
+
ctx.textAlign = getXTickTextAlign($$, options);
|
|
3417
|
+
ctx.textBaseline = "alphabetic";
|
|
3418
|
+
painter.withState((textCtx) => {
|
|
3419
|
+
textCtx.translate(tx, y);
|
|
3420
|
+
textCtx.rotate(tickRotate * Math.PI / 180);
|
|
3421
|
+
lines.forEach((line, i) => {
|
|
3422
|
+
textCtx.fillText(line, textDx, textY2 + i * lineHeight);
|
|
3423
|
+
});
|
|
3424
|
+
});
|
|
3425
|
+
return;
|
|
3377
3426
|
} else {
|
|
3378
3427
|
textX = tx + (tickTextPosition.x || 0);
|
|
3379
3428
|
textY = y + (AXIS_TICK_SIZE + AXIS_TICK_PADDING) * tickTextDirection + (tickTextPosition.y || 0);
|
|
@@ -3535,10 +3584,6 @@ class CanvasEngine {
|
|
|
3535
3584
|
init(container, w, h) {
|
|
3536
3585
|
this.canvas = browser_doc.createElement("canvas");
|
|
3537
3586
|
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
3587
|
this.canvas.style.display = "block";
|
|
3543
3588
|
container.appendChild(this.canvas);
|
|
3544
3589
|
this.dpr = win.devicePixelRatio || 1;
|
|
@@ -3554,6 +3599,7 @@ class CanvasEngine {
|
|
|
3554
3599
|
resize(w, h) {
|
|
3555
3600
|
const width = Math.max(0, w);
|
|
3556
3601
|
const height = Math.max(0, h);
|
|
3602
|
+
this.dpr = win.devicePixelRatio || 1;
|
|
3557
3603
|
this.canvas.width = width * this.dpr;
|
|
3558
3604
|
this.canvas.height = height * this.dpr;
|
|
3559
3605
|
this.canvas.style.width = `${width}px`;
|
|
@@ -3623,10 +3669,13 @@ class CanvasEngine {
|
|
|
3623
3669
|
if (!frame || !frameCtx) {
|
|
3624
3670
|
return;
|
|
3625
3671
|
}
|
|
3626
|
-
frame.width = canvas.width;
|
|
3627
|
-
frame.height = canvas.height;
|
|
3628
3672
|
frameCtx.setTransform(1, 0, 0, 1, 0, 0);
|
|
3629
|
-
|
|
3673
|
+
if (frame.width !== canvas.width || frame.height !== canvas.height) {
|
|
3674
|
+
frame.width = canvas.width;
|
|
3675
|
+
frame.height = canvas.height;
|
|
3676
|
+
} else {
|
|
3677
|
+
frameCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
3678
|
+
}
|
|
3630
3679
|
frameCtx.drawImage(canvas, 0, 0);
|
|
3631
3680
|
}
|
|
3632
3681
|
}
|
|
@@ -3897,12 +3946,8 @@ var path_spreadValues = (a, b) => {
|
|
|
3897
3946
|
};
|
|
3898
3947
|
var path_spreadProps = (a, b) => path_defProps(a, path_getOwnPropDescs(b));
|
|
3899
3948
|
|
|
3900
|
-
function getLineValues($$,
|
|
3901
|
-
|
|
3902
|
-
if ($$.isStepType(target)) {
|
|
3903
|
-
values = $$.convertValuesToStep(values);
|
|
3904
|
-
}
|
|
3905
|
-
return values;
|
|
3949
|
+
function getLineValues($$, d, values) {
|
|
3950
|
+
return $$.isStepType(d) ? $$.convertValuesToStep(values) : values;
|
|
3906
3951
|
}
|
|
3907
3952
|
function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
3908
3953
|
const { config, scale } = $$;
|
|
@@ -3936,7 +3981,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
3936
3981
|
}
|
|
3937
3982
|
path = $$.lineWithRegions(values, scale.zoom || x, y, regions);
|
|
3938
3983
|
} else {
|
|
3939
|
-
path = line.curve($$.getCurve(d))(getLineValues($$,
|
|
3984
|
+
path = line.curve($$.getCurve(d))(getLineValues($$, d, values));
|
|
3940
3985
|
}
|
|
3941
3986
|
} else {
|
|
3942
3987
|
if (values[0]) {
|
|
@@ -4119,14 +4164,15 @@ function getLabelImageUrl(option, d) {
|
|
|
4119
4164
|
ID: d.id
|
|
4120
4165
|
});
|
|
4121
4166
|
}
|
|
4122
|
-
function getLabelImagePosition($$, option, text, x, y) {
|
|
4123
|
-
var _a, _b;
|
|
4167
|
+
function getLabelImagePosition($$, option, text, x, y, d) {
|
|
4168
|
+
var _a, _b, _c;
|
|
4124
4169
|
const { width = 0, height = 0, pos } = option;
|
|
4125
4170
|
const w = width / 2;
|
|
4126
4171
|
const h = height / 2;
|
|
4127
4172
|
const textHeight = getLabelDecorationBox($$.canvasEngine.ctx, text, x, y).h;
|
|
4173
|
+
const fontSize = getFontSize($$.canvasEngine.ctx.font);
|
|
4128
4174
|
const imageX = x - w;
|
|
4129
|
-
const imageY = y - h - textHeight / 2;
|
|
4175
|
+
const imageY = y - h - (((_a = $$.isTreemapType) == null ? void 0 : _a.call($$, d)) ? fontSize * 0.7 : textHeight / 2);
|
|
4130
4176
|
let textX = x;
|
|
4131
4177
|
let textY = y;
|
|
4132
4178
|
if ($$.config.axis_rotated) {
|
|
@@ -4135,16 +4181,16 @@ function getLabelImagePosition($$, option, text, x, y) {
|
|
|
4135
4181
|
textY += h;
|
|
4136
4182
|
}
|
|
4137
4183
|
return {
|
|
4138
|
-
x: imageX + ((
|
|
4139
|
-
y: imageY + ((
|
|
4184
|
+
x: imageX + ((_b = pos == null ? void 0 : pos.x) != null ? _b : 0),
|
|
4185
|
+
y: imageY + ((_c = pos == null ? void 0 : pos.y) != null ? _c : 0),
|
|
4140
4186
|
textX,
|
|
4141
4187
|
textY
|
|
4142
4188
|
};
|
|
4143
4189
|
}
|
|
4144
4190
|
function getLabelColor($$, d, fallback) {
|
|
4145
|
-
var _a, _b;
|
|
4191
|
+
var _a, _b, _c;
|
|
4146
4192
|
const color = (_a = $$.updateTextColor) == null ? void 0 : _a.call($$, d);
|
|
4147
|
-
return typeof color === "string" ? color : ((_b = $$.
|
|
4193
|
+
return typeof color === "string" ? color : ((_b = $$.isTreemapType) == null ? void 0 : _b.call($$, d)) ? fallback : ((_c = $$.color) == null ? void 0 : _c.call($$, d)) || fallback;
|
|
4148
4194
|
}
|
|
4149
4195
|
function getLabelBackgroundColor($$, d) {
|
|
4150
4196
|
var _a;
|
|
@@ -4182,9 +4228,10 @@ function getLabelDecorationBox(ctx, text, x, y, padding = { top: 0, right: 0, bo
|
|
|
4182
4228
|
const lines = text.split("\n");
|
|
4183
4229
|
const metrics = lines.map((line) => ctx.measureText(line));
|
|
4184
4230
|
const width = Math.max(...metrics.map((metric) => metric.width), 0);
|
|
4185
|
-
const fontSize =
|
|
4231
|
+
const fontSize = getFontSize(ctx.font);
|
|
4186
4232
|
const lineHeight = fontSize * LABEL_LINE_HEIGHT_RATIO;
|
|
4187
4233
|
const fontBoundingHeight = metrics[0] ? (metrics[0].fontBoundingBoxAscent || 0) + (metrics[0].fontBoundingBoxDescent || 0) : 0;
|
|
4234
|
+
const baselineDescent = metrics[0] ? metrics[0].fontBoundingBoxDescent || metrics[0].actualBoundingBoxDescent || 0 : 0;
|
|
4188
4235
|
const height = lines.length > 1 ? lineHeight * lines.length : Math.max(
|
|
4189
4236
|
fontSize,
|
|
4190
4237
|
fontBoundingHeight,
|
|
@@ -4199,7 +4246,9 @@ function getLabelDecorationBox(ctx, text, x, y, padding = { top: 0, right: 0, bo
|
|
|
4199
4246
|
}
|
|
4200
4247
|
if (ctx.textBaseline === "middle") {
|
|
4201
4248
|
textY -= height / 2;
|
|
4202
|
-
} else if (ctx.textBaseline === "
|
|
4249
|
+
} else if (ctx.textBaseline === "alphabetic") {
|
|
4250
|
+
textY -= height - baselineDescent;
|
|
4251
|
+
} else if (ctx.textBaseline === "bottom" || ctx.textBaseline === "ideographic") {
|
|
4203
4252
|
textY -= height;
|
|
4204
4253
|
}
|
|
4205
4254
|
return {
|
|
@@ -4843,16 +4892,6 @@ const RENDERER_GROUPED_TYPE_FILTERS = [
|
|
|
4843
4892
|
isCanvasCandlestickType
|
|
4844
4893
|
];
|
|
4845
4894
|
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
4895
|
const canvasFocusLookupCache = /* @__PURE__ */ new WeakMap();
|
|
4857
4896
|
const subchartBrushHandlePathCache = /* @__PURE__ */ new Map();
|
|
4858
4897
|
function applyCssMatrixTransform(ctx, transform) {
|
|
@@ -4869,6 +4908,29 @@ function applyCssMatrixTransform(ctx, transform) {
|
|
|
4869
4908
|
values.length === 16 && values.every(Number.isFinite) && ctx.transform(values[0], values[1], values[4], values[5], values[12], values[13]);
|
|
4870
4909
|
}
|
|
4871
4910
|
}
|
|
4911
|
+
function getPreservedAspectRatioRect(image, width, height) {
|
|
4912
|
+
const imageWidth = image.naturalWidth || image.width;
|
|
4913
|
+
const imageHeight = image.naturalHeight || image.height;
|
|
4914
|
+
if (!imageWidth || !imageHeight || !width || !height) {
|
|
4915
|
+
return { x: 0, y: 0, w: width, h: height };
|
|
4916
|
+
}
|
|
4917
|
+
const scale = Math.min(width / imageWidth, height / imageHeight);
|
|
4918
|
+
const w = imageWidth * scale;
|
|
4919
|
+
const h = imageHeight * scale;
|
|
4920
|
+
return {
|
|
4921
|
+
x: (width - w) / 2,
|
|
4922
|
+
y: (height - h) / 2,
|
|
4923
|
+
w,
|
|
4924
|
+
h
|
|
4925
|
+
};
|
|
4926
|
+
}
|
|
4927
|
+
function getBackgroundImageOffset($$) {
|
|
4928
|
+
const { state } = $$;
|
|
4929
|
+
return state.hasFunnel || state.hasTreemap ? { x: 0, y: 0 } : {
|
|
4930
|
+
x: asHalfPixel(state.margin.left),
|
|
4931
|
+
y: asHalfPixel(state.margin.top)
|
|
4932
|
+
};
|
|
4933
|
+
}
|
|
4872
4934
|
function drawCanvasLine($$, target, indices, painter, isSub = false) {
|
|
4873
4935
|
painter.strokePath((ctx) => {
|
|
4874
4936
|
generateDrawLinePath($$, indices, isSub, ctx)(target);
|
|
@@ -5094,12 +5156,14 @@ function getPointFillStyle($$, ctx, d, x, y, r, fallback) {
|
|
|
5094
5156
|
const cy = isNumber(gradientOption.cy) ? gradientOption.cy : 0.3;
|
|
5095
5157
|
const radius = isNumber(gradientOption.r) ? gradientOption.r : 0.7;
|
|
5096
5158
|
const stops = Array.isArray(gradientOption.stops) ? gradientOption.stops : [[0.1, null, 1], [0.9, null, 0]];
|
|
5159
|
+
const gradientX = x + (cx - 0.5) * r * 2;
|
|
5160
|
+
const gradientY = y + (cy - 0.5) * r * 2;
|
|
5097
5161
|
const gradient = ctx.createRadialGradient(
|
|
5098
|
-
|
|
5099
|
-
|
|
5162
|
+
gradientX,
|
|
5163
|
+
gradientY,
|
|
5100
5164
|
0,
|
|
5101
|
-
|
|
5102
|
-
|
|
5165
|
+
gradientX,
|
|
5166
|
+
gradientY,
|
|
5103
5167
|
Math.max(1, r * radius * 2)
|
|
5104
5168
|
);
|
|
5105
5169
|
stops.forEach(([offset, stopColor, stopOpacity]) => {
|
|
@@ -5107,7 +5171,9 @@ function getPointFillStyle($$, ctx, d, x, y, r, fallback) {
|
|
|
5107
5171
|
if (!color) {
|
|
5108
5172
|
color = fallback;
|
|
5109
5173
|
}
|
|
5110
|
-
|
|
5174
|
+
const numericOffset = Number(offset);
|
|
5175
|
+
const parsedOffset = Number.isFinite(numericOffset) ? Math.max(0, Math.min(1, numericOffset)) : 0;
|
|
5176
|
+
gradient.addColorStop(parsedOffset, withOpacity(color, stopOpacity));
|
|
5111
5177
|
});
|
|
5112
5178
|
return gradient;
|
|
5113
5179
|
}
|
|
@@ -5334,13 +5400,21 @@ class CanvasRenderer {
|
|
|
5334
5400
|
if (classStyle.opacity !== void 0) {
|
|
5335
5401
|
ctx.globalAlpha *= classStyle.opacity;
|
|
5336
5402
|
}
|
|
5337
|
-
applyCssMatrixTransform(ctx, classStyle.transform);
|
|
5338
5403
|
if (bg.imgUrl) {
|
|
5339
5404
|
const entry = this.getBackgroundImage(bg.imgUrl, $$);
|
|
5340
5405
|
if (entry == null ? void 0 : entry.loaded) {
|
|
5341
|
-
|
|
5406
|
+
const offset = getBackgroundImageOffset($$);
|
|
5407
|
+
const rect = getPreservedAspectRatioRect(
|
|
5408
|
+
entry.image,
|
|
5409
|
+
current.width,
|
|
5410
|
+
current.height
|
|
5411
|
+
);
|
|
5412
|
+
ctx.translate(offset.x, offset.y);
|
|
5413
|
+
applyCssMatrixTransform(ctx, classStyle.transform);
|
|
5414
|
+
ctx.drawImage(entry.image, rect.x, rect.y, rect.w, rect.h);
|
|
5342
5415
|
}
|
|
5343
5416
|
} else if (bg.color) {
|
|
5417
|
+
applyCssMatrixTransform(ctx, classStyle.transform);
|
|
5344
5418
|
painter.fillRect({
|
|
5345
5419
|
x: margin.left,
|
|
5346
5420
|
y: margin.top,
|
|
@@ -5366,7 +5440,7 @@ class CanvasRenderer {
|
|
|
5366
5440
|
return { x, y };
|
|
5367
5441
|
}
|
|
5368
5442
|
const url = getLabelImageUrl(option, d);
|
|
5369
|
-
const position = getLabelImagePosition($$, option, text, x, y);
|
|
5443
|
+
const position = getLabelImagePosition($$, option, text, x, y, d);
|
|
5370
5444
|
const entry = this.getLabelImage(url, $$);
|
|
5371
5445
|
if (entry == null ? void 0 : entry.loaded) {
|
|
5372
5446
|
this.ctx.drawImage(
|
|
@@ -5497,7 +5571,7 @@ class CanvasRenderer {
|
|
|
5497
5571
|
const { ctx, painter, theme: { style } } = this;
|
|
5498
5572
|
const { margin2, width2, height2 } = state;
|
|
5499
5573
|
const rect = { x: margin2.left, y: margin2.top, w: width2, h: height2 };
|
|
5500
|
-
const targets = $$.filterTargetsToShow(
|
|
5574
|
+
const targets = $$.filterTargetsToShow().filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5501
5575
|
painter.withState(() => {
|
|
5502
5576
|
ctx.strokeStyle = style.axis.lineColor;
|
|
5503
5577
|
ctx.lineWidth = style.axis.lineWidth;
|
|
@@ -5567,7 +5641,7 @@ class CanvasRenderer {
|
|
|
5567
5641
|
ctx.lineWidth = style.shape.candlestickLineWidth;
|
|
5568
5642
|
for (const target of candlestickTargets) {
|
|
5569
5643
|
target.values.forEach((d, i) => {
|
|
5570
|
-
var _a2
|
|
5644
|
+
var _a2;
|
|
5571
5645
|
const value = (_a2 = $$.getCandlestickData) == null ? void 0 : _a2.call($$, d);
|
|
5572
5646
|
const geometry = value && getCanvasCandlestickGeometry(
|
|
5573
5647
|
$$,
|
|
@@ -5578,7 +5652,7 @@ class CanvasRenderer {
|
|
|
5578
5652
|
if (!geometry) {
|
|
5579
5653
|
return;
|
|
5580
5654
|
}
|
|
5581
|
-
const color =
|
|
5655
|
+
const color = getCandlestickColor($$, { id: target.id }, value);
|
|
5582
5656
|
ctx.strokeStyle = color;
|
|
5583
5657
|
ctx.fillStyle = color;
|
|
5584
5658
|
painter.strokePath(() => {
|
|
@@ -5724,7 +5798,7 @@ class CanvasRenderer {
|
|
|
5724
5798
|
const { ctx, painter, theme: { style } } = this;
|
|
5725
5799
|
const isBar = isCanvasBarType.bind(null, $$);
|
|
5726
5800
|
const isExpanded = getExpandedFocusMatcher($$, focusData, isCanvasBarType);
|
|
5727
|
-
const targets = $$.filterTargetsToShow(
|
|
5801
|
+
const targets = $$.filterTargetsToShow().filter(isBar).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5728
5802
|
const getPoints = $$.generateGetBarPoints(
|
|
5729
5803
|
getCanvasShapeIndices($$, shape, TYPE.BAR, isBar),
|
|
5730
5804
|
false
|
|
@@ -5813,7 +5887,7 @@ class CanvasRenderer {
|
|
|
5813
5887
|
const { ctx, painter, theme: { style } } = this;
|
|
5814
5888
|
const isCandlestick = isCanvasCandlestickType.bind(null, $$);
|
|
5815
5889
|
const isExpanded = getExpandedFocusMatcher($$, focusData, isCanvasCandlestickType);
|
|
5816
|
-
const targets = $$.filterTargetsToShow(
|
|
5890
|
+
const targets = $$.filterTargetsToShow().filter(isCandlestick).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5817
5891
|
const getPoints = (_a = $$.generateGetCandlestickPoints) == null ? void 0 : _a.call(
|
|
5818
5892
|
$$,
|
|
5819
5893
|
getCanvasShapeIndices($$, shape, TYPE.CANDLESTICK, isCandlestick),
|
|
@@ -5882,7 +5956,7 @@ class CanvasRenderer {
|
|
|
5882
5956
|
drawLines($$, shape) {
|
|
5883
5957
|
const { ctx, painter, theme: { style } } = this;
|
|
5884
5958
|
const isLine = isCanvasLineType.bind(null, $$);
|
|
5885
|
-
const targets = $$.filterTargetsToShow(
|
|
5959
|
+
const targets = $$.filterTargetsToShow().filter(isLine).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5886
5960
|
const indices = getCanvasShapeIndices($$, shape, TYPE.LINE, isLine);
|
|
5887
5961
|
const { margin } = $$.state;
|
|
5888
5962
|
if (!$$.generateGetLinePoints) {
|
|
@@ -5912,7 +5986,7 @@ class CanvasRenderer {
|
|
|
5912
5986
|
drawAreas($$, shape, focusData) {
|
|
5913
5987
|
const { ctx, painter, theme: { style } } = this;
|
|
5914
5988
|
const isArea = isCanvasAreaType.bind(null, $$);
|
|
5915
|
-
const targets = $$.filterTargetsToShow(
|
|
5989
|
+
const targets = $$.filterTargetsToShow().filter(isArea).filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5916
5990
|
const indices = getCanvasShapeIndices($$, shape, TYPE.AREA, isArea);
|
|
5917
5991
|
const { margin } = $$.state;
|
|
5918
5992
|
if (!$$.generateGetAreaPoints) {
|
|
@@ -5930,7 +6004,8 @@ class CanvasRenderer {
|
|
|
5930
6004
|
ctx,
|
|
5931
6005
|
target,
|
|
5932
6006
|
"area",
|
|
5933
|
-
|
|
6007
|
+
// bounds computation is a full O(n) pass: skip when no gradient is set
|
|
6008
|
+
$$.config.area_linearGradient ? getCanvasAreaBounds($$, target, indices) : null,
|
|
5934
6009
|
color
|
|
5935
6010
|
);
|
|
5936
6011
|
drawCanvasArea($$, target, indices, painter);
|
|
@@ -5960,7 +6035,7 @@ class CanvasRenderer {
|
|
|
5960
6035
|
}
|
|
5961
6036
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
5962
6037
|
var _a2, _b, _c;
|
|
5963
|
-
for (const target of $$.filterTargetsToShow(
|
|
6038
|
+
for (const target of $$.filterTargetsToShow()) {
|
|
5964
6039
|
if (!isCanvasPointType($$, target) || !isCanvasRenderableTarget($$, target) || isCanvasLineType($$, target) && !shouldDrawPoints($$, target)) {
|
|
5965
6040
|
continue;
|
|
5966
6041
|
}
|
|
@@ -6191,39 +6266,36 @@ class CanvasRenderer {
|
|
|
6191
6266
|
),
|
|
6192
6267
|
false
|
|
6193
6268
|
) : null;
|
|
6194
|
-
const targets = $$.filterTargetsToShow(
|
|
6269
|
+
const targets = $$.filterTargetsToShow().filter(
|
|
6195
6270
|
(target) => (isCanvasBarType($$, target) || isCanvasPointType($$, target) || isCanvasAreaType($$, target) || isCanvasCandlestickType($$, target)) && isCanvasRenderableTarget($$, target)
|
|
6196
6271
|
);
|
|
6197
|
-
const
|
|
6198
|
-
|
|
6272
|
+
const targetRows = [];
|
|
6273
|
+
let labelCount = 0;
|
|
6199
6274
|
targets.forEach((target) => {
|
|
6200
6275
|
const range = getCanvasTargetVisibleRange($$, target);
|
|
6201
|
-
$$.labelishData(target)
|
|
6276
|
+
const data = $$.labelishData(target);
|
|
6277
|
+
const rows = [];
|
|
6278
|
+
for (let i = 0; i < data.length; i++) {
|
|
6279
|
+
const d = data[i];
|
|
6202
6280
|
const text = getLabelText($$, d);
|
|
6203
6281
|
if (text && d.index >= range.start && d.index < range.end && hasCanvasDrawableValue($$, d)) {
|
|
6204
|
-
|
|
6205
|
-
labelTexts.set(getLabelRowKey(d), text);
|
|
6282
|
+
rows.push({ d, i, text });
|
|
6206
6283
|
}
|
|
6207
|
-
}
|
|
6284
|
+
}
|
|
6285
|
+
labelCount += rows.length;
|
|
6286
|
+
rows.length && targetRows.push(rows);
|
|
6208
6287
|
});
|
|
6209
6288
|
const texts = {
|
|
6210
|
-
size: () =>
|
|
6289
|
+
size: () => labelCount
|
|
6211
6290
|
};
|
|
6212
6291
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
6213
6292
|
ctx.font = style.label.font;
|
|
6214
6293
|
ctx.textAlign = "center";
|
|
6215
|
-
|
|
6294
|
+
targetRows.forEach((rows) => {
|
|
6216
6295
|
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));
|
|
6296
|
+
for (const { d, i, text } of rows) {
|
|
6222
6297
|
let x;
|
|
6223
6298
|
let y;
|
|
6224
|
-
if (!text || d.index < range.start || d.index >= range.end || !hasCanvasDrawableValue($$, d)) {
|
|
6225
|
-
continue;
|
|
6226
|
-
}
|
|
6227
6299
|
if (isCanvasBarType($$, d) && barPoints) {
|
|
6228
6300
|
const geometry = getCanvasBarGeometry($$, barPoints, d, i);
|
|
6229
6301
|
if (!geometry) {
|
|
@@ -6276,7 +6348,7 @@ class CanvasRenderer {
|
|
|
6276
6348
|
*/
|
|
6277
6349
|
drawEmptyLabel($$) {
|
|
6278
6350
|
const text = $$.config.data_empty_label_text;
|
|
6279
|
-
const targetsToShow = $$.filterTargetsToShow(
|
|
6351
|
+
const targetsToShow = $$.filterTargetsToShow();
|
|
6280
6352
|
if (!text || targetsToShow.length) {
|
|
6281
6353
|
return;
|
|
6282
6354
|
}
|
|
@@ -6372,22 +6444,34 @@ class CanvasRenderer {
|
|
|
6372
6444
|
if (!config.treemap_label_show || (data.ratio || 0) < (config.treemap_label_threshold || 0)) {
|
|
6373
6445
|
continue;
|
|
6374
6446
|
}
|
|
6375
|
-
if ((_a2 = getLabelImageOption($$, data)) == null ? void 0 : _a2.url) {
|
|
6376
|
-
continue;
|
|
6377
|
-
}
|
|
6378
6447
|
const label = getTreemapLabelText($$, data, w, h);
|
|
6379
6448
|
if (!label) {
|
|
6380
6449
|
continue;
|
|
6381
6450
|
}
|
|
6382
6451
|
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);
|
|
6452
|
+
const isCentered = !!config.data_labels.centered;
|
|
6386
6453
|
ctx.font = style.label.font;
|
|
6387
|
-
|
|
6388
|
-
ctx.
|
|
6454
|
+
const lineHeight = getFontSize(ctx.font);
|
|
6455
|
+
const metrics = ctx.measureText((_a2 = lines[0]) != null ? _a2 : "");
|
|
6456
|
+
const fontBoundingHeight = (metrics.fontBoundingBoxAscent || 0) + (metrics.fontBoundingBoxDescent || 0) || (metrics.actualBoundingBoxAscent || 0) + (metrics.actualBoundingBoxDescent || 0);
|
|
6457
|
+
const textHeight = Math.max(lineHeight, fontBoundingHeight) + (lines.length - 1) * lineHeight;
|
|
6458
|
+
const blockY = isCentered ? y + h / 2 : y + textHeight + 5;
|
|
6459
|
+
let textX = isCentered ? x + w / 2 : x + 5;
|
|
6460
|
+
let textY = blockY - (lines.length - 1) * lineHeight / (isCentered ? 2 : 1);
|
|
6461
|
+
ctx.textAlign = isCentered ? "center" : "left";
|
|
6462
|
+
ctx.textBaseline = isCentered ? "middle" : "alphabetic";
|
|
6463
|
+
({ x: textX, y: textY } = this.drawLabelImage($$, data, label, textX, textY));
|
|
6464
|
+
ctx.fillStyle = getLabelColor($$, data, style.label.color);
|
|
6465
|
+
drawLabelDecorations(
|
|
6466
|
+
$$,
|
|
6467
|
+
painter,
|
|
6468
|
+
data,
|
|
6469
|
+
label,
|
|
6470
|
+
textX,
|
|
6471
|
+
isCentered ? textY + (lines.length - 1) * lineHeight / 2 : blockY
|
|
6472
|
+
);
|
|
6389
6473
|
lines.forEach((line, i) => {
|
|
6390
|
-
painter.text(line,
|
|
6474
|
+
painter.text(line, textX, textY + i * lineHeight, {
|
|
6391
6475
|
maxWidth: Math.max(0, w - 8)
|
|
6392
6476
|
});
|
|
6393
6477
|
});
|
|
@@ -6472,14 +6556,15 @@ class CanvasRenderer {
|
|
|
6472
6556
|
const { x, y } = getRenderDataPoint($$, d);
|
|
6473
6557
|
const baseR = (_b = (_a = $$.pointR) == null ? void 0 : _a.call($$, d)) != null ? _b : 2.5;
|
|
6474
6558
|
const r = (_d = (_c = $$.pointExpandedR) == null ? void 0 : _c.call($$, d)) != null ? _d : baseR * 1.75;
|
|
6475
|
-
const
|
|
6559
|
+
const overColor = getCanvasOverColor($$, d);
|
|
6560
|
+
const color = overColor || $$.color(d.id);
|
|
6476
6561
|
if (!isFiniteCanvasCoordinate(x, y)) {
|
|
6477
6562
|
return;
|
|
6478
6563
|
}
|
|
6479
6564
|
drawPointPattern(painter, pointType, x, y, r, {
|
|
6480
|
-
fill:
|
|
6565
|
+
fill: overColor || style.focusPoint.fill || style.shape.pointFillColor || color,
|
|
6481
6566
|
lineWidth: style.focusPoint.lineWidth,
|
|
6482
|
-
stroke:
|
|
6567
|
+
stroke: overColor || style.focusPoint.stroke || color,
|
|
6483
6568
|
alpha: getPointOpacity($$, d)
|
|
6484
6569
|
}, baseR);
|
|
6485
6570
|
});
|
|
@@ -7394,7 +7479,7 @@ class HitDetector {
|
|
|
7394
7479
|
rebuild($$, shape) {
|
|
7395
7480
|
var _a, _b, _c;
|
|
7396
7481
|
const { current, margin, width, height } = $$.state;
|
|
7397
|
-
const targets = $$.filterTargetsToShow(
|
|
7482
|
+
const targets = $$.filterTargetsToShow();
|
|
7398
7483
|
this.bars = [];
|
|
7399
7484
|
this.points = [];
|
|
7400
7485
|
this.indices = [];
|
|
@@ -7531,26 +7616,30 @@ class HitDetector {
|
|
|
7531
7616
|
this.indices = indexMap ? Array.from(indexMap.values()).sort((a, b) => a[this.indexAxis] - b[this.indexAxis]) : [];
|
|
7532
7617
|
}
|
|
7533
7618
|
/**
|
|
7534
|
-
*
|
|
7619
|
+
* Hit-test bars at the given canvas coordinates.
|
|
7535
7620
|
* @param {number} mx Mouse x coordinate
|
|
7536
7621
|
* @param {number} my Mouse y coordinate
|
|
7537
7622
|
* @returns {object|null} Matching data row
|
|
7538
7623
|
* @private
|
|
7539
7624
|
*/
|
|
7540
|
-
|
|
7541
|
-
var _a, _b;
|
|
7625
|
+
hitBar(mx, my) {
|
|
7542
7626
|
for (const item of getGridItems(this.barGrid, mx, my, BAR_CELL_SIZE)) {
|
|
7543
7627
|
const { w = 0, h = 0 } = item;
|
|
7544
7628
|
if (mx >= item.x && mx <= item.x + w && my >= item.y && my <= item.y + h) {
|
|
7545
7629
|
return item.data;
|
|
7546
7630
|
}
|
|
7547
7631
|
}
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7632
|
+
return null;
|
|
7633
|
+
}
|
|
7634
|
+
/**
|
|
7635
|
+
* Find the nearest point within sensitivity at the given canvas coordinates.
|
|
7636
|
+
* @param {number} mx Mouse x coordinate
|
|
7637
|
+
* @param {number} my Mouse y coordinate
|
|
7638
|
+
* @returns {object|null} Matching data row
|
|
7639
|
+
* @private
|
|
7640
|
+
*/
|
|
7641
|
+
hitPoint(mx, my) {
|
|
7642
|
+
var _a, _b;
|
|
7554
7643
|
let nearest = null;
|
|
7555
7644
|
let min = Number.POSITIVE_INFINITY;
|
|
7556
7645
|
for (const item of getGridItems(this.pointGrid, mx, my, this.pointCellSize, 1)) {
|
|
@@ -7566,33 +7655,35 @@ class HitDetector {
|
|
|
7566
7655
|
return (_b = nearest == null ? void 0 : nearest.data) != null ? _b : null;
|
|
7567
7656
|
}
|
|
7568
7657
|
/**
|
|
7569
|
-
* Find the nearest
|
|
7658
|
+
* Find the nearest data row for the given canvas coordinates.
|
|
7570
7659
|
* @param {number} mx Mouse x coordinate
|
|
7571
7660
|
* @param {number} my Mouse y coordinate
|
|
7572
7661
|
* @returns {object|null} Matching data row
|
|
7573
7662
|
* @private
|
|
7574
7663
|
*/
|
|
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
|
-
}
|
|
7664
|
+
findNearest(mx, my) {
|
|
7665
|
+
const bar = this.hitBar(mx, my);
|
|
7666
|
+
if (bar) {
|
|
7667
|
+
return bar;
|
|
7582
7668
|
}
|
|
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;
|
|
7669
|
+
if (!this.pointBased && this.grouped && this.isWithinPlot(mx, my)) {
|
|
7670
|
+
const item = this.findNearestIndexItem(mx, my);
|
|
7671
|
+
if (item) {
|
|
7672
|
+
return item.data;
|
|
7593
7673
|
}
|
|
7594
7674
|
}
|
|
7595
|
-
return (
|
|
7675
|
+
return this.hitPoint(mx, my);
|
|
7676
|
+
}
|
|
7677
|
+
/**
|
|
7678
|
+
* Find the nearest directly hit shape row, excluding grouped index fallback.
|
|
7679
|
+
* @param {number} mx Mouse x coordinate
|
|
7680
|
+
* @param {number} my Mouse y coordinate
|
|
7681
|
+
* @returns {object|null} Matching data row
|
|
7682
|
+
* @private
|
|
7683
|
+
*/
|
|
7684
|
+
findNearestShape(mx, my) {
|
|
7685
|
+
var _a;
|
|
7686
|
+
return (_a = this.hitBar(mx, my)) != null ? _a : this.hitPoint(mx, my);
|
|
7596
7687
|
}
|
|
7597
7688
|
/**
|
|
7598
7689
|
* Find the nearest grouped x-index row for an axis-adjacent pointer coordinate.
|
|
@@ -7902,7 +7993,7 @@ const $ZOOM = {
|
|
|
7902
7993
|
buttonZoomReset: "bb-zoom-reset",
|
|
7903
7994
|
zoomBrush: "bb-zoom-brush"
|
|
7904
7995
|
};
|
|
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));
|
|
7996
|
+
/* 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
7997
|
|
|
7907
7998
|
;// ./src/config/Options/common/boost.ts
|
|
7908
7999
|
/* harmony default export */ var boost = ({
|
|
@@ -8501,7 +8592,7 @@ const $ZOOM = {
|
|
|
8501
8592
|
* @memberof Options
|
|
8502
8593
|
* @type {object}
|
|
8503
8594
|
* @property {object} [transition] transition object
|
|
8504
|
-
* @property {number} [transition.duration=
|
|
8595
|
+
* @property {number} [transition.duration=250] duration in milliseconds
|
|
8505
8596
|
* @example
|
|
8506
8597
|
* transition: {
|
|
8507
8598
|
* duration: 500
|
|
@@ -10369,8 +10460,7 @@ class Cache {
|
|
|
10369
10460
|
}
|
|
10370
10461
|
return targets;
|
|
10371
10462
|
} else {
|
|
10372
|
-
|
|
10373
|
-
return isValue(value) ? value : null;
|
|
10463
|
+
return this.cache.has(key) ? this.cache.get(key) : null;
|
|
10374
10464
|
}
|
|
10375
10465
|
}
|
|
10376
10466
|
/**
|
|
@@ -10487,11 +10577,12 @@ function getCssSelector(s) {
|
|
|
10487
10577
|
}
|
|
10488
10578
|
function _getRect(relativeViewport, node, forceEval = false) {
|
|
10489
10579
|
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
10580
|
+
const cacheKey = relativeViewport ? "rectClient" : "rectBBox";
|
|
10490
10581
|
if (forceEval) {
|
|
10491
10582
|
return _(node);
|
|
10492
10583
|
} else {
|
|
10493
|
-
const needEvaluate = !(
|
|
10494
|
-
return needEvaluate ? node
|
|
10584
|
+
const needEvaluate = !(cacheKey in node) || node.hasAttribute("width") && node[cacheKey].width !== +(node.getAttribute("width") || 0);
|
|
10585
|
+
return needEvaluate ? node[cacheKey] = _(node) : node[cacheKey];
|
|
10495
10586
|
}
|
|
10496
10587
|
}
|
|
10497
10588
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
@@ -10611,14 +10702,14 @@ function getElementPos(element, type) {
|
|
|
10611
10702
|
}
|
|
10612
10703
|
function hasViewBox(svg) {
|
|
10613
10704
|
const attr = svg.attr("viewBox");
|
|
10614
|
-
return attr ?
|
|
10705
|
+
return attr ? attr.trim().split(/[\s,]+/).length === 4 : false;
|
|
10615
10706
|
}
|
|
10616
10707
|
function hasStyle(node, condition, all = false) {
|
|
10617
10708
|
const isD3Node = !!node.node;
|
|
10618
10709
|
let has = false;
|
|
10619
10710
|
for (const [key, value] of Object.entries(condition)) {
|
|
10620
10711
|
has = isD3Node ? node.style(key) === value : node.style[key] === value;
|
|
10621
|
-
if (all
|
|
10712
|
+
if (all ? !has : has) {
|
|
10622
10713
|
break;
|
|
10623
10714
|
}
|
|
10624
10715
|
}
|
|
@@ -10734,23 +10825,28 @@ function generateResize(option) {
|
|
|
10734
10825
|
const callResizeFn = function() {
|
|
10735
10826
|
callResizeFn.clear();
|
|
10736
10827
|
if (option === false) {
|
|
10737
|
-
requestIdleCallback(() => {
|
|
10828
|
+
timeout = requestIdleCallback(() => {
|
|
10829
|
+
timeout = null;
|
|
10738
10830
|
fn.forEach((f) => f());
|
|
10739
10831
|
}, { timeout: 200 });
|
|
10740
10832
|
} else {
|
|
10741
10833
|
timeout = generator_setTimeout(() => {
|
|
10834
|
+
timeout = null;
|
|
10742
10835
|
fn.forEach((f) => f());
|
|
10743
10836
|
}, isNumber(option) ? option : 200);
|
|
10744
10837
|
}
|
|
10745
10838
|
};
|
|
10746
10839
|
callResizeFn.clear = () => {
|
|
10747
10840
|
if (timeout) {
|
|
10748
|
-
generator_clearTimeout(timeout);
|
|
10841
|
+
(option === false ? cancelIdleCallback : generator_clearTimeout)(timeout);
|
|
10749
10842
|
timeout = null;
|
|
10750
10843
|
}
|
|
10751
10844
|
};
|
|
10752
10845
|
callResizeFn.add = (f) => fn.push(f);
|
|
10753
|
-
callResizeFn.remove = (f) =>
|
|
10846
|
+
callResizeFn.remove = (f) => {
|
|
10847
|
+
const index = fn.indexOf(f);
|
|
10848
|
+
index !== -1 && fn.splice(index, 1);
|
|
10849
|
+
};
|
|
10754
10850
|
return callResizeFn;
|
|
10755
10851
|
}
|
|
10756
10852
|
function generateWait() {
|
|
@@ -10789,6 +10885,7 @@ function generateWait() {
|
|
|
10789
10885
|
;// ./src/module/worker.ts
|
|
10790
10886
|
|
|
10791
10887
|
const cache = {};
|
|
10888
|
+
let messageId = 0;
|
|
10792
10889
|
function getOrCreateWorkerResources(fn, depsFn) {
|
|
10793
10890
|
var _a;
|
|
10794
10891
|
const fnString = fn.toString();
|
|
@@ -10799,8 +10896,8 @@ function getOrCreateWorkerResources(fn, depsFn) {
|
|
|
10799
10896
|
`${depsString}
|
|
10800
10897
|
|
|
10801
10898
|
self.onmessage=function({data}) {
|
|
10802
|
-
const result = (${fnString}).apply(null, data);
|
|
10803
|
-
self.postMessage(result);
|
|
10899
|
+
const result = (${fnString}).apply(null, data.args);
|
|
10900
|
+
self.postMessage({id: data.id, result});
|
|
10804
10901
|
};`
|
|
10805
10902
|
], {
|
|
10806
10903
|
type: "text/javascript"
|
|
@@ -10837,10 +10934,16 @@ function runWorker(useWorker = true, fn, callback, depsFn) {
|
|
|
10837
10934
|
const worker = getWorker(key, src);
|
|
10838
10935
|
runFn = function(...args) {
|
|
10839
10936
|
if (worker) {
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10937
|
+
const id = ++messageId;
|
|
10938
|
+
const handler = function(e) {
|
|
10939
|
+
var _a;
|
|
10940
|
+
if (((_a = e.data) == null ? void 0 : _a.id) === id) {
|
|
10941
|
+
worker.removeEventListener("message", handler);
|
|
10942
|
+
callback(e.data.result);
|
|
10943
|
+
}
|
|
10843
10944
|
};
|
|
10945
|
+
worker.addEventListener("message", handler);
|
|
10946
|
+
worker.postMessage({ id, args });
|
|
10844
10947
|
}
|
|
10845
10948
|
};
|
|
10846
10949
|
}
|
|
@@ -11112,8 +11215,8 @@ function _setXS(ids, data, params) {
|
|
|
11112
11215
|
if (params.xs.indexOf(xKey) >= 0) {
|
|
11113
11216
|
xsData = (params.appendXs && $$.data.xs[id] || []).concat(
|
|
11114
11217
|
data.map((d, i) => {
|
|
11115
|
-
const rawX =
|
|
11116
|
-
return rawX ? $$.generateTargetX(rawX, id, i) : false;
|
|
11218
|
+
const rawX = d[xKey];
|
|
11219
|
+
return isValue(rawX) ? $$.generateTargetX(rawX, id, i) : false;
|
|
11117
11220
|
}).filter((v) => v !== false)
|
|
11118
11221
|
);
|
|
11119
11222
|
} else if (config.data_x) {
|
|
@@ -11144,7 +11247,7 @@ function _setXS(ids, data, params) {
|
|
|
11144
11247
|
let data = args;
|
|
11145
11248
|
if (args.bindto) {
|
|
11146
11249
|
data = {};
|
|
11147
|
-
["url", "mimeType", "headers", "keys", "json", "
|
|
11250
|
+
["url", "mimeType", "headers", "keys", "json", "rows", "columns"].forEach((v) => {
|
|
11148
11251
|
const key = `data_${v}`;
|
|
11149
11252
|
if (key in args) {
|
|
11150
11253
|
data[v] = args[key];
|
|
@@ -11195,20 +11298,20 @@ function _setXS(ids, data, params) {
|
|
|
11195
11298
|
const params = {
|
|
11196
11299
|
appendXs,
|
|
11197
11300
|
xs,
|
|
11198
|
-
idConverter: config.data_idConverter.bind($$.api),
|
|
11199
11301
|
categorized: axis == null ? void 0 : axis.isCategorized(),
|
|
11200
11302
|
timeSeries: axis == null ? void 0 : axis.isTimeSeries(),
|
|
11201
11303
|
customX: axis == null ? void 0 : axis.isCustomX()
|
|
11202
11304
|
};
|
|
11203
11305
|
_setXS.bind($$)(ids, data, params);
|
|
11204
11306
|
const categoryIndexMap = params.customX && params.categorized && config.axis_x_categories.length ? new Map(config.axis_x_categories.map((cat, i) => [cat, i])) : null;
|
|
11307
|
+
const idConverter = config.data_idConverter.bind($$.api);
|
|
11205
11308
|
const targets = ids.map((id, index) => {
|
|
11206
|
-
const convertedId =
|
|
11309
|
+
const convertedId = idConverter(id);
|
|
11207
11310
|
const xKey = $$.getXKey(id);
|
|
11208
11311
|
const isCategory = params.customX && params.categorized;
|
|
11209
|
-
const hasCategory = isCategory && (() => {
|
|
11312
|
+
const hasCategory = isCategory && index === 0 && (() => {
|
|
11210
11313
|
const categorySet = toSet(config.axis_x_categories);
|
|
11211
|
-
return data.every((v) => categorySet.has(v
|
|
11314
|
+
return data.every((v) => categorySet.has(v[xKey]));
|
|
11212
11315
|
})();
|
|
11213
11316
|
const isDataAppend = data.__append__;
|
|
11214
11317
|
const xIndex = xKey === null && isDataAppend ? $$.api.data.values(id).length : 0;
|
|
@@ -11222,7 +11325,7 @@ function _setXS(ids, data, params) {
|
|
|
11222
11325
|
let x;
|
|
11223
11326
|
value = value !== null && !isNaN(value) && !isObject(value) ? +value : isArray(value) || isObject(value) ? value : null;
|
|
11224
11327
|
if ((isCategory || state.hasRadar) && index === 0 && !isUndefined(rawX)) {
|
|
11225
|
-
if (!hasCategory &&
|
|
11328
|
+
if (!hasCategory && i === 0 && !isDataAppend) {
|
|
11226
11329
|
config.axis_x_categories = [];
|
|
11227
11330
|
if (categoryIndexMap) {
|
|
11228
11331
|
categoryIndexMap.clear();
|
|
@@ -11284,6 +11387,10 @@ function _setXS(ids, data, params) {
|
|
|
11284
11387
|
|
|
11285
11388
|
|
|
11286
11389
|
|
|
11390
|
+
const rangedDataKeyIndex = {
|
|
11391
|
+
areaRange: { high: 0, mid: 1, low: 2 },
|
|
11392
|
+
candlestick: { open: 0, high: 1, low: 2, close: 3, volume: 4 }
|
|
11393
|
+
};
|
|
11287
11394
|
/* harmony default export */ var data_data = ({
|
|
11288
11395
|
isX(key) {
|
|
11289
11396
|
const $$ = this;
|
|
@@ -11559,7 +11666,7 @@ function _setXS(ids, data, params) {
|
|
|
11559
11666
|
if (!sum[i]) {
|
|
11560
11667
|
sum[i] = 0;
|
|
11561
11668
|
}
|
|
11562
|
-
sum[i] +=
|
|
11669
|
+
sum[i] += isNumber(v.value) ? v.value : 0;
|
|
11563
11670
|
});
|
|
11564
11671
|
});
|
|
11565
11672
|
$$.cache.add(cacheKey, sum);
|
|
@@ -11600,7 +11707,7 @@ function _setXS(ids, data, params) {
|
|
|
11600
11707
|
const { api, state: { hiddenTargetIds } } = $$;
|
|
11601
11708
|
let total = 0;
|
|
11602
11709
|
if (hiddenTargetIds.size) {
|
|
11603
|
-
total = api.data.values.bind(api)([...hiddenTargetIds]).reduce((p, c) => p + c);
|
|
11710
|
+
total = api.data.values.bind(api)([...hiddenTargetIds]).reduce((p, c) => p + c, 0);
|
|
11604
11711
|
}
|
|
11605
11712
|
return total;
|
|
11606
11713
|
},
|
|
@@ -12193,16 +12300,14 @@ function _setXS(ids, data, params) {
|
|
|
12193
12300
|
return current;
|
|
12194
12301
|
},
|
|
12195
12302
|
getRangedData(d, key = "", type = "areaRange") {
|
|
12303
|
+
var _a, _b;
|
|
12196
12304
|
const value = d == null ? void 0 : d.value;
|
|
12197
12305
|
if (isArray(value)) {
|
|
12198
12306
|
if (type === "bar") {
|
|
12199
12307
|
return value.reduce((a, c) => c - a);
|
|
12200
12308
|
} 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;
|
|
12309
|
+
const index = (_b = (_a = rangedDataKeyIndex[type]) == null ? void 0 : _a[key]) != null ? _b : -1;
|
|
12310
|
+
return index >= 0 ? value[index] : void 0;
|
|
12206
12311
|
}
|
|
12207
12312
|
} else if (value && key) {
|
|
12208
12313
|
return value[key];
|
|
@@ -12267,7 +12372,9 @@ function _setXS(ids, data, params) {
|
|
|
12267
12372
|
if (hiddenIds.length) {
|
|
12268
12373
|
let hiddenSum = dataValues(hiddenIds, false);
|
|
12269
12374
|
if (hiddenSum.length) {
|
|
12270
|
-
hiddenSum = hiddenSum.reduce(
|
|
12375
|
+
hiddenSum = hiddenSum.reduce(
|
|
12376
|
+
(acc, curr) => acc.map((v, i) => (isNumber(v) ? v : 0) + curr[i])
|
|
12377
|
+
);
|
|
12271
12378
|
total = total.map((v, i) => v - hiddenSum[i]);
|
|
12272
12379
|
}
|
|
12273
12380
|
}
|
|
@@ -12376,25 +12483,22 @@ function callDone(fn, resizeAfter = false) {
|
|
|
12376
12483
|
$$.setTargetType(t.id, type);
|
|
12377
12484
|
});
|
|
12378
12485
|
}
|
|
12486
|
+
const incoming = new Map(targets.map((t) => [t.id, t]));
|
|
12379
12487
|
data.targets.forEach((d) => {
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
}
|
|
12387
|
-
} else {
|
|
12388
|
-
d.values = targets[i].values;
|
|
12488
|
+
const t = incoming.get(d.id);
|
|
12489
|
+
if (t) {
|
|
12490
|
+
if (append) {
|
|
12491
|
+
const values = t.values;
|
|
12492
|
+
for (let j = 0; j < values.length; j++) {
|
|
12493
|
+
d.values.push(values[j]);
|
|
12389
12494
|
}
|
|
12390
|
-
|
|
12391
|
-
|
|
12495
|
+
} else {
|
|
12496
|
+
d.values = t.values;
|
|
12392
12497
|
}
|
|
12498
|
+
incoming.delete(d.id);
|
|
12393
12499
|
}
|
|
12394
12500
|
});
|
|
12395
|
-
|
|
12396
|
-
data.targets.push(targets[i]);
|
|
12397
|
-
}
|
|
12501
|
+
incoming.forEach((t) => data.targets.push(t));
|
|
12398
12502
|
}
|
|
12399
12503
|
if ($$.state.isCanvasMode) {
|
|
12400
12504
|
$$.redraw({
|
|
@@ -12473,15 +12577,16 @@ function callDone(fn, resizeAfter = false) {
|
|
|
12473
12577
|
};
|
|
12474
12578
|
}
|
|
12475
12579
|
targetIds = targetIds.filter((id) => $$.hasTarget($$.data.targets, id));
|
|
12476
|
-
if (
|
|
12580
|
+
if (targetIds.length === 0) {
|
|
12477
12581
|
done();
|
|
12478
12582
|
return;
|
|
12479
12583
|
}
|
|
12584
|
+
const unloadIds = new Set(targetIds);
|
|
12480
12585
|
if (state.isCanvasMode) {
|
|
12481
12586
|
targetIds.forEach((id) => {
|
|
12482
12587
|
state.withoutFadeIn[id] = false;
|
|
12483
|
-
$$.data.targets = $$.data.targets.filter((t) => t.id !== id);
|
|
12484
12588
|
});
|
|
12589
|
+
$$.data.targets = $$.data.targets.filter((t) => !unloadIds.has(t.id));
|
|
12485
12590
|
$$.removeHiddenTargetIds(targetIds);
|
|
12486
12591
|
$$.removeHiddenLegendIds(targetIds);
|
|
12487
12592
|
$$.updateTypesElements();
|
|
@@ -12495,9 +12600,9 @@ function callDone(fn, resizeAfter = false) {
|
|
|
12495
12600
|
if ($el.legend) {
|
|
12496
12601
|
$el.legend.selectAll(`.${$LEGEND.legendItem}${suffixId}`).remove();
|
|
12497
12602
|
}
|
|
12498
|
-
$$.data.targets = $$.data.targets.filter((t) => t.id !== id);
|
|
12499
12603
|
hasLegendDefsPoint && ((_a2 = $el.defs) == null ? void 0 : _a2.select(`#${$$.getDefsPointId(suffixId)}`).remove());
|
|
12500
12604
|
});
|
|
12605
|
+
$$.data.targets = $$.data.targets.filter((t) => !unloadIds.has(t.id));
|
|
12501
12606
|
state.hasFunnel && $$.updateFunnel($$.data.targets);
|
|
12502
12607
|
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
12503
12608
|
$$.updateTypesElements();
|
|
@@ -12665,7 +12770,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
12665
12770
|
}
|
|
12666
12771
|
let x = left + (mouse ? mouse[0] : 0) + (isMultipleX || isRotated ? 0 : width / 2);
|
|
12667
12772
|
let y = top + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0);
|
|
12668
|
-
if (hasViewBox(svg)) {
|
|
12773
|
+
if (hasViewBox(svg) && $$.$el.eventRect) {
|
|
12669
12774
|
const ctm = getTransformCTM($$.$el.eventRect.node(), x, y, false);
|
|
12670
12775
|
x = ctm.x;
|
|
12671
12776
|
y = ctm.y;
|
|
@@ -12697,9 +12802,10 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
12697
12802
|
*/
|
|
12698
12803
|
unbindZoomEvent() {
|
|
12699
12804
|
const $$ = this;
|
|
12700
|
-
const { $el: { canvas, eventRect, zoomResetBtn } } = $$;
|
|
12805
|
+
const { $el: { canvas, eventRect, svg, zoomResetBtn } } = $$;
|
|
12701
12806
|
eventRect == null ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
|
|
12702
12807
|
canvas == null ? void 0 : canvas.on(".zoom wheel.zoom .drag", null);
|
|
12808
|
+
svg == null ? void 0 : svg.on("wheel", null);
|
|
12703
12809
|
zoomResetBtn == null ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
|
|
12704
12810
|
},
|
|
12705
12811
|
/**
|
|
@@ -13681,6 +13787,8 @@ function _getFormat($$, typeValue, v) {
|
|
|
13681
13787
|
|
|
13682
13788
|
|
|
13683
13789
|
|
|
13790
|
+
const LEGEND_TOUCH_TAP_THRESHOLD = 10;
|
|
13791
|
+
const LEGEND_TOUCH_CLICK_TIMEOUT = 750;
|
|
13684
13792
|
function _getLegendColor(id) {
|
|
13685
13793
|
const $$ = this;
|
|
13686
13794
|
const data = $$.getDataById(id);
|
|
@@ -13697,9 +13805,14 @@ function _getFormattedText(id, formatted = true) {
|
|
|
13697
13805
|
return text;
|
|
13698
13806
|
}
|
|
13699
13807
|
function _buildLegendItemMap($$, legendItems) {
|
|
13808
|
+
var _a;
|
|
13700
13809
|
if (!legendItems || legendItems.empty()) {
|
|
13701
13810
|
return;
|
|
13702
13811
|
}
|
|
13812
|
+
const allItems = (_a = $$.$el.legend) == null ? void 0 : _a.selectAll(`.${$LEGEND.legendItem}`);
|
|
13813
|
+
if (allItems && !allItems.empty()) {
|
|
13814
|
+
legendItems = allItems;
|
|
13815
|
+
}
|
|
13703
13816
|
const items = [];
|
|
13704
13817
|
legendItems.each(function(id) {
|
|
13705
13818
|
items.push({ id, node: this });
|
|
@@ -13711,6 +13824,54 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13711
13824
|
);
|
|
13712
13825
|
$$.cache.add(KEY.legendItemMap, itemMap);
|
|
13713
13826
|
}
|
|
13827
|
+
function _getLegendTouchPoint(event) {
|
|
13828
|
+
var _a, _b;
|
|
13829
|
+
return ((_a = event.changedTouches) == null ? void 0 : _a[0]) || ((_b = event.touches) == null ? void 0 : _b[0]);
|
|
13830
|
+
}
|
|
13831
|
+
function _setLegendTouchStart($$, id, event) {
|
|
13832
|
+
const touch = _getLegendTouchPoint(event);
|
|
13833
|
+
$$.state.legendTouch = touch ? {
|
|
13834
|
+
id,
|
|
13835
|
+
x: touch.clientX,
|
|
13836
|
+
y: touch.clientY,
|
|
13837
|
+
moved: false
|
|
13838
|
+
} : null;
|
|
13839
|
+
}
|
|
13840
|
+
function _updateLegendTouchMove($$, event) {
|
|
13841
|
+
const start = $$.state.legendTouch;
|
|
13842
|
+
const touch = start && _getLegendTouchPoint(event);
|
|
13843
|
+
if (touch) {
|
|
13844
|
+
start.moved = start.moved || Math.abs(touch.clientX - start.x) > LEGEND_TOUCH_TAP_THRESHOLD || Math.abs(touch.clientY - start.y) > LEGEND_TOUCH_TAP_THRESHOLD;
|
|
13845
|
+
}
|
|
13846
|
+
}
|
|
13847
|
+
function _isLegendTouchTap($$, id, event) {
|
|
13848
|
+
_updateLegendTouchMove($$, event);
|
|
13849
|
+
const start = $$.state.legendTouch;
|
|
13850
|
+
$$.state.legendTouch = null;
|
|
13851
|
+
return !!start && start.id === id && !start.moved;
|
|
13852
|
+
}
|
|
13853
|
+
function _markLegendTouchClick($$, id) {
|
|
13854
|
+
$$.state.legendLastTouchClickId = id;
|
|
13855
|
+
$$.state.legendLastTouchClickTime = Date.now();
|
|
13856
|
+
}
|
|
13857
|
+
function _isDuplicateLegendTouchClick($$, id) {
|
|
13858
|
+
const { state } = $$;
|
|
13859
|
+
const duplicate = state.legendLastTouchClickId === id && Date.now() - (state.legendLastTouchClickTime || 0) < LEGEND_TOUCH_CLICK_TIMEOUT;
|
|
13860
|
+
if (duplicate) {
|
|
13861
|
+
state.legendLastTouchClickId = null;
|
|
13862
|
+
state.legendLastTouchClickTime = 0;
|
|
13863
|
+
}
|
|
13864
|
+
return duplicate;
|
|
13865
|
+
}
|
|
13866
|
+
function _getLegendTouchOption($$) {
|
|
13867
|
+
var _a;
|
|
13868
|
+
const preventDefault = (_a = $$.config.interaction_inputType_touch) == null ? void 0 : _a.preventDefault;
|
|
13869
|
+
const isPrevented = isBoolean(preventDefault) && preventDefault || false;
|
|
13870
|
+
const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
|
|
13871
|
+
return {
|
|
13872
|
+
passive: !isPrevented && preventThreshold === null
|
|
13873
|
+
};
|
|
13874
|
+
}
|
|
13714
13875
|
/* harmony default export */ var internals_legend = ({
|
|
13715
13876
|
/**
|
|
13716
13877
|
* Initialize the legend.
|
|
@@ -13762,8 +13923,7 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13762
13923
|
} else if (!state.hasTreemap) {
|
|
13763
13924
|
$$.updateLegendElement(
|
|
13764
13925
|
targetIds || $$.mapToIds($$.data.targets),
|
|
13765
|
-
optionz
|
|
13766
|
-
transitions
|
|
13926
|
+
optionz
|
|
13767
13927
|
);
|
|
13768
13928
|
}
|
|
13769
13929
|
(_a = $el.legend) == null ? void 0 : _a.selectAll(`.${$LEGEND.legendItem}`).classed($LEGEND.legendItemHidden, function(id) {
|
|
@@ -13947,10 +14107,10 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13947
14107
|
const { config, $el: { legend } } = $$;
|
|
13948
14108
|
if (config.legend_show && isEmpty(targetIds)) {
|
|
13949
14109
|
config.legend_show = false;
|
|
13950
|
-
legend.style("visibility", "hidden");
|
|
14110
|
+
legend == null ? void 0 : legend.style("visibility", "hidden");
|
|
13951
14111
|
}
|
|
13952
14112
|
$$.addHiddenLegendIds(targetIds);
|
|
13953
|
-
legend.selectAll($$.selectorLegends(targetIds)).style("opacity", "0").style("visibility", "hidden");
|
|
14113
|
+
legend == null ? void 0 : legend.selectAll($$.selectorLegends(targetIds)).style("opacity", "0").style("visibility", "hidden");
|
|
13954
14114
|
},
|
|
13955
14115
|
/**
|
|
13956
14116
|
* Get legend item textbox dimension
|
|
@@ -13986,6 +14146,31 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
13986
14146
|
const hasGauge = $$.hasType("gauge");
|
|
13987
14147
|
const useCssRule = config.boost_useCssRule;
|
|
13988
14148
|
const interaction = config.legend_item_interaction;
|
|
14149
|
+
const eventType = interaction.dblclick ? "dblclick" : "click";
|
|
14150
|
+
const hasClickInteraction = interaction || isFunction(config.legend_item_onclick);
|
|
14151
|
+
const touchOption = isTouch ? _getLegendTouchOption($$) : void 0;
|
|
14152
|
+
const handleLegendToggle = function(event, id) {
|
|
14153
|
+
var _a;
|
|
14154
|
+
if (!callFn(config.legend_item_onclick, api, id, !state.hiddenTargetIds.has(id))) {
|
|
14155
|
+
const { altKey, type } = event;
|
|
14156
|
+
const selected = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
14157
|
+
if (type === "dblclick" || altKey) {
|
|
14158
|
+
if (state.hiddenTargetIds.size && !selected.classed($LEGEND.legendItemHidden)) {
|
|
14159
|
+
api.show();
|
|
14160
|
+
} else {
|
|
14161
|
+
api.hide();
|
|
14162
|
+
api.show(id);
|
|
14163
|
+
}
|
|
14164
|
+
} else {
|
|
14165
|
+
api.toggle(id);
|
|
14166
|
+
selected.classed($FOCUS.legendItemFocused, false);
|
|
14167
|
+
}
|
|
14168
|
+
}
|
|
14169
|
+
if (isTouch) {
|
|
14170
|
+
$$.hideTooltip();
|
|
14171
|
+
(_a = $$.hideGridFocus) == null ? void 0 : _a.call($$, true);
|
|
14172
|
+
}
|
|
14173
|
+
};
|
|
13989
14174
|
item.attr("class", function(id) {
|
|
13990
14175
|
const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
13991
14176
|
const itemClass = !node.empty() && node.attr("class") || "";
|
|
@@ -14004,33 +14189,22 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
14004
14189
|
$$.setCssRule(false, selector, [props])($el.legend);
|
|
14005
14190
|
});
|
|
14006
14191
|
}
|
|
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
|
-
);
|
|
14192
|
+
item.on(eventType, hasClickInteraction ? function(event, id) {
|
|
14193
|
+
if (isTouch && event.type === "click" && _isDuplicateLegendTouchClick($$, id)) {
|
|
14194
|
+
return;
|
|
14195
|
+
}
|
|
14196
|
+
handleLegendToggle.call(this, event, id);
|
|
14197
|
+
} : null);
|
|
14198
|
+
isTouch && eventType === "click" && hasClickInteraction && item.on("touchstart", function(event, id) {
|
|
14199
|
+
_setLegendTouchStart($$, id, event);
|
|
14200
|
+
}, touchOption).on("touchmove", (event) => {
|
|
14201
|
+
_updateLegendTouchMove($$, event);
|
|
14202
|
+
}, touchOption).on("touchend", function(event, id) {
|
|
14203
|
+
if (_isLegendTouchTap($$, id, event)) {
|
|
14204
|
+
_markLegendTouchClick($$, id);
|
|
14205
|
+
handleLegendToggle.call(this, event, id);
|
|
14206
|
+
}
|
|
14207
|
+
}, touchOption);
|
|
14034
14208
|
!isTouch && item.on("mouseout", interaction || isFunction(config.legend_item_onout) ? function(event, id) {
|
|
14035
14209
|
if (!callFn(
|
|
14036
14210
|
config.legend_item_onout,
|
|
@@ -14327,30 +14501,34 @@ function _buildLegendItemMap($$, legendItems) {
|
|
|
14327
14501
|
const isRectangle = legendType !== "circle";
|
|
14328
14502
|
if (usePoint) {
|
|
14329
14503
|
const tiles = legend.selectAll(`.${$LEGEND.legendItemPoint}`).data(targetIdz);
|
|
14504
|
+
const isRectangleTile = config.legend_item_tile_type !== "circle";
|
|
14505
|
+
const tileWidth = isRectangleTile ? config.legend_item_tile_width : config.legend_item_tile_r * 2;
|
|
14506
|
+
const tileHeight = isRectangleTile ? config.legend_item_tile_height : config.legend_item_tile_r * 2;
|
|
14507
|
+
const iconWidth = tileWidth * 0.75;
|
|
14508
|
+
const iconHeight = tileHeight * 0.75;
|
|
14509
|
+
const customScaleX = tileWidth / 8;
|
|
14510
|
+
const customScaleY = tileHeight / 8;
|
|
14330
14511
|
$T(tiles, withTransition).each(function() {
|
|
14331
14512
|
const nodeName = this.nodeName.toLowerCase();
|
|
14332
|
-
const pointR = config.point_r;
|
|
14333
14513
|
let x = "x";
|
|
14334
14514
|
let y = "y";
|
|
14335
|
-
let xOffset = 2;
|
|
14336
|
-
let yOffset = 2.5;
|
|
14337
14515
|
let radius = null;
|
|
14338
14516
|
let width = null;
|
|
14339
14517
|
let height = null;
|
|
14340
14518
|
if (nodeName === "circle") {
|
|
14341
|
-
const size = pointR * 0.2;
|
|
14342
14519
|
x = "cx";
|
|
14343
14520
|
y = "cy";
|
|
14344
|
-
radius =
|
|
14345
|
-
xOffset = pointR * 2;
|
|
14346
|
-
yOffset = -size;
|
|
14521
|
+
radius = Math.min(iconWidth, iconHeight) / 2;
|
|
14347
14522
|
} else if (nodeName === "rect") {
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14523
|
+
width = iconWidth;
|
|
14524
|
+
height = iconHeight;
|
|
14525
|
+
}
|
|
14526
|
+
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);
|
|
14527
|
+
if (nodeName === "use") {
|
|
14528
|
+
tile.attr("transform", (d) => `translate(${posFn.x1Tile(d)} ${posFn.yTile(d) - tileHeight / 2}) scale(${customScaleX} ${customScaleY})`);
|
|
14529
|
+
} else {
|
|
14530
|
+
tile.attr(x, (d) => posFn.x1Tile(d) + (tileWidth - (width || 0)) / 2).attr(y, (d) => posFn.yTile(d) - (height || 0) / 2);
|
|
14352
14531
|
}
|
|
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
14532
|
});
|
|
14355
14533
|
} else {
|
|
14356
14534
|
const tiles = legend.selectAll(`.${$LEGEND.legendItemTile}`).data(targetIdz);
|
|
@@ -14599,7 +14777,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
|
|
|
14599
14777
|
$$.updateSvgSize();
|
|
14600
14778
|
$$.transformAll(options.withTransitionForTransform, transitions);
|
|
14601
14779
|
}
|
|
14602
|
-
$$.redraw(options
|
|
14780
|
+
$$.redraw(options);
|
|
14603
14781
|
}
|
|
14604
14782
|
});
|
|
14605
14783
|
|
|
@@ -15146,7 +15324,7 @@ function batchGetBBox(elements) {
|
|
|
15146
15324
|
return toMap(
|
|
15147
15325
|
elements,
|
|
15148
15326
|
(element) => element,
|
|
15149
|
-
(element) => getBBox(element)
|
|
15327
|
+
(element) => getBBox(element, true)
|
|
15150
15328
|
);
|
|
15151
15329
|
}
|
|
15152
15330
|
|
|
@@ -15160,7 +15338,7 @@ function batchGetBBox(elements) {
|
|
|
15160
15338
|
/* harmony default export */ var internals_text = ({
|
|
15161
15339
|
opacityForText(d) {
|
|
15162
15340
|
const $$ = this;
|
|
15163
|
-
return $$.isBarType(d) && !meetsLabelThreshold.call($$, Math.abs($$.getRatio("bar", d)), "bar") ? "0" : $$.hasDataLabel ? null : "0";
|
|
15341
|
+
return $$.isBarType(d) && !meetsLabelThreshold.call($$, Math.abs($$.getRatio("bar", d)), "bar") ? "0" : $$.hasDataLabel() ? null : "0";
|
|
15164
15342
|
},
|
|
15165
15343
|
/**
|
|
15166
15344
|
* Initializes the text
|
|
@@ -15330,8 +15508,8 @@ function batchGetBBox(elements) {
|
|
|
15330
15508
|
);
|
|
15331
15509
|
const isInverted = config[`axis_${axis == null ? void 0 : axis.getId(d.id)}_inverted`];
|
|
15332
15510
|
let pos = {
|
|
15333
|
-
x: getX.
|
|
15334
|
-
y: getY.
|
|
15511
|
+
x: getX.call(this, d, i, labelDimension),
|
|
15512
|
+
y: getY.call(this, d, i, labelDimension)
|
|
15335
15513
|
};
|
|
15336
15514
|
if (angle) {
|
|
15337
15515
|
pos = setRotatePos.bind($$)(d, pos, anchorString, isRotated, isInverted);
|
|
@@ -15657,6 +15835,14 @@ function _getCanvasTitleHeight($$) {
|
|
|
15657
15835
|
title.attr("transform", `translate(${x}, ${y})`);
|
|
15658
15836
|
}
|
|
15659
15837
|
},
|
|
15838
|
+
/**
|
|
15839
|
+
* Get canvas title height using the same SVG text measurement as title padding.
|
|
15840
|
+
* @returns {number} Title height
|
|
15841
|
+
* @private
|
|
15842
|
+
*/
|
|
15843
|
+
getCanvasTitleHeight() {
|
|
15844
|
+
return _getCanvasTitleHeight(this);
|
|
15845
|
+
},
|
|
15660
15846
|
/**
|
|
15661
15847
|
* Get title padding
|
|
15662
15848
|
* @returns {number} padding value
|
|
@@ -15668,7 +15854,7 @@ function _getCanvasTitleHeight($$) {
|
|
|
15668
15854
|
const paddingTop = config.title_padding.top || 0;
|
|
15669
15855
|
const paddingBottom = config.title_padding.bottom || 0;
|
|
15670
15856
|
if (state.isCanvasMode && config.title_text) {
|
|
15671
|
-
return paddingTop +
|
|
15857
|
+
return paddingTop + $$.getCanvasTitleHeight() + paddingBottom;
|
|
15672
15858
|
}
|
|
15673
15859
|
if (!(title == null ? void 0 : title.node())) {
|
|
15674
15860
|
return paddingTop + paddingBottom;
|
|
@@ -15809,7 +15995,8 @@ const RE_TOOLTIP_TPL = /{{(.*)}}/;
|
|
|
15809
15995
|
let i;
|
|
15810
15996
|
for (i = 0; i < len; i++) {
|
|
15811
15997
|
row = d[i];
|
|
15812
|
-
|
|
15998
|
+
const rowValue = row && getRowValue(row);
|
|
15999
|
+
if (!row || !(rowValue || rowValue === 0)) {
|
|
15813
16000
|
continue;
|
|
15814
16001
|
}
|
|
15815
16002
|
if (isUndefined(text)) {
|
|
@@ -16608,7 +16795,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
16608
16795
|
const { hasRadar, hasTreemap } = $$.state;
|
|
16609
16796
|
const shape = { type: {}, indices: {}, pos: {} };
|
|
16610
16797
|
!hasTreemap && ["bar", "candlestick", "line", "area"].forEach((v) => {
|
|
16611
|
-
const name = capitalize(
|
|
16798
|
+
const name = capitalize(v);
|
|
16612
16799
|
if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) {
|
|
16613
16800
|
const indices = $$.getShapeIndices($$[`is${name}Type`]);
|
|
16614
16801
|
const drawFn = $$[`generateDraw${name}`];
|
|
@@ -17525,7 +17712,7 @@ class ChartInternal {
|
|
|
17525
17712
|
);
|
|
17526
17713
|
}
|
|
17527
17714
|
initWithData(data2) {
|
|
17528
|
-
var _a, _b, _c, _d, _e;
|
|
17715
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17529
17716
|
const $$ = this;
|
|
17530
17717
|
const { config, scale: scale2, state, $el, org } = $$;
|
|
17531
17718
|
const { hasAxis, hasFunnel, hasTreemap } = state;
|
|
@@ -17600,15 +17787,21 @@ class ChartInternal {
|
|
|
17600
17787
|
if (hasInteraction && state.inputType) {
|
|
17601
17788
|
const isTouch = state.inputType === "touch";
|
|
17602
17789
|
const { onclick, onover, onout } = config;
|
|
17790
|
+
const preventDefault = (_a = config.interaction_inputType_touch) == null ? void 0 : _a.preventDefault;
|
|
17791
|
+
const isPrevented = isBoolean(preventDefault) && preventDefault || false;
|
|
17792
|
+
const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
|
|
17793
|
+
const touchOption = isTouch ? {
|
|
17794
|
+
passive: !isPrevented && preventThreshold === null
|
|
17795
|
+
} : void 0;
|
|
17603
17796
|
$el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
|
|
17604
17797
|
isTouch ? "touchstart" : "mouseenter",
|
|
17605
17798
|
(onover == null ? void 0 : onover.bind($$.api)) || null,
|
|
17606
|
-
|
|
17799
|
+
touchOption
|
|
17607
17800
|
).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
|
|
17608
17801
|
}
|
|
17609
17802
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
17610
17803
|
const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
17611
|
-
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((
|
|
17804
|
+
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_b = $$.hasLegendDefsPoint) == null ? void 0 : _b.call($$))) {
|
|
17612
17805
|
$el.defs = $el.svg.append("defs");
|
|
17613
17806
|
if (hasAxis) {
|
|
17614
17807
|
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
@@ -17632,16 +17825,16 @@ class ChartInternal {
|
|
|
17632
17825
|
main.append("text").attr("class", `${$TEXT.text} ${$COMMON.empty}`).attr("text-anchor", "middle").attr("dominant-baseline", "middle");
|
|
17633
17826
|
}
|
|
17634
17827
|
if (hasAxis) {
|
|
17635
|
-
config.regions.length && ((
|
|
17828
|
+
config.regions.length && ((_c = $$.initRegion) == null ? void 0 : _c.call($$));
|
|
17636
17829
|
!config.clipPath && $$.axis.init();
|
|
17637
17830
|
}
|
|
17638
17831
|
main.append("g").classed($COMMON.chart, true).attr("clip-path", hasAxis ? state.clip.path : null);
|
|
17639
17832
|
$$.callPluginHook("$init");
|
|
17640
17833
|
$$.initChartElements();
|
|
17641
17834
|
if (hasAxis) {
|
|
17642
|
-
hasInteraction && ((
|
|
17643
|
-
(
|
|
17644
|
-
config.clipPath && ((
|
|
17835
|
+
hasInteraction && ((_d = $$.initEventRect) == null ? void 0 : _d.call($$));
|
|
17836
|
+
(_e = $$.initGrid) == null ? void 0 : _e.call($$);
|
|
17837
|
+
config.clipPath && ((_f = $$.axis) == null ? void 0 : _f.init());
|
|
17645
17838
|
}
|
|
17646
17839
|
$$.updateTargets($$.data.targets);
|
|
17647
17840
|
$$.updateDimension();
|
|
@@ -17951,6 +18144,8 @@ const CANVAS_SELECTABLE_TYPE_FILTERS = [
|
|
|
17951
18144
|
isCanvasCandlestickType,
|
|
17952
18145
|
isCanvasTreemapType
|
|
17953
18146
|
];
|
|
18147
|
+
const CANVAS_LEGEND_TOUCH_TAP_THRESHOLD = 10;
|
|
18148
|
+
const CANVAS_LEGEND_TOUCH_CLICK_TIMEOUT = 750;
|
|
17954
18149
|
const CANVAS_SUBCHART_HANDLE_SIZE = 6;
|
|
17955
18150
|
const CANVAS_SUBCHART_CLICK_TOLERANCE = 2;
|
|
17956
18151
|
const CANVAS_FLOW_ANIMATION_MAX_VALUES = 1e5;
|
|
@@ -17988,7 +18183,7 @@ function getCanvasLegendPointIcon($$, id) {
|
|
|
17988
18183
|
const pattern = getCanvasLegendPointPattern($$, id);
|
|
17989
18184
|
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
18185
|
const paintAttrs = `fill="${color}" stroke="${color}"`;
|
|
17991
|
-
if (/^rect(angle)?$/i.test(pattern)
|
|
18186
|
+
if (/^rect(angle)?$/i.test(pattern)) {
|
|
17992
18187
|
return `<svg ${svgAttrs}><rect x="1" y="1" width="6" height="6" ${paintAttrs}></rect></svg>`;
|
|
17993
18188
|
}
|
|
17994
18189
|
if (!pattern || /^circle$/i.test(pattern)) {
|
|
@@ -18043,15 +18238,58 @@ function revertCanvasLegendTargetFocus($$) {
|
|
|
18043
18238
|
state.defocusedTargetIds = /* @__PURE__ */ new Set();
|
|
18044
18239
|
changed && ((_c = $$.renderCanvasFrame) == null ? void 0 : _c.call($$, void 0, null, false));
|
|
18045
18240
|
}
|
|
18241
|
+
function getCanvasLegendTouchPoint(event) {
|
|
18242
|
+
var _a, _b;
|
|
18243
|
+
return ((_a = event.changedTouches) == null ? void 0 : _a[0]) || ((_b = event.touches) == null ? void 0 : _b[0]);
|
|
18244
|
+
}
|
|
18245
|
+
function setCanvasLegendTouchStart($$, id, event) {
|
|
18246
|
+
const touch = getCanvasLegendTouchPoint(event);
|
|
18247
|
+
$$.state.canvasLegendTouch = touch ? {
|
|
18248
|
+
id,
|
|
18249
|
+
x: touch.clientX,
|
|
18250
|
+
y: touch.clientY,
|
|
18251
|
+
moved: false
|
|
18252
|
+
} : null;
|
|
18253
|
+
}
|
|
18254
|
+
function updateCanvasLegendTouchMove($$, event) {
|
|
18255
|
+
const start = $$.state.canvasLegendTouch;
|
|
18256
|
+
const touch = start && getCanvasLegendTouchPoint(event);
|
|
18257
|
+
if (touch) {
|
|
18258
|
+
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;
|
|
18259
|
+
}
|
|
18260
|
+
}
|
|
18261
|
+
function isCanvasLegendTouchTap($$, id, event) {
|
|
18262
|
+
updateCanvasLegendTouchMove($$, event);
|
|
18263
|
+
const start = $$.state.canvasLegendTouch;
|
|
18264
|
+
$$.state.canvasLegendTouch = null;
|
|
18265
|
+
return !!start && start.id === id && !start.moved;
|
|
18266
|
+
}
|
|
18267
|
+
function markCanvasLegendTouchClick($$, id) {
|
|
18268
|
+
$$.state.canvasLegendLastTouchClickId = id;
|
|
18269
|
+
$$.state.canvasLegendLastTouchClickTime = Date.now();
|
|
18270
|
+
}
|
|
18271
|
+
function isDuplicateCanvasLegendTouchClick($$, id) {
|
|
18272
|
+
const { state } = $$;
|
|
18273
|
+
const duplicate = state.canvasLegendLastTouchClickId === id && Date.now() - (state.canvasLegendLastTouchClickTime || 0) < CANVAS_LEGEND_TOUCH_CLICK_TIMEOUT;
|
|
18274
|
+
if (duplicate) {
|
|
18275
|
+
state.canvasLegendLastTouchClickId = null;
|
|
18276
|
+
state.canvasLegendLastTouchClickTime = 0;
|
|
18277
|
+
}
|
|
18278
|
+
return duplicate;
|
|
18279
|
+
}
|
|
18046
18280
|
function bindCanvasHtmlLegendInteractions($$, item) {
|
|
18047
18281
|
const { api, config, state } = $$;
|
|
18048
|
-
item.on("click
|
|
18282
|
+
item.on("click dblclick mouseover mouseout touchstart touchmove touchend", null);
|
|
18049
18283
|
if (!config.interaction_enabled) {
|
|
18050
18284
|
return;
|
|
18051
18285
|
}
|
|
18052
18286
|
const interaction = config.legend_item_interaction;
|
|
18053
18287
|
const eventType = typeof interaction === "object" && (interaction == null ? void 0 : interaction.dblclick) ? "dblclick" : "click";
|
|
18054
|
-
|
|
18288
|
+
const isTouch = state.inputType === "touch";
|
|
18289
|
+
const hasClickInteraction = interaction || isFunction(config.legend_item_onclick);
|
|
18290
|
+
const touchOption = isTouch ? getCanvasTouchListenerOption(config) : void 0;
|
|
18291
|
+
const handleCanvasLegendToggle = function(event, id) {
|
|
18292
|
+
var _a;
|
|
18055
18293
|
if (!callFn(config.legend_item_onclick, api, id, !state.hiddenTargetIds.has(id))) {
|
|
18056
18294
|
const selected = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
18057
18295
|
if (event.type === "dblclick" || event.altKey) {
|
|
@@ -18067,15 +18305,30 @@ function bindCanvasHtmlLegendInteractions($$, item) {
|
|
|
18067
18305
|
}
|
|
18068
18306
|
revertCanvasLegendTargetFocus($$);
|
|
18069
18307
|
}
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18308
|
+
isTouch && ((_a = $$.hideTooltip) == null ? void 0 : _a.call($$));
|
|
18309
|
+
};
|
|
18310
|
+
item.on(eventType, hasClickInteraction ? function(event, id) {
|
|
18311
|
+
if (isTouch && event.type === "click" && isDuplicateCanvasLegendTouchClick($$, id)) {
|
|
18312
|
+
return;
|
|
18313
|
+
}
|
|
18314
|
+
handleCanvasLegendToggle.call(this, event, id);
|
|
18315
|
+
} : null);
|
|
18316
|
+
isTouch && eventType === "click" && hasClickInteraction && item.on("touchstart", function(event, id) {
|
|
18317
|
+
setCanvasLegendTouchStart($$, id, event);
|
|
18318
|
+
}, touchOption).on("touchmove", (event) => {
|
|
18319
|
+
updateCanvasLegendTouchMove($$, event);
|
|
18320
|
+
}, touchOption).on("touchend", function(event, id) {
|
|
18321
|
+
if (isCanvasLegendTouchTap($$, id, event)) {
|
|
18322
|
+
markCanvasLegendTouchClick($$, id);
|
|
18323
|
+
handleCanvasLegendToggle.call(this, event, id);
|
|
18324
|
+
}
|
|
18325
|
+
}, touchOption);
|
|
18326
|
+
!isTouch && item.on("mouseover", interaction || isFunction(config.legend_item_onover) ? function(event, id) {
|
|
18327
|
+
if (!callFn(config.legend_item_onover, api, id, !state.hiddenTargetIds.has(id))) {
|
|
18328
|
+
setCanvasHtmlLegendFocus($$, id);
|
|
18329
|
+
!state.transiting && $$.isTargetToShow(id) && setCanvasLegendTargetFocus($$, id);
|
|
18330
|
+
}
|
|
18331
|
+
} : null).on("mouseout", interaction || isFunction(config.legend_item_onout) ? function(event, id) {
|
|
18079
18332
|
if (!callFn(config.legend_item_onout, api, id, !state.hiddenTargetIds.has(id))) {
|
|
18080
18333
|
revertCanvasHtmlLegendFocus($$);
|
|
18081
18334
|
revertCanvasLegendTargetFocus($$);
|
|
@@ -19721,7 +19974,7 @@ const canvasInternal = {
|
|
|
19721
19974
|
return;
|
|
19722
19975
|
}
|
|
19723
19976
|
this.dispatchCanvasDataClick(event, true);
|
|
19724
|
-
this.
|
|
19977
|
+
this.dispatchCanvasDataOut(this.$el.canvas.node());
|
|
19725
19978
|
(_c = this.config.onout) == null ? void 0 : _c.bind(this.api)(event);
|
|
19726
19979
|
},
|
|
19727
19980
|
/**
|
|
@@ -19895,16 +20148,19 @@ const canvasInternal = {
|
|
|
19895
20148
|
state._canvasVisibleRangeCache = null;
|
|
19896
20149
|
state._canvasXTickValuesCache = null;
|
|
19897
20150
|
$$.canvasEngine.beginFrame(state.current.width, $$.getCanvasSurfaceHeight());
|
|
19898
|
-
|
|
19899
|
-
|
|
19900
|
-
|
|
19901
|
-
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19906
|
-
|
|
19907
|
-
|
|
20151
|
+
try {
|
|
20152
|
+
$$.canvasRenderer.drawBackground($$);
|
|
20153
|
+
$$.canvasAxisRenderer.drawTitle($$);
|
|
20154
|
+
state.hasAxis && $$.canvasAxisRenderer.draw($$);
|
|
20155
|
+
$$.canvasRenderer.draw($$, drawShape);
|
|
20156
|
+
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
20157
|
+
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
20158
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
20159
|
+
$$.canvasRenderer.drawEmptyLabel($$);
|
|
20160
|
+
rebuildHit && $$.hitDetector.rebuild($$, drawShape);
|
|
20161
|
+
} finally {
|
|
20162
|
+
$$.canvasEngine.endFrame();
|
|
20163
|
+
}
|
|
19908
20164
|
$$.canvasEngine.clearOverlay();
|
|
19909
20165
|
state.canvasFocusMainRedraw = false;
|
|
19910
20166
|
focusData && $$.renderCanvasFocus(focusData);
|
|
@@ -19923,15 +20179,18 @@ const canvasInternal = {
|
|
|
19923
20179
|
if (withMainRedraw) {
|
|
19924
20180
|
const drawShape = state.canvasShape || $$.getDrawShape();
|
|
19925
20181
|
$$.canvasEngine.beginFrame(state.current.width, $$.getCanvasSurfaceHeight());
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
|
|
19934
|
-
|
|
20182
|
+
try {
|
|
20183
|
+
$$.canvasRenderer.drawBackground($$);
|
|
20184
|
+
$$.canvasAxisRenderer.drawTitle($$);
|
|
20185
|
+
state.hasAxis && $$.canvasAxisRenderer.draw($$);
|
|
20186
|
+
$$.canvasRenderer.draw($$, drawShape, focusData);
|
|
20187
|
+
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
20188
|
+
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
20189
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
20190
|
+
$$.canvasRenderer.drawEmptyLabel($$);
|
|
20191
|
+
} finally {
|
|
20192
|
+
$$.canvasEngine.endFrame();
|
|
20193
|
+
}
|
|
19935
20194
|
}
|
|
19936
20195
|
state.canvasFocusMainRedraw = !!withMainRedraw;
|
|
19937
20196
|
$$.canvasEngine.withOverlay((ctx) => {
|
|
@@ -20073,6 +20332,7 @@ function loadConfig(config) {
|
|
|
20073
20332
|
;// ./src/Chart/api/chart.ts
|
|
20074
20333
|
|
|
20075
20334
|
|
|
20335
|
+
|
|
20076
20336
|
/* harmony default export */ var chart = ({
|
|
20077
20337
|
/**
|
|
20078
20338
|
* Resize the chart.
|
|
@@ -20164,22 +20424,25 @@ function loadConfig(config) {
|
|
|
20164
20424
|
* chart.destroy();
|
|
20165
20425
|
*/
|
|
20166
20426
|
destroy() {
|
|
20167
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
20427
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
20168
20428
|
const $$ = this.internal;
|
|
20169
20429
|
const { state, $el: { chart, style, svg } } = $$;
|
|
20170
20430
|
if (notEmpty($$)) {
|
|
20171
20431
|
$$.callPluginHook("$willDestroy");
|
|
20172
20432
|
(_a = $$.cache) == null ? void 0 : _a.remove(["setOverOut", "callOverOutForTouch"]);
|
|
20173
20433
|
$$.charts.splice($$.charts.indexOf(this), 1);
|
|
20434
|
+
$$.charts.length === 0 && cleanupWorkers();
|
|
20174
20435
|
$$.unbindAllEvents();
|
|
20175
20436
|
svg == null ? void 0 : svg.select("*").interrupt();
|
|
20176
20437
|
state.canvasFlowFrame !== null && ((_c = (_b = win).cancelAnimationFrame) == null ? void 0 : _c.call(_b, state.canvasFlowFrame));
|
|
20177
20438
|
state.canvasFlowFrame = null;
|
|
20178
20439
|
state.canvasFlowFinish = null;
|
|
20179
|
-
(_d =
|
|
20180
|
-
|
|
20181
|
-
(_f = $$.
|
|
20182
|
-
(
|
|
20440
|
+
state.pendingRaf !== null && ((_e = (_d = win).cancelAnimationFrame) == null ? void 0 : _e.call(_d, state.pendingRaf));
|
|
20441
|
+
state.pendingRaf = null;
|
|
20442
|
+
(_f = $$.canvasRenderer) == null ? void 0 : _f.destroy();
|
|
20443
|
+
(_g = $$.canvasEngine) == null ? void 0 : _g.destroy();
|
|
20444
|
+
(_h = $$.resizeFunction) == null ? void 0 : _h.clear();
|
|
20445
|
+
(_j = (_i = $$.resizeFunction) == null ? void 0 : _i.resizeObserver) == null ? void 0 : _j.disconnect();
|
|
20183
20446
|
$$.resizeFunction && win.removeEventListener("resize", $$.resizeFunction);
|
|
20184
20447
|
chart.classed("bb", false).style("position", null);
|
|
20185
20448
|
if (state.isCanvasMode) {
|
|
@@ -20451,9 +20714,22 @@ extend(api_data_data, {
|
|
|
20451
20714
|
* chart.focus();
|
|
20452
20715
|
*/
|
|
20453
20716
|
focus(targetIdsValue) {
|
|
20717
|
+
var _a;
|
|
20454
20718
|
const $$ = this.internal;
|
|
20455
20719
|
const { state } = $$;
|
|
20456
20720
|
const targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
20721
|
+
if (state.isCanvasMode) {
|
|
20722
|
+
const focusedIds = targetIds.filter($$.isTargetToShow, $$);
|
|
20723
|
+
const focusedSet = new Set(focusedIds);
|
|
20724
|
+
const defocusedIds = $$.mapToTargetIds().filter((id) => !focusedSet.has(id) && $$.isTargetToShow(id));
|
|
20725
|
+
$$.revertLegend();
|
|
20726
|
+
$$.toggleFocusLegend(defocusedIds, false);
|
|
20727
|
+
$$.toggleFocusLegend(focusedIds, true);
|
|
20728
|
+
state.focusedTargetIds = focusedSet;
|
|
20729
|
+
state.defocusedTargetIds = new Set(defocusedIds);
|
|
20730
|
+
(_a = $$.renderCanvasFrame) == null ? void 0 : _a.call($$, void 0, null, false);
|
|
20731
|
+
return;
|
|
20732
|
+
}
|
|
20457
20733
|
const candidates = $$.$el.svg.selectAll(
|
|
20458
20734
|
$$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))
|
|
20459
20735
|
);
|
|
@@ -20486,9 +20762,18 @@ extend(api_data_data, {
|
|
|
20486
20762
|
* chart.defocus();
|
|
20487
20763
|
*/
|
|
20488
20764
|
defocus(targetIdsValue) {
|
|
20765
|
+
var _a;
|
|
20489
20766
|
const $$ = this.internal;
|
|
20490
20767
|
const { state } = $$;
|
|
20491
20768
|
const targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
20769
|
+
if (state.isCanvasMode) {
|
|
20770
|
+
const defocusedIds = targetIds.filter($$.isTargetToShow, $$);
|
|
20771
|
+
$$.toggleFocusLegend(defocusedIds, false);
|
|
20772
|
+
defocusedIds.forEach((id) => state.focusedTargetIds.delete(id));
|
|
20773
|
+
state.defocusedTargetIds = new Set(defocusedIds);
|
|
20774
|
+
(_a = $$.renderCanvasFrame) == null ? void 0 : _a.call($$, void 0, null, false);
|
|
20775
|
+
return;
|
|
20776
|
+
}
|
|
20492
20777
|
const candidates = $$.$el.svg.selectAll(
|
|
20493
20778
|
$$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))
|
|
20494
20779
|
);
|
|
@@ -20519,9 +20804,23 @@ extend(api_data_data, {
|
|
|
20519
20804
|
* chart.revert();
|
|
20520
20805
|
*/
|
|
20521
20806
|
revert(targetIdsValue) {
|
|
20807
|
+
var _a, _b, _c;
|
|
20522
20808
|
const $$ = this.internal;
|
|
20523
20809
|
const { config, state, $el } = $$;
|
|
20524
20810
|
const targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
20811
|
+
if (state.isCanvasMode) {
|
|
20812
|
+
const changed = !!((_a = state.focusedTargetIds) == null ? void 0 : _a.size) || !!((_b = state.defocusedTargetIds) == null ? void 0 : _b.size);
|
|
20813
|
+
if (config.legend_show) {
|
|
20814
|
+
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
20815
|
+
$el.legend.selectAll($$.selectorLegends(targetIds)).filter(function() {
|
|
20816
|
+
return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused);
|
|
20817
|
+
}).classed($FOCUS.legendItemFocused, false);
|
|
20818
|
+
}
|
|
20819
|
+
state.focusedTargetIds = /* @__PURE__ */ new Set();
|
|
20820
|
+
state.defocusedTargetIds = /* @__PURE__ */ new Set();
|
|
20821
|
+
changed && ((_c = $$.renderCanvasFrame) == null ? void 0 : _c.call($$, void 0, null, false));
|
|
20822
|
+
return;
|
|
20823
|
+
}
|
|
20525
20824
|
const candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
|
|
20526
20825
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
|
|
20527
20826
|
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
@@ -20764,7 +21063,12 @@ const legend_legend = {
|
|
|
20764
21063
|
return;
|
|
20765
21064
|
}
|
|
20766
21065
|
if (hasUnload) {
|
|
20767
|
-
$$.
|
|
21066
|
+
const unloadIds = $$.mapToTargetIds(args.unload === true ? null : args.unload);
|
|
21067
|
+
$$.unload(unloadIds, () => {
|
|
21068
|
+
if (!$$.config || !$$.cache) {
|
|
21069
|
+
return;
|
|
21070
|
+
}
|
|
21071
|
+
$$.cache.remove(unloadIds);
|
|
20768
21072
|
requestIdleCallback(() => $$.loadFromArgs(args));
|
|
20769
21073
|
});
|
|
20770
21074
|
} else {
|
|
@@ -20809,6 +21113,9 @@ const legend_legend = {
|
|
|
20809
21113
|
$$.state.dirty.data = true;
|
|
20810
21114
|
$$.state._eventRectFingerprint = null;
|
|
20811
21115
|
$$.unload(ids, () => {
|
|
21116
|
+
if (!$$.config || !$$.cache) {
|
|
21117
|
+
return;
|
|
21118
|
+
}
|
|
20812
21119
|
$$.redraw({
|
|
20813
21120
|
withUpdateOrgXDomain: true,
|
|
20814
21121
|
withUpdateXDomain: true,
|
|
@@ -21015,7 +21322,7 @@ const tooltip_tooltip = {
|
|
|
21015
21322
|
* });
|
|
21016
21323
|
*/
|
|
21017
21324
|
show: function(args) {
|
|
21018
|
-
var _a, _b, _c;
|
|
21325
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
21019
21326
|
const $$ = this.internal;
|
|
21020
21327
|
const { $el, config, state: { eventReceiver, hasFunnel, hasTreemap, inputType } } = $$;
|
|
21021
21328
|
let index;
|
|
@@ -21042,6 +21349,24 @@ const tooltip_tooltip = {
|
|
|
21042
21349
|
} else if (isDefined(args.index)) {
|
|
21043
21350
|
index = args.index;
|
|
21044
21351
|
}
|
|
21352
|
+
if ($$.state.isCanvasMode) {
|
|
21353
|
+
const targets = ((_d = $$.filterTargetsToShow) == null ? void 0 : _d.call($$)) || $$.data.targets;
|
|
21354
|
+
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);
|
|
21355
|
+
const canvas = (_g = (_f = $el.canvas) == null ? void 0 : _f.node) == null ? void 0 : _g.call(_f);
|
|
21356
|
+
const shape = $$.state.canvasShape || ((_h = $$.getDrawShape) == null ? void 0 : _h.call($$));
|
|
21357
|
+
const first = selectedData[0];
|
|
21358
|
+
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) ? [
|
|
21359
|
+
$$.state.margin.left + shape.pos.cx(first),
|
|
21360
|
+
$$.state.margin.top + shape.pos.cy(first)
|
|
21361
|
+
] : void 0);
|
|
21362
|
+
if (!selectedData.length || !canvas) {
|
|
21363
|
+
return;
|
|
21364
|
+
}
|
|
21365
|
+
$$.state.canvasFocusKey = selectedData.map((v) => `${v.id}:${v.index}`).join("|");
|
|
21366
|
+
(_k = $$.renderCanvasFocus) == null ? void 0 : _k.call($$, selectedData, point);
|
|
21367
|
+
(_l = $$.showTooltip) == null ? void 0 : _l.call($$, selectedData, canvas);
|
|
21368
|
+
return;
|
|
21369
|
+
}
|
|
21045
21370
|
(inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach((eventName) => {
|
|
21046
21371
|
$$.dispatchEvent(eventName, index, mouse);
|
|
21047
21372
|
});
|
|
@@ -21058,6 +21383,7 @@ const tooltip_tooltip = {
|
|
|
21058
21383
|
const { state: { inputType, isCanvasMode }, $el: { tooltip: tooltip2 } } = $$;
|
|
21059
21384
|
const data = tooltip2 == null ? void 0 : tooltip2.datum();
|
|
21060
21385
|
if (isCanvasMode) {
|
|
21386
|
+
$$.state.canvasFocusKey = null;
|
|
21061
21387
|
$$.hideTooltip(true);
|
|
21062
21388
|
(_a = $$.clearCanvasFocus) == null ? void 0 : _a.call($$);
|
|
21063
21389
|
return;
|
|
@@ -21216,11 +21542,9 @@ function getGlyph(svg) {
|
|
|
21216
21542
|
};
|
|
21217
21543
|
};
|
|
21218
21544
|
if (t.childElementCount > 1) {
|
|
21219
|
-
const text = [];
|
|
21220
21545
|
toArray(t.querySelectorAll("tspan")).filter(filterFn).forEach((ts) => {
|
|
21221
21546
|
glyph.push(getStyleFn(ts));
|
|
21222
21547
|
});
|
|
21223
|
-
return text;
|
|
21224
21548
|
} else {
|
|
21225
21549
|
glyph.push(getStyleFn(t));
|
|
21226
21550
|
}
|
|
@@ -21477,6 +21801,9 @@ let exportApi = () => {
|
|
|
21477
21801
|
$$.data.targets.forEach((t) => {
|
|
21478
21802
|
for (let i = 0; i < notfoundIds.length; i++) {
|
|
21479
21803
|
if (t.id === notfoundIds[i]) {
|
|
21804
|
+
if (!t.values[t.values.length - 1]) {
|
|
21805
|
+
continue;
|
|
21806
|
+
}
|
|
21480
21807
|
tail = t.values[t.values.length - 1].index + 1;
|
|
21481
21808
|
for (let j = 0; j < length; j++) {
|
|
21482
21809
|
t.values.push({
|
|
@@ -21948,8 +22275,17 @@ extend(ygrids, {
|
|
|
21948
22275
|
|
|
21949
22276
|
|
|
21950
22277
|
|
|
22278
|
+
const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`;
|
|
21951
22279
|
const _getGridTextAnchor = (d) => isValue(d.position) || "end";
|
|
21952
22280
|
const _getGridTextDx = (d) => d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
|
22281
|
+
function _getGridFocusEl($$) {
|
|
22282
|
+
var _a;
|
|
22283
|
+
const { state, $el: { main } } = $$;
|
|
22284
|
+
const cached = state._gridFocusEl;
|
|
22285
|
+
const mainNode = main.node();
|
|
22286
|
+
const cachedNodes = ((_a = cached == null ? void 0 : cached.nodes) == null ? void 0 : _a.call(cached)) || [];
|
|
22287
|
+
return cachedNodes.length && cachedNodes.every((node) => mainNode == null ? void 0 : mainNode.contains(node)) ? cached : state._gridFocusEl = main.selectAll(GRID_FOCUS_SELECTOR);
|
|
22288
|
+
}
|
|
21953
22289
|
function _getGridTextX(isX, width, height) {
|
|
21954
22290
|
return (d) => {
|
|
21955
22291
|
let x = isX ? 0 : width;
|
|
@@ -22017,8 +22353,9 @@ function _smoothLines(el, type) {
|
|
|
22017
22353
|
grid.x.each(function() {
|
|
22018
22354
|
const grid2 = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
22019
22355
|
Object.keys(state.xgridAttr).forEach((id) => {
|
|
22020
|
-
grid2.attr(id, state.xgridAttr[id])
|
|
22356
|
+
grid2.attr(id, state.xgridAttr[id]);
|
|
22021
22357
|
});
|
|
22358
|
+
grid2.style("opacity", () => +grid2.attr(isRotated ? "y1" : "x1") === (isRotated ? state.height : 0) ? "0" : null);
|
|
22022
22359
|
});
|
|
22023
22360
|
}
|
|
22024
22361
|
},
|
|
@@ -22161,13 +22498,11 @@ function _smoothLines(el, type) {
|
|
|
22161
22498
|
* @private
|
|
22162
22499
|
*/
|
|
22163
22500
|
showGridFocus(data) {
|
|
22164
|
-
var _a
|
|
22501
|
+
var _a;
|
|
22165
22502
|
const $$ = this;
|
|
22166
|
-
const { config, state
|
|
22503
|
+
const { config, state: { width, height } } = $$;
|
|
22167
22504
|
const isRotated = config.axis_rotated;
|
|
22168
|
-
const focusEl = (
|
|
22169
|
-
`line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`
|
|
22170
|
-
);
|
|
22505
|
+
const focusEl = _getGridFocusEl($$);
|
|
22171
22506
|
const dataToShow = (data || [focusEl.datum()]).filter(
|
|
22172
22507
|
(d) => d && isValue($$.getBaseValue(d))
|
|
22173
22508
|
);
|
|
@@ -22220,18 +22555,16 @@ function _smoothLines(el, type) {
|
|
|
22220
22555
|
["x1", "y1", "x2", "y2"].forEach((v, i) => el.attr(v, xy[i]));
|
|
22221
22556
|
});
|
|
22222
22557
|
_smoothLines(focusEl, "grid");
|
|
22223
|
-
(
|
|
22558
|
+
(_a = $$.showCircleFocus) == null ? void 0 : _a.call($$, data);
|
|
22224
22559
|
},
|
|
22225
|
-
hideGridFocus() {
|
|
22226
|
-
var _a
|
|
22560
|
+
hideGridFocus(force = false) {
|
|
22561
|
+
var _a;
|
|
22227
22562
|
const $$ = this;
|
|
22228
|
-
const { state
|
|
22229
|
-
if (inputType === "mouse" || !resizing) {
|
|
22230
|
-
const focusEl = (
|
|
22231
|
-
`line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`
|
|
22232
|
-
);
|
|
22563
|
+
const { state: { inputType, resizing } } = $$;
|
|
22564
|
+
if (force || inputType === "mouse" || !resizing) {
|
|
22565
|
+
const focusEl = _getGridFocusEl($$);
|
|
22233
22566
|
focusEl.style("visibility", "hidden");
|
|
22234
|
-
(
|
|
22567
|
+
(_a = $$.hideCircleFocus) == null ? void 0 : _a.call($$);
|
|
22235
22568
|
}
|
|
22236
22569
|
},
|
|
22237
22570
|
updateGridFocus() {
|
|
@@ -22256,7 +22589,7 @@ function _smoothLines(el, type) {
|
|
|
22256
22589
|
const tickNum = $$.$el.main.select(`.${$AXIS.axisX}`).selectAll(".tick").size();
|
|
22257
22590
|
let gridData = [];
|
|
22258
22591
|
if (type === "year") {
|
|
22259
|
-
const xDomain = $$.getXDomain();
|
|
22592
|
+
const xDomain = $$.getXDomain($$.data.targets);
|
|
22260
22593
|
const [firstYear, lastYear] = xDomain.map((v) => v.getFullYear());
|
|
22261
22594
|
for (let i = firstYear; i <= lastYear; i++) {
|
|
22262
22595
|
gridData.push(/* @__PURE__ */ new Date(`${i}-01-01 00:00:00`));
|
|
@@ -22546,8 +22879,8 @@ function setSelection(isSelection = false, ids, indices, resetOther) {
|
|
|
22546
22879
|
let isWithin;
|
|
22547
22880
|
let toggle;
|
|
22548
22881
|
if (shape.classed($CIRCLE.circle)) {
|
|
22549
|
-
const x = +shape.attr("cx")
|
|
22550
|
-
const y = +shape.attr("cy")
|
|
22882
|
+
const x = +shape.attr("cx");
|
|
22883
|
+
const y = +shape.attr("cy");
|
|
22551
22884
|
toggle = $$.togglePoint;
|
|
22552
22885
|
isWithin = minX < x && x < maxX && minY < y && y < maxY;
|
|
22553
22886
|
} else if (shape.classed($BAR.bar)) {
|
|
@@ -22932,7 +23265,7 @@ const subchart = function(domainValue) {
|
|
|
22932
23265
|
$$.getZoomDomain("subX")
|
|
22933
23266
|
);
|
|
22934
23267
|
if (isWithinRange) {
|
|
22935
|
-
state.domain = domain;
|
|
23268
|
+
state.domain = domain.slice();
|
|
22936
23269
|
brush.move(
|
|
22937
23270
|
brush.getSelection(),
|
|
22938
23271
|
domain.map(subX)
|
|
@@ -23066,6 +23399,7 @@ extend(subchart, {
|
|
|
23066
23399
|
|
|
23067
23400
|
|
|
23068
23401
|
|
|
23402
|
+
|
|
23069
23403
|
/* harmony default export */ var interactions_subchart = ({
|
|
23070
23404
|
/**
|
|
23071
23405
|
* Initialize the brush.
|
|
@@ -23186,14 +23520,8 @@ extend(subchart, {
|
|
|
23186
23520
|
const isRotated = config.axis_rotated;
|
|
23187
23521
|
const initRange = config.subchart_init_range;
|
|
23188
23522
|
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");
|
|
23523
|
+
const path = SUBCHART_BRUSH_HANDLE_PATH[isRotated ? "y" : "x"];
|
|
23524
|
+
$$.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
23525
|
},
|
|
23198
23526
|
/**
|
|
23199
23527
|
* Update sub chart
|
|
@@ -23398,7 +23726,7 @@ var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack
|
|
|
23398
23726
|
|
|
23399
23727
|
|
|
23400
23728
|
const zoom = function(domainValue) {
|
|
23401
|
-
var _a;
|
|
23729
|
+
var _a, _b;
|
|
23402
23730
|
const $$ = this.internal;
|
|
23403
23731
|
const { axis, config, org, scale, state } = $$;
|
|
23404
23732
|
let domain;
|
|
@@ -23418,12 +23746,16 @@ const zoom = function(domainValue) {
|
|
|
23418
23746
|
$$.getZoomDomain("zoom")
|
|
23419
23747
|
);
|
|
23420
23748
|
if (isWithinRange) {
|
|
23421
|
-
state.domain = domain;
|
|
23749
|
+
state.domain = domain.slice();
|
|
23422
23750
|
domain = $$.getZoomDomainValue(domain);
|
|
23423
23751
|
$$.api.tooltip.hide();
|
|
23424
23752
|
if (config.subchart_show) {
|
|
23425
|
-
|
|
23426
|
-
|
|
23753
|
+
if (state.isCanvasMode) {
|
|
23754
|
+
(_a = $$.setCanvasSubchartDomain) == null ? void 0 : _a.call($$, domain, true, false);
|
|
23755
|
+
} else {
|
|
23756
|
+
const x = scale.zoom || scale.x;
|
|
23757
|
+
$$.brush.getSelection().call($$.brush.move, domain.map(x));
|
|
23758
|
+
}
|
|
23427
23759
|
} else {
|
|
23428
23760
|
const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x;
|
|
23429
23761
|
$$.updateCurrentZoomTransform(x, domain);
|
|
@@ -23434,7 +23766,7 @@ const zoom = function(domainValue) {
|
|
|
23434
23766
|
domain = $$.zoom.getDomain();
|
|
23435
23767
|
}
|
|
23436
23768
|
}
|
|
23437
|
-
return (
|
|
23769
|
+
return (_b = state.domain) != null ? _b : domain;
|
|
23438
23770
|
};
|
|
23439
23771
|
extend(zoom, {
|
|
23440
23772
|
/**
|
|
@@ -23558,11 +23890,12 @@ extend(zoom, {
|
|
|
23558
23890
|
* chart.unzoom();
|
|
23559
23891
|
*/
|
|
23560
23892
|
unzoom() {
|
|
23893
|
+
var _a;
|
|
23561
23894
|
const $$ = this.internal;
|
|
23562
23895
|
const { config, $el: { canvas, eventRect, zoomResetBtn }, scale: { zoom: zoom2 }, state } = $$;
|
|
23563
23896
|
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);
|
|
23897
|
+
if (zoom2 || state.isCanvasMode && config.subchart_show && state.domain) {
|
|
23898
|
+
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
23899
|
$$.updateZoom(true);
|
|
23567
23900
|
zoomResetBtn == null ? void 0 : zoomResetBtn.style("display", "none");
|
|
23568
23901
|
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 +24073,9 @@ function getZoomDragPointer($$, event, element) {
|
|
|
23740
24073
|
const useRAF = sourceEvent && isMousemove && config.zoom_type !== "wheel";
|
|
23741
24074
|
const executeRedraw = () => {
|
|
23742
24075
|
var _a;
|
|
24076
|
+
if (!$$.config) {
|
|
24077
|
+
return;
|
|
24078
|
+
}
|
|
23743
24079
|
$$.redraw({
|
|
23744
24080
|
withTransition: doTransition,
|
|
23745
24081
|
withY: config.zoom_rescale,
|
|
@@ -23872,6 +24208,10 @@ function getZoomDragPointer($$, event, element) {
|
|
|
23872
24208
|
if (!state.isCanvasMode && !zoomRect) {
|
|
23873
24209
|
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
24210
|
}
|
|
24211
|
+
zoomRect == null ? void 0 : zoomRect.attr(
|
|
24212
|
+
isRotated ? "width" : "height",
|
|
24213
|
+
isRotated ? state.width : state.height
|
|
24214
|
+
);
|
|
23875
24215
|
start = clampPointer(getZoomDragPointer($$, event, this)[prop.index]);
|
|
23876
24216
|
end = start;
|
|
23877
24217
|
state.isCanvasMode ? (_a = $$.renderCanvasZoomBrush) == null ? void 0 : _a.call($$, start, end) : zoomRect.attr(prop.axis, start).attr(prop.attr, 0);
|
|
@@ -23993,7 +24333,6 @@ function getZoomDragPointer($$, event, element) {
|
|
|
23993
24333
|
zoom_enabled: false,
|
|
23994
24334
|
zoom_type: "wheel",
|
|
23995
24335
|
zoom_extent: void 0,
|
|
23996
|
-
zoom_privileged: false,
|
|
23997
24336
|
zoom_rescale: false,
|
|
23998
24337
|
zoom_onzoom: void 0,
|
|
23999
24338
|
zoom_onzoomstart: void 0,
|
|
@@ -24675,32 +25014,6 @@ function _getStrokeDashArray(start, end, pattern, isLastX = false) {
|
|
|
24675
25014
|
$T(line, withTransition, getRandom()).attr("d", drawFn).style("stroke", this.color).style("opacity", null)
|
|
24676
25015
|
];
|
|
24677
25016
|
},
|
|
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
25017
|
generateDrawLine(lineIndices, isSub) {
|
|
24705
25018
|
const $$ = this;
|
|
24706
25019
|
return generateDrawLinePath($$, lineIndices, isSub);
|
|
@@ -24759,6 +25072,9 @@ function _getStrokeDashArray(start, end, pattern, isLastX = false) {
|
|
|
24759
25072
|
};
|
|
24760
25073
|
const axisType = { x: $$.axis.getAxisType("x"), y: $$.axis.getAxisType("y") };
|
|
24761
25074
|
let path = "";
|
|
25075
|
+
if (!d.length) {
|
|
25076
|
+
return path;
|
|
25077
|
+
}
|
|
24762
25078
|
const target = $$.$el.line.filter(({ id }) => id === d[0].id);
|
|
24763
25079
|
const tempNode = target.clone().style("display", "none");
|
|
24764
25080
|
const getLength = (node, path2) => node.attr("d", path2).node().getTotalLength();
|
|
@@ -24829,9 +25145,9 @@ function _getStrokeDashArray(start, end, pattern, isLastX = false) {
|
|
|
24829
25145
|
}
|
|
24830
25146
|
if (dashArray.dash.length) {
|
|
24831
25147
|
!isLastX && dashArray.dash.push(getLength(tempNode, path));
|
|
24832
|
-
tempNode.remove();
|
|
24833
25148
|
target.attr("stroke-dasharray", dashArray.dash.join(" "));
|
|
24834
25149
|
}
|
|
25150
|
+
tempNode.remove();
|
|
24835
25151
|
return path;
|
|
24836
25152
|
},
|
|
24837
25153
|
isWithinRegions(withinX, withinRegions) {
|
|
@@ -25163,7 +25479,7 @@ function getPointBBox(node) {
|
|
|
25163
25479
|
if (mainCircles.attr("cx")) {
|
|
25164
25480
|
mainCircles = $$.$T(mainCircles, withTransition, getTransitionName());
|
|
25165
25481
|
}
|
|
25166
|
-
selectedCircles && $$.$T(
|
|
25482
|
+
selectedCircles && $$.$T(selectedCircles, withTransition, getTransitionName());
|
|
25167
25483
|
}
|
|
25168
25484
|
return mainCircles.attr("cx", xPosFn).attr("cy", yPosFn).style("fill", fillStyleFn);
|
|
25169
25485
|
}
|
|
@@ -25805,10 +26121,6 @@ class AxisRendererHelper {
|
|
|
25805
26121
|
} else {
|
|
25806
26122
|
ticks = scale.ticks(...this.config.tickArguments || []);
|
|
25807
26123
|
}
|
|
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
26124
|
}
|
|
25813
26125
|
return ticks;
|
|
25814
26126
|
}
|
|
@@ -25941,7 +26253,13 @@ class AxisRenderer {
|
|
|
25941
26253
|
sizeFor1Char = ctx.helper.getSizeFor1Char(orient, tickText, !!evalTextSize);
|
|
25942
26254
|
}
|
|
25943
26255
|
let tspan = tickText.selectAll("tspan").data((d, index) => {
|
|
25944
|
-
|
|
26256
|
+
let split;
|
|
26257
|
+
if (params.tickMultiline) {
|
|
26258
|
+
split = splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w);
|
|
26259
|
+
} else {
|
|
26260
|
+
const formatted = helper.textFormatted(d);
|
|
26261
|
+
split = isArray(formatted) ? formatted.concat() : [formatted];
|
|
26262
|
+
}
|
|
25945
26263
|
counts[index] = split.length;
|
|
25946
26264
|
return split.map((splitted) => ({ index, splitted }));
|
|
25947
26265
|
});
|
|
@@ -26721,7 +27039,7 @@ class Axis_Axis {
|
|
|
26721
27039
|
const fit = config.axis_x_tick_fit;
|
|
26722
27040
|
let count = config.axis_x_tick_count;
|
|
26723
27041
|
let values;
|
|
26724
|
-
if (fit
|
|
27042
|
+
if (fit) {
|
|
26725
27043
|
values = $$.mapTargetsToUniqueXs(targets);
|
|
26726
27044
|
if (this.isCategorized() && count > values.length) {
|
|
26727
27045
|
count = values.length;
|
|
@@ -26982,7 +27300,7 @@ class Axis_Axis {
|
|
|
26982
27300
|
const isDomainSame = domain[0] === domain[1] && domain.every((v) => v > 0);
|
|
26983
27301
|
const isCurrentMaxTickDomainSame = isArray(currentTickMax.domain) && currentTickMax.domain[0] === currentTickMax.domain[1] && currentTickMax.domain.every((v) => v > 0);
|
|
26984
27302
|
if (isDomainSame || isCurrentMaxTickDomainSame) {
|
|
26985
|
-
return currentTickMax
|
|
27303
|
+
return currentTickMax;
|
|
26986
27304
|
} else {
|
|
26987
27305
|
currentTickMax.domain = domain;
|
|
26988
27306
|
}
|
|
@@ -27336,6 +27654,7 @@ class Axis_Axis {
|
|
|
27336
27654
|
break;
|
|
27337
27655
|
}
|
|
27338
27656
|
}
|
|
27657
|
+
intervalForCulling = intervalForCulling != null ? intervalForCulling : tickSize;
|
|
27339
27658
|
const tickIndexMap = /* @__PURE__ */ new Map();
|
|
27340
27659
|
for (let i = 0; i < tickValues.length; i++) {
|
|
27341
27660
|
tickIndexMap.set(tickValues[i], i);
|
|
@@ -27563,7 +27882,7 @@ var __pow = Math.pow;
|
|
|
27563
27882
|
const isRotated = config.axis_rotated;
|
|
27564
27883
|
const isMultipleX = $$.isMultipleX();
|
|
27565
27884
|
const xDomain = xScale == null ? void 0 : xScale.domain();
|
|
27566
|
-
const fingerprint = xDomain ? `${xDomain[0]}_${xDomain[1]}_${$$.data.targets.length}_${[...state.hiddenTargetIds].join(",")}` : null;
|
|
27885
|
+
const fingerprint = xDomain ? `${xDomain[0]}_${xDomain[1]}_${state.width}_${state.height}_${$$.data.targets.length}_${[...state.hiddenTargetIds].join(",")}` : null;
|
|
27567
27886
|
if (fingerprint && fingerprint === state._eventRectFingerprint) {
|
|
27568
27887
|
return;
|
|
27569
27888
|
}
|
|
@@ -27590,7 +27909,6 @@ var __pow = Math.pow;
|
|
|
27590
27909
|
next: $$.getNextX(index)
|
|
27591
27910
|
});
|
|
27592
27911
|
rectW = (d) => {
|
|
27593
|
-
var _a, _b;
|
|
27594
27912
|
const x2 = getPrevNextX(d);
|
|
27595
27913
|
const xDomain2 = xScale.domain();
|
|
27596
27914
|
let val;
|
|
@@ -27601,8 +27919,6 @@ var __pow = Math.pow;
|
|
|
27601
27919
|
} else if (x2.next === null) {
|
|
27602
27920
|
val = xScale(xDomain2[1]) - (xScale(x2.prev) + xScale(d.x)) / 2;
|
|
27603
27921
|
} else {
|
|
27604
|
-
x2.prev = (_a = x2.prev) != null ? _a : xDomain2[0];
|
|
27605
|
-
x2.next = (_b = x2.next) != null ? _b : xDomain2[1];
|
|
27606
27922
|
val = Math.max(0, (xScale(x2.next) - xScale(x2.prev)) / 2);
|
|
27607
27923
|
}
|
|
27608
27924
|
return val;
|
|
@@ -27716,7 +28032,7 @@ var __pow = Math.pow;
|
|
|
27716
28032
|
(_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
|
|
27717
28033
|
const dist = $$.dist(closest, mouse);
|
|
27718
28034
|
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
27719
|
-
$$.$el.
|
|
28035
|
+
$$.$el.eventRect.style("cursor", "pointer");
|
|
27720
28036
|
if (triggerEvent && (!state.mouseover || state.mouseover.x !== closest.x || state.mouseover.id !== closest.id)) {
|
|
27721
28037
|
config.data_onover.call($$.api, closest);
|
|
27722
28038
|
state.mouseover = closest;
|
|
@@ -27728,7 +28044,7 @@ var __pow = Math.pow;
|
|
|
27728
28044
|
* @private
|
|
27729
28045
|
*/
|
|
27730
28046
|
unselectRect() {
|
|
27731
|
-
var _a, _b;
|
|
28047
|
+
var _a, _b, _c;
|
|
27732
28048
|
const $$ = this;
|
|
27733
28049
|
const { state, $el: { circle, tooltip } } = $$;
|
|
27734
28050
|
state._lastTooltipMouse = null;
|
|
@@ -27737,8 +28053,8 @@ var __pow = Math.pow;
|
|
|
27737
28053
|
tooltip && $$.hideTooltip();
|
|
27738
28054
|
return;
|
|
27739
28055
|
}
|
|
27740
|
-
$$.$el.
|
|
27741
|
-
(
|
|
28056
|
+
(_b = $$.$el.eventRect) == null ? void 0 : _b.style("cursor", null);
|
|
28057
|
+
(_c = $$.hideGridFocus) == null ? void 0 : _c.call($$);
|
|
27742
28058
|
if (tooltip) {
|
|
27743
28059
|
$$.hideTooltip();
|
|
27744
28060
|
$$._handleLinkedCharts(false);
|
|
@@ -27814,7 +28130,7 @@ var __pow = Math.pow;
|
|
|
27814
28130
|
$$.setOverOut(index !== -1, index);
|
|
27815
28131
|
}).on("mouseout", (event) => {
|
|
27816
28132
|
state.event = event;
|
|
27817
|
-
if (
|
|
28133
|
+
if (!$$.config || $$.hasArcType() || eventReceiver.currentIdx === -1 || !config.interaction_onout) {
|
|
27818
28134
|
return;
|
|
27819
28135
|
}
|
|
27820
28136
|
$$.hideAxisGridFocus();
|
|
@@ -27876,10 +28192,10 @@ var __pow = Math.pow;
|
|
|
27876
28192
|
}
|
|
27877
28193
|
const mouse = getPointer(state.event, this);
|
|
27878
28194
|
const closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
|
27879
|
-
const sensitivity = $$.getPointSensitivity(closest);
|
|
27880
28195
|
if (!closest) {
|
|
27881
28196
|
return;
|
|
27882
28197
|
}
|
|
28198
|
+
const sensitivity = $$.getPointSensitivity(closest);
|
|
27883
28199
|
if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < sensitivity) {
|
|
27884
28200
|
$$.$el.main.selectAll(`.${$SHAPE.shapes}${$$.getTargetSelectorSuffix(closest.id)}`).selectAll(`.${$SHAPE.shape}-${closest.index}`).each(function() {
|
|
27885
28201
|
var _a;
|
|
@@ -27957,8 +28273,8 @@ var __pow = Math.pow;
|
|
|
27957
28273
|
if (defs && !clip.idXAxisTickTexts) {
|
|
27958
28274
|
const clipId = `${clip.id}-xaxisticktexts`;
|
|
27959
28275
|
$$.appendClip(defs, clipId);
|
|
27960
|
-
clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts);
|
|
27961
28276
|
clip.idXAxisTickTexts = clipId;
|
|
28277
|
+
clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts);
|
|
27962
28278
|
}
|
|
27963
28279
|
if (!config.axis_x_tick_multiline && $$.getAxisTickRotate("x") && newXAxisHeight !== xAxisHeight) {
|
|
27964
28280
|
$$.setXAxisTickClipWidth();
|
|
@@ -30314,15 +30630,15 @@ function _getConnectLineType(id) {
|
|
|
30314
30630
|
}
|
|
30315
30631
|
if (path.length > 1) {
|
|
30316
30632
|
barPath.push(path[1]);
|
|
30317
|
-
|
|
30318
|
-
|
|
30319
|
-
|
|
30320
|
-
|
|
30321
|
-
|
|
30322
|
-
)
|
|
30323
|
-
|
|
30324
|
-
|
|
30325
|
-
|
|
30633
|
+
}
|
|
30634
|
+
if (i === arr.length - 1 && barPath.length) {
|
|
30635
|
+
const barConnectLineNode = $$.$T(
|
|
30636
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode.querySelector(`.${$BAR.barConnectLine}`)),
|
|
30637
|
+
withTransition,
|
|
30638
|
+
getRandom()
|
|
30639
|
+
);
|
|
30640
|
+
$$.updateConnectLine(barConnectLineNode, connectLineType, barPath);
|
|
30641
|
+
barPath.splice(0);
|
|
30326
30642
|
}
|
|
30327
30643
|
return path[0];
|
|
30328
30644
|
}).style("fill", $$.updateBarColor.bind($$)).style("clip-path", (d) => d.clipPath).style("opacity", null)
|
|
@@ -31760,14 +32076,30 @@ function _getAttrTweenFn(fn) {
|
|
|
31760
32076
|
}
|
|
31761
32077
|
const gStart = $$.getStartingAngle();
|
|
31762
32078
|
const radius = config.gauge_fullCircle || forRange && !hasGauge ? $$.getArcLength() : gStart * -2;
|
|
31763
|
-
|
|
32079
|
+
const isSingleArcGauge = d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge();
|
|
32080
|
+
if (isSingleArcGauge) {
|
|
31764
32081
|
const { gauge_min: gMin, gauge_max: gMax } = config;
|
|
31765
32082
|
const totalSum = $$.getTotalDataSum(state.rendered);
|
|
31766
32083
|
const gEnd = radius * ((totalSum - gMin) / (gMax - gMin));
|
|
31767
32084
|
pie = pie.startAngle(gStart).endAngle(gEnd + gStart);
|
|
31768
32085
|
}
|
|
31769
32086
|
if (forRange === false) {
|
|
31770
|
-
|
|
32087
|
+
let layout;
|
|
32088
|
+
if (isSingleArcGauge) {
|
|
32089
|
+
layout = pie($$.filterTargetsToShow());
|
|
32090
|
+
} else {
|
|
32091
|
+
const cacheKey = "$arcPieLayout";
|
|
32092
|
+
let cached = $$.cache.get(cacheKey);
|
|
32093
|
+
if (!cached || cached.generation !== state.redrawGeneration) {
|
|
32094
|
+
cached = {
|
|
32095
|
+
generation: state.redrawGeneration,
|
|
32096
|
+
layout: pie($$.filterTargetsToShow())
|
|
32097
|
+
};
|
|
32098
|
+
$$.cache.add(cacheKey, cached);
|
|
32099
|
+
}
|
|
32100
|
+
layout = cached.layout;
|
|
32101
|
+
}
|
|
32102
|
+
layout.forEach((t, i) => {
|
|
31771
32103
|
var _a2;
|
|
31772
32104
|
if (!found && t.data.id === ((_a2 = d.data) == null ? void 0 : _a2.id)) {
|
|
31773
32105
|
found = true;
|
|
@@ -31854,7 +32186,7 @@ function _getAttrTweenFn(fn) {
|
|
|
31854
32186
|
}
|
|
31855
32187
|
const pieData = $$.pie(values).map((d, i) => (d.index = i, d));
|
|
31856
32188
|
let rangeText = arcs.selectAll(`.${$ARC.arcRange}`).data(values);
|
|
31857
|
-
rangeText.exit();
|
|
32189
|
+
rangeText.exit().remove();
|
|
31858
32190
|
rangeText = $T(rangeText.enter().append("text").attr("class", $ARC.arcRange).style("text-anchor", "middle").style("pointer-events", "none").style("opacity", "0").text((v) => {
|
|
31859
32191
|
const range = isPercent ? v / totalSum * 100 : v;
|
|
31860
32192
|
return isFunction(format) ? format(range) : `${range}${isPercent ? "%" : ""}`;
|
|
@@ -31933,7 +32265,7 @@ function _getAttrTweenFn(fn) {
|
|
|
31933
32265
|
const { state: { transiting }, $el } = $$;
|
|
31934
32266
|
if (transiting) {
|
|
31935
32267
|
const interval = setInterval(() => {
|
|
31936
|
-
if (
|
|
32268
|
+
if (!$$.state.transiting) {
|
|
31937
32269
|
clearInterval(interval);
|
|
31938
32270
|
$el.legend.selectAll(`.${$FOCUS.legendItemFocused}`).size() > 0 && $$.expandArc(targetIds);
|
|
31939
32271
|
}
|
|
@@ -32143,6 +32475,11 @@ function _getAttrTweenFn(fn) {
|
|
|
32143
32475
|
$$.updateLegendItemColor(d.data.id, path.style("fill"));
|
|
32144
32476
|
}
|
|
32145
32477
|
state.transiting = false;
|
|
32478
|
+
if (state.redrawing) {
|
|
32479
|
+
state.redrawing = false;
|
|
32480
|
+
state._targetsToShow = null;
|
|
32481
|
+
state._cachedDrawShape = null;
|
|
32482
|
+
}
|
|
32146
32483
|
callFn(config.onrendered, $$.api);
|
|
32147
32484
|
});
|
|
32148
32485
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
@@ -32220,7 +32557,7 @@ function _getAttrTweenFn(fn) {
|
|
|
32220
32557
|
const { gauge_min: min, gauge_max: max } = config;
|
|
32221
32558
|
radian = radius * ((value - min) / (max - min));
|
|
32222
32559
|
} else {
|
|
32223
|
-
radian = arcLength * (value / total);
|
|
32560
|
+
radian = total ? arcLength * (value / total) : 0;
|
|
32224
32561
|
}
|
|
32225
32562
|
return (startingAngle + radian) * (180 / Math.PI);
|
|
32226
32563
|
},
|
|
@@ -32600,7 +32937,7 @@ function _getSplineClipPath() {
|
|
|
32600
32937
|
const getTarget = (event) => {
|
|
32601
32938
|
var _a;
|
|
32602
32939
|
const target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) == null ? void 0 : _a.node();
|
|
32603
|
-
if (/^path$/i.test(target.tagName)) {
|
|
32940
|
+
if (target && /^path$/i.test(target.tagName)) {
|
|
32604
32941
|
state.event = event;
|
|
32605
32942
|
return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
|
32606
32943
|
}
|
|
@@ -32665,10 +33002,9 @@ function _getSplineClipPath() {
|
|
|
32665
33002
|
const { top, left, width, height } = _getSize.call($$);
|
|
32666
33003
|
const points = {};
|
|
32667
33004
|
let accumulated = 0;
|
|
32668
|
-
targets.each((d
|
|
32669
|
-
var _a;
|
|
33005
|
+
targets.each((d) => {
|
|
32670
33006
|
const start = accumulated;
|
|
32671
|
-
const ratio
|
|
33007
|
+
const { ratio } = d;
|
|
32672
33008
|
accumulated += ratio;
|
|
32673
33009
|
const offset = isRotated ? left : top;
|
|
32674
33010
|
const segmentStart = offset + start;
|
|
@@ -34049,7 +34385,7 @@ function position(group, root) {
|
|
|
34049
34385
|
var _a;
|
|
34050
34386
|
const target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) == null ? void 0 : _a.node();
|
|
34051
34387
|
let data;
|
|
34052
|
-
if (/^rect$/i.test(target.tagName)) {
|
|
34388
|
+
if (target && /^rect$/i.test(target.tagName)) {
|
|
34053
34389
|
state.event = event;
|
|
34054
34390
|
data = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
|
|
34055
34391
|
}
|
|
@@ -34269,7 +34605,7 @@ const bb = {
|
|
|
34269
34605
|
* bb.version; // "1.0.0"
|
|
34270
34606
|
* @memberof bb
|
|
34271
34607
|
*/
|
|
34272
|
-
version: "4.0.0-next.
|
|
34608
|
+
version: "4.0.0-next.3",
|
|
34273
34609
|
/**
|
|
34274
34610
|
* Generate chart
|
|
34275
34611
|
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|