billboard.js 4.0.3 → 4.1.0-next.2
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 +82 -7
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +1848 -494
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +19 -24
- package/dist/billboard.pkgd.js +1844 -679
- package/dist/billboard.pkgd.min.js +24 -29
- package/dist/billboard.react.js +205 -0
- package/dist/billboard.react.min.js +9 -0
- package/dist/billboard.worker.js +10 -0
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +5 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +6 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +6 -3
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +59 -27
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +75 -55
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +5 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +6 -3
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +59 -27
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +68 -3557
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
- 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 +134 -152
- package/dist-esm/Chart/api/axis.js +217 -237
- package/dist-esm/Chart/api/category.js +54 -54
- package/dist-esm/Chart/api/chart.js +172 -215
- package/dist-esm/Chart/api/color.js +21 -21
- package/dist-esm/Chart/api/data.js +172 -173
- package/dist-esm/Chart/api/export.js +242 -262
- package/dist-esm/Chart/api/flow.js +198 -254
- package/dist-esm/Chart/api/focus.js +136 -143
- package/dist-esm/Chart/api/grid.js +191 -190
- package/dist-esm/Chart/api/group.js +31 -34
- package/dist-esm/Chart/api/legend.js +54 -63
- package/dist-esm/Chart/api/load.js +237 -257
- package/dist-esm/Chart/api/regions.js +148 -168
- package/dist-esm/Chart/api/selection.js +181 -139
- package/dist-esm/Chart/api/show.js +133 -147
- package/dist-esm/Chart/api/stubs.js +43 -42
- package/dist-esm/Chart/api/subchart.js +155 -172
- package/dist-esm/Chart/api/tooltip.js +132 -177
- package/dist-esm/Chart/api/x.js +67 -71
- package/dist-esm/Chart/api/zoom.js +183 -220
- package/dist-esm/ChartInternal/Axis/Axis.js +1059 -1266
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +408 -540
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +113 -149
- package/dist-esm/ChartInternal/ChartInternal.js +573 -749
- package/dist-esm/ChartInternal/data/convert.helper.js +133 -159
- package/dist-esm/ChartInternal/data/convert.js +200 -229
- package/dist-esm/ChartInternal/data/data.js +967 -1153
- package/dist-esm/ChartInternal/data/load.js +145 -197
- package/dist-esm/ChartInternal/interactions/drag.js +86 -122
- package/dist-esm/ChartInternal/interactions/eventrect.js +455 -621
- package/dist-esm/ChartInternal/interactions/flow.js +151 -215
- package/dist-esm/ChartInternal/interactions/interaction.js +214 -252
- package/dist-esm/ChartInternal/interactions/subchart.js +425 -300
- package/dist-esm/ChartInternal/interactions/zoom.js +321 -440
- package/dist-esm/ChartInternal/internals/category.js +18 -18
- package/dist-esm/ChartInternal/internals/class.js +89 -99
- package/dist-esm/ChartInternal/internals/clip.js +88 -119
- package/dist-esm/ChartInternal/internals/color.js +233 -288
- package/dist-esm/ChartInternal/internals/domain.js +452 -588
- package/dist-esm/ChartInternal/internals/format.js +64 -77
- package/dist-esm/ChartInternal/internals/grid.js +333 -457
- package/dist-esm/ChartInternal/internals/legend.js +675 -927
- package/dist-esm/ChartInternal/internals/redraw.js +200 -289
- package/dist-esm/ChartInternal/internals/region.js +106 -159
- package/dist-esm/ChartInternal/internals/scale.js +186 -215
- package/dist-esm/ChartInternal/internals/selection.js +132 -159
- package/dist-esm/ChartInternal/internals/size.axis.js +92 -139
- package/dist-esm/ChartInternal/internals/size.js +286 -394
- package/dist-esm/ChartInternal/internals/style.js +39 -41
- package/dist-esm/ChartInternal/internals/subchart.util.js +49 -0
- package/dist-esm/ChartInternal/internals/text.arc.js +155 -219
- package/dist-esm/ChartInternal/internals/text.js +368 -528
- package/dist-esm/ChartInternal/internals/text.util.js +179 -239
- package/dist-esm/ChartInternal/internals/title.js +96 -121
- package/dist-esm/ChartInternal/internals/tooltip.js +450 -586
- package/dist-esm/ChartInternal/internals/transform.js +79 -97
- package/dist-esm/ChartInternal/internals/type.js +285 -236
- package/dist-esm/ChartInternal/shape/arc.js +825 -1112
- package/dist-esm/ChartInternal/shape/area.js +73 -94
- package/dist-esm/ChartInternal/shape/bar.js +227 -288
- package/dist-esm/ChartInternal/shape/bubble.js +9 -8
- package/dist-esm/ChartInternal/shape/candlestick.js +110 -138
- package/dist-esm/ChartInternal/shape/core/barRadius.js +197 -133
- package/dist-esm/ChartInternal/shape/core/bubble.js +64 -73
- package/dist-esm/ChartInternal/shape/core/candlestick.js +93 -86
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +68 -75
- package/dist-esm/ChartInternal/shape/core/geometry.js +112 -112
- package/dist-esm/ChartInternal/shape/core/path.js +142 -115
- package/dist-esm/ChartInternal/shape/core/point.js +105 -125
- package/dist-esm/ChartInternal/shape/core/treemap.js +83 -88
- package/dist-esm/ChartInternal/shape/funnel.js +310 -338
- package/dist-esm/ChartInternal/shape/gauge.js +71 -103
- package/dist-esm/ChartInternal/shape/line.js +208 -278
- package/dist-esm/ChartInternal/shape/point.js +310 -425
- package/dist-esm/ChartInternal/shape/polar.js +84 -109
- package/dist-esm/ChartInternal/shape/radar.js +228 -318
- package/dist-esm/ChartInternal/shape/shape.js +782 -843
- package/dist-esm/ChartInternal/shape/treemap.js +152 -190
- package/dist-esm/canvas/CanvasAxisRenderer.js +1180 -1328
- package/dist-esm/canvas/CanvasEngine.js +148 -166
- package/dist-esm/canvas/CanvasPainter.js +395 -411
- package/dist-esm/canvas/CanvasRenderer.js +1584 -1834
- package/dist-esm/canvas/CanvasTheme.js +899 -802
- package/dist-esm/canvas/HitDetector.js +394 -463
- package/dist-esm/canvas/axisTicks.js +672 -786
- package/dist-esm/canvas/classes.js +19 -17
- package/dist-esm/canvas/color.js +40 -59
- package/dist-esm/canvas/geometry.js +38 -38
- package/dist-esm/canvas/labels.js +318 -371
- package/dist-esm/canvas/pointPattern.js +578 -580
- package/dist-esm/canvas/util.js +242 -262
- package/dist-esm/config/Options/Options.js +29 -32
- package/dist-esm/config/Options/axis/axis.js +101 -101
- package/dist-esm/config/Options/axis/x.js +759 -755
- package/dist-esm/config/Options/axis/y.js +525 -522
- package/dist-esm/config/Options/axis/y2.js +501 -485
- package/dist-esm/config/Options/common/boost.js +93 -32
- package/dist-esm/config/Options/common/color.js +88 -87
- package/dist-esm/config/Options/common/grid.js +74 -73
- package/dist-esm/config/Options/common/legend.js +180 -179
- package/dist-esm/config/Options/common/main.js +474 -473
- package/dist-esm/config/Options/common/point.js +160 -159
- package/dist-esm/config/Options/common/title.js +47 -46
- package/dist-esm/config/Options/common/tooltip.js +253 -252
- package/dist-esm/config/Options/data/axis.js +173 -172
- package/dist-esm/config/Options/data/data.js +958 -957
- package/dist-esm/config/Options/data/selection.js +131 -130
- package/dist-esm/config/Options/interaction/interaction.js +53 -52
- package/dist-esm/config/Options/interaction/subchart.js +164 -73
- package/dist-esm/config/Options/interaction/zoom.js +86 -85
- package/dist-esm/config/Options/shape/arc.js +150 -149
- package/dist-esm/config/Options/shape/area.js +69 -68
- package/dist-esm/config/Options/shape/bar.js +147 -146
- package/dist-esm/config/Options/shape/bubble.js +35 -34
- package/dist-esm/config/Options/shape/candlestick.js +61 -60
- package/dist-esm/config/Options/shape/donut.js +181 -180
- package/dist-esm/config/Options/shape/funnel.js +49 -48
- package/dist-esm/config/Options/shape/gauge.js +237 -236
- package/dist-esm/config/Options/shape/line.js +58 -57
- package/dist-esm/config/Options/shape/pie.js +185 -184
- package/dist-esm/config/Options/shape/polar.js +167 -166
- package/dist-esm/config/Options/shape/radar.js +76 -75
- package/dist-esm/config/Options/shape/scatter.js +36 -36
- package/dist-esm/config/Options/shape/spline.js +46 -46
- package/dist-esm/config/Options/shape/treemap.js +80 -79
- package/dist-esm/config/Store/Element.js +64 -62
- package/dist-esm/config/Store/State.js +189 -200
- package/dist-esm/config/Store/Store.js +25 -26
- package/dist-esm/config/classes.js +157 -155
- package/dist-esm/config/config.js +26 -35
- package/dist-esm/config/const.js +120 -128
- package/dist-esm/config/resolver/axis.core.js +25 -25
- package/dist-esm/config/resolver/axis.js +26 -27
- package/dist-esm/config/resolver/canvas.js +2071 -2472
- package/dist-esm/config/resolver/canvasShape.js +201 -177
- package/dist-esm/config/resolver/category.js +26 -27
- package/dist-esm/config/resolver/export.js +24 -26
- package/dist-esm/config/resolver/flow.js +29 -31
- package/dist-esm/config/resolver/grid.js +34 -35
- package/dist-esm/config/resolver/interaction/selection.js +17 -17
- package/dist-esm/config/resolver/interaction/subchart.js +17 -17
- package/dist-esm/config/resolver/interaction/zoom.js +17 -17
- package/dist-esm/config/resolver/regions.js +30 -31
- package/dist-esm/config/resolver/shape/arc.helpers.js +19 -19
- package/dist-esm/config/resolver/shape/area.js +17 -17
- package/dist-esm/config/resolver/shape/axis.helpers.js +28 -25
- package/dist-esm/config/resolver/shape/bar.js +13 -13
- package/dist-esm/config/resolver/shape/bubble.js +18 -14
- package/dist-esm/config/resolver/shape/candlestick.js +13 -13
- package/dist-esm/config/resolver/shape/donut.js +11 -11
- package/dist-esm/config/resolver/shape/funnel.js +11 -11
- package/dist-esm/config/resolver/shape/gauge.js +12 -12
- package/dist-esm/config/resolver/shape/line.js +10 -10
- package/dist-esm/config/resolver/shape/pie.js +11 -11
- package/dist-esm/config/resolver/shape/polar.js +12 -12
- package/dist-esm/config/resolver/shape/radar.js +22 -14
- package/dist-esm/config/resolver/shape/scatter.js +13 -13
- package/dist-esm/config/resolver/shape/treemap.js +11 -11
- package/dist-esm/core.js +208 -211
- package/dist-esm/index.canvas.js +14 -13
- package/dist-esm/index.esm.js +25 -24
- package/dist-esm/module/Cache.js +117 -129
- package/dist-esm/module/browser.js +30 -35
- package/dist-esm/module/dsv.js +107 -127
- package/dist-esm/module/error.js +45 -52
- package/dist-esm/module/generator.js +75 -83
- package/dist-esm/module/sanitize.js +302 -399
- package/dist-esm/module/util/brush.js +27 -38
- package/dist-esm/module/util/dom.js +288 -348
- package/dist-esm/module/util/object.js +277 -341
- package/dist-esm/module/util/type-checks.js +21 -25
- package/dist-esm/module/worker.js +312 -130
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +185 -198
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +442 -450
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +813 -950
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +708 -788
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +344 -301
- package/dist-esm/react/index.js +157 -0
- package/package.json +28 -8
- package/src/Chart/api/selection.ts +130 -5
- package/src/ChartInternal/Axis/Axis.ts +164 -65
- package/src/ChartInternal/Axis/AxisRenderer.ts +41 -8
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/convert.ts +54 -4
- package/src/ChartInternal/data/data.ts +4 -1
- package/src/ChartInternal/interactions/eventrect.ts +8 -2
- package/src/ChartInternal/interactions/subchart.ts +437 -66
- package/src/ChartInternal/internals/color.ts +2 -2
- package/src/ChartInternal/internals/domain.ts +15 -3
- package/src/ChartInternal/internals/grid.ts +21 -1
- package/src/ChartInternal/internals/scale.ts +9 -2
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/subchart.util.ts +55 -0
- package/src/ChartInternal/internals/text.arc.ts +3 -1
- package/src/ChartInternal/internals/text.ts +18 -5
- package/src/ChartInternal/internals/transform.ts +8 -2
- package/src/ChartInternal/internals/type.ts +105 -1
- package/src/ChartInternal/shape/IShape.ts +6 -3
- package/src/ChartInternal/shape/bar.ts +62 -31
- package/src/ChartInternal/shape/core/barRadius.ts +129 -0
- package/src/ChartInternal/shape/core/candlestick.ts +1 -1
- package/src/ChartInternal/shape/core/path.ts +76 -9
- package/src/ChartInternal/shape/funnel.ts +2 -3
- package/src/ChartInternal/shape/point.ts +2 -2
- package/src/ChartInternal/shape/shape.ts +149 -17
- package/src/Plugin/stanford/index.ts +0 -4
- package/src/Plugin/tableview/index.ts +85 -3
- package/src/Plugin/textoverlap/index.ts +9 -15
- package/src/canvas/CanvasAxisRenderer.ts +184 -36
- package/src/canvas/CanvasRenderer.ts +247 -160
- package/src/canvas/CanvasTheme.ts +212 -0
- package/src/canvas/axisTicks.ts +122 -40
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/common/boost.ts +64 -4
- package/src/config/Options/common/color.ts +2 -2
- package/src/config/Options/interaction/subchart.ts +98 -1
- package/src/config/Options/shape/gauge.ts +1 -1
- package/src/config/Options/shape/treemap.ts +2 -2
- package/src/config/Store/Element.ts +3 -1
- package/src/config/Store/State.ts +1 -0
- package/src/config/classes.ts +1 -0
- package/src/config/resolver/canvas.ts +92 -10
- package/src/module/util/type-checks.ts +3 -1
- package/src/module/voronoi.ts +119 -0
- package/src/module/worker.entry.ts +61 -0
- package/src/module/worker.ts +346 -63
- package/src/react/index.ts +193 -0
- package/types/options.d.ts +206 -3
- package/types/react/index.d.ts +27 -0
package/dist/billboard.js
CHANGED
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.2
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
12
|
-
module.exports = factory(require("d3-
|
|
12
|
+
module.exports = factory(require("d3-brush"), require("d3-drag"), require("d3-hierarchy"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom"));
|
|
13
13
|
else if(typeof define === 'function' && define.amd)
|
|
14
|
-
define(["d3-
|
|
14
|
+
define(["d3-brush", "d3-drag", "d3-hierarchy", "d3-interpolate", "d3-scale", "d3-selection", "d3-shape", "d3-time-format", "d3-transition", "d3-zoom"], factory);
|
|
15
15
|
else {
|
|
16
|
-
var a = typeof exports === 'object' ? factory(require("d3-
|
|
16
|
+
var a = typeof exports === 'object' ? factory(require("d3-brush"), require("d3-drag"), require("d3-hierarchy"), require("d3-interpolate"), require("d3-scale"), require("d3-selection"), require("d3-shape"), require("d3-time-format"), require("d3-transition"), require("d3-zoom")) : factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]);
|
|
17
17
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
18
18
|
}
|
|
19
|
-
})(this, function(
|
|
19
|
+
})(this, function(__WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__11__, __WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__) {
|
|
20
20
|
return /******/ (function() { // webpackBootstrap
|
|
21
21
|
/******/ "use strict";
|
|
22
22
|
/******/ var __webpack_modules__ = ([
|
|
@@ -81,12 +81,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__10__;
|
|
|
81
81
|
|
|
82
82
|
module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
|
|
83
83
|
|
|
84
|
-
/***/ }),
|
|
85
|
-
/* 12 */
|
|
86
|
-
/***/ (function(module) {
|
|
87
|
-
|
|
88
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
|
89
|
-
|
|
90
84
|
/***/ })
|
|
91
85
|
/******/ ]);
|
|
92
86
|
/************************************************************************/
|
|
@@ -342,7 +336,9 @@ const diffDomain = (d) => d[1] - d[0];
|
|
|
342
336
|
const isObjectType = (v) => typeof v === "object";
|
|
343
337
|
const isEmptyObject = (obj) => {
|
|
344
338
|
for (const x in obj) {
|
|
345
|
-
|
|
339
|
+
if (Object.prototype.hasOwnProperty.call(obj, x)) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
346
342
|
}
|
|
347
343
|
return true;
|
|
348
344
|
};
|
|
@@ -1042,7 +1038,7 @@ function getScale(type = "linear", min, max) {
|
|
|
1042
1038
|
* @private
|
|
1043
1039
|
*/
|
|
1044
1040
|
updateScales(isInit, updateXDomain = true) {
|
|
1045
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1041
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1046
1042
|
const $$ = this;
|
|
1047
1043
|
const {
|
|
1048
1044
|
axis,
|
|
@@ -1078,7 +1074,12 @@ function getScale(type = "linear", min, max) {
|
|
|
1078
1074
|
format.subXAxisTick = axis.getXAxisTickFormat(true);
|
|
1079
1075
|
axis.setAxis("x", scale.x, config.axis_x_tick_outer, isInit);
|
|
1080
1076
|
if (config.subchart_show) {
|
|
1081
|
-
axis.setAxis(
|
|
1077
|
+
axis.setAxis(
|
|
1078
|
+
"subX",
|
|
1079
|
+
scale.subX,
|
|
1080
|
+
(_f = config.subchart_axis_x_tick_outer) != null ? _f : config.axis_x_tick_outer,
|
|
1081
|
+
isInit
|
|
1082
|
+
);
|
|
1082
1083
|
}
|
|
1083
1084
|
scale.y = $$.getYScale(
|
|
1084
1085
|
"y",
|
|
@@ -1095,7 +1096,13 @@ function getScale(type = "linear", min, max) {
|
|
|
1095
1096
|
scale.subY
|
|
1096
1097
|
);
|
|
1097
1098
|
axis.setAxis("y", scale.y, config.axis_y_tick_outer, isInit);
|
|
1098
|
-
|
|
1099
|
+
config.subchart_show && config.subchart_axis_y_show && axis.setAxis(
|
|
1100
|
+
"subY",
|
|
1101
|
+
scale.subY,
|
|
1102
|
+
(_g = config.subchart_axis_y_tick_outer) != null ? _g : config.axis_y_tick_outer,
|
|
1103
|
+
isInit
|
|
1104
|
+
);
|
|
1105
|
+
if (config.axis_y2_show || config.subchart_axis_y2_show) {
|
|
1099
1106
|
scale.y2 = $$.getYScale(
|
|
1100
1107
|
"y2",
|
|
1101
1108
|
min.y,
|
|
@@ -1111,13 +1118,19 @@ function getScale(type = "linear", min, max) {
|
|
|
1111
1118
|
scale.subY2
|
|
1112
1119
|
);
|
|
1113
1120
|
axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit);
|
|
1121
|
+
config.subchart_show && config.subchart_axis_y2_show && axis.setAxis(
|
|
1122
|
+
"subY2",
|
|
1123
|
+
scale.subY2,
|
|
1124
|
+
(_h = config.subchart_axis_y2_tick_outer) != null ? _h : config.axis_y2_tick_outer,
|
|
1125
|
+
isInit
|
|
1126
|
+
);
|
|
1114
1127
|
}
|
|
1115
1128
|
} else if (hasTreemap) {
|
|
1116
1129
|
const padding = $$.getCurrentPadding();
|
|
1117
1130
|
scale.x = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.left, current.width - padding.right]);
|
|
1118
1131
|
scale.y = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.top, current.height - padding.bottom]);
|
|
1119
1132
|
} else {
|
|
1120
|
-
(
|
|
1133
|
+
(_i = $$.updateArc) == null ? void 0 : _i.call($$);
|
|
1121
1134
|
}
|
|
1122
1135
|
},
|
|
1123
1136
|
/**
|
|
@@ -1326,6 +1339,10 @@ function markCanvasPointOccupancy(grid, x, y) {
|
|
|
1326
1339
|
|
|
1327
1340
|
|
|
1328
1341
|
|
|
1342
|
+
function getAxisTickOption(config, id, key, prefix = `axis_${id}`) {
|
|
1343
|
+
const value = config[`${prefix}_tick_${key}`];
|
|
1344
|
+
return value !== void 0 ? value : config[`axis_${id}_tick_${key}`];
|
|
1345
|
+
}
|
|
1329
1346
|
function getOptionTickValues(values, api) {
|
|
1330
1347
|
const resolved = typeof values === "function" ? values.call(api) : values;
|
|
1331
1348
|
return (resolved == null ? void 0 : resolved.length) ? resolved : void 0;
|
|
@@ -1618,52 +1635,59 @@ function getXTickValues($$, cull = true) {
|
|
|
1618
1635
|
function getSubXTickCullMax($$) {
|
|
1619
1636
|
const { config, state: { height2, width2 } } = $$;
|
|
1620
1637
|
const size = config.axis_rotated ? height2 : width2;
|
|
1621
|
-
|
|
1622
|
-
|
|
1638
|
+
const count = getAxisTickOption(config, "x", "count", "subchart_axis_x");
|
|
1639
|
+
const culling = getAxisTickOption(config, "x", "culling", "subchart_axis_x");
|
|
1640
|
+
const cullingMax = getAxisTickOption(config, "x", "culling_max", "subchart_axis_x");
|
|
1641
|
+
if (count) {
|
|
1642
|
+
return count;
|
|
1623
1643
|
}
|
|
1624
|
-
if (
|
|
1644
|
+
if (culling !== false) {
|
|
1625
1645
|
return Math.min(
|
|
1626
|
-
|
|
1646
|
+
cullingMax || AXIS_DEFAULT_TICK_COUNT,
|
|
1627
1647
|
Math.max(2, Math.floor(size / 70))
|
|
1628
1648
|
);
|
|
1629
1649
|
}
|
|
1630
1650
|
return void 0;
|
|
1631
1651
|
}
|
|
1632
|
-
function getSubXTickValues(
|
|
1652
|
+
function getSubXTickValues($$, culling = true) {
|
|
1633
1653
|
var _a, _b, _c, _d;
|
|
1634
1654
|
const { axis, config, scale } = $$;
|
|
1635
1655
|
const targetScale = scale.subX;
|
|
1636
1656
|
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow();
|
|
1657
|
+
const tickCount = getAxisTickOption(config, "x", "count", "subchart_axis_x");
|
|
1637
1658
|
const cullMax = getSubXTickCullMax($$);
|
|
1638
|
-
const
|
|
1659
|
+
const cullData = (ticks, sorted = false) => culling ? cullDataTicks($$, ticks, sorted, "subchart_axis_x", cullMax) : ticks;
|
|
1639
1660
|
if (!targetScale || !(targetsToShow == null ? void 0 : targetsToShow.length)) {
|
|
1640
1661
|
return [];
|
|
1641
1662
|
}
|
|
1642
|
-
const explicit = getOptionTickValues(
|
|
1663
|
+
const explicit = getOptionTickValues(
|
|
1664
|
+
getAxisTickOption(config, "x", "values", "subchart_axis_x"),
|
|
1665
|
+
$$.api
|
|
1666
|
+
);
|
|
1643
1667
|
if (explicit) {
|
|
1644
|
-
return
|
|
1668
|
+
return cullData(normalizeXTickValues($$, explicit));
|
|
1645
1669
|
}
|
|
1646
1670
|
if (config.axis_x_tick_fit && $$.mapTargetsToUniqueXs) {
|
|
1647
1671
|
const generated2 = generateTickValues(
|
|
1648
1672
|
$$,
|
|
1649
1673
|
$$.mapTargetsToUniqueXs(targetsToShow),
|
|
1650
|
-
|
|
1674
|
+
tickCount,
|
|
1651
1675
|
(_b = axis == null ? void 0 : axis.isTimeSeries) == null ? void 0 : _b.call(axis)
|
|
1652
1676
|
);
|
|
1653
|
-
return
|
|
1677
|
+
return cullData(generated2, true);
|
|
1654
1678
|
}
|
|
1655
1679
|
if (((_c = axis == null ? void 0 : axis.isCategorized) == null ? void 0 : _c.call(axis)) && ((_d = config.axis_x_categories) == null ? void 0 : _d.length)) {
|
|
1656
|
-
return
|
|
1680
|
+
return cullData(config.axis_x_categories.map((_, i) => i), true);
|
|
1657
1681
|
}
|
|
1658
1682
|
const generated = getScaleTicks(
|
|
1659
1683
|
targetScale,
|
|
1660
|
-
|
|
1684
|
+
tickCount || AXIS_DEFAULT_TICK_COUNT
|
|
1661
1685
|
);
|
|
1662
|
-
return
|
|
1686
|
+
return cullData(generated, true);
|
|
1663
1687
|
}
|
|
1664
|
-
function getCategoryXTickLineValues($$) {
|
|
1688
|
+
function getCategoryXTickLineValues($$, targetScale = getXScale($$), outerTick = $$.config.axis_x_tick_outer) {
|
|
1665
1689
|
var _a, _b;
|
|
1666
|
-
const scale =
|
|
1690
|
+
const scale = targetScale;
|
|
1667
1691
|
const domain = ((_a = scale.orgDomain) == null ? void 0 : _a.call(scale)) || ((_b = scale.domain) == null ? void 0 : _b.call(scale));
|
|
1668
1692
|
if (!(domain == null ? void 0 : domain.length)) {
|
|
1669
1693
|
return [];
|
|
@@ -1676,7 +1700,7 @@ function getCategoryXTickLineValues($$) {
|
|
|
1676
1700
|
const min = Math.ceil(Math.min(start, end));
|
|
1677
1701
|
const max = Math.floor(Math.max(start, end));
|
|
1678
1702
|
const values = Array.from({ length: Math.max(0, max - min + 1) }, (_, i) => min + i);
|
|
1679
|
-
return
|
|
1703
|
+
return outerTick ? values.slice(1, -1) : values;
|
|
1680
1704
|
}
|
|
1681
1705
|
function getXTickLinePosition($$, value, targetScale = getXScale($$)) {
|
|
1682
1706
|
var _a, _b, _c, _d, _e;
|
|
@@ -1692,12 +1716,12 @@ function getXTickLinePosition($$, value, targetScale = getXScale($$)) {
|
|
|
1692
1716
|
}
|
|
1693
1717
|
return scale(normalized);
|
|
1694
1718
|
}
|
|
1695
|
-
function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth) {
|
|
1719
|
+
function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth, targetScale = getXScale($$)) {
|
|
1696
1720
|
if (ticks.length < 2) {
|
|
1697
1721
|
return false;
|
|
1698
1722
|
}
|
|
1699
1723
|
const halfWidth = Math.max(1, tickLineWidth) / 2;
|
|
1700
|
-
const positions = ticks.map((tick) => getXTickLinePosition($$, tick)).filter(Number.isFinite).sort((a, b) => a - b);
|
|
1724
|
+
const positions = ticks.map((tick) => getXTickLinePosition($$, tick, targetScale)).filter(Number.isFinite).sort((a, b) => a - b);
|
|
1701
1725
|
if (positions.length < 2) {
|
|
1702
1726
|
return false;
|
|
1703
1727
|
}
|
|
@@ -1712,10 +1736,10 @@ function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth) {
|
|
|
1712
1736
|
}
|
|
1713
1737
|
return false;
|
|
1714
1738
|
}
|
|
1715
|
-
function dedupeXTickLineValues($$, ticks) {
|
|
1739
|
+
function dedupeXTickLineValues($$, ticks, targetScale = getXScale($$)) {
|
|
1716
1740
|
const seen = /* @__PURE__ */ new Set();
|
|
1717
1741
|
return ticks.filter((tick) => {
|
|
1718
|
-
const pos = getXTickLinePosition($$, tick);
|
|
1742
|
+
const pos = getXTickLinePosition($$, tick, targetScale);
|
|
1719
1743
|
const key = Math.round(pos);
|
|
1720
1744
|
if (!Number.isFinite(pos) || seen.has(key)) {
|
|
1721
1745
|
return false;
|
|
@@ -1737,13 +1761,35 @@ function getXTickLineValues($$, textTicks, tickLineWidth = 1) {
|
|
|
1737
1761
|
const lineTicks = getXTickValues($$, false);
|
|
1738
1762
|
return hasOverlappedXTickLineIntervals($$, lineTicks, tickLineWidth) ? textTicks : dedupeXTickLineValues($$, lineTicks);
|
|
1739
1763
|
}
|
|
1740
|
-
function
|
|
1741
|
-
var _a
|
|
1764
|
+
function getSubXTickLineValues($$, textTicks, tickLineWidth = 1) {
|
|
1765
|
+
var _a;
|
|
1742
1766
|
const { axis, config, scale } = $$;
|
|
1767
|
+
const targetScale = scale.subX;
|
|
1768
|
+
const culling = getAxisTickOption(config, "x", "culling", "subchart_axis_x");
|
|
1769
|
+
const cullingLines = getAxisTickOption(config, "x", "culling_lines", "subchart_axis_x");
|
|
1770
|
+
const outerTick = getAxisTickOption(config, "x", "outer", "subchart_axis_x");
|
|
1771
|
+
if (!targetScale) {
|
|
1772
|
+
return [];
|
|
1773
|
+
}
|
|
1774
|
+
if ((_a = axis == null ? void 0 : axis.isCategorized) == null ? void 0 : _a.call(axis)) {
|
|
1775
|
+
const categoryLineTicks = getCategoryXTickLineValues($$, targetScale, outerTick);
|
|
1776
|
+
return dedupeXTickLineValues($$, categoryLineTicks, targetScale);
|
|
1777
|
+
}
|
|
1778
|
+
if (culling === false || cullingLines === false) {
|
|
1779
|
+
return textTicks;
|
|
1780
|
+
}
|
|
1781
|
+
const lineTicks = getSubXTickValues($$, false);
|
|
1782
|
+
return hasOverlappedXTickLineIntervals($$, lineTicks, tickLineWidth, targetScale) ? textTicks : dedupeXTickLineValues($$, lineTicks, targetScale);
|
|
1783
|
+
}
|
|
1784
|
+
function getYTickValues($$, id = "y", count, culling = true, targetScale = $$.scale[id], optionPrefix = `axis_${id}`) {
|
|
1785
|
+
var _a, _b, _c;
|
|
1786
|
+
const { axis, config } = $$;
|
|
1743
1787
|
const prefix = `axis_${id}`;
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
|
|
1788
|
+
const explicit = getOptionTickValues(
|
|
1789
|
+
getAxisTickOption(config, id, "values", optionPrefix),
|
|
1790
|
+
$$.api
|
|
1791
|
+
);
|
|
1792
|
+
const maybeCull = (ticks) => culling ? cullAxisTicks($$, id, ticks, optionPrefix) : ticks;
|
|
1747
1793
|
if (explicit) {
|
|
1748
1794
|
return maybeCull(normalizeYTickValues($$, explicit, id));
|
|
1749
1795
|
}
|
|
@@ -1751,7 +1797,7 @@ function getYTickValues($$, id = "y", count, culling = true) {
|
|
|
1751
1797
|
if (stepTicks.length) {
|
|
1752
1798
|
return maybeCull(stepTicks);
|
|
1753
1799
|
}
|
|
1754
|
-
const tickCount = count != null ? count : config
|
|
1800
|
+
const tickCount = count != null ? count : getAxisTickOption(config, id, "count", optionPrefix);
|
|
1755
1801
|
if (((_a = axis == null ? void 0 : axis.isTimeSeries) == null ? void 0 : _a.call(axis, id)) && config[`${prefix}_tick_time_value`]) {
|
|
1756
1802
|
return maybeCull(getScaleTicks(targetScale, config[`${prefix}_tick_time_value`]));
|
|
1757
1803
|
}
|
|
@@ -1805,20 +1851,21 @@ function cullTicks(ticks, count) {
|
|
|
1805
1851
|
}
|
|
1806
1852
|
return ticks;
|
|
1807
1853
|
}
|
|
1808
|
-
function cullAxisTicks($$, id, ticks) {
|
|
1854
|
+
function cullAxisTicks($$, id, ticks, optionPrefix = `axis_${id}`) {
|
|
1809
1855
|
const { config } = $$;
|
|
1810
|
-
const
|
|
1811
|
-
if (!
|
|
1856
|
+
const culling = getAxisTickOption(config, id, "culling", optionPrefix);
|
|
1857
|
+
if (!culling) {
|
|
1812
1858
|
return ticks;
|
|
1813
1859
|
}
|
|
1860
|
+
const cullingMax = getAxisTickOption(config, id, "culling_max", optionPrefix) || AXIS_DEFAULT_TICK_COUNT;
|
|
1861
|
+
const reverse = getAxisTickOption(config, id, "culling_reverse", optionPrefix);
|
|
1814
1862
|
const sortedTicks = ticks.slice().sort((a, b) => {
|
|
1815
1863
|
const av = +a;
|
|
1816
1864
|
const bv = +b;
|
|
1817
1865
|
const order = Number.isFinite(av) && Number.isFinite(bv) ? av - bv : String(a).localeCompare(String(b));
|
|
1818
|
-
return
|
|
1866
|
+
return reverse ? -order : order;
|
|
1819
1867
|
});
|
|
1820
1868
|
const tickSize = sortedTicks.length;
|
|
1821
|
-
const cullingMax = config[`${prefix}_max`] || AXIS_DEFAULT_TICK_COUNT;
|
|
1822
1869
|
let intervalForCulling = 0;
|
|
1823
1870
|
for (let i = 1; i < tickSize; i++) {
|
|
1824
1871
|
if (tickSize / i < cullingMax) {
|
|
@@ -1834,19 +1881,21 @@ function cullAxisTicks($$, id, ticks) {
|
|
|
1834
1881
|
);
|
|
1835
1882
|
return ticks.filter((tick) => visible.has(tick));
|
|
1836
1883
|
}
|
|
1837
|
-
function cullDataTicks($$, ticks, sorted = false) {
|
|
1884
|
+
function cullDataTicks($$, ticks, sorted = false, optionPrefix = "axis_x", max) {
|
|
1838
1885
|
const { config } = $$;
|
|
1839
|
-
|
|
1886
|
+
const culling = getAxisTickOption(config, "x", "culling", optionPrefix);
|
|
1887
|
+
if (culling === false) {
|
|
1840
1888
|
return ticks;
|
|
1841
1889
|
}
|
|
1842
|
-
const cullingMax = config
|
|
1890
|
+
const cullingMax = max || getAxisTickOption(config, "x", "culling_max", optionPrefix) || AXIS_DEFAULT_TICK_COUNT;
|
|
1891
|
+
const reverse = getAxisTickOption(config, "x", "culling_reverse", optionPrefix);
|
|
1843
1892
|
const sortedTicks = sorted ? ticks : ticks.slice().sort((a, b) => {
|
|
1844
1893
|
const av = +a;
|
|
1845
1894
|
const bv = +b;
|
|
1846
1895
|
if (Number.isFinite(av) && Number.isFinite(bv)) {
|
|
1847
|
-
return
|
|
1896
|
+
return reverse ? bv - av : av - bv;
|
|
1848
1897
|
}
|
|
1849
|
-
return
|
|
1898
|
+
return reverse ? String(b).localeCompare(String(a)) : String(a).localeCompare(String(b));
|
|
1850
1899
|
});
|
|
1851
1900
|
const tickSize = sortedTicks.length;
|
|
1852
1901
|
let intervalForCulling = 0;
|
|
@@ -1861,7 +1910,7 @@ function cullDataTicks($$, ticks, sorted = false) {
|
|
|
1861
1910
|
}
|
|
1862
1911
|
if (sorted) {
|
|
1863
1912
|
return ticks.filter(
|
|
1864
|
-
(_, i) =>
|
|
1913
|
+
(_, i) => reverse ? (tickSize - 1 - i) % intervalForCulling === 0 : i % intervalForCulling === 0
|
|
1865
1914
|
);
|
|
1866
1915
|
}
|
|
1867
1916
|
const visible = new Set(
|
|
@@ -2323,6 +2372,29 @@ function getXTickTextDirection(isRotated) {
|
|
|
2323
2372
|
function getYTickTextDirection(isRotated, isY2) {
|
|
2324
2373
|
return isRotated ? isY2 ? -1 : 1 : isY2 ? 1 : -1;
|
|
2325
2374
|
}
|
|
2375
|
+
function getSubYTickFormat($$, id) {
|
|
2376
|
+
var _a, _b, _c;
|
|
2377
|
+
const subAxisId = id === "y2" ? "subY2" : "subY";
|
|
2378
|
+
const axisFormat = (_c = (_b = (_a = $$.axis) == null ? void 0 : _a[subAxisId]) == null ? void 0 : _b.tickFormat) == null ? void 0 : _c.call(_b);
|
|
2379
|
+
const configFormat = $$.config[`subchart_axis_${id}_tick_format`] || $$.config[`axis_${id}_tick_format`];
|
|
2380
|
+
if (axisFormat) {
|
|
2381
|
+
return axisFormat;
|
|
2382
|
+
}
|
|
2383
|
+
return typeof configFormat === "function" ? configFormat.bind($$.api) : ((v) => v);
|
|
2384
|
+
}
|
|
2385
|
+
function getGridLineCanvasStyle(style) {
|
|
2386
|
+
return style ? {
|
|
2387
|
+
stroke: style.lineColor,
|
|
2388
|
+
lineWidth: style.lineWidth,
|
|
2389
|
+
lineDash: style.dashArray
|
|
2390
|
+
} : void 0;
|
|
2391
|
+
}
|
|
2392
|
+
function getGridTextCanvasStyle(style) {
|
|
2393
|
+
return style ? {
|
|
2394
|
+
fill: style.labelColor,
|
|
2395
|
+
font: style.labelFont
|
|
2396
|
+
} : void 0;
|
|
2397
|
+
}
|
|
2326
2398
|
function getHorizontalXAxisClipRect(margin, width, height) {
|
|
2327
2399
|
return {
|
|
2328
2400
|
x: margin.left - X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING,
|
|
@@ -2647,7 +2719,7 @@ class CanvasAxisRenderer {
|
|
|
2647
2719
|
* @private
|
|
2648
2720
|
*/
|
|
2649
2721
|
drawSubXAxis($$) {
|
|
2650
|
-
var _a, _b, _c;
|
|
2722
|
+
var _a, _b, _c, _d;
|
|
2651
2723
|
const { ctx, painter, theme: { style: { axis } } } = this;
|
|
2652
2724
|
const {
|
|
2653
2725
|
config,
|
|
@@ -2668,12 +2740,14 @@ class CanvasAxisRenderer {
|
|
|
2668
2740
|
const rangeStart = isRotated ? y1 : x1;
|
|
2669
2741
|
const rangeEnd = isRotated ? y2 : x2;
|
|
2670
2742
|
const ticks = getSubXTickValues($$);
|
|
2743
|
+
const lineTicks = getSubXTickLineValues($$, ticks, axis.tickWidth);
|
|
2744
|
+
const outerTick = (_a = config.subchart_axis_x_tick_outer) != null ? _a : config.axis_x_tick_outer;
|
|
2671
2745
|
const tickDirection = isRotated ? config.axis_x_tick_inner ? 1 : -1 : config.axis_x_tick_inner ? -1 : 1;
|
|
2672
2746
|
const outerTickDirection = getXOuterTickDirection(isRotated);
|
|
2673
2747
|
const tickTextDirection = getXTickTextDirection(isRotated);
|
|
2674
2748
|
const tickTextPosition = config.axis_x_tick_text_position;
|
|
2675
|
-
const tickRotate = !isRotated ? ((
|
|
2676
|
-
const tickFormat = format.subXAxisTick || ((
|
|
2749
|
+
const tickRotate = !isRotated ? ((_b = $$.getAxisTickRotate) == null ? void 0 : _b.call($$, "x")) || 0 : 0;
|
|
2750
|
+
const tickFormat = format.subXAxisTick || ((_d = (_c = $$.axis) == null ? void 0 : _c.getXAxisTickFormat) == null ? void 0 : _d.call(_c, true));
|
|
2677
2751
|
painter.clipRect(
|
|
2678
2752
|
isRotated ? getRotatedXAxisClipRect(margin2, current.width, height2) : __spreadProps(CanvasAxisRenderer_spreadValues({}, getHorizontalXAxisClipRect(
|
|
2679
2753
|
margin2,
|
|
@@ -2683,15 +2757,17 @@ class CanvasAxisRenderer {
|
|
|
2683
2757
|
y: margin2.top
|
|
2684
2758
|
}),
|
|
2685
2759
|
() => {
|
|
2760
|
+
ctx.globalAlpha = 1;
|
|
2686
2761
|
ctx.strokeStyle = axis.lineColor;
|
|
2687
2762
|
ctx.lineWidth = axis.lineWidth;
|
|
2763
|
+
ctx.setLineDash([]);
|
|
2688
2764
|
painter.strokePath(() => {
|
|
2689
2765
|
if (isRotated) {
|
|
2690
2766
|
painter.traceLine(x, y1, x, y2);
|
|
2691
2767
|
} else {
|
|
2692
2768
|
painter.traceLine(x1, y, x2, y);
|
|
2693
2769
|
}
|
|
2694
|
-
if (
|
|
2770
|
+
if (outerTick) {
|
|
2695
2771
|
if (isRotated) {
|
|
2696
2772
|
painter.traceLine(x, y1, x + AXIS_TICK_SIZE * outerTickDirection, y1);
|
|
2697
2773
|
painter.traceLine(x, y2, x + AXIS_TICK_SIZE * outerTickDirection, y2);
|
|
@@ -2710,15 +2786,15 @@ class CanvasAxisRenderer {
|
|
|
2710
2786
|
ctx.lineWidth = axis.tickWidth;
|
|
2711
2787
|
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
2712
2788
|
const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, scale.subX);
|
|
2713
|
-
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2789
|
+
if (config.subchart_axis_x_tick_show) {
|
|
2790
|
+
for (const tick of lineTicks) {
|
|
2791
|
+
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
2792
|
+
const tx = margin2.left + tickPos;
|
|
2793
|
+
const ty = margin2.top + tickPos;
|
|
2794
|
+
const pos = isRotated ? ty : tx;
|
|
2795
|
+
if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
|
|
2796
|
+
continue;
|
|
2797
|
+
}
|
|
2722
2798
|
painter.strokePath(() => {
|
|
2723
2799
|
if (isRotated) {
|
|
2724
2800
|
painter.traceLine(x, ty, x + AXIS_TICK_SIZE * tickDirection, ty);
|
|
@@ -2727,6 +2803,15 @@ class CanvasAxisRenderer {
|
|
|
2727
2803
|
}
|
|
2728
2804
|
});
|
|
2729
2805
|
}
|
|
2806
|
+
}
|
|
2807
|
+
for (const tick of ticks) {
|
|
2808
|
+
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
2809
|
+
const tx = margin2.left + tickPos;
|
|
2810
|
+
const ty = margin2.top + tickPos;
|
|
2811
|
+
const pos = isRotated ? ty : tx;
|
|
2812
|
+
if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
|
|
2813
|
+
continue;
|
|
2814
|
+
}
|
|
2730
2815
|
if (!config.subchart_axis_x_tick_text_show) {
|
|
2731
2816
|
continue;
|
|
2732
2817
|
}
|
|
@@ -2764,6 +2849,42 @@ class CanvasAxisRenderer {
|
|
|
2764
2849
|
}
|
|
2765
2850
|
);
|
|
2766
2851
|
}
|
|
2852
|
+
/**
|
|
2853
|
+
* Draw the canvas subchart y/y2 axes.
|
|
2854
|
+
* @param {object} $$ ChartInternal instance
|
|
2855
|
+
* @private
|
|
2856
|
+
*/
|
|
2857
|
+
drawSubYAxes($$) {
|
|
2858
|
+
const {
|
|
2859
|
+
config,
|
|
2860
|
+
scale,
|
|
2861
|
+
state: { margin2, width2, height2 }
|
|
2862
|
+
} = $$;
|
|
2863
|
+
if (!config.subchart_show || width2 <= 0 || height2 <= 0) {
|
|
2864
|
+
return;
|
|
2865
|
+
}
|
|
2866
|
+
["y", "y2"].forEach((id) => {
|
|
2867
|
+
var _a;
|
|
2868
|
+
const subScale = id === "y2" ? scale.subY2 : scale.subY;
|
|
2869
|
+
if (!config[`subchart_axis_${id}_show`] || !subScale) {
|
|
2870
|
+
return;
|
|
2871
|
+
}
|
|
2872
|
+
this.drawYAxis($$, id, {
|
|
2873
|
+
scale: subScale,
|
|
2874
|
+
ticks: getYTickValues($$, id, void 0, true, subScale, `subchart_axis_${id}`),
|
|
2875
|
+
format: getSubYTickFormat($$, id),
|
|
2876
|
+
index: 0,
|
|
2877
|
+
outerTick: (_a = config[`subchart_axis_${id}_tick_outer`]) != null ? _a : config[`axis_${id}_tick_outer`],
|
|
2878
|
+
margin: margin2,
|
|
2879
|
+
width: width2,
|
|
2880
|
+
height: height2,
|
|
2881
|
+
prefix: `subchart_axis_${id}`,
|
|
2882
|
+
tickShow: config[`subchart_axis_${id}_tick_show`],
|
|
2883
|
+
tickTextShow: config[`subchart_axis_${id}_tick_text_show`],
|
|
2884
|
+
tickTextPosition: config[`axis_${id}_tick_text_position`]
|
|
2885
|
+
});
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2767
2888
|
/**
|
|
2768
2889
|
* Draw chart title.
|
|
2769
2890
|
* @param {object} $$ ChartInternal instance
|
|
@@ -2994,14 +3115,21 @@ class CanvasAxisRenderer {
|
|
|
2994
3115
|
ctx.fillStyle = grid.labelColor;
|
|
2995
3116
|
ctx.textBaseline = "middle";
|
|
2996
3117
|
ctx.setLineDash([]);
|
|
2997
|
-
const drawLabel = (text, x, y, rotated = false) => {
|
|
3118
|
+
const drawLabel = (text, x, y, rotated = false, style) => {
|
|
2998
3119
|
if (!text) {
|
|
2999
3120
|
return;
|
|
3000
3121
|
}
|
|
3001
|
-
painter.text(text, x, y, {
|
|
3122
|
+
painter.text(text, x, y, __spreadProps(CanvasAxisRenderer_spreadValues({}, style), {
|
|
3002
3123
|
angle: rotated ? -90 : 0
|
|
3003
|
-
});
|
|
3124
|
+
}));
|
|
3125
|
+
};
|
|
3126
|
+
const drawLine = (line, axisId, draw) => {
|
|
3127
|
+
const style = getGridLineCanvasStyle(
|
|
3128
|
+
this.theme.getGridLineStyle(axisId, line, "line")
|
|
3129
|
+
);
|
|
3130
|
+
painter.strokePath(draw, style);
|
|
3004
3131
|
};
|
|
3132
|
+
const getTextStyle = (axisId, line) => getGridTextCanvasStyle(this.theme.getGridLineStyle(axisId, line, "text"));
|
|
3005
3133
|
const drawXLine = (line) => {
|
|
3006
3134
|
if (line.value === void 0 || !scale.x) {
|
|
3007
3135
|
return;
|
|
@@ -3012,18 +3140,20 @@ class CanvasAxisRenderer {
|
|
|
3012
3140
|
}
|
|
3013
3141
|
if (isRotated) {
|
|
3014
3142
|
const y = margin.top + pos;
|
|
3015
|
-
|
|
3143
|
+
drawLine(line, "x", () => {
|
|
3016
3144
|
painter.traceLine(x1, y, x2, y);
|
|
3017
3145
|
});
|
|
3018
3146
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
3019
3147
|
drawLabel(
|
|
3020
3148
|
line.text,
|
|
3021
3149
|
getLineTextPosition(line.position, x1, x2),
|
|
3022
|
-
y - 5
|
|
3150
|
+
y - 5,
|
|
3151
|
+
false,
|
|
3152
|
+
getTextStyle("x", line)
|
|
3023
3153
|
);
|
|
3024
3154
|
} else {
|
|
3025
3155
|
const x = margin.left + pos;
|
|
3026
|
-
|
|
3156
|
+
drawLine(line, "x", () => {
|
|
3027
3157
|
painter.traceLine(x, y1, x, y2);
|
|
3028
3158
|
});
|
|
3029
3159
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
@@ -3031,7 +3161,8 @@ class CanvasAxisRenderer {
|
|
|
3031
3161
|
line.text,
|
|
3032
3162
|
x - 5,
|
|
3033
3163
|
getRotatedLineTextPosition(line.position, y1, y2),
|
|
3034
|
-
true
|
|
3164
|
+
true,
|
|
3165
|
+
getTextStyle("x", line)
|
|
3035
3166
|
);
|
|
3036
3167
|
}
|
|
3037
3168
|
};
|
|
@@ -3048,7 +3179,7 @@ class CanvasAxisRenderer {
|
|
|
3048
3179
|
}
|
|
3049
3180
|
if (isRotated) {
|
|
3050
3181
|
const x = margin.left + pos;
|
|
3051
|
-
|
|
3182
|
+
drawLine(line, "y", () => {
|
|
3052
3183
|
painter.traceLine(x, y1, x, y2);
|
|
3053
3184
|
});
|
|
3054
3185
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
@@ -3056,18 +3187,21 @@ class CanvasAxisRenderer {
|
|
|
3056
3187
|
line.text,
|
|
3057
3188
|
x - 5,
|
|
3058
3189
|
getRotatedLineTextPosition(line.position, y1, y2),
|
|
3059
|
-
true
|
|
3190
|
+
true,
|
|
3191
|
+
getTextStyle("y", line)
|
|
3060
3192
|
);
|
|
3061
3193
|
} else {
|
|
3062
3194
|
const y = margin.top + pos;
|
|
3063
|
-
|
|
3195
|
+
drawLine(line, "y", () => {
|
|
3064
3196
|
painter.traceLine(x1, y, x2, y);
|
|
3065
3197
|
});
|
|
3066
3198
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
3067
3199
|
drawLabel(
|
|
3068
3200
|
line.text,
|
|
3069
3201
|
getLineTextPosition(line.position, x1, x2),
|
|
3070
|
-
y - 5
|
|
3202
|
+
y - 5,
|
|
3203
|
+
false,
|
|
3204
|
+
getTextStyle("y", line)
|
|
3071
3205
|
);
|
|
3072
3206
|
}
|
|
3073
3207
|
};
|
|
@@ -3458,31 +3592,37 @@ class CanvasAxisRenderer {
|
|
|
3458
3592
|
* @private
|
|
3459
3593
|
*/
|
|
3460
3594
|
drawYAxis($$, id = "y", axisOptions) {
|
|
3461
|
-
var _a, _b, _c, _d;
|
|
3595
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3462
3596
|
const { ctx, painter, theme: { style: { axis } } } = this;
|
|
3463
|
-
const { config, scale, state
|
|
3464
|
-
const
|
|
3597
|
+
const { config, scale, state } = $$;
|
|
3598
|
+
const { margin, width, height } = state;
|
|
3599
|
+
const plotMargin = (axisOptions == null ? void 0 : axisOptions.margin) || margin;
|
|
3600
|
+
const plotWidth = (_a = axisOptions == null ? void 0 : axisOptions.width) != null ? _a : width;
|
|
3601
|
+
const plotHeight = (_b = axisOptions == null ? void 0 : axisOptions.height) != null ? _b : height;
|
|
3602
|
+
const prefix = (axisOptions == null ? void 0 : axisOptions.prefix) || `axis_${id}`;
|
|
3465
3603
|
const targetScale = (axisOptions == null ? void 0 : axisOptions.scale) || scale[id];
|
|
3466
3604
|
const isY2 = id === "y2";
|
|
3467
3605
|
const isRotated = config.axis_rotated;
|
|
3468
3606
|
const axisOffset = (axisOptions == null ? void 0 : axisOptions.index) ? $$.getAxisSize(id) * axisOptions.index : 0;
|
|
3469
3607
|
const x = painter.crisp(
|
|
3470
|
-
|
|
3608
|
+
plotMargin.left + (isY2 ? plotWidth + (isRotated ? 0 : axisOffset) : -axisOffset),
|
|
3471
3609
|
axis.lineWidth
|
|
3472
3610
|
);
|
|
3473
|
-
const y = painter.crisp(
|
|
3474
|
-
const x1 =
|
|
3475
|
-
const x2 =
|
|
3476
|
-
const y1 =
|
|
3477
|
-
const y2 =
|
|
3611
|
+
const y = painter.crisp(plotMargin.top + (isRotated ? isY2 ? -axisOffset - 1 : plotHeight + axisOffset : 0), axis.lineWidth);
|
|
3612
|
+
const x1 = plotMargin.left;
|
|
3613
|
+
const x2 = plotMargin.left + plotWidth;
|
|
3614
|
+
const y1 = plotMargin.top;
|
|
3615
|
+
const y2 = plotMargin.top + plotHeight;
|
|
3478
3616
|
const ticks = (axisOptions == null ? void 0 : axisOptions.ticks) || getYTickValues($$, id);
|
|
3479
3617
|
const lineTicks = (axisOptions == null ? void 0 : axisOptions.ticks) || (config[`${prefix}_tick_culling`] && config[`${prefix}_tick_culling_lines`] !== false ? getYTickValues($$, id, void 0, false) : ticks);
|
|
3480
|
-
const format = (axisOptions == null ? void 0 : axisOptions.format) || ((
|
|
3618
|
+
const format = (axisOptions == null ? void 0 : axisOptions.format) || ((_e = (_d = (_c = $$.axis) == null ? void 0 : _c[id]) == null ? void 0 : _d.tickFormat) == null ? void 0 : _e.call(_d)) || ((_f = config[`${prefix}_tick_format`]) == null ? void 0 : _f.bind($$.api)) || ((v) => v);
|
|
3481
3619
|
const outerTick = axisOptions ? axisOptions.outerTick : config[`${prefix}_tick_outer`];
|
|
3482
3620
|
const tickDirection = isRotated ? isY2 ? config.axis_y2_tick_inner ? 1 : -1 : config.axis_y_tick_inner ? -1 : 1 : isY2 ? config.axis_y2_tick_inner ? -1 : 1 : config.axis_y_tick_inner ? 1 : -1;
|
|
3483
3621
|
const outerTickDirection = getYOuterTickDirection(config, isRotated, isY2);
|
|
3484
3622
|
const tickTextDirection = getYTickTextDirection(isRotated, isY2);
|
|
3485
|
-
const tickTextPosition = config[`${prefix}_tick_text_position`];
|
|
3623
|
+
const tickTextPosition = (axisOptions == null ? void 0 : axisOptions.tickTextPosition) || config[`${prefix}_tick_text_position`] || config[`axis_${id}_tick_text_position`];
|
|
3624
|
+
const tickShow = (_g = axisOptions == null ? void 0 : axisOptions.tickShow) != null ? _g : axisOptions ? true : config[`${prefix}_tick_show`];
|
|
3625
|
+
const tickTextShow = (_h = axisOptions == null ? void 0 : axisOptions.tickTextShow) != null ? _h : axisOptions ? true : config[`${prefix}_tick_text_show`];
|
|
3486
3626
|
painter.withState(() => {
|
|
3487
3627
|
ctx.strokeStyle = axis.lineColor;
|
|
3488
3628
|
ctx.lineWidth = axis.lineWidth;
|
|
@@ -3513,8 +3653,8 @@ class CanvasAxisRenderer {
|
|
|
3513
3653
|
const drawableLineTicks = [];
|
|
3514
3654
|
const addDrawableTick = (tick, target) => {
|
|
3515
3655
|
const value = normalizeYValue($$, tick, id);
|
|
3516
|
-
const tx =
|
|
3517
|
-
const ty =
|
|
3656
|
+
const tx = plotMargin.left + targetScale(value);
|
|
3657
|
+
const ty = plotMargin.top + targetScale(value);
|
|
3518
3658
|
const pos = isRotated ? tx : ty;
|
|
3519
3659
|
if (!isDrawable(pos)) {
|
|
3520
3660
|
return;
|
|
@@ -3527,7 +3667,7 @@ class CanvasAxisRenderer {
|
|
|
3527
3667
|
for (const tick of lineTicks) {
|
|
3528
3668
|
addDrawableTick(tick, drawableLineTicks);
|
|
3529
3669
|
}
|
|
3530
|
-
if (
|
|
3670
|
+
if (tickShow) {
|
|
3531
3671
|
painter.strokePath(() => {
|
|
3532
3672
|
for (const { tx, ty } of drawableLineTicks) {
|
|
3533
3673
|
if (isRotated) {
|
|
@@ -3538,7 +3678,7 @@ class CanvasAxisRenderer {
|
|
|
3538
3678
|
}
|
|
3539
3679
|
});
|
|
3540
3680
|
}
|
|
3541
|
-
if (
|
|
3681
|
+
if (tickTextShow) {
|
|
3542
3682
|
for (const { tick, tx, ty } of drawableTicks) {
|
|
3543
3683
|
if (isRotated) {
|
|
3544
3684
|
painter.text(
|
|
@@ -3730,8 +3870,112 @@ class CanvasEngine {
|
|
|
3730
3870
|
}
|
|
3731
3871
|
}
|
|
3732
3872
|
|
|
3873
|
+
;// ./src/ChartInternal/internals/subchart.util.ts
|
|
3874
|
+
function isContinuousGridFocusEnabled($$) {
|
|
3875
|
+
const { config, state } = $$;
|
|
3876
|
+
return !!(config.subchart_grid_focus_continuous && config.subchart_grid_focus !== false && config.subchart_show && config.subchart_brush_enabled === false && state.width2 > 0 && state.height2 > 0);
|
|
3877
|
+
}
|
|
3878
|
+
function getMainCoordFromSubchartCoord($$, subCoord) {
|
|
3879
|
+
var _a;
|
|
3880
|
+
const { config, scale, state } = $$;
|
|
3881
|
+
const mainX = scale.zoom || scale.x;
|
|
3882
|
+
const subX = scale.subX;
|
|
3883
|
+
if (!mainX || !subX) {
|
|
3884
|
+
return null;
|
|
3885
|
+
}
|
|
3886
|
+
const subLength = config.axis_rotated ? state.height2 : state.width2;
|
|
3887
|
+
const mainLength = config.axis_rotated ? state.height : state.width;
|
|
3888
|
+
const domainValue = (_a = subX.invert) == null ? void 0 : _a.call(subX, subCoord);
|
|
3889
|
+
let mainCoord = domainValue == null ? NaN : mainX(domainValue);
|
|
3890
|
+
if (!Number.isFinite(mainCoord) && subLength > 0) {
|
|
3891
|
+
mainCoord = Math.max(0, Math.min(1, subCoord / subLength)) * mainLength;
|
|
3892
|
+
}
|
|
3893
|
+
return Number.isFinite(mainCoord) ? Math.max(0, Math.min(mainLength, mainCoord)) : null;
|
|
3894
|
+
}
|
|
3895
|
+
|
|
3733
3896
|
;// ./src/ChartInternal/shape/core/barRadius.ts
|
|
3734
3897
|
|
|
3898
|
+
const RE_PATH_NUMBER = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
|
|
3899
|
+
const RE_PATH_TOKEN = /([aAcChHlLmMqQsStTvVzZ])|([-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?)/g;
|
|
3900
|
+
function getArcFlagTokenIndexes(path) {
|
|
3901
|
+
const flags = /* @__PURE__ */ new Set();
|
|
3902
|
+
let numIndex = -1;
|
|
3903
|
+
let argIndex = 0;
|
|
3904
|
+
let inArc = false;
|
|
3905
|
+
let token;
|
|
3906
|
+
RE_PATH_TOKEN.lastIndex = 0;
|
|
3907
|
+
while (token = RE_PATH_TOKEN.exec(path)) {
|
|
3908
|
+
if (token[1]) {
|
|
3909
|
+
inArc = token[1] === "a" || token[1] === "A";
|
|
3910
|
+
argIndex = 0;
|
|
3911
|
+
} else {
|
|
3912
|
+
numIndex++;
|
|
3913
|
+
if (inArc) {
|
|
3914
|
+
const pos = argIndex % 7;
|
|
3915
|
+
if (pos === 2 || pos === 3 || pos === 4) {
|
|
3916
|
+
flags.add(numIndex);
|
|
3917
|
+
}
|
|
3918
|
+
argIndex++;
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
}
|
|
3922
|
+
return flags;
|
|
3923
|
+
}
|
|
3924
|
+
function getBarPathInterpolator(a, b) {
|
|
3925
|
+
const flagSet = getArcFlagTokenIndexes(b);
|
|
3926
|
+
const segments = [];
|
|
3927
|
+
const interpolators = [];
|
|
3928
|
+
let bIndex = 0;
|
|
3929
|
+
let segIndex = -1;
|
|
3930
|
+
let numIndex = -1;
|
|
3931
|
+
let am;
|
|
3932
|
+
let bm;
|
|
3933
|
+
const append = (text) => {
|
|
3934
|
+
if (segments[segIndex]) {
|
|
3935
|
+
segments[segIndex] += text;
|
|
3936
|
+
} else {
|
|
3937
|
+
segments[++segIndex] = text;
|
|
3938
|
+
}
|
|
3939
|
+
};
|
|
3940
|
+
RE_PATH_NUMBER.lastIndex = 0;
|
|
3941
|
+
const reA = RE_PATH_NUMBER;
|
|
3942
|
+
const reB = new RegExp(RE_PATH_NUMBER.source, "g");
|
|
3943
|
+
a += "";
|
|
3944
|
+
b += "";
|
|
3945
|
+
while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
|
|
3946
|
+
numIndex++;
|
|
3947
|
+
if (bm.index > bIndex) {
|
|
3948
|
+
append(b.slice(bIndex, bm.index));
|
|
3949
|
+
}
|
|
3950
|
+
if (am[0] === bm[0]) {
|
|
3951
|
+
append(bm[0]);
|
|
3952
|
+
} else {
|
|
3953
|
+
const from = +am[0];
|
|
3954
|
+
const to = +bm[0];
|
|
3955
|
+
const isFlag = flagSet.has(numIndex);
|
|
3956
|
+
segments[++segIndex] = null;
|
|
3957
|
+
interpolators.push({
|
|
3958
|
+
index: segIndex,
|
|
3959
|
+
fn: isFlag ? (t) => Math.round(from + (to - from) * t) : (t) => from + (to - from) * t
|
|
3960
|
+
});
|
|
3961
|
+
}
|
|
3962
|
+
bIndex = reB.lastIndex;
|
|
3963
|
+
}
|
|
3964
|
+
if (bIndex < b.length) {
|
|
3965
|
+
append(b.slice(bIndex));
|
|
3966
|
+
}
|
|
3967
|
+
if (!interpolators.length) {
|
|
3968
|
+
const result = segments.join("");
|
|
3969
|
+
return () => result;
|
|
3970
|
+
}
|
|
3971
|
+
return (t) => {
|
|
3972
|
+
for (let i = 0, len = interpolators.length; i < len; i++) {
|
|
3973
|
+
const { index, fn } = interpolators[i];
|
|
3974
|
+
segments[index] = String(fn(t));
|
|
3975
|
+
}
|
|
3976
|
+
return segments.join("");
|
|
3977
|
+
};
|
|
3978
|
+
}
|
|
3735
3979
|
function getBarRadiusResolver($$) {
|
|
3736
3980
|
const { bar_radius: radius, bar_radius_ratio: ratio } = $$.config;
|
|
3737
3981
|
return isNumber(radius) && radius > 0 ? () => radius : isNumber(ratio) ? (width) => width * ratio : null;
|
|
@@ -3969,6 +4213,26 @@ var path_spreadValues = (a, b) => {
|
|
|
3969
4213
|
};
|
|
3970
4214
|
var path_spreadProps = (a, b) => path_defProps(a, path_getOwnPropDescs(b));
|
|
3971
4215
|
|
|
4216
|
+
function getPathValueFn($$, isSub) {
|
|
4217
|
+
if (!isSub) {
|
|
4218
|
+
return (d) => $$.getBaseValue(d);
|
|
4219
|
+
}
|
|
4220
|
+
return (d) => {
|
|
4221
|
+
var _a;
|
|
4222
|
+
const value = (_a = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _a.call($$, d, true);
|
|
4223
|
+
return value === void 0 ? $$.getBaseValue(d) : value;
|
|
4224
|
+
};
|
|
4225
|
+
}
|
|
4226
|
+
function getProjectedValues($$, values, isSub) {
|
|
4227
|
+
if (!isSub) {
|
|
4228
|
+
return values;
|
|
4229
|
+
}
|
|
4230
|
+
return values.map((d) => {
|
|
4231
|
+
var _a;
|
|
4232
|
+
const value = (_a = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _a.call($$, d, isSub);
|
|
4233
|
+
return value === void 0 ? d : path_spreadProps(path_spreadValues({}, d), { value });
|
|
4234
|
+
});
|
|
4235
|
+
}
|
|
3972
4236
|
function getLineValues($$, d, values) {
|
|
3973
4237
|
return $$.isStepType(d) ? $$.convertValuesToStep(values) : values;
|
|
3974
4238
|
}
|
|
@@ -3978,13 +4242,16 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
3978
4242
|
const isRotated = config.axis_rotated;
|
|
3979
4243
|
const getPoints = $$.generateGetLinePoints(lineIndices, isSub);
|
|
3980
4244
|
const yScale = $$.getYScaleById.bind($$);
|
|
4245
|
+
const pathValue = getPathValueFn($$, isSub);
|
|
3981
4246
|
const xValue = (d) => (isSub ? $$.subxx : $$.xx).call($$, d);
|
|
3982
|
-
const yValue = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
|
|
4247
|
+
const yValue = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
|
|
4248
|
+
pathValue(d)
|
|
4249
|
+
);
|
|
3983
4250
|
let line = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.line)();
|
|
3984
4251
|
line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue);
|
|
3985
4252
|
context && (line = line.context(context));
|
|
3986
4253
|
if (!lineConnectNull) {
|
|
3987
|
-
line = line.defined((d) =>
|
|
4254
|
+
line = line.defined((d) => pathValue(d) !== null);
|
|
3988
4255
|
}
|
|
3989
4256
|
const x = isSub ? scale.subX : scale.x;
|
|
3990
4257
|
return (d) => {
|
|
@@ -3996,6 +4263,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
3996
4263
|
if ($$.isLineType(d)) {
|
|
3997
4264
|
const regions = config.data_regions[d.id];
|
|
3998
4265
|
if (regions && !context && $$.lineWithRegions) {
|
|
4266
|
+
values = getProjectedValues($$, values, isSub);
|
|
3999
4267
|
if ($$.isAreaRangeType(d)) {
|
|
4000
4268
|
values = values.map((dv) => path_spreadProps(path_spreadValues({}, dv), { value: $$.getRangedData(dv, "mid") }));
|
|
4001
4269
|
}
|
|
@@ -4009,7 +4277,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
4009
4277
|
} else {
|
|
4010
4278
|
if (values[0]) {
|
|
4011
4279
|
x0 = x(values[0].x);
|
|
4012
|
-
y0 = y(values[0]
|
|
4280
|
+
y0 = y(pathValue(values[0]));
|
|
4013
4281
|
}
|
|
4014
4282
|
path = isRotated ? `M ${y0} ${x0}` : `M ${x0} ${y0}`;
|
|
4015
4283
|
}
|
|
@@ -4022,12 +4290,22 @@ function generateDrawAreaPath($$, areaIndices, isSub, context) {
|
|
|
4022
4290
|
const isRotated = config.axis_rotated;
|
|
4023
4291
|
const getPoints = $$.generateGetAreaPoints(areaIndices, isSub);
|
|
4024
4292
|
const yScale = $$.getYScaleById.bind($$);
|
|
4293
|
+
const pathValue = getPathValueFn($$, isSub);
|
|
4294
|
+
const shapeYMin = /* @__PURE__ */ new Map();
|
|
4295
|
+
const getShapeYMin = (id) => {
|
|
4296
|
+
let min = shapeYMin.get(id);
|
|
4297
|
+
if (min === void 0) {
|
|
4298
|
+
min = $$.getShapeYMin(id, isSub);
|
|
4299
|
+
shapeYMin.set(id, min);
|
|
4300
|
+
}
|
|
4301
|
+
return min;
|
|
4302
|
+
};
|
|
4025
4303
|
const xValue = (d) => (isSub ? $$.subxx : $$.xx).call($$, d);
|
|
4026
4304
|
const value0 = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
|
|
4027
|
-
$$.isAreaRangeType(d) ? $$.getRangedData(d, "high") :
|
|
4305
|
+
$$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : getShapeYMin(d.id)
|
|
4028
4306
|
);
|
|
4029
4307
|
const value1 = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScale(d.id, isSub)(
|
|
4030
|
-
$$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : d
|
|
4308
|
+
$$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : pathValue(d)
|
|
4031
4309
|
);
|
|
4032
4310
|
return (d) => {
|
|
4033
4311
|
let values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values;
|
|
@@ -4036,19 +4314,20 @@ function generateDrawAreaPath($$, areaIndices, isSub, context) {
|
|
|
4036
4314
|
let path;
|
|
4037
4315
|
if ($$.isAreaType(d)) {
|
|
4038
4316
|
let area = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.area)();
|
|
4039
|
-
area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : config.area_below ? $$.state.height : value0).y1(value1);
|
|
4317
|
+
area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : config.area_below ? isSub ? $$.state.height2 : $$.state.height : value0).y1(value1);
|
|
4040
4318
|
context && (area = area.context(context));
|
|
4041
4319
|
if (!lineConnectNull) {
|
|
4042
|
-
area = area.defined((d2) =>
|
|
4320
|
+
area = area.defined((d2) => pathValue(d2) !== null);
|
|
4043
4321
|
}
|
|
4322
|
+
values = getProjectedValues($$, values, isSub);
|
|
4044
4323
|
if ($$.isStepType(d)) {
|
|
4045
4324
|
values = $$.convertValuesToStep(values);
|
|
4046
4325
|
}
|
|
4047
4326
|
path = area.curve($$.getCurve(d))(values);
|
|
4048
4327
|
} else {
|
|
4049
4328
|
if (values[0]) {
|
|
4050
|
-
x0 = $$.scale.x(values[0].x);
|
|
4051
|
-
y0 = $$.getYScaleById(d.id)(values[0]
|
|
4329
|
+
x0 = (isSub ? $$.scale.subX : $$.scale.x)(values[0].x);
|
|
4330
|
+
y0 = $$.getYScaleById(d.id, isSub)(pathValue(values[0]));
|
|
4052
4331
|
}
|
|
4053
4332
|
path = isRotated ? `M ${y0} ${x0}` : `M ${x0} ${y0}`;
|
|
4054
4333
|
}
|
|
@@ -4908,6 +5187,7 @@ var CanvasRenderer_publicField = (obj, key, value) => CanvasRenderer_defNormalPr
|
|
|
4908
5187
|
|
|
4909
5188
|
|
|
4910
5189
|
|
|
5190
|
+
|
|
4911
5191
|
const RENDERER_GROUPED_TYPE_FILTERS = [
|
|
4912
5192
|
isCanvasAreaType,
|
|
4913
5193
|
isCanvasBarType,
|
|
@@ -5589,165 +5869,175 @@ class CanvasRenderer {
|
|
|
5589
5869
|
/**
|
|
5590
5870
|
* Draw the canvas subchart overview and brush selection.
|
|
5591
5871
|
* @param {object} $$ ChartInternal instance
|
|
5592
|
-
* @param {object}
|
|
5872
|
+
* @param {object} _shape Cached main shape object
|
|
5593
5873
|
* @private
|
|
5594
5874
|
*/
|
|
5595
|
-
drawSubchart($$,
|
|
5875
|
+
drawSubchart($$, _shape) {
|
|
5596
5876
|
const { config, state } = $$;
|
|
5877
|
+
void _shape;
|
|
5597
5878
|
if (!config.subchart_show || !state.hasAxis || state.width2 <= 0 || state.height2 <= 0) {
|
|
5598
5879
|
return;
|
|
5599
5880
|
}
|
|
5600
5881
|
const { ctx, painter, theme: { style } } = this;
|
|
5601
5882
|
const { margin2, width2, height2 } = state;
|
|
5602
5883
|
const rect = { x: margin2.left, y: margin2.top, w: width2, h: height2 };
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
ctx.globalAlpha = style.shape.areaOpacity;
|
|
5625
|
-
for (const target of areaTargets) {
|
|
5626
|
-
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5627
|
-
continue;
|
|
5628
|
-
}
|
|
5629
|
-
ctx.fillStyle = $$.color(target.id);
|
|
5630
|
-
drawCanvasArea($$, target, areaIndices, painter, true);
|
|
5631
|
-
}
|
|
5632
|
-
ctx.globalAlpha = 1;
|
|
5633
|
-
const barTargets = targets.filter(isCanvasBarType.bind(null, $$));
|
|
5634
|
-
const barIndices = getCanvasShapeIndices(
|
|
5635
|
-
$$,
|
|
5636
|
-
shape,
|
|
5637
|
-
TYPE.BAR,
|
|
5638
|
-
isCanvasBarType.bind(null, $$)
|
|
5639
|
-
);
|
|
5640
|
-
const getBarPoints = (_a = $$.generateGetBarPoints) == null ? void 0 : _a.call($$, barIndices, true);
|
|
5641
|
-
if (getBarPoints) {
|
|
5642
|
-
ctx.globalAlpha = style.shape.barOpacity;
|
|
5643
|
-
for (const target of barTargets) {
|
|
5884
|
+
$$.withSubchartTypeContext(() => {
|
|
5885
|
+
var _a;
|
|
5886
|
+
const targets = $$.filterTargetsToShow().filter(isCanvasRenderableTarget.bind(null, $$));
|
|
5887
|
+
const shape = $$.getDrawShape();
|
|
5888
|
+
(_a = $$.updateSubchartYDomain) == null ? void 0 : _a.call($$, targets);
|
|
5889
|
+
painter.withState(() => {
|
|
5890
|
+
painter.clipRect(rect, () => {
|
|
5891
|
+
painter.withTranslation(rect.x, rect.y, () => {
|
|
5892
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
5893
|
+
const areaTargets = targets.filter(isCanvasAreaType.bind(null, $$));
|
|
5894
|
+
const areaIndices = getCanvasShapeIndices(
|
|
5895
|
+
$$,
|
|
5896
|
+
shape,
|
|
5897
|
+
TYPE.AREA,
|
|
5898
|
+
isCanvasAreaType.bind(null, $$)
|
|
5899
|
+
);
|
|
5900
|
+
for (const target of areaTargets) {
|
|
5901
|
+
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5902
|
+
continue;
|
|
5903
|
+
}
|
|
5904
|
+
ctx.globalAlpha = style.shape.areaOpacity * getCanvasTargetFocusOpacity($$, target);
|
|
5644
5905
|
ctx.fillStyle = $$.color(target.id);
|
|
5645
|
-
target
|
|
5646
|
-
if (!hasCanvasDrawableValue($$, d)) {
|
|
5647
|
-
return;
|
|
5648
|
-
}
|
|
5649
|
-
const geometry = getCanvasBarGeometry($$, getBarPoints, d, i);
|
|
5650
|
-
geometry && painter.fillRect(geometry.rect, { fill: ctx.fillStyle });
|
|
5651
|
-
});
|
|
5906
|
+
drawCanvasArea($$, target, areaIndices, painter, true);
|
|
5652
5907
|
}
|
|
5653
5908
|
ctx.globalAlpha = 1;
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
candlestickIndices,
|
|
5667
|
-
true
|
|
5668
|
-
);
|
|
5669
|
-
if (getCandlestickPoints) {
|
|
5670
|
-
ctx.lineWidth = style.shape.candlestickLineWidth;
|
|
5671
|
-
for (const target of candlestickTargets) {
|
|
5672
|
-
target.values.forEach((d, i) => {
|
|
5673
|
-
var _a2;
|
|
5674
|
-
const value = (_a2 = $$.getCandlestickData) == null ? void 0 : _a2.call($$, d);
|
|
5675
|
-
const geometry = value && getCanvasCandlestickGeometry(
|
|
5676
|
-
$$,
|
|
5677
|
-
getCandlestickPoints,
|
|
5678
|
-
d,
|
|
5679
|
-
i
|
|
5680
|
-
);
|
|
5681
|
-
if (!geometry) {
|
|
5682
|
-
return;
|
|
5683
|
-
}
|
|
5684
|
-
const color = getCandlestickColor($$, { id: target.id }, value);
|
|
5685
|
-
ctx.strokeStyle = color;
|
|
5686
|
-
ctx.fillStyle = color;
|
|
5687
|
-
painter.strokePath(() => {
|
|
5688
|
-
painter.traceLine(
|
|
5689
|
-
geometry.wickStart[0],
|
|
5690
|
-
geometry.wickStart[1],
|
|
5691
|
-
geometry.wickEnd[0],
|
|
5692
|
-
geometry.wickEnd[1]
|
|
5693
|
-
);
|
|
5694
|
-
});
|
|
5695
|
-
painter.fillRect(geometry.body, { fill: ctx.fillStyle });
|
|
5696
|
-
});
|
|
5697
|
-
}
|
|
5698
|
-
}
|
|
5699
|
-
const lineTargets = targets.filter(isCanvasLineType.bind(null, $$));
|
|
5700
|
-
const lineIndices = getCanvasShapeIndices(
|
|
5701
|
-
$$,
|
|
5702
|
-
shape,
|
|
5703
|
-
TYPE.LINE,
|
|
5704
|
-
isCanvasLineType.bind(null, $$)
|
|
5705
|
-
);
|
|
5706
|
-
ctx.globalAlpha = 1;
|
|
5707
|
-
ctx.lineWidth = style.shape.lineWidth;
|
|
5708
|
-
for (const target of lineTargets) {
|
|
5709
|
-
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5710
|
-
continue;
|
|
5711
|
-
}
|
|
5712
|
-
ctx.strokeStyle = $$.color(target.id);
|
|
5713
|
-
drawCanvasLine($$, target, lineIndices, painter, true);
|
|
5714
|
-
}
|
|
5715
|
-
if (config.point_show && !((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$))) {
|
|
5716
|
-
const cy = (_d = $$.updateCircleY) == null ? void 0 : _d.call($$, true);
|
|
5717
|
-
const cx = (_e = $$.subxx) == null ? void 0 : _e.bind($$);
|
|
5718
|
-
if (cx && cy) {
|
|
5719
|
-
for (const target of targets) {
|
|
5720
|
-
if (!isCanvasScatterType($$, target) && !isCanvasBubbleType($$, target)) {
|
|
5721
|
-
continue;
|
|
5722
|
-
}
|
|
5723
|
-
const color = $$.color(target.id);
|
|
5724
|
-
const pointFill = style.shape.pointFillColor || color;
|
|
5725
|
-
const pointStroke = style.shape.pointStrokeColor || color;
|
|
5726
|
-
const pointLineWidth = pointStroke ? (_f = style.shape.pointLineWidth) != null ? _f : 1 : 0;
|
|
5727
|
-
const pointStyle = pointStroke && pointLineWidth > 0 ? {
|
|
5728
|
-
fill: pointFill,
|
|
5729
|
-
stroke: pointStroke,
|
|
5730
|
-
lineWidth: pointLineWidth
|
|
5731
|
-
} : { fill: pointFill };
|
|
5732
|
-
ctx.globalAlpha = getPointOpacity($$, target);
|
|
5909
|
+
const barTargets = targets.filter(isCanvasBarType.bind(null, $$));
|
|
5910
|
+
const barIndices = getCanvasShapeIndices(
|
|
5911
|
+
$$,
|
|
5912
|
+
shape,
|
|
5913
|
+
TYPE.BAR,
|
|
5914
|
+
isCanvasBarType.bind(null, $$)
|
|
5915
|
+
);
|
|
5916
|
+
const getBarPoints = (_a2 = $$.generateGetBarPoints) == null ? void 0 : _a2.call($$, barIndices, true);
|
|
5917
|
+
if (getBarPoints) {
|
|
5918
|
+
for (const target of barTargets) {
|
|
5919
|
+
ctx.globalAlpha = style.shape.barOpacity * getCanvasTargetFocusOpacity($$, target);
|
|
5920
|
+
ctx.fillStyle = $$.color(target.id);
|
|
5733
5921
|
target.values.forEach((d, i) => {
|
|
5922
|
+
var _a3;
|
|
5734
5923
|
if (!hasCanvasDrawableValue($$, d)) {
|
|
5735
5924
|
return;
|
|
5736
5925
|
}
|
|
5737
|
-
const
|
|
5738
|
-
const
|
|
5739
|
-
|
|
5740
|
-
if (isFiniteCanvasCoordinate(x, y)) {
|
|
5741
|
-
drawPointPattern(painter, "circle", x, y, r, pointStyle);
|
|
5742
|
-
}
|
|
5926
|
+
const geometry = getCanvasBarGeometry($$, getBarPoints, d, i);
|
|
5927
|
+
const fill = ((_a3 = $$.getSubchartCandlestickBarColor) == null ? void 0 : _a3.call($$, d, true)) || ctx.fillStyle;
|
|
5928
|
+
geometry && painter.fillRect(geometry.rect, { fill });
|
|
5743
5929
|
});
|
|
5744
5930
|
}
|
|
5745
5931
|
ctx.globalAlpha = 1;
|
|
5746
5932
|
}
|
|
5747
|
-
|
|
5933
|
+
const candlestickTargets = targets.filter(
|
|
5934
|
+
isCanvasCandlestickType.bind(null, $$)
|
|
5935
|
+
);
|
|
5936
|
+
const candlestickIndices = getCanvasShapeIndices(
|
|
5937
|
+
$$,
|
|
5938
|
+
shape,
|
|
5939
|
+
TYPE.CANDLESTICK,
|
|
5940
|
+
isCanvasCandlestickType.bind(null, $$)
|
|
5941
|
+
);
|
|
5942
|
+
const getCandlestickPoints = (_b = $$.generateGetCandlestickPoints) == null ? void 0 : _b.call(
|
|
5943
|
+
$$,
|
|
5944
|
+
candlestickIndices,
|
|
5945
|
+
true
|
|
5946
|
+
);
|
|
5947
|
+
if (getCandlestickPoints) {
|
|
5948
|
+
ctx.lineWidth = style.shape.candlestickLineWidth;
|
|
5949
|
+
for (const target of candlestickTargets) {
|
|
5950
|
+
const targetOpacity = getCanvasTargetFocusOpacity($$, target);
|
|
5951
|
+
ctx.globalAlpha = targetOpacity;
|
|
5952
|
+
target.values.forEach((d, i) => {
|
|
5953
|
+
var _a3;
|
|
5954
|
+
const value = (_a3 = $$.getCandlestickData) == null ? void 0 : _a3.call($$, d);
|
|
5955
|
+
const geometry = value && getCanvasCandlestickGeometry(
|
|
5956
|
+
$$,
|
|
5957
|
+
getCandlestickPoints,
|
|
5958
|
+
d,
|
|
5959
|
+
i
|
|
5960
|
+
);
|
|
5961
|
+
if (!geometry) {
|
|
5962
|
+
return;
|
|
5963
|
+
}
|
|
5964
|
+
const color = getCandlestickColor($$, { id: target.id }, value);
|
|
5965
|
+
ctx.strokeStyle = color;
|
|
5966
|
+
ctx.fillStyle = color;
|
|
5967
|
+
painter.strokePath(() => {
|
|
5968
|
+
painter.traceLine(
|
|
5969
|
+
geometry.wickStart[0],
|
|
5970
|
+
geometry.wickStart[1],
|
|
5971
|
+
geometry.wickEnd[0],
|
|
5972
|
+
geometry.wickEnd[1]
|
|
5973
|
+
);
|
|
5974
|
+
});
|
|
5975
|
+
painter.fillRect(geometry.body, { fill: ctx.fillStyle });
|
|
5976
|
+
});
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
const lineTargets = targets.filter(isCanvasLineType.bind(null, $$));
|
|
5980
|
+
const lineIndices = getCanvasShapeIndices(
|
|
5981
|
+
$$,
|
|
5982
|
+
shape,
|
|
5983
|
+
TYPE.LINE,
|
|
5984
|
+
isCanvasLineType.bind(null, $$)
|
|
5985
|
+
);
|
|
5986
|
+
ctx.globalAlpha = 1;
|
|
5987
|
+
for (const target of lineTargets) {
|
|
5988
|
+
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5989
|
+
continue;
|
|
5990
|
+
}
|
|
5991
|
+
ctx.globalAlpha = getCanvasTargetFocusOpacity($$, target);
|
|
5992
|
+
ctx.lineWidth = isCanvasTargetFocused($$, target) ? style.shape.lineFocusedWidth : style.shape.lineWidth;
|
|
5993
|
+
ctx.strokeStyle = $$.color(target.id);
|
|
5994
|
+
drawCanvasLine($$, target, lineIndices, painter, true);
|
|
5995
|
+
}
|
|
5996
|
+
ctx.globalAlpha = 1;
|
|
5997
|
+
if (config.point_show && !((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$))) {
|
|
5998
|
+
const cy = (_d = $$.updateCircleY) == null ? void 0 : _d.call($$, true);
|
|
5999
|
+
const cx = (_e = $$.subxx) == null ? void 0 : _e.bind($$);
|
|
6000
|
+
if (cx && cy) {
|
|
6001
|
+
for (const target of targets) {
|
|
6002
|
+
if (!isCanvasScatterType($$, target) && !isCanvasBubbleType($$, target)) {
|
|
6003
|
+
continue;
|
|
6004
|
+
}
|
|
6005
|
+
const color = $$.color(target.id);
|
|
6006
|
+
const pointFill = style.shape.pointFillColor || color;
|
|
6007
|
+
const pointStroke = style.shape.pointStrokeColor || color;
|
|
6008
|
+
const pointLineWidth = pointStroke ? (_f = style.shape.pointLineWidth) != null ? _f : 1 : 0;
|
|
6009
|
+
const pointStyle = pointStroke && pointLineWidth > 0 ? {
|
|
6010
|
+
fill: pointFill,
|
|
6011
|
+
stroke: pointStroke,
|
|
6012
|
+
lineWidth: pointLineWidth
|
|
6013
|
+
} : { fill: pointFill };
|
|
6014
|
+
ctx.globalAlpha = getPointOpacity($$, target) * getCanvasTargetFocusOpacity($$, target);
|
|
6015
|
+
target.values.forEach((d, i) => {
|
|
6016
|
+
if (!hasCanvasDrawableValue($$, d)) {
|
|
6017
|
+
return;
|
|
6018
|
+
}
|
|
6019
|
+
const x = config.axis_rotated ? cy(d, i) : cx(d);
|
|
6020
|
+
const y = config.axis_rotated ? cx(d) : cy(d, i);
|
|
6021
|
+
const r = Math.min(getTargetPointRadius($$, target, d), 3);
|
|
6022
|
+
if (isFiniteCanvasCoordinate(x, y)) {
|
|
6023
|
+
drawPointPattern(
|
|
6024
|
+
painter,
|
|
6025
|
+
"circle",
|
|
6026
|
+
x,
|
|
6027
|
+
y,
|
|
6028
|
+
r,
|
|
6029
|
+
pointStyle
|
|
6030
|
+
);
|
|
6031
|
+
}
|
|
6032
|
+
});
|
|
6033
|
+
}
|
|
6034
|
+
ctx.globalAlpha = 1;
|
|
6035
|
+
}
|
|
6036
|
+
}
|
|
6037
|
+
});
|
|
5748
6038
|
});
|
|
6039
|
+
this.drawSubchartBrush($$);
|
|
5749
6040
|
});
|
|
5750
|
-
this.drawSubchartBrush($$);
|
|
5751
6041
|
});
|
|
5752
6042
|
}
|
|
5753
6043
|
/**
|
|
@@ -5759,7 +6049,7 @@ class CanvasRenderer {
|
|
|
5759
6049
|
var _a, _b;
|
|
5760
6050
|
const { config, scale, state } = $$;
|
|
5761
6051
|
const domain = state.domain;
|
|
5762
|
-
if (!config.subchart_show || !(domain == null ? void 0 : domain.length) || !scale.subX) {
|
|
6052
|
+
if (!config.subchart_show || config.subchart_brush_enabled === false || !(domain == null ? void 0 : domain.length) || !scale.subX) {
|
|
5763
6053
|
return;
|
|
5764
6054
|
}
|
|
5765
6055
|
const { margin2, width2, height2 } = state;
|
|
@@ -6220,7 +6510,7 @@ class CanvasRenderer {
|
|
|
6220
6510
|
const stackingRadiusSet = getRadius ? getStackingBarRadiusSet($$) : /* @__PURE__ */ new Set();
|
|
6221
6511
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
6222
6512
|
selectedData.forEach((d) => {
|
|
6223
|
-
var _a2, _b2, _c, _d, _e, _f;
|
|
6513
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
6224
6514
|
const color = $$.color(d.id);
|
|
6225
6515
|
if (isBar(d) && barPoints) {
|
|
6226
6516
|
const geometry = getCanvasBarGeometry($$, barPoints, d, d.index);
|
|
@@ -6264,11 +6554,13 @@ class CanvasRenderer {
|
|
|
6264
6554
|
lineWidth: style.selectedPoint.lineWidth,
|
|
6265
6555
|
stroke: style.selectedPoint.stroke || color
|
|
6266
6556
|
});
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6557
|
+
if (!((_f = $$.isPointFocusOnly) == null ? void 0 : _f.call($$))) {
|
|
6558
|
+
drawPointPattern(painter, pointType, x, y, r, {
|
|
6559
|
+
fill: style.shape.pointFillColor || color,
|
|
6560
|
+
stroke: style.shape.pointStrokeColor || color,
|
|
6561
|
+
lineWidth: (_g = style.shape.pointLineWidth) != null ? _g : 1
|
|
6562
|
+
});
|
|
6563
|
+
}
|
|
6272
6564
|
}
|
|
6273
6565
|
});
|
|
6274
6566
|
ctx.globalAlpha = 1;
|
|
@@ -6512,6 +6804,37 @@ class CanvasRenderer {
|
|
|
6512
6804
|
}
|
|
6513
6805
|
});
|
|
6514
6806
|
}
|
|
6807
|
+
/**
|
|
6808
|
+
* Draw synchronized focus grid on the canvas subchart.
|
|
6809
|
+
* @param {object} $$ ChartInternal instance
|
|
6810
|
+
* @param {Array} selectedData Focused data rows
|
|
6811
|
+
* @private
|
|
6812
|
+
*/
|
|
6813
|
+
drawSubchartFocus($$, selectedData) {
|
|
6814
|
+
const { config, scale, state } = $$;
|
|
6815
|
+
const focus = selectedData == null ? void 0 : selectedData.find(
|
|
6816
|
+
(d) => d && hasCanvasDrawableValue($$, d)
|
|
6817
|
+
);
|
|
6818
|
+
if (!focus || !config.subchart_show || config.subchart_grid_focus_continuous || config.subchart_brush_enabled !== false || config.grid_focus_show === false || config.subchart_grid_focus === false || !config.tooltip_show || config.axis_tooltip || !scale.subX || state.width2 <= 0 || state.height2 <= 0) {
|
|
6819
|
+
return;
|
|
6820
|
+
}
|
|
6821
|
+
const { margin2, width2, height2 } = state;
|
|
6822
|
+
const pos = scale.subX(focus.x);
|
|
6823
|
+
if (!Number.isFinite(pos)) {
|
|
6824
|
+
return;
|
|
6825
|
+
}
|
|
6826
|
+
const { painter, theme: { style } } = this;
|
|
6827
|
+
const lineWidth = style.axis.lineWidth;
|
|
6828
|
+
const x = painter.crisp(margin2.left + pos, lineWidth);
|
|
6829
|
+
const y = painter.crisp(margin2.top + pos, lineWidth);
|
|
6830
|
+
painter.strokePath(() => {
|
|
6831
|
+
config.axis_rotated ? painter.traceLine(margin2.left, y, margin2.left + width2, y) : painter.traceLine(x, margin2.top, x, margin2.top + height2);
|
|
6832
|
+
}, {
|
|
6833
|
+
lineDash: style.focusGrid.dashArray,
|
|
6834
|
+
lineWidth: style.focusGrid.lineWidth,
|
|
6835
|
+
stroke: style.focusGrid.lineColor
|
|
6836
|
+
});
|
|
6837
|
+
}
|
|
6515
6838
|
/**
|
|
6516
6839
|
* Draw focus grid and focused points on canvas.
|
|
6517
6840
|
* @param {object} $$ ChartInternal instance
|
|
@@ -6528,6 +6851,7 @@ class CanvasRenderer {
|
|
|
6528
6851
|
const focus = selectedData.find(
|
|
6529
6852
|
(d) => d && hasCanvasDrawableValue($$, d)
|
|
6530
6853
|
);
|
|
6854
|
+
$$.config.subchart_grid_focus !== false && !isContinuousGridFocusEnabled($$) && this.drawSubchartFocus($$, selectedData);
|
|
6531
6855
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
6532
6856
|
if ($$.config.tooltip_show && $$.config.grid_focus_show !== false && !$$.config.axis_tooltip && focus) {
|
|
6533
6857
|
const { x, y } = getRenderDataPoint($$, focus);
|
|
@@ -6538,6 +6862,9 @@ class CanvasRenderer {
|
|
|
6538
6862
|
const crispEdgeX = (value) => painter.crisp(margin.left + value, axisLineWidth) - margin.left;
|
|
6539
6863
|
const crispEdgeY = (value) => painter.crisp(margin.top + value, axisLineWidth) - margin.top;
|
|
6540
6864
|
const isEdge = $$.config.grid_focus_edge && !$$.config.tooltip_grouped;
|
|
6865
|
+
const continuousFocus = isContinuousGridFocusEnabled($$);
|
|
6866
|
+
const focusEndX = continuousFocus ? $$.state.margin2.left - margin.left + $$.state.width2 : $$.state.width;
|
|
6867
|
+
const focusEndY = continuousFocus ? $$.state.margin2.top - margin.top + $$.state.height2 : $$.state.height;
|
|
6541
6868
|
if (hasIndexCoordinate) {
|
|
6542
6869
|
painter.strokePath(() => {
|
|
6543
6870
|
var _a, _b;
|
|
@@ -6545,7 +6872,7 @@ class CanvasRenderer {
|
|
|
6545
6872
|
painter.traceLine(
|
|
6546
6873
|
crispEdgeX(0),
|
|
6547
6874
|
y,
|
|
6548
|
-
isEdge && hasValueCoordinate ? x : crispEdgeX(
|
|
6875
|
+
isEdge && hasValueCoordinate ? x : crispEdgeX(focusEndX),
|
|
6549
6876
|
y
|
|
6550
6877
|
);
|
|
6551
6878
|
if (hasValueCoordinate && $$.config.grid_focus_y && !$$.config.tooltip_grouped) {
|
|
@@ -6562,7 +6889,7 @@ class CanvasRenderer {
|
|
|
6562
6889
|
x,
|
|
6563
6890
|
isEdge && hasValueCoordinate ? y : crispEdgeY(0),
|
|
6564
6891
|
x,
|
|
6565
|
-
crispEdgeY(
|
|
6892
|
+
crispEdgeY(focusEndY)
|
|
6566
6893
|
);
|
|
6567
6894
|
if (hasValueCoordinate && $$.config.grid_focus_y && !$$.config.tooltip_grouped) {
|
|
6568
6895
|
const isY2 = ((_b = $$.axis) == null ? void 0 : _b.getId(focus.id)) === "y2";
|
|
@@ -6760,6 +7087,77 @@ function normalizeThemeSelectors(selector) {
|
|
|
6760
7087
|
(value) => value.trim().replace(/\s*>\s*/g, " ").replace(/\s+/g, " ").replace(/^(?:svg)?\.bb\s+/, "").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g, "$1.")
|
|
6761
7088
|
).filter(Boolean);
|
|
6762
7089
|
}
|
|
7090
|
+
function getDefinedKeys(values) {
|
|
7091
|
+
return Object.keys(values).filter((key) => values[key] !== void 0);
|
|
7092
|
+
}
|
|
7093
|
+
function assignDefined(target, source, skip) {
|
|
7094
|
+
getDefinedKeys(source).forEach((key) => {
|
|
7095
|
+
if (!(skip == null ? void 0 : skip.has(key))) {
|
|
7096
|
+
target[key] = source[key];
|
|
7097
|
+
}
|
|
7098
|
+
});
|
|
7099
|
+
return target;
|
|
7100
|
+
}
|
|
7101
|
+
function isSimpleGridLineSelector(selector) {
|
|
7102
|
+
const tokens = selector.split(" ");
|
|
7103
|
+
return tokens.every(
|
|
7104
|
+
(token, index) => token === "line" || token === "text" ? index === tokens.length - 1 : /^(\.[A-Za-z_-][\w-]*)+$/.test(token)
|
|
7105
|
+
);
|
|
7106
|
+
}
|
|
7107
|
+
function getGridLineSelectorTarget(selector) {
|
|
7108
|
+
const tokens = selector.split(" ");
|
|
7109
|
+
const target = tokens[tokens.length - 1];
|
|
7110
|
+
return target === "line" || target === "text" ? target : null;
|
|
7111
|
+
}
|
|
7112
|
+
function getClassNames(className) {
|
|
7113
|
+
return (className || "").split(/\s+/).filter(Boolean);
|
|
7114
|
+
}
|
|
7115
|
+
function getGridLineSelectorStyle(style, target) {
|
|
7116
|
+
const values = target === "text" ? {
|
|
7117
|
+
labelColor: readColorValue(style, "fill"),
|
|
7118
|
+
labelFont: readFontValue(style)
|
|
7119
|
+
} : {
|
|
7120
|
+
lineColor: readColorValue(style, "stroke"),
|
|
7121
|
+
lineWidth: readNumberValue(style, "stroke-width"),
|
|
7122
|
+
dashArray: readDashArrayValue(style)
|
|
7123
|
+
};
|
|
7124
|
+
return assignDefined({}, values);
|
|
7125
|
+
}
|
|
7126
|
+
function getGridLineSelectorOverrides(selectors) {
|
|
7127
|
+
const overrides = [];
|
|
7128
|
+
Object.keys(selectors != null ? selectors : {}).forEach((selector) => {
|
|
7129
|
+
normalizeThemeSelectors(selector).forEach((normalizedSelector) => {
|
|
7130
|
+
const target = getGridLineSelectorTarget(normalizedSelector) || "line";
|
|
7131
|
+
const style = getGridLineSelectorStyle(selectors[selector], target);
|
|
7132
|
+
if (isSimpleGridLineSelector(normalizedSelector) && getDefinedKeys(style).length) {
|
|
7133
|
+
overrides.push({ selector: normalizedSelector, target, style });
|
|
7134
|
+
}
|
|
7135
|
+
});
|
|
7136
|
+
});
|
|
7137
|
+
return overrides;
|
|
7138
|
+
}
|
|
7139
|
+
function matchesGridLineSelector(selector, axis, className, target) {
|
|
7140
|
+
if (!isSimpleGridLineSelector(selector)) {
|
|
7141
|
+
return false;
|
|
7142
|
+
}
|
|
7143
|
+
const selectorTarget = getGridLineSelectorTarget(selector);
|
|
7144
|
+
if (selectorTarget && selectorTarget !== target) {
|
|
7145
|
+
return false;
|
|
7146
|
+
} else if (!selectorTarget && target === "text") {
|
|
7147
|
+
return false;
|
|
7148
|
+
}
|
|
7149
|
+
const customClasses = getClassNames(className);
|
|
7150
|
+
const axisLineClass = `bb-${axis}grid-line`;
|
|
7151
|
+
const availableClasses = /* @__PURE__ */ new Set([
|
|
7152
|
+
"bb-grid",
|
|
7153
|
+
"bb-grid-lines",
|
|
7154
|
+
`bb-${axis}grid-lines`,
|
|
7155
|
+
axisLineClass,
|
|
7156
|
+
...customClasses
|
|
7157
|
+
]);
|
|
7158
|
+
const selectorClasses = (selector.match(/\.[A-Za-z_-][\w-]*/g) || []).map((match) => match.slice(1));
|
|
7159
|
+
return !!selectorClasses.length && selectorClasses.every((cls) => availableClasses.has(cls)) && (selectorClasses.includes(axisLineClass) || customClasses.some((cls) => selectorClasses.includes(cls)));
|
|
7160
|
+
}
|
|
6763
7161
|
function applySelectorStyle(target, selector, style) {
|
|
6764
7162
|
switch (selector) {
|
|
6765
7163
|
case ".bb-axis path.domain":
|
|
@@ -7036,6 +7434,8 @@ class CanvasTheme {
|
|
|
7036
7434
|
CanvasTheme_publicField(this, "style");
|
|
7037
7435
|
CanvasTheme_publicField(this, "cacheContainer", null);
|
|
7038
7436
|
CanvasTheme_publicField(this, "cacheKey", null);
|
|
7437
|
+
CanvasTheme_publicField(this, "gridLineSelectorOverrides", []);
|
|
7438
|
+
CanvasTheme_publicField(this, "directGridOverrideKeys", /* @__PURE__ */ new Set());
|
|
7039
7439
|
}
|
|
7040
7440
|
/**
|
|
7041
7441
|
* Read theme values from temporary SVG probes.
|
|
@@ -7044,8 +7444,12 @@ class CanvasTheme {
|
|
|
7044
7444
|
* @private
|
|
7045
7445
|
*/
|
|
7046
7446
|
load(container, userOverride) {
|
|
7047
|
-
var _a, _b, _c, _d;
|
|
7447
|
+
var _a, _b, _c, _d, _e;
|
|
7048
7448
|
const svg = browser_doc.createElementNS(SVG_NS, "svg");
|
|
7449
|
+
this.gridLineSelectorOverrides = getGridLineSelectorOverrides(userOverride == null ? void 0 : userOverride.selectors);
|
|
7450
|
+
this.directGridOverrideKeys = new Set(
|
|
7451
|
+
Object.keys((_a = userOverride == null ? void 0 : userOverride.grid) != null ? _a : {})
|
|
7452
|
+
);
|
|
7049
7453
|
svg.setAttribute("class", "bb");
|
|
7050
7454
|
svg.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden";
|
|
7051
7455
|
container.appendChild(svg);
|
|
@@ -7210,7 +7614,7 @@ class CanvasTheme {
|
|
|
7210
7614
|
subchartBrushSelection.fill,
|
|
7211
7615
|
toColor(subchartBrushExtent.fill, zoomBrushFill)
|
|
7212
7616
|
);
|
|
7213
|
-
const subchartBrushOpacity = (
|
|
7617
|
+
const subchartBrushOpacity = (_e = (_d = (_c = (_b = toOptionalNumber(subchartBrushSelection["fill-opacity"], 1)) != null ? _b : toOptionalNumber(subchartBrushSelection.opacity, 1)) != null ? _c : toOptionalNumber(subchartBrushExtent["fill-opacity"], 1)) != null ? _d : toOptionalNumber(subchartBrushExtent.opacity, 1)) != null ? _e : zoomBrushOpacity;
|
|
7214
7618
|
const subchartBrushHandleStroke = toColor(subchartBrushHandle.stroke, "transparent");
|
|
7215
7619
|
const defaultStyle = {
|
|
7216
7620
|
axis: {
|
|
@@ -7436,6 +7840,25 @@ class CanvasTheme {
|
|
|
7436
7840
|
}
|
|
7437
7841
|
this.load(container, userOverride);
|
|
7438
7842
|
}
|
|
7843
|
+
/**
|
|
7844
|
+
* Resolve selector based style for one configured optional grid line.
|
|
7845
|
+
* @param {string} axis Grid axis
|
|
7846
|
+
* @param {object} line Grid line options
|
|
7847
|
+
* @param {string} line.class Grid line custom class
|
|
7848
|
+
* @param {string} target Draw target
|
|
7849
|
+
* @returns {object|undefined} Grid line style override
|
|
7850
|
+
* @private
|
|
7851
|
+
*/
|
|
7852
|
+
getGridLineStyle(axis, line = {}, target = "line") {
|
|
7853
|
+
const style = {};
|
|
7854
|
+
for (const override of this.gridLineSelectorOverrides) {
|
|
7855
|
+
if (!matchesGridLineSelector(override.selector, axis, line.class, target)) {
|
|
7856
|
+
continue;
|
|
7857
|
+
}
|
|
7858
|
+
assignDefined(style, override.style, this.directGridOverrideKeys);
|
|
7859
|
+
}
|
|
7860
|
+
return getDefinedKeys(style).length ? style : void 0;
|
|
7861
|
+
}
|
|
7439
7862
|
}
|
|
7440
7863
|
|
|
7441
7864
|
;// ./src/canvas/HitDetector.ts
|
|
@@ -7973,6 +8396,7 @@ const $FOCUS = {
|
|
|
7973
8396
|
defocused: "bb-defocused",
|
|
7974
8397
|
legendItemFocused: "bb-legend-item-focused",
|
|
7975
8398
|
xgridFocus: "bb-xgrid-focus",
|
|
8399
|
+
xgridFocusContinuous: "bb-xgrid-focus-continuous",
|
|
7976
8400
|
ygridFocus: "bb-ygrid-focus"
|
|
7977
8401
|
};
|
|
7978
8402
|
const $GRID = {
|
|
@@ -8050,19 +8474,79 @@ const $ZOOM = {
|
|
|
8050
8474
|
* - **NOTE:**
|
|
8051
8475
|
* - Will append <style> to the head tag and will add shpes' CSS rules dynamically.
|
|
8052
8476
|
* - For now, covers colors related properties (fill, stroke, etc.) only.
|
|
8053
|
-
* @property {boolean} [boost.useWorker=false] Use Web Worker as possible for processing.
|
|
8477
|
+
* @property {boolean|string} [boost.useWorker=false] Use Web Worker as possible for processing.
|
|
8478
|
+
* - **Available values:**
|
|
8479
|
+
* - `false`: never offload.
|
|
8480
|
+
* - `true`: always offload when a Worker can be created.
|
|
8481
|
+
* - `"auto"`: offload only when the given data exceeds ~5,000 cells, since smaller
|
|
8482
|
+
* payloads lose more to structured cloning than they gain.
|
|
8054
8483
|
* - **NOTE:**
|
|
8055
8484
|
* - For now, only applies for data conversion at the initial time.
|
|
8056
|
-
* - As of Web Worker's async nature, handling chart instance
|
|
8485
|
+
* - As of Web Worker's async nature, handling chart instance synchronously is not recommended.
|
|
8486
|
+
* - When Worker isn't available, fails or times out, data conversion falls back to main thread.
|
|
8057
8487
|
* - When given data is empty, useWorker will be ignored.
|
|
8488
|
+
* @property {string} [boost.workerUrl=undefined] Use a custom static worker script URL instead of an inline Blob worker.
|
|
8489
|
+
* - **NOTE:**
|
|
8490
|
+
* - **Requires `boost.useWorker` to be enabled** — this option only selects where the
|
|
8491
|
+
* worker source comes from, it does not turn offloading on by itself.
|
|
8492
|
+
* - Useful for strict CSP environments that disallow `blob:` workers. Without it under
|
|
8493
|
+
* such a policy, worker creation throws and each conversion waits out the 5s timeout
|
|
8494
|
+
* before falling back, so the chart still renders but the initial draw is delayed.
|
|
8495
|
+
* - Point it at `dist/billboard.worker.js`, shipped in the package, or any script
|
|
8496
|
+
* implementing the same protocol: receive `{id, op, args}` and post back
|
|
8497
|
+
* `{id, result}` or `{id, error}`. No `eval()` is involved.
|
|
8498
|
+
* - With a bundler, make sure the file is emitted as a **real asset**, not inlined:
|
|
8499
|
+
* it is ~1.5KB, and inlining turns it into a `data:` URI, which a strict CSP
|
|
8500
|
+
* blocks exactly like `blob:`. Copying it into the static/public directory is the
|
|
8501
|
+
* option that works everywhere.
|
|
8502
|
+
* - Any failure (load error, unknown op, timeout, result mismatch) falls back to the main thread.
|
|
8058
8503
|
* @example
|
|
8504
|
+
* // offload data conversion on a Worker, using the inline Blob worker
|
|
8059
8505
|
* boost: {
|
|
8060
8506
|
* useCssRule: true,
|
|
8061
|
-
* useWorker:
|
|
8507
|
+
* useWorker: true
|
|
8062
8508
|
* }
|
|
8509
|
+
* @example
|
|
8510
|
+
* // offload only past ~5,000 cells
|
|
8511
|
+
* boost: {
|
|
8512
|
+
* useWorker: "auto"
|
|
8513
|
+
* }
|
|
8514
|
+
* @example
|
|
8515
|
+
* // strict CSP: serve the shipped script and point at it.
|
|
8516
|
+
* // 'useWorker' still has to be on - 'workerUrl' alone offloads nothing.
|
|
8517
|
+
* boost: {
|
|
8518
|
+
* useWorker: true,
|
|
8519
|
+
* workerUrl: "$YOUR_PATH/dist/billboard.worker.js"
|
|
8520
|
+
* }
|
|
8521
|
+
* @example
|
|
8522
|
+
* // ESM: the file is reachable as a package subpath.
|
|
8523
|
+
* // Vite - '?url' resolves it, but assets under 4KB are inlined as a 'data:' URI,
|
|
8524
|
+
* // which a strict CSP rejects. Opt that one file out of inlining:
|
|
8525
|
+
* //
|
|
8526
|
+
* // // vite.config.js
|
|
8527
|
+
* // export default {
|
|
8528
|
+
* // build: {
|
|
8529
|
+
* // assetsInlineLimit: path => /billboard\.worker\.js$/.test(path) ? false : undefined
|
|
8530
|
+
* // }
|
|
8531
|
+
* // };
|
|
8532
|
+
* import bb, {bar} from "billboard.js";
|
|
8533
|
+
* import workerUrl from "billboard.js/dist/billboard.worker.js?url";
|
|
8534
|
+
*
|
|
8535
|
+
* bb.generate({
|
|
8536
|
+
* boost: {useWorker: true, workerUrl},
|
|
8537
|
+
* data: {columns: [["data1", 30, 200, 100]], type: bar()}
|
|
8538
|
+
* });
|
|
8539
|
+
* @example
|
|
8540
|
+
* // ESM, bundler-agnostic: copy the file into the served static directory
|
|
8541
|
+
* // cp node_modules/billboard.js/dist/billboard.worker.js public/
|
|
8542
|
+
* bb.generate({
|
|
8543
|
+
* boost: {useWorker: true, workerUrl: "/billboard.worker.js"},
|
|
8544
|
+
* data: {columns: [["data1", 30, 200, 100]]}
|
|
8545
|
+
* });
|
|
8063
8546
|
*/
|
|
8064
8547
|
boost_useCssRule: false,
|
|
8065
|
-
boost_useWorker: false
|
|
8548
|
+
boost_useWorker: false,
|
|
8549
|
+
boost_workerUrl: void 0
|
|
8066
8550
|
});
|
|
8067
8551
|
|
|
8068
8552
|
;// ./src/config/Options/common/color.ts
|
|
@@ -8073,9 +8557,9 @@ const $ZOOM = {
|
|
|
8073
8557
|
* @memberof Options
|
|
8074
8558
|
* @type {object}
|
|
8075
8559
|
* @property {object} color color object
|
|
8076
|
-
* @property {string|object|(
|
|
8560
|
+
* @property {string|object|function(DataItem): string} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
|
|
8077
8561
|
* @property {Array|null} [color.pattern=[]] Set custom color pattern. Passing `null` will not set a color for these elements, which requires the usage of custom CSS-based theming to work.
|
|
8078
|
-
* @property {(
|
|
8562
|
+
* @property {function(): Array.<SVGPatternElement>} [color.tiles] if defined, allows use svg's patterns to fill data area. It should return an array of [SVGPatternElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement).
|
|
8079
8563
|
* - **NOTE:** The pattern element's id will be defined as `bb-colorize-pattern-$COLOR-VALUE`.<br>
|
|
8080
8564
|
* ex. When color pattern value is `['red', '#fff']` and defined 2 patterns,then ids for pattern elements are:<br>
|
|
8081
8565
|
* - `bb-colorize-pattern-red`
|
|
@@ -10138,7 +10622,9 @@ class Element {
|
|
|
10138
10622
|
x: null,
|
|
10139
10623
|
y: null,
|
|
10140
10624
|
y2: null,
|
|
10141
|
-
subX: null
|
|
10625
|
+
subX: null,
|
|
10626
|
+
subY: null,
|
|
10627
|
+
subY2: null
|
|
10142
10628
|
},
|
|
10143
10629
|
axisTooltip: {
|
|
10144
10630
|
x: null,
|
|
@@ -10253,6 +10739,7 @@ class State {
|
|
|
10253
10739
|
loading: void 0,
|
|
10254
10740
|
// Zoom/subchart domain (different from current.domain which is for rendering)
|
|
10255
10741
|
domain: void 0,
|
|
10742
|
+
subchartSourceTypes: void 0,
|
|
10256
10743
|
current: {
|
|
10257
10744
|
// current domain value. Assigned when is zoom is called
|
|
10258
10745
|
domain: void 0,
|
|
@@ -10928,28 +11415,148 @@ function generateWait() {
|
|
|
10928
11415
|
;// ./src/module/worker.ts
|
|
10929
11416
|
|
|
10930
11417
|
const cache = {};
|
|
11418
|
+
const disabledKeys = /* @__PURE__ */ new Set();
|
|
11419
|
+
const verifiedOps = /* @__PURE__ */ new Map();
|
|
11420
|
+
const DEFAULT_WORKER_TIMEOUT = 5e3;
|
|
11421
|
+
const VERIFY_SAMPLE_SIZE = 3;
|
|
10931
11422
|
let messageId = 0;
|
|
10932
|
-
function
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
11423
|
+
function getWorkerSrc() {
|
|
11424
|
+
try {
|
|
11425
|
+
return "var bbWorker=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=[];return e.forEach(function(e,n){let r=e[0];e.forEach(function(e,i){if(i>0){if(t[i-1]===void 0&&(t[i-1]={}),e===void 0)throw Error(`Source data is missing a component at (${n}, ${i})!`);t[i-1][r]=e}})}),t}function n(e){let t=e[0],n=[];return e.forEach(function(e,r){if(r>0){let i={};e.forEach(function(e,n){if(e===void 0)throw Error(`Source data is missing a component at (${r}, ${n})!`);i[t[n]]=e}),n.push(i)}}),n}function r(e,r){let i=[],a,o;if(Array.isArray(e)){let t=function(e,t){if(e[t]!==void 0)return e[t];let n=t.replace(/\\[(\\w+)\\]/g,`.$1`).replace(/^\\./,``).split(`.`),r=e;return n.some(function(e){return!(r=r&&typeof r==`object`&&e in r?r[e]:void 0)}),r};a=r.x?r.value.concat(r.x):r.value,i.push(a),e.forEach(function(e){let n=a.map(function(n){let r=t(e,n);return r===void 0&&(r=null),r});i.push(n)}),o=n(i)}else Object.keys(e).forEach(function(t){let n=[].concat(e[t]);n.unshift?.(t),i.push(n)}),o=t(i);return o}let i={columns:t,json:r,rows:n},a=self;function o({data:e}){let{args:t,id:n,op:r}=e;try{let e=i[r];if(!e)throw Error(`Unknown worker op: ${r}`);a.postMessage({id:n,result:e(...t)})}catch(e){a.postMessage({id:n,error:e&&(e.message||e.name)||String(e)})}}return typeof window>`u`&&(a.onmessage=o),e.handleMessage=o,e.ops=i,e})({});";
|
|
11426
|
+
} catch (e) {
|
|
11427
|
+
return "";
|
|
11428
|
+
}
|
|
11429
|
+
}
|
|
11430
|
+
function getWorkerAPI() {
|
|
11431
|
+
const { Blob, Worker, URL } = win;
|
|
11432
|
+
return Worker && Blob && (URL == null ? void 0 : URL.createObjectURL) && (URL == null ? void 0 : URL.revokeObjectURL) ? { Blob, Worker, URL } : null;
|
|
11433
|
+
}
|
|
11434
|
+
function getWorkerConstructor() {
|
|
11435
|
+
return win.Worker || null;
|
|
11436
|
+
}
|
|
11437
|
+
function normalizeWorkerOptions(options) {
|
|
11438
|
+
var _a, _b;
|
|
11439
|
+
return typeof options === "number" ? { timeout: options, workerUrl: "" } : {
|
|
11440
|
+
timeout: (_a = options == null ? void 0 : options.timeout) != null ? _a : DEFAULT_WORKER_TIMEOUT,
|
|
11441
|
+
workerUrl: (_b = options == null ? void 0 : options.workerUrl) != null ? _b : ""
|
|
11442
|
+
};
|
|
11443
|
+
}
|
|
11444
|
+
function releaseWorker(key, disable = false) {
|
|
11445
|
+
var _a, _b;
|
|
11446
|
+
const cached = cache[key];
|
|
11447
|
+
if (disable) {
|
|
11448
|
+
disabledKeys.add(key);
|
|
11449
|
+
}
|
|
11450
|
+
if (cached) {
|
|
11451
|
+
(_a = cached.worker) == null ? void 0 : _a.terminate();
|
|
11452
|
+
cached.revoke && ((_b = getWorkerAPI()) == null ? void 0 : _b.URL.revokeObjectURL(cached.src));
|
|
11453
|
+
delete cache[key];
|
|
11454
|
+
}
|
|
11455
|
+
for (const verified of verifiedOps.keys()) {
|
|
11456
|
+
if (verified.startsWith(`${key}:`)) {
|
|
11457
|
+
verifiedOps.delete(verified);
|
|
11458
|
+
}
|
|
11459
|
+
}
|
|
11460
|
+
}
|
|
11461
|
+
function isSameResult(actual, expected) {
|
|
11462
|
+
if (actual === expected) {
|
|
11463
|
+
return true;
|
|
11464
|
+
}
|
|
11465
|
+
try {
|
|
11466
|
+
return JSON.stringify(actual) === JSON.stringify(expected);
|
|
11467
|
+
} catch (e) {
|
|
11468
|
+
return true;
|
|
11469
|
+
}
|
|
11470
|
+
}
|
|
11471
|
+
function getVerifySample(args) {
|
|
11472
|
+
const [data, ...rest] = args;
|
|
11473
|
+
if (!Array.isArray(data)) {
|
|
11474
|
+
return args;
|
|
11475
|
+
}
|
|
11476
|
+
return [
|
|
11477
|
+
data.slice(0, VERIFY_SAMPLE_SIZE).map(
|
|
11478
|
+
(entry) => (
|
|
11479
|
+
// +1: a column/row entry leads with its name, which the values follow
|
|
11480
|
+
Array.isArray(entry) ? entry.slice(0, VERIFY_SAMPLE_SIZE + 1) : entry
|
|
11481
|
+
)
|
|
11482
|
+
),
|
|
11483
|
+
...rest
|
|
11484
|
+
];
|
|
11485
|
+
}
|
|
11486
|
+
function request(worker, op, args, timeout) {
|
|
11487
|
+
const id = ++messageId;
|
|
11488
|
+
let settled = false;
|
|
11489
|
+
let cleanup;
|
|
11490
|
+
const promise = new Promise((resolve, reject) => {
|
|
11491
|
+
const settle = (fn, value) => {
|
|
11492
|
+
if (!settled) {
|
|
11493
|
+
settled = true;
|
|
11494
|
+
cleanup();
|
|
11495
|
+
fn(value);
|
|
11496
|
+
}
|
|
11497
|
+
};
|
|
11498
|
+
const handler = function(e) {
|
|
11499
|
+
var _a;
|
|
11500
|
+
if (((_a = e.data) == null ? void 0 : _a.id) === id) {
|
|
11501
|
+
e.data.error ? settle(reject, new Error(e.data.error)) : settle(resolve, e.data.result);
|
|
11502
|
+
}
|
|
11503
|
+
};
|
|
11504
|
+
const errorHandler = function() {
|
|
11505
|
+
settle(reject, new Error("worker error"));
|
|
11506
|
+
};
|
|
11507
|
+
const timer = setTimeout(() => settle(reject, new Error("worker timeout")), timeout);
|
|
11508
|
+
cleanup = () => {
|
|
11509
|
+
clearTimeout(timer);
|
|
11510
|
+
worker.removeEventListener("message", handler);
|
|
11511
|
+
worker.removeEventListener("error", errorHandler);
|
|
11512
|
+
};
|
|
11513
|
+
worker.addEventListener("message", handler);
|
|
11514
|
+
worker.addEventListener("error", errorHandler);
|
|
11515
|
+
});
|
|
11516
|
+
try {
|
|
11517
|
+
worker.postMessage({ args, id, op });
|
|
11518
|
+
} catch (error) {
|
|
11519
|
+
settled = true;
|
|
11520
|
+
cleanup();
|
|
11521
|
+
throw error;
|
|
11522
|
+
}
|
|
11523
|
+
return promise;
|
|
11524
|
+
}
|
|
11525
|
+
function startVerify(worker, verifyKey, op, fn, args, timeout) {
|
|
11526
|
+
const sample = getVerifySample(args);
|
|
11527
|
+
const check = request(worker, op, sample, timeout).then((result) => isSameResult(result, fn(...sample)), () => false).then((matched) => {
|
|
11528
|
+
matched ? verifiedOps.set(verifyKey, true) : verifiedOps.delete(verifyKey);
|
|
11529
|
+
return matched;
|
|
11530
|
+
});
|
|
11531
|
+
verifiedOps.set(verifyKey, check);
|
|
11532
|
+
return check;
|
|
11533
|
+
}
|
|
11534
|
+
function getOrCreateWorkerResources(op, workerUrl = "") {
|
|
11535
|
+
const hasWorker = !!getWorkerConstructor();
|
|
11536
|
+
const api = workerUrl ? null : getWorkerAPI();
|
|
11537
|
+
const src = workerUrl ? "" : getWorkerSrc();
|
|
11538
|
+
const key = workerUrl || "blob";
|
|
11539
|
+
if (!hasWorker || !workerUrl && (!api || !src) || disabledKeys.has(key)) {
|
|
11540
|
+
return null;
|
|
11541
|
+
}
|
|
10937
11542
|
if (!(key in cache)) {
|
|
10938
11543
|
try {
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
11544
|
+
if (workerUrl) {
|
|
11545
|
+
cache[key] = {
|
|
11546
|
+
revoke: false,
|
|
11547
|
+
src: workerUrl,
|
|
11548
|
+
worker: null
|
|
11549
|
+
};
|
|
11550
|
+
} else if (api) {
|
|
11551
|
+
const blob = new api.Blob([src], {
|
|
11552
|
+
type: "text/javascript"
|
|
11553
|
+
});
|
|
11554
|
+
cache[key] = {
|
|
11555
|
+
revoke: true,
|
|
11556
|
+
src: api.URL.createObjectURL(blob),
|
|
11557
|
+
worker: null
|
|
11558
|
+
};
|
|
11559
|
+
}
|
|
10953
11560
|
} catch (e) {
|
|
10954
11561
|
return null;
|
|
10955
11562
|
}
|
|
@@ -10958,59 +11565,71 @@ function getOrCreateWorkerResources(fn, depsFn) {
|
|
|
10958
11565
|
}
|
|
10959
11566
|
function getWorker(key, src) {
|
|
10960
11567
|
const cached = cache[key];
|
|
10961
|
-
|
|
11568
|
+
const Worker = getWorkerConstructor();
|
|
11569
|
+
if (!cached || !Worker || disabledKeys.has(key)) {
|
|
10962
11570
|
return null;
|
|
10963
11571
|
}
|
|
10964
11572
|
if (!cached.worker) {
|
|
10965
11573
|
try {
|
|
10966
|
-
cached.worker = new
|
|
11574
|
+
cached.worker = new Worker(src);
|
|
10967
11575
|
} catch (e) {
|
|
11576
|
+
releaseWorker(key, true);
|
|
10968
11577
|
return null;
|
|
10969
11578
|
}
|
|
10970
|
-
if (cached.worker) {
|
|
10971
|
-
cached.worker.onerror = function(e) {
|
|
10972
|
-
console.error ? console.error(e) : console.log(e);
|
|
10973
|
-
};
|
|
10974
|
-
}
|
|
10975
11579
|
}
|
|
10976
11580
|
return cached.worker;
|
|
10977
11581
|
}
|
|
10978
|
-
function runWorker(useWorker = true, fn, callback,
|
|
10979
|
-
|
|
11582
|
+
function runWorker(useWorker = true, op, fn, callback, options) {
|
|
11583
|
+
const { timeout, workerUrl } = normalizeWorkerOptions(options);
|
|
11584
|
+
const runSync = function(...args) {
|
|
10980
11585
|
const res = fn(...args);
|
|
10981
11586
|
callback(res);
|
|
10982
11587
|
};
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
const
|
|
10986
|
-
|
|
11588
|
+
let runFn = runSync;
|
|
11589
|
+
if (useWorker) {
|
|
11590
|
+
const workerResources = getOrCreateWorkerResources(op, workerUrl);
|
|
11591
|
+
const worker = workerResources ? getWorker(workerResources.key, workerResources.src) : null;
|
|
11592
|
+
if (worker && workerResources) {
|
|
11593
|
+
const { key } = workerResources;
|
|
10987
11594
|
runFn = function(...args) {
|
|
10988
|
-
|
|
10989
|
-
const
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
|
|
10993
|
-
callback(e.data.result);
|
|
10994
|
-
}
|
|
11595
|
+
var _a;
|
|
11596
|
+
const fallback = () => {
|
|
11597
|
+
releaseWorker(key, true);
|
|
11598
|
+
runFn = runSync;
|
|
11599
|
+
runSync(...args);
|
|
10995
11600
|
};
|
|
10996
|
-
|
|
10997
|
-
|
|
11601
|
+
try {
|
|
11602
|
+
const verifyKey = `${key}:${op}`;
|
|
11603
|
+
const verified = (_a = verifiedOps.get(verifyKey)) != null ? _a : startVerify(worker, verifyKey, op, fn, args, timeout);
|
|
11604
|
+
request(worker, op, args, timeout).then((result) => {
|
|
11605
|
+
if (verified === true) {
|
|
11606
|
+
callback(result);
|
|
11607
|
+
} else {
|
|
11608
|
+
verified.then((matched) => matched ? callback(result) : fallback());
|
|
11609
|
+
}
|
|
11610
|
+
}, fallback);
|
|
11611
|
+
} catch (e) {
|
|
11612
|
+
fallback();
|
|
11613
|
+
}
|
|
10998
11614
|
};
|
|
10999
11615
|
}
|
|
11000
11616
|
}
|
|
11001
11617
|
return runFn;
|
|
11002
11618
|
}
|
|
11003
11619
|
function cleanupWorkers() {
|
|
11620
|
+
const api = getWorkerAPI();
|
|
11004
11621
|
for (const key in cache) {
|
|
11005
11622
|
const cached = cache[key];
|
|
11006
11623
|
if (cached.worker) {
|
|
11007
11624
|
cached.worker.terminate();
|
|
11008
11625
|
}
|
|
11009
11626
|
if (cached.src) {
|
|
11010
|
-
|
|
11627
|
+
cached.revoke && (api == null ? void 0 : api.URL.revokeObjectURL(cached.src));
|
|
11011
11628
|
}
|
|
11012
11629
|
delete cache[key];
|
|
11013
11630
|
}
|
|
11631
|
+
disabledKeys.clear();
|
|
11632
|
+
verifiedOps.clear();
|
|
11014
11633
|
}
|
|
11015
11634
|
|
|
11016
11635
|
;// ./src/module/dsv.ts
|
|
@@ -11249,6 +11868,19 @@ function convert_helper_tsv(tsv2) {
|
|
|
11249
11868
|
|
|
11250
11869
|
|
|
11251
11870
|
|
|
11871
|
+
const WORKER_CELL_THRESHOLD = 5e3;
|
|
11872
|
+
function _getCellCount(data) {
|
|
11873
|
+
var _a, _b;
|
|
11874
|
+
const first = data[0];
|
|
11875
|
+
if (isArray(first)) {
|
|
11876
|
+
let count = 0;
|
|
11877
|
+
for (let i = 0, len = data.length; i < len; i++) {
|
|
11878
|
+
count += (_b = (_a = data[i]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
11879
|
+
}
|
|
11880
|
+
return count;
|
|
11881
|
+
}
|
|
11882
|
+
return data.length * Object.keys(first != null ? first : {}).length;
|
|
11883
|
+
}
|
|
11252
11884
|
function _getDataKeyForJson(keysParam, config) {
|
|
11253
11885
|
const keys = keysParam || (config == null ? void 0 : config.data_keys);
|
|
11254
11886
|
if (keys == null ? void 0 : keys.x) {
|
|
@@ -11294,7 +11926,15 @@ function _setXS(ids, data, params) {
|
|
|
11294
11926
|
*/
|
|
11295
11927
|
convertData(args, callback) {
|
|
11296
11928
|
const { config } = this;
|
|
11297
|
-
const useWorker = (d) =>
|
|
11929
|
+
const useWorker = (d) => {
|
|
11930
|
+
if (!(d == null ? void 0 : d.length) || isEmpty(d[0])) {
|
|
11931
|
+
return false;
|
|
11932
|
+
}
|
|
11933
|
+
return config.boost_useWorker === "auto" ? _getCellCount(d) >= WORKER_CELL_THRESHOLD : !!config.boost_useWorker;
|
|
11934
|
+
};
|
|
11935
|
+
const workerOptions = config.boost_workerUrl ? {
|
|
11936
|
+
workerUrl: config.boost_workerUrl
|
|
11937
|
+
} : void 0;
|
|
11298
11938
|
let data = args;
|
|
11299
11939
|
if (args.bindto) {
|
|
11300
11940
|
data = {};
|
|
@@ -11314,14 +11954,16 @@ function _setXS(ids, data, params) {
|
|
|
11314
11954
|
callback
|
|
11315
11955
|
);
|
|
11316
11956
|
} else if (data.json) {
|
|
11317
|
-
runWorker(useWorker(data.json), json,
|
|
11957
|
+
runWorker(useWorker(data.json), "json", json, callback, workerOptions)(
|
|
11318
11958
|
data.json,
|
|
11319
11959
|
_getDataKeyForJson(data.keys, config)
|
|
11320
11960
|
);
|
|
11321
11961
|
} else if (data.rows) {
|
|
11322
|
-
runWorker(useWorker(data.rows), rows, callback)(data.rows);
|
|
11962
|
+
runWorker(useWorker(data.rows), "rows", rows, callback, workerOptions)(data.rows);
|
|
11323
11963
|
} else if (data.columns) {
|
|
11324
|
-
runWorker(useWorker(data.columns), columns, callback)(
|
|
11964
|
+
runWorker(useWorker(data.columns), "columns", columns, callback, workerOptions)(
|
|
11965
|
+
data.columns
|
|
11966
|
+
);
|
|
11325
11967
|
} else if (args.bindto) {
|
|
11326
11968
|
throw Error("url or json or rows or columns is required.");
|
|
11327
11969
|
}
|
|
@@ -11438,6 +12080,7 @@ function _setXS(ids, data, params) {
|
|
|
11438
12080
|
|
|
11439
12081
|
|
|
11440
12082
|
|
|
12083
|
+
|
|
11441
12084
|
const rangedDataKeyIndex = {
|
|
11442
12085
|
areaRange: { high: 0, mid: 1, low: 2 },
|
|
11443
12086
|
candlestick: { open: 0, high: 1, low: 2, close: 3, volume: 4 }
|
|
@@ -12488,9 +13131,10 @@ function normalizeTargetIds(targetIds) {
|
|
|
12488
13131
|
* @private
|
|
12489
13132
|
*/
|
|
12490
13133
|
isBarRangeType(d) {
|
|
13134
|
+
var _a;
|
|
12491
13135
|
const $$ = this;
|
|
12492
13136
|
const { value } = d;
|
|
12493
|
-
return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(isNumber);
|
|
13137
|
+
return $$.isBarType(d) && !((_a = $$.isSubchartSourceTypeOf) == null ? void 0 : _a.call($$, d, TYPE.CANDLESTICK)) && isArray(value) && value.length >= 2 && value.every(isNumber);
|
|
12494
13138
|
},
|
|
12495
13139
|
/**
|
|
12496
13140
|
* Get data object by id
|
|
@@ -13015,7 +13659,6 @@ const RE_SELECTOR_SUFFIX = /[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`
|
|
|
13015
13659
|
|
|
13016
13660
|
|
|
13017
13661
|
|
|
13018
|
-
|
|
13019
13662
|
const _colorizePattern = (pattern, color, id) => {
|
|
13020
13663
|
const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(pattern.cloneNode(true));
|
|
13021
13664
|
node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color);
|
|
@@ -13057,7 +13700,7 @@ const schemeCategory10 = [
|
|
|
13057
13700
|
const { $el, config } = $$;
|
|
13058
13701
|
const ids = [];
|
|
13059
13702
|
const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
|
|
13060
|
-
let pattern = notEmpty(config.color_pattern) ? config.color_pattern :
|
|
13703
|
+
let pattern = notEmpty(config.color_pattern) ? config.color_pattern : [..._getColorFromCss($el.chart) || schemeCategory10];
|
|
13061
13704
|
const originalColorPattern = pattern;
|
|
13062
13705
|
if (isFunction(config.color_tiles)) {
|
|
13063
13706
|
const tiles = config.color_tiles.bind($$.api)();
|
|
@@ -13270,13 +13913,15 @@ function brushEmpty(ctx) {
|
|
|
13270
13913
|
|
|
13271
13914
|
function getTargetDomainCacheKey($$, targets) {
|
|
13272
13915
|
return targets.map((target) => {
|
|
13273
|
-
var _a, _b, _c, _d;
|
|
13916
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
13274
13917
|
const { values } = target;
|
|
13275
13918
|
const first = values[0];
|
|
13276
13919
|
const last = values[values.length - 1];
|
|
13277
13920
|
const firstX = first ? (_b = (_a = $$.getXCacheKey) == null ? void 0 : _a.call($$, first.x)) != null ? _b : first.x : "";
|
|
13278
13921
|
const lastX = last ? (_d = (_c = $$.getXCacheKey) == null ? void 0 : _c.call($$, last.x)) != null ? _d : last.x : "";
|
|
13279
|
-
|
|
13922
|
+
const targetType = (_f = (_e = $$.getTargetType) == null ? void 0 : _e.call($$, target)) != null ? _f : "";
|
|
13923
|
+
const sourceType = (_i = (_h = (_g = $$.state) == null ? void 0 : _g.subchartSourceTypes) == null ? void 0 : _h[target.id]) != null ? _i : "";
|
|
13924
|
+
return `${target.id}:${targetType}:${sourceType}:${values.length}:${firstX}:${lastX}`;
|
|
13280
13925
|
}).join("|");
|
|
13281
13926
|
}
|
|
13282
13927
|
function canCacheTargetDomain($$, targets) {
|
|
@@ -13311,12 +13956,13 @@ function updateMinMaxFromValues(minMax, values) {
|
|
|
13311
13956
|
}
|
|
13312
13957
|
}
|
|
13313
13958
|
function getTargetValueMinMax($$, targets) {
|
|
13314
|
-
var _a, _b;
|
|
13959
|
+
var _a, _b, _c, _d;
|
|
13315
13960
|
const minMax = { min: void 0, max: void 0 };
|
|
13316
13961
|
const hasAxis = $$.state.hasAxis;
|
|
13317
13962
|
for (let i = 0; i < targets.length; i++) {
|
|
13318
13963
|
const target = targets[i];
|
|
13319
13964
|
const isCandlestick = (_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, target);
|
|
13965
|
+
const isSubchartCandlestick = !isCandlestick && !!((_b = $$.isSubchartSourceTypeOf) == null ? void 0 : _b.call($$, target, TYPE.CANDLESTICK));
|
|
13320
13966
|
const { values } = target;
|
|
13321
13967
|
for (let j = 0; j < values.length; j++) {
|
|
13322
13968
|
const row = values[j];
|
|
@@ -13324,14 +13970,17 @@ function getTargetValueMinMax($$, targets) {
|
|
|
13324
13970
|
if (!(isValue(value) || value === null)) {
|
|
13325
13971
|
continue;
|
|
13326
13972
|
}
|
|
13327
|
-
|
|
13973
|
+
const subchartCandlestickValue = isSubchartCandlestick ? (_c = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _c.call($$, row, true) : void 0;
|
|
13974
|
+
if (isNumber(subchartCandlestickValue)) {
|
|
13975
|
+
value = subchartCandlestickValue;
|
|
13976
|
+
} else if (value !== null && (isCandlestick || isSubchartCandlestick)) {
|
|
13328
13977
|
value = Array.isArray(value) ? value.slice(0, 4) : [value.open, value.high, value.low, value.close];
|
|
13329
13978
|
}
|
|
13330
13979
|
if (Array.isArray(value)) {
|
|
13331
13980
|
updateMinMaxFromValues(minMax, value);
|
|
13332
13981
|
} else if (isObject(value) && "high" in value) {
|
|
13333
13982
|
updateMinMaxFromValues(minMax, Object.values(value));
|
|
13334
|
-
} else if ((
|
|
13983
|
+
} else if ((_d = $$.isBubbleZType) == null ? void 0 : _d.call($$, row)) {
|
|
13335
13984
|
updateMinMax(minMax, hasAxis && $$.getBubbleZData(value, "y"));
|
|
13336
13985
|
} else {
|
|
13337
13986
|
updateMinMax(minMax, value);
|
|
@@ -13358,7 +14007,7 @@ function getTargetXMinMax(targets, type) {
|
|
|
13358
14007
|
* Get both min and max Y domain values in a single pass.
|
|
13359
14008
|
* Avoids calling getValuesAsIdKeyed twice.
|
|
13360
14009
|
* @param {Array} targets Target data
|
|
13361
|
-
* @returns {
|
|
14010
|
+
* @returns {Array.<number|Date|undefined>} [min, max]
|
|
13362
14011
|
* @private
|
|
13363
14012
|
*/
|
|
13364
14013
|
getYDomainMinMaxBoth(targets) {
|
|
@@ -15804,13 +16453,23 @@ function batchGetBBox(elements) {
|
|
|
15804
16453
|
const textNode = textNodes.filter((node) => node.data.id === id);
|
|
15805
16454
|
const translate = getTranslation(textNode.node());
|
|
15806
16455
|
const calcHypo = (x, y) => Math.sqrt(x * x + y * y);
|
|
15807
|
-
textNode.node()
|
|
16456
|
+
if (!textNode.node()) {
|
|
16457
|
+
return;
|
|
16458
|
+
}
|
|
16459
|
+
const fontSize = parseInt(textNode.style("font-size"), 10);
|
|
16460
|
+
const overlapStates = [];
|
|
16461
|
+
filteredTextNodes.each(function() {
|
|
15808
16462
|
const coordinate = getTranslation(this);
|
|
15809
|
-
const
|
|
15810
|
-
const nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : filteredTextNode;
|
|
16463
|
+
const nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
15811
16464
|
const overlapsX = Math.ceil(Math.abs(translate.e - coordinate.e)) < Math.ceil(nodeForWidth.node().getComputedTextLength());
|
|
15812
|
-
const overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) <
|
|
15813
|
-
|
|
16465
|
+
const overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) < fontSize;
|
|
16466
|
+
overlapStates.push({
|
|
16467
|
+
node: this,
|
|
16468
|
+
overlaps: overlapsX && overlapsY
|
|
16469
|
+
});
|
|
16470
|
+
});
|
|
16471
|
+
overlapStates.forEach(({ node, overlaps }) => {
|
|
16472
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(node).classed($TEXT.TextOverlapping, overlaps);
|
|
15814
16473
|
});
|
|
15815
16474
|
},
|
|
15816
16475
|
/**
|
|
@@ -16494,6 +17153,12 @@ const RE_TOOLTIP_TPL = /{{(.*)}}/;
|
|
|
16494
17153
|
} else if (target === "subX") {
|
|
16495
17154
|
x = 0;
|
|
16496
17155
|
y = isRotated ? 0 : state.height2;
|
|
17156
|
+
} else if (target === "subY") {
|
|
17157
|
+
x = 0;
|
|
17158
|
+
y = isRotated ? state.height2 : 0;
|
|
17159
|
+
} else if (target === "subY2") {
|
|
17160
|
+
x = isRotated ? 0 : state.width2;
|
|
17161
|
+
y = isRotated ? -1 : 0;
|
|
16497
17162
|
} else if (target === "arc") {
|
|
16498
17163
|
x = state.arcWidth / 2;
|
|
16499
17164
|
y = state.arcHeight / 2;
|
|
@@ -16564,6 +17229,96 @@ const INTERPOLATION_TYPES = /* @__PURE__ */ new Set([
|
|
|
16564
17229
|
isValidChartType(type) {
|
|
16565
17230
|
return !!(type && Object.values(TYPE).indexOf(type) > -1);
|
|
16566
17231
|
},
|
|
17232
|
+
/**
|
|
17233
|
+
* Get the chart type to use for the subchart target.
|
|
17234
|
+
* subchart.types > subchart.type > data.types > data.type > line
|
|
17235
|
+
* @param {object|string} d Target data or id
|
|
17236
|
+
* @returns {string}
|
|
17237
|
+
* @private
|
|
17238
|
+
*/
|
|
17239
|
+
getSubchartTargetType(d) {
|
|
17240
|
+
const $$ = this;
|
|
17241
|
+
const { config } = $$;
|
|
17242
|
+
const id = isString(d) ? d : d == null ? void 0 : d.id;
|
|
17243
|
+
const subchartTypes = config.subchart_types || {};
|
|
17244
|
+
const subchartType = config.subchart_type;
|
|
17245
|
+
const dataTypes = config.data_types || {};
|
|
17246
|
+
const targetSubchartType = id && subchartTypes[id];
|
|
17247
|
+
if (targetSubchartType && $$.isValidChartType(targetSubchartType)) {
|
|
17248
|
+
return targetSubchartType;
|
|
17249
|
+
} else if (subchartType && $$.isValidChartType(subchartType)) {
|
|
17250
|
+
return subchartType;
|
|
17251
|
+
}
|
|
17252
|
+
return id && dataTypes[id] || config.data_type || TYPE.LINE;
|
|
17253
|
+
},
|
|
17254
|
+
/**
|
|
17255
|
+
* Get the regular chart type configured for the target.
|
|
17256
|
+
* @param {object|string} d Target data or id
|
|
17257
|
+
* @returns {string}
|
|
17258
|
+
* @private
|
|
17259
|
+
*/
|
|
17260
|
+
getTargetType(d) {
|
|
17261
|
+
var _a;
|
|
17262
|
+
const { config } = this;
|
|
17263
|
+
const id = isString(d) ? d : d == null ? void 0 : d.id;
|
|
17264
|
+
return id && ((_a = config.data_types) == null ? void 0 : _a[id]) || config.data_type || TYPE.LINE;
|
|
17265
|
+
},
|
|
17266
|
+
/**
|
|
17267
|
+
* Get the target's original chart type while subchart.type context is active.
|
|
17268
|
+
* @param {object|string} d Target data or id
|
|
17269
|
+
* @returns {string}
|
|
17270
|
+
* @private
|
|
17271
|
+
*/
|
|
17272
|
+
getSubchartSourceTargetType(d) {
|
|
17273
|
+
const { state } = this;
|
|
17274
|
+
const id = isString(d) ? d : d == null ? void 0 : d.id;
|
|
17275
|
+
const sourceTypes = state.subchartSourceTypes;
|
|
17276
|
+
return id && (sourceTypes == null ? void 0 : sourceTypes[id]) || this.getTargetType(d);
|
|
17277
|
+
},
|
|
17278
|
+
/**
|
|
17279
|
+
* Check whether a target had the given source type before subchart.type remapping.
|
|
17280
|
+
* @param {object|string} d Target data or id
|
|
17281
|
+
* @param {string|Array} type chart type
|
|
17282
|
+
* @returns {boolean}
|
|
17283
|
+
* @private
|
|
17284
|
+
*/
|
|
17285
|
+
isSubchartSourceTypeOf(d, type) {
|
|
17286
|
+
const sourceType = this.getSubchartSourceTargetType(d);
|
|
17287
|
+
return isArray(type) ? type.indexOf(sourceType) >= 0 : sourceType === type;
|
|
17288
|
+
},
|
|
17289
|
+
/**
|
|
17290
|
+
* Run a callback while regular type helpers resolve using subchart.type/types.
|
|
17291
|
+
* @param {function(): unknown} callback Callback to run
|
|
17292
|
+
* @returns {unknown} Callback return value
|
|
17293
|
+
* @private
|
|
17294
|
+
*/
|
|
17295
|
+
withSubchartTypeContext(callback) {
|
|
17296
|
+
const $$ = this;
|
|
17297
|
+
const { config, data, state } = $$;
|
|
17298
|
+
const dataType = config.data_type;
|
|
17299
|
+
const dataTypes = config.data_types;
|
|
17300
|
+
const currentTypes = state.current.types;
|
|
17301
|
+
const sourceTypes = state.subchartSourceTypes;
|
|
17302
|
+
const subchartTypes = {};
|
|
17303
|
+
const subchartSourceTypes = {};
|
|
17304
|
+
const subchartType = config.subchart_type;
|
|
17305
|
+
$$.mapToIds(data.targets).forEach((id) => {
|
|
17306
|
+
subchartSourceTypes[id] = $$.getTargetType(id);
|
|
17307
|
+
subchartTypes[id] = $$.getSubchartTargetType(id);
|
|
17308
|
+
});
|
|
17309
|
+
config.data_type = subchartType && $$.isValidChartType(subchartType) ? subchartType : dataType;
|
|
17310
|
+
config.data_types = subchartTypes;
|
|
17311
|
+
state.current.types = [];
|
|
17312
|
+
state.subchartSourceTypes = subchartSourceTypes;
|
|
17313
|
+
try {
|
|
17314
|
+
return callback();
|
|
17315
|
+
} finally {
|
|
17316
|
+
config.data_type = dataType;
|
|
17317
|
+
config.data_types = dataTypes;
|
|
17318
|
+
state.current.types = currentTypes;
|
|
17319
|
+
state.subchartSourceTypes = sourceTypes;
|
|
17320
|
+
}
|
|
17321
|
+
},
|
|
16567
17322
|
setTargetType(targetIds, type) {
|
|
16568
17323
|
const $$ = this;
|
|
16569
17324
|
const { config, state: { withoutFadeIn } } = $$;
|
|
@@ -16642,9 +17397,8 @@ const INTERPOLATION_TYPES = /* @__PURE__ */ new Set([
|
|
|
16642
17397
|
* @private
|
|
16643
17398
|
*/
|
|
16644
17399
|
isTypeOf(d, type) {
|
|
16645
|
-
var _a;
|
|
16646
17400
|
const id = isString(d) ? d : d.id;
|
|
16647
|
-
const dataType = this.config &&
|
|
17401
|
+
const dataType = this.config && this.getTargetType(id);
|
|
16648
17402
|
return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
|
16649
17403
|
},
|
|
16650
17404
|
hasPointType() {
|
|
@@ -16752,6 +17506,7 @@ const INTERPOLATION_TYPES = /* @__PURE__ */ new Set([
|
|
|
16752
17506
|
|
|
16753
17507
|
|
|
16754
17508
|
|
|
17509
|
+
|
|
16755
17510
|
const CURVE_MAP = {
|
|
16756
17511
|
basis: external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasis,
|
|
16757
17512
|
"basis-closed": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasisClosed,
|
|
@@ -16779,13 +17534,48 @@ function isLinePointGroupType($$, d) {
|
|
|
16779
17534
|
function getLinePointGroupTypeFilter($$) {
|
|
16780
17535
|
return (d) => isLinePointGroupType($$, d);
|
|
16781
17536
|
}
|
|
16782
|
-
function getShapeOffsetValue($$, d) {
|
|
17537
|
+
function getShapeOffsetValue($$, d, isSub) {
|
|
16783
17538
|
var _a, _b, _c;
|
|
17539
|
+
const subchartCandlestickValue = isSub ? getSubchartCandlestickShapeValue($$, d, isSub) : void 0;
|
|
17540
|
+
if (isNumber(subchartCandlestickValue)) {
|
|
17541
|
+
return subchartCandlestickValue;
|
|
17542
|
+
}
|
|
16784
17543
|
if ((_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, d)) {
|
|
16785
17544
|
return (_c = (_b = $$.getCandlestickData) == null ? void 0 : _b.call($$, d)) == null ? void 0 : _c.close;
|
|
16786
17545
|
}
|
|
16787
17546
|
return $$.getBaseValue(d);
|
|
16788
17547
|
}
|
|
17548
|
+
function getSubchartCandlestickShapeValue($$, d, isSub) {
|
|
17549
|
+
var _a, _b, _c;
|
|
17550
|
+
if (!isSub || ((_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, d)) || !((_b = $$.isSubchartSourceTypeOf) == null ? void 0 : _b.call($$, d, TYPE.CANDLESTICK))) {
|
|
17551
|
+
return void 0;
|
|
17552
|
+
}
|
|
17553
|
+
const value = (_c = $$.getCandlestickData) == null ? void 0 : _c.call($$, d);
|
|
17554
|
+
if (!value) {
|
|
17555
|
+
return void 0;
|
|
17556
|
+
}
|
|
17557
|
+
if ($$.isBarType(d)) {
|
|
17558
|
+
return isNumber(value.open) && isNumber(value.close) ? value._isUp ? value.close : value.open : void 0;
|
|
17559
|
+
}
|
|
17560
|
+
return isNumber(value.close) ? value.close : void 0;
|
|
17561
|
+
}
|
|
17562
|
+
function isSubchartCandlestickBarValue($$, d, isSub) {
|
|
17563
|
+
const value = getSubchartCandlestickShapeValue($$, d, isSub);
|
|
17564
|
+
return isNumber(value) && $$.isBarType(d);
|
|
17565
|
+
}
|
|
17566
|
+
function getSubchartCandlestickBarColor($$, d, isSub) {
|
|
17567
|
+
var _a;
|
|
17568
|
+
if (!isSubchartCandlestickBarValue($$, d, isSub)) {
|
|
17569
|
+
return null;
|
|
17570
|
+
}
|
|
17571
|
+
const value = (_a = $$.getCandlestickData) == null ? void 0 : _a.call($$, d);
|
|
17572
|
+
if (value == null ? void 0 : value._isUp) {
|
|
17573
|
+
return $$.color(d);
|
|
17574
|
+
}
|
|
17575
|
+
const downColor = $$.config.candlestick_color_down;
|
|
17576
|
+
const color = downColor && typeof downColor === "object" ? downColor[d.id] : downColor;
|
|
17577
|
+
return color || $$.color(d);
|
|
17578
|
+
}
|
|
16789
17579
|
function _getGroupedDataPointsFn(d) {
|
|
16790
17580
|
var _a, _b;
|
|
16791
17581
|
const $$ = this;
|
|
@@ -17014,8 +17804,11 @@ function updateTargetsForShape(targets, config) {
|
|
|
17014
17804
|
const isStackNormalized = $$.isStackNormalized();
|
|
17015
17805
|
return (d) => {
|
|
17016
17806
|
let { value } = d;
|
|
17807
|
+
const subchartCandlestickValue = isSub ? getSubchartCandlestickShapeValue($$, d, isSub) : void 0;
|
|
17017
17808
|
if (isNumber(d)) {
|
|
17018
17809
|
value = d;
|
|
17810
|
+
} else if (isNumber(subchartCandlestickValue)) {
|
|
17811
|
+
value = subchartCandlestickValue;
|
|
17019
17812
|
} else if ($$.isAreaRangeType(d)) {
|
|
17020
17813
|
value = $$.getBaseValue(d, "mid");
|
|
17021
17814
|
} else if (isStackNormalized) {
|
|
@@ -17031,13 +17824,14 @@ function updateTargetsForShape(targets, config) {
|
|
|
17031
17824
|
/**
|
|
17032
17825
|
* Get shape based y Axis min value
|
|
17033
17826
|
* @param {string} id Data id
|
|
17827
|
+
* @param {boolean} isSub Whether to use subchart scale
|
|
17034
17828
|
* @returns {number}
|
|
17035
17829
|
* @private
|
|
17036
17830
|
*/
|
|
17037
|
-
getShapeYMin(id) {
|
|
17831
|
+
getShapeYMin(id, isSub = false) {
|
|
17038
17832
|
const $$ = this;
|
|
17039
17833
|
const axisId = $$.axis.getId(id);
|
|
17040
|
-
const scale = $$.
|
|
17834
|
+
const scale = $$.getYScaleById(id, isSub);
|
|
17041
17835
|
const [yMin] = scale.domain();
|
|
17042
17836
|
const inverted = $$.config[`axis_${axisId}_inverted`];
|
|
17043
17837
|
return !$$.isGrouped(id) && !inverted && yMin > 0 ? yMin : 0;
|
|
@@ -17045,17 +17839,18 @@ function updateTargetsForShape(targets, config) {
|
|
|
17045
17839
|
/**
|
|
17046
17840
|
* Get Shape's offset data
|
|
17047
17841
|
* @param {function} typeFilter Type filter function
|
|
17842
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
17048
17843
|
* @returns {object}
|
|
17049
17844
|
* @private
|
|
17050
17845
|
*/
|
|
17051
|
-
getShapeOffsetData(typeFilter) {
|
|
17846
|
+
getShapeOffsetData(typeFilter, isSub) {
|
|
17052
17847
|
const $$ = this;
|
|
17053
17848
|
const targets = $$.orderTargets(
|
|
17054
17849
|
$$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))
|
|
17055
17850
|
);
|
|
17056
17851
|
const dataGeneration = $$.state.dataGeneration;
|
|
17057
17852
|
const targetIds = targets.map((t) => t.id).join("_");
|
|
17058
|
-
const cacheKey = `${KEY.shapeOffset}_${targetIds}`;
|
|
17853
|
+
const cacheKey = `${KEY.shapeOffset}_${isSub ? "sub" : "main"}_${targetIds}`;
|
|
17059
17854
|
const cachedData = $$.cache.get(cacheKey);
|
|
17060
17855
|
if ((cachedData == null ? void 0 : cachedData.generation) === dataGeneration) {
|
|
17061
17856
|
return cachedData;
|
|
@@ -17069,7 +17864,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
17069
17864
|
}
|
|
17070
17865
|
const rowValueMapByXValue = rowValues.reduce((out, d) => {
|
|
17071
17866
|
const key = Number(d.x);
|
|
17072
|
-
const value = getShapeOffsetValue($$, d);
|
|
17867
|
+
const value = getShapeOffsetValue($$, d, isSub);
|
|
17073
17868
|
out[key] = d;
|
|
17074
17869
|
values[key] = isStackNormalized ? $$.getRatio("index", d, true) : value;
|
|
17075
17870
|
return out;
|
|
@@ -17092,7 +17887,8 @@ function updateTargetsForShape(targets, config) {
|
|
|
17092
17887
|
getShapeOffset(typeFilter, indices, isSub) {
|
|
17093
17888
|
const $$ = this;
|
|
17094
17889
|
const { shapeOffsetTargets, indexMapByTargetId } = $$.getShapeOffsetData(
|
|
17095
|
-
typeFilter
|
|
17890
|
+
typeFilter,
|
|
17891
|
+
isSub
|
|
17096
17892
|
);
|
|
17097
17893
|
const groupsZeroAs = $$.config.data_groupsZeroAs;
|
|
17098
17894
|
let sameGroupByTargetId = null;
|
|
@@ -17111,14 +17907,14 @@ function updateTargetsForShape(targets, config) {
|
|
|
17111
17907
|
return (d, idx) => {
|
|
17112
17908
|
var _a;
|
|
17113
17909
|
const { id, value, x } = d;
|
|
17114
|
-
const baseValue = getShapeOffsetValue($$, d);
|
|
17910
|
+
const baseValue = getShapeOffsetValue($$, d, isSub);
|
|
17115
17911
|
const ind = $$.getIndices(indices, d);
|
|
17116
17912
|
const scale = $$.getYScaleById(id, isSub);
|
|
17117
17913
|
if ($$.isBarRangeType(d)) {
|
|
17118
17914
|
return scale(value[0]);
|
|
17119
17915
|
}
|
|
17120
17916
|
const dataXAsNumber = Number(x);
|
|
17121
|
-
const y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id));
|
|
17917
|
+
const y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id, isSub));
|
|
17122
17918
|
let offset = y0;
|
|
17123
17919
|
const sameGroupTargets = (_a = sameGroupByTargetId == null ? void 0 : sameGroupByTargetId.get(id)) != null ? _a : shapeOffsetTargets.filter((t) => t.id !== id && ind[t.id] === ind[id]);
|
|
17124
17920
|
for (const t of sameGroupTargets) {
|
|
@@ -17134,7 +17930,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
17134
17930
|
if (!row || Number(row.x) !== dataXAsNumber) {
|
|
17135
17931
|
row = rowValueMapByXValue[dataXAsNumber];
|
|
17136
17932
|
}
|
|
17137
|
-
const rowValue = row && getShapeOffsetValue($$, row);
|
|
17933
|
+
const rowValue = row && getShapeOffsetValue($$, row, isSub);
|
|
17138
17934
|
if (isNumber(rowValue) && isNumber(baseValue) && rowValue * baseValue >= 0 && isNumber(rValue)) {
|
|
17139
17935
|
const addOffset = baseValue === 0 ? groupsZeroAs === "positive" && rValue > 0 || groupsZeroAs === "negative" && rValue < 0 : true;
|
|
17140
17936
|
if (addOffset) {
|
|
@@ -17161,8 +17957,13 @@ function updateTargetsForShape(targets, config) {
|
|
|
17161
17957
|
const y = $$.getShapeY(isSub);
|
|
17162
17958
|
const lineOffset = $$.getShapeOffset(typeFilter || $$.isLineType, lineIndices, isSub);
|
|
17163
17959
|
const yScale = $$.getYScaleById.bind($$);
|
|
17960
|
+
const y0Cache = /* @__PURE__ */ new Map();
|
|
17164
17961
|
return (d, i) => {
|
|
17165
|
-
|
|
17962
|
+
let y0 = y0Cache.get(d.id);
|
|
17963
|
+
if (y0 === void 0) {
|
|
17964
|
+
y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
|
|
17965
|
+
y0Cache.set(d.id, y0);
|
|
17966
|
+
}
|
|
17166
17967
|
const offset = lineOffset(d, i) || y0;
|
|
17167
17968
|
const posX = x(d);
|
|
17168
17969
|
let posY = y(d);
|
|
@@ -17196,7 +17997,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
17196
17997
|
return function(d, i) {
|
|
17197
17998
|
let y0 = y0Cache.get(d.id);
|
|
17198
17999
|
if (y0 === void 0) {
|
|
17199
|
-
y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
|
|
18000
|
+
y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
|
|
17200
18001
|
y0Cache.set(d.id, y0);
|
|
17201
18002
|
}
|
|
17202
18003
|
const offset = areaOffset(d, i) || y0;
|
|
@@ -17237,7 +18038,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
17237
18038
|
let idInfo = idCache.get(id);
|
|
17238
18039
|
if (!idInfo) {
|
|
17239
18040
|
idInfo = {
|
|
17240
|
-
y0: yScale.call($$, id, isSub)($$.getShapeYMin(id)),
|
|
18041
|
+
y0: yScale.call($$, id, isSub)($$.getShapeYMin(id, isSub)),
|
|
17241
18042
|
isInverted: config[`axis_${$$.axis.getId(id)}_inverted`]
|
|
17242
18043
|
};
|
|
17243
18044
|
idCache.set(id, idInfo);
|
|
@@ -17302,11 +18103,42 @@ function updateTargetsForShape(targets, config) {
|
|
|
17302
18103
|
isSub,
|
|
17303
18104
|
typeFilter
|
|
17304
18105
|
);
|
|
18106
|
+
const y = $$.getShapeY(isSub);
|
|
17305
18107
|
return (d, i) => {
|
|
17306
18108
|
const id = d.id;
|
|
17307
|
-
return $$.isGrouped(id) && isLinePointGroupType($$, d) ? getPoints(d, i)[0][1] :
|
|
18109
|
+
return $$.isGrouped(id) && isLinePointGroupType($$, d) ? getPoints(d, i)[0][1] : y(d);
|
|
17308
18110
|
};
|
|
17309
18111
|
},
|
|
18112
|
+
/**
|
|
18113
|
+
* Get candlestick data projected for alternate subchart shapes.
|
|
18114
|
+
* @param {object} d Data row
|
|
18115
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
18116
|
+
* @returns {number|undefined} Projected value
|
|
18117
|
+
* @private
|
|
18118
|
+
*/
|
|
18119
|
+
getSubchartCandlestickShapeValue(d, isSub) {
|
|
18120
|
+
return getSubchartCandlestickShapeValue(this, d, isSub);
|
|
18121
|
+
},
|
|
18122
|
+
/**
|
|
18123
|
+
* Check whether the row should be drawn as a candlestick-derived subchart bar.
|
|
18124
|
+
* @param {object} d Data row
|
|
18125
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
18126
|
+
* @returns {boolean}
|
|
18127
|
+
* @private
|
|
18128
|
+
*/
|
|
18129
|
+
isSubchartCandlestickBarValue(d, isSub) {
|
|
18130
|
+
return isSubchartCandlestickBarValue(this, d, isSub);
|
|
18131
|
+
},
|
|
18132
|
+
/**
|
|
18133
|
+
* Get subchart bar color projected from candlestick up/down state.
|
|
18134
|
+
* @param {object} d Data row
|
|
18135
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
18136
|
+
* @returns {string|null} Bar color
|
|
18137
|
+
* @private
|
|
18138
|
+
*/
|
|
18139
|
+
getSubchartCandlestickBarColor(d, isSub) {
|
|
18140
|
+
return getSubchartCandlestickBarColor(this, d, isSub);
|
|
18141
|
+
},
|
|
17310
18142
|
/**
|
|
17311
18143
|
* Get point radius.
|
|
17312
18144
|
* @param {object} d Data row
|
|
@@ -17864,7 +18696,7 @@ class ChartInternal {
|
|
|
17864
18696
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_b = $$.hasLegendDefsPoint) == null ? void 0 : _b.call($$))) {
|
|
17865
18697
|
$el.defs = $el.svg.append("defs");
|
|
17866
18698
|
if (hasAxis) {
|
|
17867
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
18699
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
17868
18700
|
$$.appendClip($el.defs, state.clip[v]);
|
|
17869
18701
|
});
|
|
17870
18702
|
}
|
|
@@ -18207,6 +19039,7 @@ extend(ChartInternal.prototype, [
|
|
|
18207
19039
|
|
|
18208
19040
|
|
|
18209
19041
|
|
|
19042
|
+
|
|
18210
19043
|
const CANVAS_SELECTABLE_TYPE_FILTERS = [
|
|
18211
19044
|
isCanvasPointType,
|
|
18212
19045
|
isCanvasBarType,
|
|
@@ -18515,6 +19348,21 @@ function isCanvasSubchartPoint($$, point) {
|
|
|
18515
19348
|
const rect = getCanvasSubchartRect($$);
|
|
18516
19349
|
return !!rect && point[0] >= rect.x && point[0] <= rect.x + rect.w && point[1] >= rect.y && point[1] <= rect.y + rect.h;
|
|
18517
19350
|
}
|
|
19351
|
+
function getCanvasMainPointFromSubchart($$, point) {
|
|
19352
|
+
const { config, state } = $$;
|
|
19353
|
+
const rect = getCanvasSubchartRect($$);
|
|
19354
|
+
if (config.subchart_brush_enabled !== false || !rect || !isCanvasSubchartPoint($$, point)) {
|
|
19355
|
+
return null;
|
|
19356
|
+
}
|
|
19357
|
+
const mainCoord = getMainCoordFromSubchartCoord(
|
|
19358
|
+
$$,
|
|
19359
|
+
config.axis_rotated ? point[1] - rect.y : point[0] - rect.x
|
|
19360
|
+
);
|
|
19361
|
+
if (mainCoord === null) {
|
|
19362
|
+
return null;
|
|
19363
|
+
}
|
|
19364
|
+
return config.axis_rotated ? [state.margin.left + state.width / 2, state.margin.top + mainCoord] : [state.margin.left + mainCoord, state.margin.top + state.height / 2];
|
|
19365
|
+
}
|
|
18518
19366
|
function getCanvasSubchartBrushExtent($$) {
|
|
18519
19367
|
var _a, _b;
|
|
18520
19368
|
const rect = getCanvasSubchartRect($$);
|
|
@@ -18706,15 +19554,17 @@ function getCanvasFlowValueCount($$) {
|
|
|
18706
19554
|
return $$.data.targets.reduce((sum, target) => sum + target.values.length, 0);
|
|
18707
19555
|
}
|
|
18708
19556
|
function syncCanvasFlowYDomains($$) {
|
|
18709
|
-
var _a, _b;
|
|
18710
19557
|
const { scale } = $$;
|
|
18711
19558
|
const targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
18712
19559
|
["y", "y2"].forEach((key) => {
|
|
18713
|
-
var
|
|
18714
|
-
(
|
|
19560
|
+
var _a;
|
|
19561
|
+
(_a = scale[key]) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, key));
|
|
19562
|
+
});
|
|
19563
|
+
$$.withSubchartTypeContext(() => {
|
|
19564
|
+
var _a, _b;
|
|
19565
|
+
(_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
|
|
19566
|
+
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
18715
19567
|
});
|
|
18716
|
-
(_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
|
|
18717
|
-
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
18718
19568
|
}
|
|
18719
19569
|
const canvasInternal = {
|
|
18720
19570
|
/**
|
|
@@ -19391,22 +20241,42 @@ const canvasInternal = {
|
|
|
19391
20241
|
const { config, state } = $$;
|
|
19392
20242
|
const selected = state.canvasSelection;
|
|
19393
20243
|
const selectionGrouped = config.data_selection_grouped;
|
|
19394
|
-
|
|
20244
|
+
let targetIds = getCanvasSelectionIds(ids);
|
|
19395
20245
|
let changed = false;
|
|
20246
|
+
const singleSelection = isSelection && !config.data_selection_multiple;
|
|
20247
|
+
let resetDone = !singleSelection;
|
|
19396
20248
|
if (!config.data_selection_enabled) {
|
|
19397
20249
|
return;
|
|
19398
20250
|
}
|
|
20251
|
+
if (singleSelection) {
|
|
20252
|
+
indices = (indices == null ? void 0 : indices.length) ? [indices[0]] : [0];
|
|
20253
|
+
if (!selectionGrouped) {
|
|
20254
|
+
if (targetIds) {
|
|
20255
|
+
targetIds = targetIds.slice(0, 1);
|
|
20256
|
+
} else {
|
|
20257
|
+
const [firstTarget] = $$.filterTargetsToShow($$.data.targets);
|
|
20258
|
+
targetIds = firstTarget ? [firstTarget.id] : [];
|
|
20259
|
+
}
|
|
20260
|
+
}
|
|
20261
|
+
}
|
|
19399
20262
|
eachCanvasSelectableData($$, (d) => {
|
|
19400
20263
|
const key = getCanvasDataKey(d);
|
|
19401
20264
|
const isTargetId = selectionGrouped || !targetIds || targetIds.indexOf(d.id) >= 0;
|
|
19402
20265
|
const isTargetIndex = !indices || indices.indexOf(d.index) >= 0;
|
|
19403
20266
|
const isSelected = selected.has(key);
|
|
19404
20267
|
if (isSelection) {
|
|
19405
|
-
if (isTargetId && isTargetIndex && !isSelected) {
|
|
20268
|
+
if (isTargetId && isTargetIndex && (!isSelected || singleSelection)) {
|
|
20269
|
+
if (!resetDone) {
|
|
20270
|
+
$$.setCanvasSelection(false);
|
|
20271
|
+
resetDone = true;
|
|
20272
|
+
}
|
|
20273
|
+
if (selected.has(key)) {
|
|
20274
|
+
return;
|
|
20275
|
+
}
|
|
19406
20276
|
selected.add(key);
|
|
19407
20277
|
callFn(config.data_onselected, $$.api, d, $$.canvasEngine.canvas);
|
|
19408
20278
|
changed = true;
|
|
19409
|
-
} else if (resetOther && isSelected) {
|
|
20279
|
+
} else if ((!singleSelection || resetDone) && resetOther && isSelected) {
|
|
19410
20280
|
selected.delete(key);
|
|
19411
20281
|
callFn(config.data_onunselected, $$.api, d, $$.canvasEngine.canvas);
|
|
19412
20282
|
changed = true;
|
|
@@ -19653,12 +20523,12 @@ const canvasInternal = {
|
|
|
19653
20523
|
updateCanvasSubchartBrush(event) {
|
|
19654
20524
|
var _a, _b;
|
|
19655
20525
|
const $$ = this;
|
|
19656
|
-
const { state } = $$;
|
|
20526
|
+
const { config, state } = $$;
|
|
19657
20527
|
const start = state.canvasSubchartBrushStart;
|
|
19658
20528
|
const origin = state.canvasSubchartBrushOrigin;
|
|
19659
20529
|
const mode = state.canvasSubchartBrushMode;
|
|
19660
20530
|
const coord = getCanvasSubchartBrushCoord($$, event, true);
|
|
19661
|
-
if (!state.canvasSubchartBrushDragging || start === null || coord === null || !mode) {
|
|
20531
|
+
if (config.subchart_brush_enabled === false || !state.canvasSubchartBrushDragging || start === null || coord === null || !mode) {
|
|
19662
20532
|
return false;
|
|
19663
20533
|
}
|
|
19664
20534
|
const delta = coord - start;
|
|
@@ -19709,6 +20579,10 @@ const canvasInternal = {
|
|
|
19709
20579
|
updateCanvasSubchartCursor(event) {
|
|
19710
20580
|
const $$ = this;
|
|
19711
20581
|
const canvas2 = $$.$el.canvas.node();
|
|
20582
|
+
if ($$.config.subchart_brush_enabled === false) {
|
|
20583
|
+
canvas2.style.cursor = "";
|
|
20584
|
+
return false;
|
|
20585
|
+
}
|
|
19712
20586
|
const coord = getCanvasSubchartBrushCoord($$, event);
|
|
19713
20587
|
if (coord === null) {
|
|
19714
20588
|
canvas2.style.cursor = "";
|
|
@@ -19728,6 +20602,9 @@ const canvasInternal = {
|
|
|
19728
20602
|
var _a;
|
|
19729
20603
|
const $$ = this;
|
|
19730
20604
|
const { state } = $$;
|
|
20605
|
+
if ($$.config.subchart_brush_enabled === false) {
|
|
20606
|
+
return false;
|
|
20607
|
+
}
|
|
19731
20608
|
const coord = getCanvasSubchartBrushCoord($$, event);
|
|
19732
20609
|
if (coord === null) {
|
|
19733
20610
|
return false;
|
|
@@ -20087,7 +20964,8 @@ const canvasInternal = {
|
|
|
20087
20964
|
(_b = $$.hideTooltip) == null ? void 0 : _b.call($$);
|
|
20088
20965
|
return;
|
|
20089
20966
|
}
|
|
20090
|
-
const
|
|
20967
|
+
const rawPoint = getCanvasEventPoint($$, event);
|
|
20968
|
+
const point = rawPoint && (getCanvasMainPointFromSubchart($$, rawPoint) || rawPoint);
|
|
20091
20969
|
const d = point ? getCanvasHoverDatumFromPoint($$, point) : null;
|
|
20092
20970
|
if (!d) {
|
|
20093
20971
|
$$.dispatchCanvasDataOut(canvas2);
|
|
@@ -20095,8 +20973,8 @@ const canvasInternal = {
|
|
|
20095
20973
|
state.canvasFocusKey = null;
|
|
20096
20974
|
$$.clearCanvasFocus();
|
|
20097
20975
|
}
|
|
20098
|
-
if (
|
|
20099
|
-
$$.renderCanvasAxisTooltip(
|
|
20976
|
+
if (rawPoint && config.axis_tooltip && isCanvasAxisTooltipArea($$, rawPoint)) {
|
|
20977
|
+
$$.renderCanvasAxisTooltip(rawPoint);
|
|
20100
20978
|
(_c = $$.hideTooltip) == null ? void 0 : _c.call($$);
|
|
20101
20979
|
return;
|
|
20102
20980
|
}
|
|
@@ -20227,6 +21105,7 @@ const canvasInternal = {
|
|
|
20227
21105
|
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
20228
21106
|
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
20229
21107
|
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
21108
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubYAxes($$);
|
|
20230
21109
|
$$.canvasRenderer.drawEmptyLabel($$);
|
|
20231
21110
|
rebuildHit && $$.hitDetector.rebuild($$, drawShape);
|
|
20232
21111
|
} finally {
|
|
@@ -20258,6 +21137,7 @@ const canvasInternal = {
|
|
|
20258
21137
|
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
20259
21138
|
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
20260
21139
|
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
21140
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubYAxes($$);
|
|
20261
21141
|
$$.canvasRenderer.drawEmptyLabel($$);
|
|
20262
21142
|
} finally {
|
|
20263
21143
|
$$.canvasEngine.endFrame();
|
|
@@ -22344,7 +23224,7 @@ extend(ygrids, {
|
|
|
22344
23224
|
|
|
22345
23225
|
|
|
22346
23226
|
|
|
22347
|
-
const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`;
|
|
23227
|
+
const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}:not(.${$FOCUS.xgridFocusContinuous}), line.${$FOCUS.ygridFocus}`;
|
|
22348
23228
|
const _getGridTextAnchor = (d) => isValue(d.position) || "end";
|
|
22349
23229
|
const _getGridTextDx = (d) => d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
|
22350
23230
|
function _getGridFocusEl($$) {
|
|
@@ -22355,6 +23235,9 @@ function _getGridFocusEl($$) {
|
|
|
22355
23235
|
const cachedNodes = ((_a = cached == null ? void 0 : cached.nodes) == null ? void 0 : _a.call(cached)) || [];
|
|
22356
23236
|
return cachedNodes.length && cachedNodes.every((node) => mainNode == null ? void 0 : mainNode.contains(node)) ? cached : state._gridFocusEl = main.selectAll(GRID_FOCUS_SELECTOR);
|
|
22357
23237
|
}
|
|
23238
|
+
function _hideContinuousGridFocus($$) {
|
|
23239
|
+
$$.$el.main.select(`line.${$FOCUS.xgridFocusContinuous}`).style("visibility", "hidden");
|
|
23240
|
+
}
|
|
22358
23241
|
function _getGridTextX(isX, width, height) {
|
|
22359
23242
|
return (d) => {
|
|
22360
23243
|
let x = isX ? 0 : width;
|
|
@@ -22525,6 +23408,7 @@ function _smoothLines(el, type) {
|
|
|
22525
23408
|
if (config.grid_focus_y && !config.tooltip_grouped) {
|
|
22526
23409
|
grid.append("g").attr("class", $FOCUS.ygridFocus).append("line").attr("class", $FOCUS.ygridFocus);
|
|
22527
23410
|
}
|
|
23411
|
+
config.subchart_grid_focus_continuous && config.subchart_grid_focus !== false && $el.main.insert("g", className).attr("class", $FOCUS.xgridFocusContinuous).append("line").attr("class", `${$FOCUS.xgridFocus} ${$FOCUS.xgridFocusContinuous}`).style("visibility", "hidden");
|
|
22528
23412
|
}
|
|
22529
23413
|
},
|
|
22530
23414
|
showAxisGridFocus() {
|
|
@@ -22633,6 +23517,7 @@ function _smoothLines(el, type) {
|
|
|
22633
23517
|
if (force || inputType === "mouse" || !resizing) {
|
|
22634
23518
|
const focusEl = _getGridFocusEl($$);
|
|
22635
23519
|
focusEl.style("visibility", "hidden");
|
|
23520
|
+
_hideContinuousGridFocus($$);
|
|
22636
23521
|
(_a = $$.hideCircleFocus) == null ? void 0 : _a.call($$);
|
|
22637
23522
|
}
|
|
22638
23523
|
},
|
|
@@ -22650,6 +23535,7 @@ function _smoothLines(el, type) {
|
|
|
22650
23535
|
} else {
|
|
22651
23536
|
const isRotated = $$.config.axis_rotated;
|
|
22652
23537
|
xgridFocus.attr("x1", isRotated ? 0 : -10).attr("x2", isRotated ? width : -10).attr("y1", isRotated ? -10 : 0).attr("y2", isRotated ? -10 : height);
|
|
23538
|
+
_hideContinuousGridFocus($$);
|
|
22653
23539
|
}
|
|
22654
23540
|
return true;
|
|
22655
23541
|
},
|
|
@@ -22788,28 +23674,85 @@ let grid_grid = () => {
|
|
|
22788
23674
|
|
|
22789
23675
|
|
|
22790
23676
|
|
|
23677
|
+
function setSelectionForFocusOnly(isSelection, ids, indices, resetOther) {
|
|
23678
|
+
const $$ = this;
|
|
23679
|
+
const { config, $el: { main } } = $$;
|
|
23680
|
+
const selectionGrouped = config.data_selection_grouped;
|
|
23681
|
+
const isSelectable = config.data_selection_isselectable.bind($$.api);
|
|
23682
|
+
const targetIds = isDefined(ids) ? [].concat(ids) : null;
|
|
23683
|
+
const singleSelection = isSelection && !config.data_selection_multiple;
|
|
23684
|
+
let resetDone = !singleSelection;
|
|
23685
|
+
const unselect = (circle, d, index) => {
|
|
23686
|
+
$$.unselectPoint(circle, d, index);
|
|
23687
|
+
circle.interrupt().remove();
|
|
23688
|
+
};
|
|
23689
|
+
$$.getTargetsToShow().forEach((target) => {
|
|
23690
|
+
const { id } = target;
|
|
23691
|
+
const isTargetId = selectionGrouped || !targetIds || targetIds.indexOf(id) >= 0;
|
|
23692
|
+
const selectedCircles = main.select(
|
|
23693
|
+
`.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(id)}`
|
|
23694
|
+
);
|
|
23695
|
+
target.values.forEach((d) => {
|
|
23696
|
+
const { index } = d;
|
|
23697
|
+
const isTargetIndex = !indices || indices.indexOf(index) >= 0;
|
|
23698
|
+
const circle = selectedCircles.selectAll(`.${$SELECT.selectedCircle}-${index}`);
|
|
23699
|
+
const isSelected = !circle.empty();
|
|
23700
|
+
if (isSelection) {
|
|
23701
|
+
if (isTargetId && isTargetIndex && isSelectable(d) && (!isSelected || singleSelection)) {
|
|
23702
|
+
if (!resetDone) {
|
|
23703
|
+
setSelectionForFocusOnly.call($$, false);
|
|
23704
|
+
resetDone = true;
|
|
23705
|
+
}
|
|
23706
|
+
$$.selectPoint(null, d, index);
|
|
23707
|
+
} else if ((!singleSelection || resetDone) && isDefined(resetOther) && resetOther && isSelected) {
|
|
23708
|
+
unselect(circle, d, index);
|
|
23709
|
+
}
|
|
23710
|
+
} else if (isTargetId && isTargetIndex && isSelected) {
|
|
23711
|
+
unselect(circle, d, index);
|
|
23712
|
+
}
|
|
23713
|
+
});
|
|
23714
|
+
});
|
|
23715
|
+
}
|
|
22791
23716
|
function setSelection(isSelection = false, ids, indices, resetOther) {
|
|
23717
|
+
var _a;
|
|
22792
23718
|
const $$ = this;
|
|
22793
23719
|
const { config, $el: { main } } = $$;
|
|
22794
23720
|
const selectionGrouped = config.data_selection_grouped;
|
|
22795
23721
|
const isSelectable = config.data_selection_isselectable.bind($$.api);
|
|
23722
|
+
const singleSelection = isSelection && !config.data_selection_multiple;
|
|
23723
|
+
let resetDone = !singleSelection;
|
|
22796
23724
|
if (!config.data_selection_enabled) {
|
|
22797
23725
|
return;
|
|
22798
23726
|
}
|
|
23727
|
+
if (singleSelection) {
|
|
23728
|
+
indices = (indices == null ? void 0 : indices.length) ? [indices[0]] : [0];
|
|
23729
|
+
if (!selectionGrouped) {
|
|
23730
|
+
const targetIds = isDefined(ids) ? [].concat(ids) : $$.getTargetsToShow().map((t) => t.id);
|
|
23731
|
+
ids = targetIds.slice(0, 1);
|
|
23732
|
+
}
|
|
23733
|
+
}
|
|
23734
|
+
if ((_a = $$.isPointFocusOnly) == null ? void 0 : _a.call($$)) {
|
|
23735
|
+
setSelectionForFocusOnly.call($$, isSelection, ids, indices, resetOther);
|
|
23736
|
+
return;
|
|
23737
|
+
}
|
|
22799
23738
|
main.selectAll(`.${$SHAPE.shapes}`).selectAll(`.${$SHAPE.shape}`).each(function(d) {
|
|
22800
23739
|
const shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
22801
23740
|
const { id, index } = d.data ? d.data : d;
|
|
22802
|
-
const toggle = $$.getToggle(this, d).bind($$);
|
|
22803
23741
|
const isTargetId = selectionGrouped || !ids || ids.indexOf(id) >= 0;
|
|
22804
23742
|
const isTargetIndex = !indices || indices.indexOf(index) >= 0;
|
|
22805
|
-
const isSelected = shape.classed($SELECT.SELECTED);
|
|
22806
23743
|
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
22807
23744
|
return;
|
|
22808
23745
|
}
|
|
23746
|
+
const toggle = $$.getToggle(this, d).bind($$);
|
|
23747
|
+
const isSelected = shape.classed($SELECT.SELECTED);
|
|
22809
23748
|
if (isSelection) {
|
|
22810
|
-
if (isTargetId && isTargetIndex && isSelectable(d) && !isSelected) {
|
|
22811
|
-
|
|
22812
|
-
|
|
23749
|
+
if (isTargetId && isTargetIndex && isSelectable(d) && (!isSelected || singleSelection)) {
|
|
23750
|
+
if (!resetDone) {
|
|
23751
|
+
setSelection.call($$, false);
|
|
23752
|
+
resetDone = true;
|
|
23753
|
+
}
|
|
23754
|
+
!shape.classed($SELECT.SELECTED) && toggle(true, shape.classed($SELECT.SELECTED, true), d, index);
|
|
23755
|
+
} else if ((!singleSelection || resetDone) && isDefined(resetOther) && resetOther && isSelected) {
|
|
22813
23756
|
toggle(false, shape.classed($SELECT.SELECTED, false), d, index);
|
|
22814
23757
|
}
|
|
22815
23758
|
} else {
|
|
@@ -22837,12 +23780,16 @@ function setSelection(isSelection = false, ids, indices, resetOther) {
|
|
|
22837
23780
|
* chart.selected("data1");
|
|
22838
23781
|
*/
|
|
22839
23782
|
selected(targetId) {
|
|
22840
|
-
var _a;
|
|
23783
|
+
var _a, _b;
|
|
22841
23784
|
const $$ = this.internal;
|
|
22842
23785
|
const dataPoint = [];
|
|
22843
23786
|
if ($$.state.isCanvasMode) {
|
|
22844
23787
|
return ((_a = $$.getCanvasSelectedData) == null ? void 0 : _a.call($$, targetId)) || dataPoint;
|
|
22845
23788
|
}
|
|
23789
|
+
if ((_b = $$.isPointFocusOnly) == null ? void 0 : _b.call($$)) {
|
|
23790
|
+
$$.$el.main.selectAll(`.${$SELECT.selectedCircles + $$.getTargetSelectorSuffix(targetId)}`).selectAll(`.${$SELECT.selectedCircle}`).each((d) => dataPoint.push(d));
|
|
23791
|
+
return dataPoint;
|
|
23792
|
+
}
|
|
22846
23793
|
$$.$el.main.selectAll(`.${$SHAPE.shapes + $$.getTargetSelectorSuffix(targetId)}`).selectAll(`.${$SHAPE.shape}`).filter(function() {
|
|
22847
23794
|
return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($SELECT.SELECTED);
|
|
22848
23795
|
}).each((d) => dataPoint.push(d));
|
|
@@ -23040,7 +23987,7 @@ var selection_spreadProps = (a, b) => selection_defProps(a, selection_getOwnProp
|
|
|
23040
23987
|
const cx = (isRotated ? $$.circleY : $$.circleX).bind($$);
|
|
23041
23988
|
const cy = (isRotated ? $$.circleX : $$.circleY).bind($$);
|
|
23042
23989
|
const r = $$.pointSelectR.bind($$);
|
|
23043
|
-
callFn(config.data_onselected, $$.api, d, target.node());
|
|
23990
|
+
callFn(config.data_onselected, $$.api, d, target == null ? void 0 : target.node());
|
|
23044
23991
|
$T(main.select(`.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(d.id)}`).selectAll(`.${$SELECT.selectedCircle}-${i}`).data([d]).enter().append("circle").attr("class", () => $$.generateClass($SELECT.selectedCircle, i)).attr("cx", cx).attr("cy", cy).attr("stroke", $$.color).attr("r", (d2) => $$.pointSelectR(d2) * 1.4)).attr("r", r);
|
|
23045
23992
|
},
|
|
23046
23993
|
/**
|
|
@@ -23469,7 +24416,134 @@ extend(subchart, {
|
|
|
23469
24416
|
|
|
23470
24417
|
|
|
23471
24418
|
|
|
24419
|
+
|
|
24420
|
+
|
|
24421
|
+
const SUBCHART_TYPES = ["bar", "line", "bubble", "candlestick", "scatter"];
|
|
24422
|
+
const FOCUS_GRID_STYLE_PROPS = [
|
|
24423
|
+
"opacity",
|
|
24424
|
+
"stroke",
|
|
24425
|
+
"stroke-dasharray",
|
|
24426
|
+
"stroke-dashoffset",
|
|
24427
|
+
"stroke-linecap",
|
|
24428
|
+
"stroke-linejoin",
|
|
24429
|
+
"stroke-miterlimit",
|
|
24430
|
+
"stroke-opacity",
|
|
24431
|
+
"stroke-width"
|
|
24432
|
+
];
|
|
24433
|
+
function syncSubchartGridFocusStyle($$, line) {
|
|
24434
|
+
var _a, _b;
|
|
24435
|
+
const source = (_b = (_a = $$.$el.grid) == null ? void 0 : _a.main) == null ? void 0 : _b.select(`line.${config_classes.xgridFocus}`).node();
|
|
24436
|
+
if (!source || !win.getComputedStyle) {
|
|
24437
|
+
return;
|
|
24438
|
+
}
|
|
24439
|
+
const style = win.getComputedStyle(source);
|
|
24440
|
+
FOCUS_GRID_STYLE_PROPS.forEach((prop) => {
|
|
24441
|
+
const value = style.getPropertyValue(prop);
|
|
24442
|
+
value && line.style(prop, value);
|
|
24443
|
+
});
|
|
24444
|
+
}
|
|
24445
|
+
function getFiniteAttr(value, fallback) {
|
|
24446
|
+
const parsed = Number(value);
|
|
24447
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
24448
|
+
}
|
|
24449
|
+
function showContinuousSubchartGridFocus($$) {
|
|
24450
|
+
var _a, _b;
|
|
24451
|
+
if (!isContinuousGridFocusEnabled($$)) {
|
|
24452
|
+
return false;
|
|
24453
|
+
}
|
|
24454
|
+
const { config, state, $el } = $$;
|
|
24455
|
+
const mainLine = (_b = (_a = $el.grid) == null ? void 0 : _a.main) == null ? void 0 : _b.select(
|
|
24456
|
+
`line.${config_classes.xgridFocus}:not(.${config_classes.xgridFocusContinuous})`
|
|
24457
|
+
);
|
|
24458
|
+
const line = $el.main.select(`line.${config_classes.xgridFocusContinuous}`);
|
|
24459
|
+
if (!(mainLine == null ? void 0 : mainLine.node()) || !line.node()) {
|
|
24460
|
+
return false;
|
|
24461
|
+
}
|
|
24462
|
+
const x2 = state.margin2.left - state.margin.left + state.width2;
|
|
24463
|
+
const y2 = state.margin2.top - state.margin.top + state.height2;
|
|
24464
|
+
syncSubchartGridFocusStyle($$, line);
|
|
24465
|
+
config.axis_rotated ? line.attr("x1", getFiniteAttr(mainLine.attr("x1"), 0)).attr("x2", x2).attr("y1", getFiniteAttr(mainLine.attr("y1"), -10)).attr("y2", getFiniteAttr(mainLine.attr("y2"), -10)) : line.attr("x1", getFiniteAttr(mainLine.attr("x1"), -10)).attr("x2", getFiniteAttr(mainLine.attr("x2"), -10)).attr("y1", getFiniteAttr(mainLine.attr("y1"), 0)).attr("y2", y2);
|
|
24466
|
+
line.style("visibility", null);
|
|
24467
|
+
mainLine.style("visibility", "hidden");
|
|
24468
|
+
return true;
|
|
24469
|
+
}
|
|
24470
|
+
function hideContinuousSubchartGridFocus($$) {
|
|
24471
|
+
var _a;
|
|
24472
|
+
(_a = $$.$el.main) == null ? void 0 : _a.select(`line.${config_classes.xgridFocusContinuous}`).style("visibility", "hidden");
|
|
24473
|
+
}
|
|
24474
|
+
function getMainPointFromSubchartEvent($$, event, context) {
|
|
24475
|
+
const { config, state } = $$;
|
|
24476
|
+
const [x, y] = getPointer(event, context);
|
|
24477
|
+
const mainCoord = getMainCoordFromSubchartCoord($$, config.axis_rotated ? y : x);
|
|
24478
|
+
if (mainCoord === null) {
|
|
24479
|
+
return null;
|
|
24480
|
+
}
|
|
24481
|
+
return config.axis_rotated ? [state.width / 2, mainCoord] : [mainCoord, state.height / 2];
|
|
24482
|
+
}
|
|
24483
|
+
function dispatchSubchartEvent($$, type, event, context) {
|
|
24484
|
+
var _a, _b;
|
|
24485
|
+
const mainEventRect = (_b = (_a = $$.$el.eventRect) == null ? void 0 : _a.node) == null ? void 0 : _b.call(_a);
|
|
24486
|
+
if (!mainEventRect) {
|
|
24487
|
+
return;
|
|
24488
|
+
}
|
|
24489
|
+
const point = getMainPointFromSubchartEvent($$, event, context) || [0, 0];
|
|
24490
|
+
const rect = getBoundingRect(mainEventRect, true);
|
|
24491
|
+
const clientX = rect.left + point[0];
|
|
24492
|
+
const clientY = rect.top + point[1];
|
|
24493
|
+
const params = {
|
|
24494
|
+
bubbles: true,
|
|
24495
|
+
cancelable: true,
|
|
24496
|
+
screenX: clientX,
|
|
24497
|
+
screenY: clientY,
|
|
24498
|
+
clientX,
|
|
24499
|
+
clientY
|
|
24500
|
+
};
|
|
24501
|
+
/^touch/.test(type) ? emulateEvent.touch(mainEventRect, type, params) : emulateEvent.mouse(mainEventRect, type, params);
|
|
24502
|
+
}
|
|
23472
24503
|
/* harmony default export */ var interactions_subchart = ({
|
|
24504
|
+
/**
|
|
24505
|
+
* Whether subchart brush interaction is enabled.
|
|
24506
|
+
* @returns {boolean}
|
|
24507
|
+
* @private
|
|
24508
|
+
*/
|
|
24509
|
+
isSubchartBrushEnabled() {
|
|
24510
|
+
const { config } = this;
|
|
24511
|
+
return config.subchart_show && config.subchart_brush_enabled !== false;
|
|
24512
|
+
},
|
|
24513
|
+
/**
|
|
24514
|
+
* Bind event rect handlers for subchart hover interactions.
|
|
24515
|
+
* @param {d3Selection} eventRect Subchart event rect selection
|
|
24516
|
+
* @private
|
|
24517
|
+
*/
|
|
24518
|
+
bindSubchartEventRect(eventRect) {
|
|
24519
|
+
const $$ = this;
|
|
24520
|
+
const { config, state } = $$;
|
|
24521
|
+
eventRect.on("mouseover mousemove mouseout touchstart touchmove touchend", null);
|
|
24522
|
+
if (!config.interaction_enabled) {
|
|
24523
|
+
return;
|
|
24524
|
+
}
|
|
24525
|
+
if (state.inputType === "mouse") {
|
|
24526
|
+
eventRect.on("mouseover mousemove", function(event) {
|
|
24527
|
+
if ($$.isSubchartBrushEnabled()) {
|
|
24528
|
+
return;
|
|
24529
|
+
}
|
|
24530
|
+
dispatchSubchartEvent($$, event.type, event, this);
|
|
24531
|
+
}).on("mouseout", function(event) {
|
|
24532
|
+
if ($$.isSubchartBrushEnabled()) {
|
|
24533
|
+
return;
|
|
24534
|
+
}
|
|
24535
|
+
dispatchSubchartEvent($$, "mouseout", event, this);
|
|
24536
|
+
});
|
|
24537
|
+
} else if (state.inputType === "touch") {
|
|
24538
|
+
eventRect.on("touchstart touchmove touchend", function(event) {
|
|
24539
|
+
var _a;
|
|
24540
|
+
if ($$.isSubchartBrushEnabled() || ((_a = event.touches) == null ? void 0 : _a.length) > 1) {
|
|
24541
|
+
return;
|
|
24542
|
+
}
|
|
24543
|
+
dispatchSubchartEvent($$, event.type, event, this);
|
|
24544
|
+
});
|
|
24545
|
+
}
|
|
24546
|
+
},
|
|
23473
24547
|
/**
|
|
23474
24548
|
* Initialize the brush.
|
|
23475
24549
|
* @private
|
|
@@ -23563,19 +24637,26 @@ extend(subchart, {
|
|
|
23563
24637
|
const { main } = subchart;
|
|
23564
24638
|
main.style("visibility", visibility);
|
|
23565
24639
|
main.append("g").attr("clip-path", clipPath).attr("class", config_classes.chart);
|
|
23566
|
-
|
|
23567
|
-
|
|
23568
|
-
|
|
23569
|
-
|
|
23570
|
-
|
|
23571
|
-
|
|
23572
|
-
chart.
|
|
24640
|
+
$$.withSubchartTypeContext(() => {
|
|
24641
|
+
SUBCHART_TYPES.forEach((v) => {
|
|
24642
|
+
const type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
|
|
24643
|
+
if ($$.hasType(v) || $$.hasTypeOf(type)) {
|
|
24644
|
+
const chart = main.select(`.${config_classes.chart}`);
|
|
24645
|
+
const chartClassName = config_classes[`chart${type}s`];
|
|
24646
|
+
if (chart.select(`.${chartClassName}`).empty()) {
|
|
24647
|
+
chart.append("g").attr("class", chartClassName);
|
|
24648
|
+
}
|
|
23573
24649
|
}
|
|
23574
|
-
}
|
|
24650
|
+
});
|
|
23575
24651
|
});
|
|
23576
|
-
const brush = main.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).call($$.brush);
|
|
24652
|
+
const brush = main.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).style("pointer-events", $$.isSubchartBrushEnabled() ? null : "none").call($$.brush);
|
|
23577
24653
|
config.subchart_showHandle && $$.addBrushHandle(brush);
|
|
24654
|
+
subchart.eventRect = main.append("g").attr("clip-path", clipPath).attr("class", `${config_classes.eventRects} ${config_classes.eventRects}-subchart`).style("fill-opacity", "0").style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all").append("rect").attr("class", `${config_classes.eventRect} ${config_classes.eventRect}-subchart`).attr("width", $$.state.width2).attr("height", $$.state.height2);
|
|
24655
|
+
$$.bindSubchartEventRect(subchart.eventRect);
|
|
24656
|
+
main.append("g").attr("clip-path", clipPath).attr("class", config_classes.xgridFocus).append("line").attr("class", config_classes.xgridFocus).style("visibility", "hidden");
|
|
23578
24657
|
axis.subX = main.append("g").attr("class", config_classes.axisX).attr("transform", $$.getTranslate("subX")).attr("clip-path", config.axis_rotated ? "" : clip.pathXAxis).style("visibility", config.subchart_axis_x_show ? visibility : "hidden");
|
|
24658
|
+
axis.subY = main.append("g").attr("class", config_classes.axisY).attr("transform", $$.getTranslate("subY")).style("visibility", config.subchart_axis_y_show ? visibility : "hidden");
|
|
24659
|
+
axis.subY2 = main.append("g").attr("class", config_classes.axisY2).attr("transform", $$.getTranslate("subY2")).style("visibility", config.subchart_axis_y2_show ? visibility : "hidden");
|
|
23579
24660
|
},
|
|
23580
24661
|
/**
|
|
23581
24662
|
* Add brush handle
|
|
@@ -23598,64 +24679,89 @@ extend(subchart, {
|
|
|
23598
24679
|
* @private
|
|
23599
24680
|
*/
|
|
23600
24681
|
updateTargetsForSubchart(targets) {
|
|
24682
|
+
var _a;
|
|
23601
24683
|
const $$ = this;
|
|
23602
24684
|
const { config, state, $el: { subchart: { main } } } = $$;
|
|
23603
24685
|
if (config.subchart_show) {
|
|
23604
|
-
|
|
23605
|
-
|
|
23606
|
-
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23618
|
-
|
|
23619
|
-
|
|
24686
|
+
$$.withSubchartTypeContext(() => {
|
|
24687
|
+
SUBCHART_TYPES.filter((v) => $$.hasType(v) || $$.hasTypeOf(capitalize(v))).forEach((v) => {
|
|
24688
|
+
const isPointType = /^(bubble|scatter)$/.test(v);
|
|
24689
|
+
const name = capitalize(isPointType ? "circle" : v);
|
|
24690
|
+
const chartClass = $$.getChartClass(name, true);
|
|
24691
|
+
const shapeClass = $$.getClass(isPointType ? "circles" : `${v}s`, true);
|
|
24692
|
+
const shapeChart = main.select(`.${config_classes[`chart${`${name}s`}`]}`);
|
|
24693
|
+
if (isPointType) {
|
|
24694
|
+
const circle = shapeChart.selectAll(`.${config_classes.circles}`).data(targets.filter($$[`is${capitalize(v)}Type`].bind($$))).attr("class", shapeClass);
|
|
24695
|
+
circle.exit().remove();
|
|
24696
|
+
circle.enter().append("g").attr("class", shapeClass);
|
|
24697
|
+
} else {
|
|
24698
|
+
const shapeUpdate = shapeChart.selectAll(`.${config_classes[`chart${name}`]}`).attr("class", chartClass).data(targets.filter($$[`is${name}Type`].bind($$)));
|
|
24699
|
+
const shapeEnter = shapeUpdate.enter().append("g").style("opacity", "0").attr("class", chartClass).append("g").attr("class", shapeClass);
|
|
24700
|
+
shapeUpdate.exit().remove();
|
|
24701
|
+
v === "line" && $$.hasTypeOf("Area") && shapeEnter.append("g").attr("class", $$.getClass("areas", true));
|
|
24702
|
+
}
|
|
24703
|
+
});
|
|
23620
24704
|
});
|
|
23621
24705
|
main.selectAll(`.${config_classes.brush} rect`).attr(
|
|
23622
24706
|
config.axis_rotated ? "width" : "height",
|
|
23623
24707
|
config.axis_rotated ? state.width2 : state.height2
|
|
23624
24708
|
);
|
|
24709
|
+
(_a = $$.$el.subchart.eventRect) == null ? void 0 : _a.attr("width", state.width2).attr("height", state.height2).style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all");
|
|
23625
24710
|
}
|
|
23626
24711
|
},
|
|
24712
|
+
/**
|
|
24713
|
+
* Update subchart y domains using subchart type options.
|
|
24714
|
+
* @param {object} targets Targets to show
|
|
24715
|
+
* @private
|
|
24716
|
+
*/
|
|
24717
|
+
updateSubchartYDomain(targets) {
|
|
24718
|
+
var _a, _b;
|
|
24719
|
+
const $$ = this;
|
|
24720
|
+
const { scale } = $$;
|
|
24721
|
+
const targetsToShow = targets || $$.filterTargetsToShow($$.data.targets);
|
|
24722
|
+
(_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
|
|
24723
|
+
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
24724
|
+
},
|
|
23627
24725
|
/**
|
|
23628
24726
|
* Redraw subchart.
|
|
23629
24727
|
* @private
|
|
23630
24728
|
* @param {boolean} withSubchart whether or not to show subchart
|
|
23631
24729
|
* @param {number} duration duration
|
|
23632
|
-
* @param {object} shape Shape's info
|
|
23633
24730
|
*/
|
|
23634
|
-
redrawSubchart(withSubchart, duration
|
|
23635
|
-
var _a;
|
|
24731
|
+
redrawSubchart(withSubchart, duration) {
|
|
24732
|
+
var _a, _b, _c, _d;
|
|
23636
24733
|
const $$ = this;
|
|
23637
24734
|
const { config, $el: { subchart: { main } }, state } = $$;
|
|
23638
24735
|
const withTransition = !!duration;
|
|
23639
24736
|
main.style("visibility", config.subchart_show ? null : "hidden");
|
|
24737
|
+
main.select(`.${config_classes.brush}`).style("pointer-events", $$.isSubchartBrushEnabled() ? null : "none");
|
|
24738
|
+
(_a = $$.$el.subchart.eventRect) == null ? void 0 : _a.style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all");
|
|
24739
|
+
(_b = $$.$el.axis.subY) == null ? void 0 : _b.style("visibility", config.subchart_axis_y_show ? null : "hidden");
|
|
24740
|
+
(_c = $$.$el.axis.subY2) == null ? void 0 : _c.style("visibility", config.subchart_axis_y2_show ? null : "hidden");
|
|
23640
24741
|
if (config.subchart_show) {
|
|
23641
|
-
if (((
|
|
24742
|
+
if (((_d = state.event) == null ? void 0 : _d.type) === "zoom") {
|
|
23642
24743
|
$$.brush.update();
|
|
23643
24744
|
}
|
|
23644
24745
|
if (withSubchart) {
|
|
23645
24746
|
const initRange = config.subchart_init_range;
|
|
23646
24747
|
!brushEmpty($$) && $$.brush.update();
|
|
23647
|
-
|
|
23648
|
-
const
|
|
23649
|
-
|
|
23650
|
-
|
|
23651
|
-
|
|
24748
|
+
$$.withSubchartTypeContext(() => {
|
|
24749
|
+
const targetsToShow = state._targetsToShow || $$.filterTargetsToShow($$.data.targets);
|
|
24750
|
+
$$.updateSubchartYDomain(targetsToShow);
|
|
24751
|
+
const subchartShape = $$.getDrawShape();
|
|
24752
|
+
Object.keys(subchartShape.type).forEach((v) => {
|
|
24753
|
+
const name = capitalize(v);
|
|
24754
|
+
const drawFn = $$[`generateDraw${name}`](subchartShape.indices[v], true);
|
|
24755
|
+
$$[`update${name}`](withTransition, true);
|
|
24756
|
+
$$[`redraw${name}`](drawFn, withTransition, true);
|
|
24757
|
+
});
|
|
24758
|
+
if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
|
24759
|
+
const { cx } = subchartShape.pos;
|
|
24760
|
+
const cy = $$.updateCircleY(true);
|
|
24761
|
+
$$.updateCircle(true);
|
|
24762
|
+
$$.redrawCircle(cx, cy, withTransition, void 0, true);
|
|
24763
|
+
}
|
|
23652
24764
|
});
|
|
23653
|
-
if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
|
23654
|
-
const { cx } = shape.pos;
|
|
23655
|
-
const cy = $$.updateCircleY(true);
|
|
23656
|
-
$$.updateCircle(true);
|
|
23657
|
-
$$.redrawCircle(cx, cy, withTransition, void 0, true);
|
|
23658
|
-
}
|
|
23659
24765
|
if (!state.rendered && initRange) {
|
|
23660
24766
|
state.domain = initRange;
|
|
23661
24767
|
$$.brush.move(
|
|
@@ -23666,6 +24772,46 @@ extend(subchart, {
|
|
|
23666
24772
|
}
|
|
23667
24773
|
}
|
|
23668
24774
|
},
|
|
24775
|
+
/**
|
|
24776
|
+
* Show a focus grid line on subchart following main chart focus.
|
|
24777
|
+
* @param {Array} data Selected data
|
|
24778
|
+
* @private
|
|
24779
|
+
*/
|
|
24780
|
+
showSubchartGridFocus(data) {
|
|
24781
|
+
const $$ = this;
|
|
24782
|
+
const { config, state, $el: { subchart: { main } } } = $$;
|
|
24783
|
+
if (!main || !config.subchart_show || $$.isSubchartBrushEnabled() || config.grid_focus_show === false || config.subchart_grid_focus === false || !config.tooltip_show || config.axis_tooltip) {
|
|
24784
|
+
return;
|
|
24785
|
+
}
|
|
24786
|
+
const focusData = Array.isArray(data) ? data : [data];
|
|
24787
|
+
const focus = focusData.find((d) => d && $$.getBaseValue(d) != null);
|
|
24788
|
+
if (!focus) {
|
|
24789
|
+
$$.hideSubchartGridFocus();
|
|
24790
|
+
return;
|
|
24791
|
+
}
|
|
24792
|
+
const pos = $$.scale.subX(focus.x);
|
|
24793
|
+
if (!Number.isFinite(pos)) {
|
|
24794
|
+
$$.hideSubchartGridFocus();
|
|
24795
|
+
return;
|
|
24796
|
+
}
|
|
24797
|
+
const line = main.select(`g.${config_classes.xgridFocus} line.${config_classes.xgridFocus}`);
|
|
24798
|
+
if (showContinuousSubchartGridFocus($$)) {
|
|
24799
|
+
line.style("visibility", "hidden");
|
|
24800
|
+
return;
|
|
24801
|
+
}
|
|
24802
|
+
syncSubchartGridFocusStyle($$, line);
|
|
24803
|
+
config.axis_rotated ? line.attr("x1", 0).attr("x2", state.width2).attr("y1", pos).attr("y2", pos) : line.attr("x1", pos).attr("x2", pos).attr("y1", 0).attr("y2", state.height2);
|
|
24804
|
+
line.style("visibility", null);
|
|
24805
|
+
},
|
|
24806
|
+
/**
|
|
24807
|
+
* Hide subchart focus grid line.
|
|
24808
|
+
* @private
|
|
24809
|
+
*/
|
|
24810
|
+
hideSubchartGridFocus() {
|
|
24811
|
+
var _a;
|
|
24812
|
+
hideContinuousSubchartGridFocus(this);
|
|
24813
|
+
(_a = this.$el.subchart.main) == null ? void 0 : _a.select(`g.${config_classes.xgridFocus} line.${config_classes.xgridFocus}`).style("visibility", "hidden");
|
|
24814
|
+
},
|
|
23669
24815
|
/**
|
|
23670
24816
|
* Redraw the brush.
|
|
23671
24817
|
* @param {boolean} [callCallbck=true] Call 'onbrush' callback or not.
|
|
@@ -23701,8 +24847,12 @@ extend(subchart, {
|
|
|
23701
24847
|
const $$ = this;
|
|
23702
24848
|
const { $el: { subchart }, $T } = $$;
|
|
23703
24849
|
const subXAxis = (transitions == null ? void 0 : transitions.axisSubX) ? transitions.axisSubX : $T(subchart.main.select(`.${config_classes.axisX}`), withTransition);
|
|
24850
|
+
const subYAxis = (transitions == null ? void 0 : transitions.axisSubY) ? transitions.axisSubY : $T(subchart.main.select(`.${config_classes.axisY}`), withTransition);
|
|
24851
|
+
const subY2Axis = (transitions == null ? void 0 : transitions.axisSubY2) ? transitions.axisSubY2 : $T(subchart.main.select(`.${config_classes.axisY2}`), withTransition);
|
|
23704
24852
|
subchart.main.attr("transform", $$.getTranslate("context"));
|
|
23705
24853
|
subXAxis.attr("transform", $$.getTranslate("subX"));
|
|
24854
|
+
subYAxis.attr("transform", $$.getTranslate("subY"));
|
|
24855
|
+
subY2Axis.attr("transform", $$.getTranslate("subY2"));
|
|
23706
24856
|
}
|
|
23707
24857
|
});
|
|
23708
24858
|
|
|
@@ -23710,7 +24860,7 @@ extend(subchart, {
|
|
|
23710
24860
|
/* harmony default export */ var interaction_subchart = ({
|
|
23711
24861
|
/**
|
|
23712
24862
|
* Set subchart options.
|
|
23713
|
-
* - **NOTE:** Not supported for
|
|
24863
|
+
* - **NOTE:** Not supported for non-Axis based(pie, donut, gauge, radar) types.
|
|
23714
24864
|
* @name subchart
|
|
23715
24865
|
* @memberof Options
|
|
23716
24866
|
* @type {object}
|
|
@@ -23718,11 +24868,45 @@ extend(subchart, {
|
|
|
23718
24868
|
* @property {boolean} [subchart.show=false] Show sub chart on the bottom of the chart.
|
|
23719
24869
|
* - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
|
|
23720
24870
|
* - `show: subchart()`
|
|
24871
|
+
* @property {string} [subchart.type] Set chart type for the subchart. Defaults to data.type.
|
|
24872
|
+
* @property {object} [subchart.types] Set chart type for each data in the subchart. Defaults to data.types.
|
|
24873
|
+
* @property {boolean} [subchart.brush.enabled=true] Enable subchart brush interaction.
|
|
23721
24874
|
* @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
|
|
24875
|
+
* @property {boolean|object} [subchart.grid.focus=true] Show x focus grid line in subchart when subchart brush is disabled.
|
|
24876
|
+
* @property {boolean} [subchart.grid.focus.continuous=false] Render x focus grid line as one continuous line across main chart and subchart when subchart brush is disabled.
|
|
23722
24877
|
* @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
|
|
23723
24878
|
* @property {boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line.
|
|
24879
|
+
* @property {number} [subchart.axis.x.tick.count] Set the number of x axis ticks.
|
|
24880
|
+
* @property {Array|function} [subchart.axis.x.tick.values] Set x axis tick values manually.
|
|
24881
|
+
* @property {boolean|object} [subchart.axis.x.tick.culling] Setting for culling x axis ticks.
|
|
24882
|
+
* @property {number} [subchart.axis.x.tick.culling.max] The number of x axis tick texts will be adjusted to less than this value.
|
|
24883
|
+
* @property {boolean} [subchart.axis.x.tick.culling.lines=true] Control x axis tick line visibility within culling option.
|
|
24884
|
+
* @property {boolean} [subchart.axis.x.tick.culling.reverse=false] Control x axis culling start point to be reversed.
|
|
24885
|
+
* @property {boolean} [subchart.axis.x.tick.outer] Show or hide x axis outer tick.
|
|
23724
24886
|
* @property {function|string} [subchart.axis.x.tick.format] Use custom format for x axis ticks - see [axis.x.tick.format](#.axis․x․tick․format) for details.
|
|
23725
24887
|
* @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
|
|
24888
|
+
* @property {boolean} [subchart.axis.y.show=false] Show or hide y axis.
|
|
24889
|
+
* @property {boolean} [subchart.axis.y.tick.show=true] Show or hide y axis tick line.
|
|
24890
|
+
* @property {number} [subchart.axis.y.tick.count] Set the number of y axis ticks.
|
|
24891
|
+
* @property {Array|function} [subchart.axis.y.tick.values] Set y axis tick values manually.
|
|
24892
|
+
* @property {boolean|object} [subchart.axis.y.tick.culling] Setting for culling y axis ticks.
|
|
24893
|
+
* @property {number} [subchart.axis.y.tick.culling.max] The number of y axis tick texts will be adjusted to less than this value.
|
|
24894
|
+
* @property {boolean} [subchart.axis.y.tick.culling.lines=true] Control y axis tick line visibility within culling option.
|
|
24895
|
+
* @property {boolean} [subchart.axis.y.tick.culling.reverse=false] Control y axis culling start point to be reversed.
|
|
24896
|
+
* @property {boolean} [subchart.axis.y.tick.outer] Show or hide y axis outer tick.
|
|
24897
|
+
* @property {function|string} [subchart.axis.y.tick.format] Use custom format for y axis ticks - see [axis.y.tick.format](#.axis․y․tick․format) for details.
|
|
24898
|
+
* @property {boolean} [subchart.axis.y.tick.text.show=true] Show or hide y axis tick text.
|
|
24899
|
+
* @property {boolean} [subchart.axis.y2.show=false] Show or hide y2 axis.
|
|
24900
|
+
* @property {boolean} [subchart.axis.y2.tick.show=true] Show or hide y2 axis tick line.
|
|
24901
|
+
* @property {number} [subchart.axis.y2.tick.count] Set the number of y2 axis ticks.
|
|
24902
|
+
* @property {Array|function} [subchart.axis.y2.tick.values] Set y2 axis tick values manually.
|
|
24903
|
+
* @property {boolean|object} [subchart.axis.y2.tick.culling] Setting for culling y2 axis ticks.
|
|
24904
|
+
* @property {number} [subchart.axis.y2.tick.culling.max] The number of y2 axis tick texts will be adjusted to less than this value.
|
|
24905
|
+
* @property {boolean} [subchart.axis.y2.tick.culling.lines=true] Control y2 axis tick line visibility within culling option.
|
|
24906
|
+
* @property {boolean} [subchart.axis.y2.tick.culling.reverse=false] Control y2 axis culling start point to be reversed.
|
|
24907
|
+
* @property {boolean} [subchart.axis.y2.tick.outer] Show or hide y2 axis outer tick.
|
|
24908
|
+
* @property {function|string} [subchart.axis.y2.tick.format] Use custom format for y2 axis ticks - see [axis.y2.tick.format](#.axis․y2․tick․format) for details.
|
|
24909
|
+
* @property {boolean} [subchart.axis.y2.tick.text.show=true] Show or hide y2 axis tick text.
|
|
23726
24910
|
* @property {Array} [subchart.init.range] Set initial selection domain range.
|
|
23727
24911
|
* @property {number} [subchart.size.height] Change the height of the subchart.
|
|
23728
24912
|
* @property {function} [subchart.onbrush] Set callback for brush event.<br>
|
|
@@ -23732,9 +24916,29 @@ extend(subchart, {
|
|
|
23732
24916
|
* subchart: {
|
|
23733
24917
|
* show: true,
|
|
23734
24918
|
* showHandle: true,
|
|
24919
|
+
*
|
|
24920
|
+
* // render the overview with a different chart type than the main chart
|
|
24921
|
+
* type: "bar",
|
|
24922
|
+
*
|
|
24923
|
+
* // override the type per data series
|
|
24924
|
+
* types: {
|
|
24925
|
+
* data2: "area"
|
|
24926
|
+
* },
|
|
23735
24927
|
* size: {
|
|
23736
24928
|
* height: 20
|
|
23737
24929
|
* },
|
|
24930
|
+
* brush: {
|
|
24931
|
+
* // disable brush(zoom) interaction, rendering the subchart as a static overview
|
|
24932
|
+
* enabled: false
|
|
24933
|
+
* },
|
|
24934
|
+
* grid: {
|
|
24935
|
+
* // set false to hide focus grid line in subchart
|
|
24936
|
+
* // focus: false,
|
|
24937
|
+
* focus: {
|
|
24938
|
+
* // NOTE: works only when 'brush.enabled=false'
|
|
24939
|
+
* continuous: true
|
|
24940
|
+
* }
|
|
24941
|
+
* },
|
|
23738
24942
|
* init: {
|
|
23739
24943
|
* // specify initial range domain selection
|
|
23740
24944
|
* range: [1, 2]
|
|
@@ -23749,6 +24953,12 @@ extend(subchart, {
|
|
|
23749
24953
|
* show: false
|
|
23750
24954
|
* }
|
|
23751
24955
|
* }
|
|
24956
|
+
* },
|
|
24957
|
+
* y: {
|
|
24958
|
+
* show: true,
|
|
24959
|
+
* tick: {
|
|
24960
|
+
* count: 3
|
|
24961
|
+
* }
|
|
23752
24962
|
* }
|
|
23753
24963
|
* },
|
|
23754
24964
|
* onbrush: function(domain) { ... }
|
|
@@ -23763,12 +24973,46 @@ extend(subchart, {
|
|
|
23763
24973
|
* }
|
|
23764
24974
|
*/
|
|
23765
24975
|
subchart_show: false,
|
|
24976
|
+
subchart_type: void 0,
|
|
24977
|
+
subchart_types: {},
|
|
24978
|
+
subchart_brush_enabled: true,
|
|
23766
24979
|
subchart_showHandle: false,
|
|
23767
24980
|
subchart_size_height: 60,
|
|
24981
|
+
subchart_grid_focus: true,
|
|
24982
|
+
subchart_grid_focus_continuous: false,
|
|
23768
24983
|
subchart_axis_x_show: true,
|
|
23769
24984
|
subchart_axis_x_tick_show: true,
|
|
24985
|
+
subchart_axis_x_tick_count: void 0,
|
|
24986
|
+
subchart_axis_x_tick_values: void 0,
|
|
24987
|
+
subchart_axis_x_tick_culling: void 0,
|
|
24988
|
+
subchart_axis_x_tick_culling_max: void 0,
|
|
24989
|
+
subchart_axis_x_tick_culling_lines: void 0,
|
|
24990
|
+
subchart_axis_x_tick_culling_reverse: void 0,
|
|
24991
|
+
subchart_axis_x_tick_outer: void 0,
|
|
23770
24992
|
subchart_axis_x_tick_format: void 0,
|
|
23771
24993
|
subchart_axis_x_tick_text_show: true,
|
|
24994
|
+
subchart_axis_y_show: false,
|
|
24995
|
+
subchart_axis_y_tick_show: true,
|
|
24996
|
+
subchart_axis_y_tick_count: void 0,
|
|
24997
|
+
subchart_axis_y_tick_values: void 0,
|
|
24998
|
+
subchart_axis_y_tick_culling: void 0,
|
|
24999
|
+
subchart_axis_y_tick_culling_max: void 0,
|
|
25000
|
+
subchart_axis_y_tick_culling_lines: void 0,
|
|
25001
|
+
subchart_axis_y_tick_culling_reverse: void 0,
|
|
25002
|
+
subchart_axis_y_tick_outer: void 0,
|
|
25003
|
+
subchart_axis_y_tick_format: void 0,
|
|
25004
|
+
subchart_axis_y_tick_text_show: true,
|
|
25005
|
+
subchart_axis_y2_show: false,
|
|
25006
|
+
subchart_axis_y2_tick_show: true,
|
|
25007
|
+
subchart_axis_y2_tick_count: void 0,
|
|
25008
|
+
subchart_axis_y2_tick_values: void 0,
|
|
25009
|
+
subchart_axis_y2_tick_culling: void 0,
|
|
25010
|
+
subchart_axis_y2_tick_culling_max: void 0,
|
|
25011
|
+
subchart_axis_y2_tick_culling_lines: void 0,
|
|
25012
|
+
subchart_axis_y2_tick_culling_reverse: void 0,
|
|
25013
|
+
subchart_axis_y2_tick_outer: void 0,
|
|
25014
|
+
subchart_axis_y2_tick_format: void 0,
|
|
25015
|
+
subchart_axis_y2_tick_text_show: true,
|
|
23772
25016
|
subchart_init_range: void 0,
|
|
23773
25017
|
subchart_onbrush: () => {
|
|
23774
25018
|
}
|
|
@@ -26102,8 +27346,6 @@ const axis = {
|
|
|
26102
27346
|
}
|
|
26103
27347
|
});
|
|
26104
27348
|
|
|
26105
|
-
// EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
|
|
26106
|
-
var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(10);
|
|
26107
27349
|
;// ./src/ChartInternal/Axis/AxisRendererHelper.ts
|
|
26108
27350
|
var AxisRendererHelper_defProp = Object.defineProperty;
|
|
26109
27351
|
var AxisRendererHelper_defNormalProp = (obj, key, value) => key in obj ? AxisRendererHelper_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -26159,7 +27401,7 @@ class AxisRendererHelper {
|
|
|
26159
27401
|
/**
|
|
26160
27402
|
* Get tick transform setter function
|
|
26161
27403
|
* @param {string} id Axis id
|
|
26162
|
-
* @returns {(
|
|
27404
|
+
* @returns {function(d3Selection, d3Scale): void} transform setter function
|
|
26163
27405
|
* @private
|
|
26164
27406
|
*/
|
|
26165
27407
|
getTickTransformSetter(id) {
|
|
@@ -26241,6 +27483,13 @@ var AxisRenderer_publicField = (obj, key, value) => AxisRenderer_defNormalProp(o
|
|
|
26241
27483
|
|
|
26242
27484
|
|
|
26243
27485
|
|
|
27486
|
+
function getBaseAxisId(id) {
|
|
27487
|
+
return id === "subX" ? "x" : id === "subY" ? "y" : id === "subY2" ? "y2" : id;
|
|
27488
|
+
}
|
|
27489
|
+
function getAxisOptionPrefix(id) {
|
|
27490
|
+
const type = getBaseAxisId(id);
|
|
27491
|
+
return /^sub/.test(id) ? `subchart_axis_${type}` : `axis_${type}`;
|
|
27492
|
+
}
|
|
26244
27493
|
class AxisRenderer {
|
|
26245
27494
|
constructor(params = {}) {
|
|
26246
27495
|
AxisRenderer_publicField(this, "helper");
|
|
@@ -26273,8 +27522,8 @@ class AxisRenderer {
|
|
|
26273
27522
|
const { config, params } = this;
|
|
26274
27523
|
const { config: chartConfig, id, owner } = params;
|
|
26275
27524
|
const isX = /^(x|subX)$/.test(id);
|
|
26276
|
-
const type = id
|
|
26277
|
-
const customTickFormat = id
|
|
27525
|
+
const type = getBaseAxisId(id);
|
|
27526
|
+
const customTickFormat = /^sub/.test(id) ? chartConfig[`subchart_axis_${type}_tick_format`] || chartConfig[`axis_${type}_tick_format`] : chartConfig[`axis_${type}_tick_format`];
|
|
26278
27527
|
const categoryAutoWrap = params.tickMultiline && params.isCategory && !isLeftRight && !(params.tickWidth > 0);
|
|
26279
27528
|
return !!(owner.state.resizing && !owner.state.flowing && !isFunction(chartConfig.axis_evalTextSize) && !customTickFormat && !params.tickTitle && !(isX && chartConfig.axis_x_tick_autorotate) && !categoryAutoWrap && config.withoutTransition);
|
|
26280
27529
|
}
|
|
@@ -26316,10 +27565,12 @@ class AxisRenderer {
|
|
|
26316
27565
|
this.config.range = scale.rangeExtent ? scale.rangeExtent() : helper.scaleExtent((params.orgXScale || scale).range());
|
|
26317
27566
|
const { innerTickSize, tickLength, range } = config;
|
|
26318
27567
|
const id = params.id;
|
|
26319
|
-
const
|
|
26320
|
-
const
|
|
27568
|
+
const type = getBaseAxisId(id);
|
|
27569
|
+
const { isSubAxes } = params;
|
|
27570
|
+
const tickTextPos = !isSubAxes && type && /^(x|y|y2)$/.test(type) ? params.config[`axis_${type}_tick_text_position`] : { x: 0, y: 0 };
|
|
27571
|
+
const prefix = getAxisOptionPrefix(id);
|
|
26321
27572
|
const axisShow = params.config[`${prefix}_show`];
|
|
26322
|
-
const tickShow = {
|
|
27573
|
+
const tickShow = isSubAxes ? { tick: true, text: true } : {
|
|
26323
27574
|
tick: axisShow ? params.config[`${prefix}_tick_show`] : false,
|
|
26324
27575
|
text: axisShow ? params.config[`${prefix}_tick_text_show`] : false
|
|
26325
27576
|
};
|
|
@@ -26518,7 +27769,7 @@ class AxisRenderer {
|
|
|
26518
27769
|
axis_x_tick_text_inner: inner
|
|
26519
27770
|
}
|
|
26520
27771
|
} = this.params.owner;
|
|
26521
|
-
const tickLineInner = this.params.config[`axis_${axisId}_tick_inner`];
|
|
27772
|
+
const tickLineInner = this.params.config[`axis_${getBaseAxisId(axisId)}_tick_inner`];
|
|
26522
27773
|
switch (orient) {
|
|
26523
27774
|
case "bottom":
|
|
26524
27775
|
lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", (d) => this.getTickSize.bind(this)(d) * (tickLineInner ? -1 : 1));
|
|
@@ -26713,7 +27964,17 @@ var Axis_publicField = (obj, key, value) => Axis_defNormalProp(obj, typeof key !
|
|
|
26713
27964
|
|
|
26714
27965
|
|
|
26715
27966
|
|
|
26716
|
-
|
|
27967
|
+
function Axis_getBaseAxisId(id) {
|
|
27968
|
+
return id === "subX" ? "x" : id === "subY" ? "y" : id === "subY2" ? "y2" : id;
|
|
27969
|
+
}
|
|
27970
|
+
function isSubAxis(id) {
|
|
27971
|
+
return /^sub/.test(id);
|
|
27972
|
+
}
|
|
27973
|
+
function Axis_getAxisTickOption(config, id, key) {
|
|
27974
|
+
const type = Axis_getBaseAxisId(id);
|
|
27975
|
+
const subValue = config[`subchart_axis_${type}_tick_${key}`];
|
|
27976
|
+
return isSubAxis(id) && subValue !== void 0 ? subValue : config[`axis_${type}_tick_${key}`];
|
|
27977
|
+
}
|
|
26717
27978
|
function _sampleTickNodes(nodes) {
|
|
26718
27979
|
var _a, _b;
|
|
26719
27980
|
const sampled = [nodes[0], nodes[nodes.length - 1]];
|
|
@@ -26917,6 +28178,8 @@ class Axis_Axis {
|
|
|
26917
28178
|
Axis_publicField(this, "owner");
|
|
26918
28179
|
Axis_publicField(this, "x");
|
|
26919
28180
|
Axis_publicField(this, "subX");
|
|
28181
|
+
Axis_publicField(this, "subY");
|
|
28182
|
+
Axis_publicField(this, "subY2");
|
|
26920
28183
|
Axis_publicField(this, "y");
|
|
26921
28184
|
Axis_publicField(this, "y2");
|
|
26922
28185
|
Axis_publicField(this, "axesList", {});
|
|
@@ -26930,7 +28193,9 @@ class Axis_Axis {
|
|
|
26930
28193
|
x: "bottom",
|
|
26931
28194
|
y: "left",
|
|
26932
28195
|
y2: "right",
|
|
26933
|
-
subX: "bottom"
|
|
28196
|
+
subX: "bottom",
|
|
28197
|
+
subY: "left",
|
|
28198
|
+
subY2: "right"
|
|
26934
28199
|
});
|
|
26935
28200
|
this.owner = owner;
|
|
26936
28201
|
this.setOrient();
|
|
@@ -27021,7 +28286,9 @@ class Axis_Axis {
|
|
|
27021
28286
|
x: isRotated ? "left" : "bottom",
|
|
27022
28287
|
y: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
|
|
27023
28288
|
y2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right",
|
|
27024
|
-
subX: isRotated ? "left" : "bottom"
|
|
28289
|
+
subX: isRotated ? "left" : "bottom",
|
|
28290
|
+
subY: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
|
|
28291
|
+
subY2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right"
|
|
27025
28292
|
};
|
|
27026
28293
|
}
|
|
27027
28294
|
/**
|
|
@@ -27036,24 +28303,32 @@ class Axis_Axis {
|
|
|
27036
28303
|
const axes = [];
|
|
27037
28304
|
const axesConfig = config[`axis_${id}_axes`];
|
|
27038
28305
|
const isRotated = config.axis_rotated;
|
|
27039
|
-
let
|
|
28306
|
+
let orient;
|
|
27040
28307
|
if (id === "x") {
|
|
27041
|
-
|
|
28308
|
+
orient = isRotated ? "left" : "bottom";
|
|
27042
28309
|
} else if (id === "y") {
|
|
27043
|
-
|
|
28310
|
+
orient = isRotated ? "bottom" : "left";
|
|
27044
28311
|
} else if (id === "y2") {
|
|
27045
|
-
|
|
28312
|
+
orient = isRotated ? "top" : "right";
|
|
27046
28313
|
}
|
|
27047
28314
|
if (axesConfig.length) {
|
|
27048
28315
|
axesConfig.forEach((v) => {
|
|
27049
28316
|
const tick = v.tick || {};
|
|
27050
28317
|
const scale = $$.scale[id].copy();
|
|
27051
28318
|
v.domain && scale.domain(v.domain);
|
|
27052
|
-
|
|
27053
|
-
|
|
27054
|
-
|
|
27055
|
-
|
|
28319
|
+
const axis = new AxisRenderer({
|
|
28320
|
+
outerTick: tick.outer !== false,
|
|
28321
|
+
noTransition: false,
|
|
28322
|
+
config,
|
|
28323
|
+
id,
|
|
28324
|
+
isSubAxes: true,
|
|
28325
|
+
owner: $$
|
|
28326
|
+
}).scale(scale).orient(orient).tickFormat(
|
|
28327
|
+
isFunction(tick.format) ? tick.format.bind($$.api) : ((x) => x)
|
|
27056
28328
|
);
|
|
28329
|
+
isValue(tick.count) && axis.ticks(tick.count);
|
|
28330
|
+
tick.values && axis.tickValues(tick.values);
|
|
28331
|
+
axes.push(axis);
|
|
27057
28332
|
});
|
|
27058
28333
|
}
|
|
27059
28334
|
this.axesList[id] = axes;
|
|
@@ -27077,10 +28352,11 @@ class Axis_Axis {
|
|
|
27077
28352
|
const className = `${this.getAxisClassName(id)}-${i + 1}`;
|
|
27078
28353
|
let g = main.select(`.${className.replace(/\s/, ".")}`);
|
|
27079
28354
|
if (g.empty()) {
|
|
27080
|
-
g = main.append("g").attr("class", className).style("visibility", config[`axis_${id}_show`] ? null : "hidden")
|
|
28355
|
+
g = main.append("g").attr("class", className).style("visibility", config[`axis_${id}_show`] ? null : "hidden");
|
|
28356
|
+
v.create(g);
|
|
27081
28357
|
} else {
|
|
27082
28358
|
axesConfig[i].domain && scale.domain(axesConfig[i].domain);
|
|
27083
|
-
|
|
28359
|
+
v.scale(scale).create($T(g));
|
|
27084
28360
|
}
|
|
27085
28361
|
g.attr("transform", $$.getTranslate(id, i + 1));
|
|
27086
28362
|
});
|
|
@@ -27097,8 +28373,9 @@ class Axis_Axis {
|
|
|
27097
28373
|
*/
|
|
27098
28374
|
setAxis(id, scale, outerTick, noTransition) {
|
|
27099
28375
|
const $$ = this.owner;
|
|
27100
|
-
|
|
27101
|
-
|
|
28376
|
+
const type = Axis_getBaseAxisId(id);
|
|
28377
|
+
if (!isSubAxis(id)) {
|
|
28378
|
+
this.tick[type] = this.getTickValues(type);
|
|
27102
28379
|
}
|
|
27103
28380
|
this[id] = this.getAxis(
|
|
27104
28381
|
id,
|
|
@@ -27114,7 +28391,7 @@ class Axis_Axis {
|
|
|
27114
28391
|
const $$ = this.owner;
|
|
27115
28392
|
const { config } = $$;
|
|
27116
28393
|
const isX = /^(x|subX)$/.test(id);
|
|
27117
|
-
const type =
|
|
28394
|
+
const type = Axis_getBaseAxisId(id);
|
|
27118
28395
|
const isCategory = isX && this.isCategorized();
|
|
27119
28396
|
const orient = this.orient[id];
|
|
27120
28397
|
const tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type);
|
|
@@ -27122,12 +28399,12 @@ class Axis_Axis {
|
|
|
27122
28399
|
if (isX) {
|
|
27123
28400
|
tickFormat = id === "subX" ? $$.format.subXAxisTick : $$.format.xAxisTick;
|
|
27124
28401
|
} else {
|
|
27125
|
-
const fn = config[`axis_${
|
|
28402
|
+
const fn = isSubAxis(id) ? config[`subchart_axis_${type}_tick_format`] || config[`axis_${type}_tick_format`] : config[`axis_${type}_tick_format`];
|
|
27126
28403
|
if (isFunction(fn)) {
|
|
27127
28404
|
tickFormat = fn.bind($$.api);
|
|
27128
28405
|
}
|
|
27129
28406
|
}
|
|
27130
|
-
let tickValues = this.tick[type];
|
|
28407
|
+
let tickValues = isSubAxis(id) ? this.getTickValues(type, true) : this.tick[type];
|
|
27131
28408
|
const axisParams = mergeObj({
|
|
27132
28409
|
outerTick,
|
|
27133
28410
|
noTransition,
|
|
@@ -27156,7 +28433,7 @@ class Axis_Axis {
|
|
|
27156
28433
|
}
|
|
27157
28434
|
tickValues && axis.tickValues(tickValues);
|
|
27158
28435
|
axis.tickFormat(
|
|
27159
|
-
tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(
|
|
28436
|
+
tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(type) && ((x) => `${x}%`))
|
|
27160
28437
|
);
|
|
27161
28438
|
if (isCategory) {
|
|
27162
28439
|
axis.tickCentered(config.axis_x_tick_centered);
|
|
@@ -27164,7 +28441,7 @@ class Axis_Axis {
|
|
|
27164
28441
|
config.axis_x_tick_culling = false;
|
|
27165
28442
|
}
|
|
27166
28443
|
}
|
|
27167
|
-
const tickCount = config
|
|
28444
|
+
const tickCount = Axis_getAxisTickOption(config, id, "count");
|
|
27168
28445
|
tickCount && axis.ticks(tickCount);
|
|
27169
28446
|
return axis;
|
|
27170
28447
|
}
|
|
@@ -27173,24 +28450,31 @@ class Axis_Axis {
|
|
|
27173
28450
|
const $$ = this.owner;
|
|
27174
28451
|
const { config } = $$;
|
|
27175
28452
|
const fit = config.axis_x_tick_fit;
|
|
27176
|
-
|
|
27177
|
-
|
|
27178
|
-
|
|
27179
|
-
|
|
27180
|
-
|
|
27181
|
-
count
|
|
27182
|
-
|
|
27183
|
-
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
|
|
27187
|
-
|
|
27188
|
-
|
|
28453
|
+
const generateValues = (countOption = config.axis_x_tick_count) => {
|
|
28454
|
+
let count = countOption;
|
|
28455
|
+
let values2;
|
|
28456
|
+
if (fit) {
|
|
28457
|
+
values2 = $$.mapTargetsToUniqueXs(targets);
|
|
28458
|
+
if (this.isCategorized() && count > values2.length) {
|
|
28459
|
+
count = values2.length;
|
|
28460
|
+
}
|
|
28461
|
+
values2 = this.generateTickValues(
|
|
28462
|
+
values2,
|
|
28463
|
+
count,
|
|
28464
|
+
this.isTimeSeries()
|
|
28465
|
+
);
|
|
28466
|
+
}
|
|
28467
|
+
return values2;
|
|
28468
|
+
};
|
|
28469
|
+
const values = generateValues();
|
|
27189
28470
|
if (axis) {
|
|
27190
28471
|
axis.tickValues(values);
|
|
27191
28472
|
} else if (this.x) {
|
|
28473
|
+
const subTickValues = this.getTickValues("x", true);
|
|
28474
|
+
const subTickCount = Axis_getAxisTickOption(config, "subX", "count");
|
|
28475
|
+
const subValues = subTickValues != null ? subTickValues : subTickCount !== config.axis_x_tick_count ? generateValues(subTickCount) : values;
|
|
27192
28476
|
this.x.tickValues(values);
|
|
27193
|
-
(_a = this.subX) == null ? void 0 : _a.tickValues(
|
|
28477
|
+
(_a = this.subX) == null ? void 0 : _a.tickValues(subValues);
|
|
27194
28478
|
}
|
|
27195
28479
|
return values;
|
|
27196
28480
|
}
|
|
@@ -27220,11 +28504,12 @@ class Axis_Axis {
|
|
|
27220
28504
|
}
|
|
27221
28505
|
return isFunction(currFormat) ? (v) => currFormat.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]) : currFormat;
|
|
27222
28506
|
}
|
|
27223
|
-
getTickValues(id) {
|
|
28507
|
+
getTickValues(id, isSub = false) {
|
|
27224
28508
|
const $$ = this.owner;
|
|
27225
|
-
const tickValues = $$.config[`axis_${id}_tick_values`];
|
|
28509
|
+
const tickValues = isSub ? Axis_getAxisTickOption($$.config, `sub${capitalize(id)}`, "values") : $$.config[`axis_${id}_tick_values`];
|
|
28510
|
+
const values = isFunction(tickValues) ? tickValues.call($$.api) : tickValues;
|
|
27226
28511
|
const axis = $$[`${id}Axis`];
|
|
27227
|
-
return
|
|
28512
|
+
return isSub ? values != null ? values : void 0 : values || (axis ? axis.tickValues() : void 0);
|
|
27228
28513
|
}
|
|
27229
28514
|
getLabelOptionByAxisId(id) {
|
|
27230
28515
|
return this.owner.config[`axis_${id}_label`];
|
|
@@ -27659,14 +28944,21 @@ class Axis_Axis {
|
|
|
27659
28944
|
generateTransitions(withTransition) {
|
|
27660
28945
|
const $$ = this.owner;
|
|
27661
28946
|
const { $el: { axis }, $T } = $$;
|
|
27662
|
-
const [axisX, axisY, axisY2, axisSubX
|
|
27663
|
-
|
|
28947
|
+
const [axisX, axisY, axisY2, axisSubX, axisSubY, axisSubY2] = [
|
|
28948
|
+
"x",
|
|
28949
|
+
"y",
|
|
28950
|
+
"y2",
|
|
28951
|
+
"subX",
|
|
28952
|
+
"subY",
|
|
28953
|
+
"subY2"
|
|
28954
|
+
].map((v) => $T(axis[v], withTransition));
|
|
28955
|
+
return { axisX, axisY, axisY2, axisSubX, axisSubY, axisSubY2 };
|
|
27664
28956
|
}
|
|
27665
28957
|
redraw(transitions, isHidden, isInit) {
|
|
27666
28958
|
const $$ = this.owner;
|
|
27667
28959
|
const { config, state, $el } = $$;
|
|
27668
28960
|
const opacity = isHidden ? "0" : null;
|
|
27669
|
-
["x", "y", "y2", "subX"].forEach((id) => {
|
|
28961
|
+
["x", "y", "y2", "subX", "subY", "subY2"].forEach((id) => {
|
|
27670
28962
|
const axis = this[id];
|
|
27671
28963
|
const $axis = $el.axis[id];
|
|
27672
28964
|
if (axis && $axis) {
|
|
@@ -27688,7 +28980,7 @@ class Axis_Axis {
|
|
|
27688
28980
|
* @private
|
|
27689
28981
|
*/
|
|
27690
28982
|
syncAxisDomains(targetsToShow, wth, flow) {
|
|
27691
|
-
var _a
|
|
28983
|
+
var _a;
|
|
27692
28984
|
const $$ = this.owner;
|
|
27693
28985
|
const { config, scale, $el } = $$;
|
|
27694
28986
|
const hasZoom = !!scale.zoom;
|
|
@@ -27734,8 +29026,30 @@ class Axis_Axis {
|
|
|
27734
29026
|
}
|
|
27735
29027
|
});
|
|
27736
29028
|
if (wth.Y) {
|
|
27737
|
-
|
|
27738
|
-
|
|
29029
|
+
const updateSubDomain = () => {
|
|
29030
|
+
var _a2, _b;
|
|
29031
|
+
(_a2 = scale.subY) == null ? void 0 : _a2.domain($$.getYDomain(targetsToShow, "y"));
|
|
29032
|
+
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
29033
|
+
["y", "y2"].forEach((key) => {
|
|
29034
|
+
const subAxisId = key === "y2" ? "subY2" : "subY";
|
|
29035
|
+
const axisScale = scale[subAxisId];
|
|
29036
|
+
const axis = $$.axis[subAxisId];
|
|
29037
|
+
const tickValues = this.getTickValues(key, true);
|
|
29038
|
+
const tickCount = Axis_getAxisTickOption(config, subAxisId, "count");
|
|
29039
|
+
if (!axisScale || !axis || tickValues || !tickCount) {
|
|
29040
|
+
return;
|
|
29041
|
+
}
|
|
29042
|
+
const domain = axisScale.domain();
|
|
29043
|
+
axis.tickValues(
|
|
29044
|
+
this.generateTickValues(
|
|
29045
|
+
domain,
|
|
29046
|
+
domain.every((v) => v === 0) ? 1 : tickCount,
|
|
29047
|
+
this.isTimeSeriesY()
|
|
29048
|
+
)
|
|
29049
|
+
);
|
|
29050
|
+
});
|
|
29051
|
+
};
|
|
29052
|
+
config.subchart_show ? $$.withSubchartTypeContext(updateSubDomain) : updateSubDomain();
|
|
27739
29053
|
}
|
|
27740
29054
|
}
|
|
27741
29055
|
/**
|
|
@@ -27763,20 +29077,18 @@ class Axis_Axis {
|
|
|
27763
29077
|
setCulling() {
|
|
27764
29078
|
const $$ = this.owner;
|
|
27765
29079
|
const { config, state: { clip, current }, $el } = $$;
|
|
27766
|
-
["subX", "x", "y", "y2"].forEach((type) => {
|
|
29080
|
+
["subX", "x", "y", "y2", "subY", "subY2"].forEach((type) => {
|
|
27767
29081
|
const axis = $el.axis[type];
|
|
27768
|
-
const
|
|
27769
|
-
const cullingOptionPrefix = `axis_${id}_tick_culling`;
|
|
27770
|
-
const toCull = config[cullingOptionPrefix];
|
|
29082
|
+
const toCull = Axis_getAxisTickOption(config, type, "culling");
|
|
27771
29083
|
if (axis && toCull) {
|
|
27772
29084
|
const tickNodes = axis.selectAll(".tick");
|
|
27773
29085
|
const tickValues = sortValue(
|
|
27774
29086
|
tickNodes.data(),
|
|
27775
|
-
!config
|
|
29087
|
+
!Axis_getAxisTickOption(config, type, "culling_reverse")
|
|
27776
29088
|
);
|
|
27777
29089
|
const tickSize = tickValues.length;
|
|
27778
|
-
const cullingMax = config
|
|
27779
|
-
const lines = config
|
|
29090
|
+
const cullingMax = Axis_getAxisTickOption(config, type, "culling_max");
|
|
29091
|
+
const lines = Axis_getAxisTickOption(config, type, "culling_lines");
|
|
27780
29092
|
const cullTickLine = !lines || _hasOverlappedTickLineIntervals(
|
|
27781
29093
|
this[type],
|
|
27782
29094
|
tickValues,
|
|
@@ -28096,7 +29408,7 @@ var __pow = Math.pow;
|
|
|
28096
29408
|
* @private
|
|
28097
29409
|
*/
|
|
28098
29410
|
selectRectForSingle(context, index) {
|
|
28099
|
-
var _a, _b, _c, _d;
|
|
29411
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
28100
29412
|
const $$ = this;
|
|
28101
29413
|
const { config, state, $el: { main, circle } } = $$;
|
|
28102
29414
|
const isSelectionEnabled = config.data_selection_enabled;
|
|
@@ -28107,6 +29419,7 @@ var __pow = Math.pow;
|
|
|
28107
29419
|
if (isTooltipGrouped) {
|
|
28108
29420
|
$$.showTooltip(selectedData, context);
|
|
28109
29421
|
(_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
|
|
29422
|
+
(_b = $$.showSubchartGridFocus) == null ? void 0 : _b.call($$, selectedData);
|
|
28110
29423
|
if (!isSelectionEnabled || isSelectionGrouped) {
|
|
28111
29424
|
return;
|
|
28112
29425
|
}
|
|
@@ -28119,7 +29432,7 @@ var __pow = Math.pow;
|
|
|
28119
29432
|
return $$.isWithinShape(this, d);
|
|
28120
29433
|
});
|
|
28121
29434
|
shapeAtIndex.call((selected) => {
|
|
28122
|
-
var _a2, _b2;
|
|
29435
|
+
var _a2, _b2, _c2;
|
|
28123
29436
|
const d = selected.data();
|
|
28124
29437
|
if (isSelectionEnabled && (isSelectionGrouped || (isSelectable == null ? void 0 : isSelectable.bind($$.api)(d)))) {
|
|
28125
29438
|
context.style.cursor = "pointer";
|
|
@@ -28127,7 +29440,8 @@ var __pow = Math.pow;
|
|
|
28127
29440
|
if (!isTooltipGrouped) {
|
|
28128
29441
|
$$.showTooltip(d, context);
|
|
28129
29442
|
(_a2 = $$.showGridFocus) == null ? void 0 : _a2.call($$, d);
|
|
28130
|
-
(_b2 = $$.
|
|
29443
|
+
(_b2 = $$.showSubchartGridFocus) == null ? void 0 : _b2.call($$, d);
|
|
29444
|
+
(_c2 = $$.unexpandCircles) == null ? void 0 : _c2.call($$);
|
|
28131
29445
|
selected.each((d2) => $$.setExpand(index, d2.id));
|
|
28132
29446
|
}
|
|
28133
29447
|
});
|
|
@@ -28152,14 +29466,16 @@ var __pow = Math.pow;
|
|
|
28152
29466
|
}
|
|
28153
29467
|
}
|
|
28154
29468
|
$$.showTooltip([closest], context);
|
|
28155
|
-
(
|
|
28156
|
-
(
|
|
29469
|
+
(_c = $$.showGridFocus) == null ? void 0 : _c.call($$, [closest]);
|
|
29470
|
+
(_d = $$.showSubchartGridFocus) == null ? void 0 : _d.call($$, [closest]);
|
|
29471
|
+
(_e = $$.unexpandCircles) == null ? void 0 : _e.call($$);
|
|
28157
29472
|
$$.setExpand(index, closest.id, true);
|
|
28158
29473
|
if (isSelectionEnabled && (isSelectionGrouped || (isSelectable == null ? void 0 : isSelectable.bind($$.api)(closest)))) {
|
|
28159
29474
|
context.style.cursor = "pointer";
|
|
28160
29475
|
}
|
|
28161
29476
|
} else if (config.interaction_onout) {
|
|
28162
|
-
(
|
|
29477
|
+
(_f = $$.hideGridFocus) == null ? void 0 : _f.call($$);
|
|
29478
|
+
(_g = $$.hideSubchartGridFocus) == null ? void 0 : _g.call($$);
|
|
28163
29479
|
$$.hideTooltip();
|
|
28164
29480
|
!isSelectionGrouped && $$.setExpand(index);
|
|
28165
29481
|
}
|
|
@@ -28172,7 +29488,7 @@ var __pow = Math.pow;
|
|
|
28172
29488
|
* @private
|
|
28173
29489
|
*/
|
|
28174
29490
|
selectRectForMultipleXs(context, triggerEvent = true) {
|
|
28175
|
-
var _a;
|
|
29491
|
+
var _a, _b;
|
|
28176
29492
|
const $$ = this;
|
|
28177
29493
|
const { config, state } = $$;
|
|
28178
29494
|
const targetsToShow = $$.getTargetsToShow();
|
|
@@ -28194,6 +29510,7 @@ var __pow = Math.pow;
|
|
|
28194
29510
|
$$.showTooltip(selectedData, context);
|
|
28195
29511
|
$$.setExpand(closest.index, closest.id, true);
|
|
28196
29512
|
(_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
|
|
29513
|
+
(_b = $$.showSubchartGridFocus) == null ? void 0 : _b.call($$, selectedData);
|
|
28197
29514
|
const dist = $$.dist(closest, mouse);
|
|
28198
29515
|
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
28199
29516
|
$$.$el.eventRect.style("cursor", "pointer");
|
|
@@ -28208,7 +29525,7 @@ var __pow = Math.pow;
|
|
|
28208
29525
|
* @private
|
|
28209
29526
|
*/
|
|
28210
29527
|
unselectRect() {
|
|
28211
|
-
var _a, _b, _c;
|
|
29528
|
+
var _a, _b, _c, _d;
|
|
28212
29529
|
const $$ = this;
|
|
28213
29530
|
const { state, $el: { circle, tooltip } } = $$;
|
|
28214
29531
|
state._lastTooltipMouse = null;
|
|
@@ -28219,6 +29536,7 @@ var __pow = Math.pow;
|
|
|
28219
29536
|
}
|
|
28220
29537
|
(_b = $$.$el.eventRect) == null ? void 0 : _b.style("cursor", null);
|
|
28221
29538
|
(_c = $$.hideGridFocus) == null ? void 0 : _c.call($$);
|
|
29539
|
+
(_d = $$.hideSubchartGridFocus) == null ? void 0 : _d.call($$);
|
|
28222
29540
|
if (tooltip) {
|
|
28223
29541
|
$$.hideTooltip();
|
|
28224
29542
|
$$._handleLinkedCharts(false);
|
|
@@ -28256,6 +29574,7 @@ var __pow = Math.pow;
|
|
|
28256
29574
|
$$.updateEventRect();
|
|
28257
29575
|
Object.values($$.$el.axisTooltip).forEach((v) => v == null ? void 0 : v.style("display", null));
|
|
28258
29576
|
}).on("mousemove", function(event) {
|
|
29577
|
+
var _a;
|
|
28259
29578
|
const d = getData(event);
|
|
28260
29579
|
state.event = event;
|
|
28261
29580
|
if (!d) {
|
|
@@ -28273,7 +29592,7 @@ var __pow = Math.pow;
|
|
|
28273
29592
|
index += 1;
|
|
28274
29593
|
}
|
|
28275
29594
|
}
|
|
28276
|
-
$$.showAxisGridFocus();
|
|
29595
|
+
(_a = $$.showAxisGridFocus) == null ? void 0 : _a.call($$);
|
|
28277
29596
|
const eventOnSameIdx = config.tooltip_grouped && index === eventReceiver.currentIdx;
|
|
28278
29597
|
if (state.dragging || state.flowing || $$.hasArcType() || eventOnSameIdx) {
|
|
28279
29598
|
if (config.tooltip_show && eventOnSameIdx) {
|
|
@@ -28293,11 +29612,12 @@ var __pow = Math.pow;
|
|
|
28293
29612
|
index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, index);
|
|
28294
29613
|
$$.setOverOut(index !== -1, index);
|
|
28295
29614
|
}).on("mouseout", (event) => {
|
|
29615
|
+
var _a;
|
|
28296
29616
|
state.event = event;
|
|
28297
29617
|
if (!$$.config || $$.hasArcType() || eventReceiver.currentIdx === -1 || !config.interaction_onout) {
|
|
28298
29618
|
return;
|
|
28299
29619
|
}
|
|
28300
|
-
$$.hideAxisGridFocus();
|
|
29620
|
+
(_a = $$.hideAxisGridFocus) == null ? void 0 : _a.call($$);
|
|
28301
29621
|
$$.unselectRect();
|
|
28302
29622
|
$$.setOverOut(false, eventReceiver.currentIdx);
|
|
28303
29623
|
eventReceiver.currentIdx = -1;
|
|
@@ -29851,6 +31171,18 @@ var __pow = Math.pow;
|
|
|
29851
31171
|
|
|
29852
31172
|
;// ./src/config/Options/axis/y2.ts
|
|
29853
31173
|
/* harmony default export */ var y2 = ({
|
|
31174
|
+
/**
|
|
31175
|
+
* Set clip-path attribute for y2 axis element
|
|
31176
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
31177
|
+
* @name axis․y2․clipPath
|
|
31178
|
+
* @memberof Options
|
|
31179
|
+
* @type {boolean}
|
|
31180
|
+
* @default true
|
|
31181
|
+
* @example
|
|
31182
|
+
* // don't set 'clip-path' attribute
|
|
31183
|
+
* clipPath: false
|
|
31184
|
+
*/
|
|
31185
|
+
axis_y2_clipPath: true,
|
|
29854
31186
|
/**
|
|
29855
31187
|
* Show or hide y2 axis.
|
|
29856
31188
|
* - **NOTE**:
|
|
@@ -30781,28 +32113,51 @@ function _getConnectLineType(id) {
|
|
|
30781
32113
|
const { bar } = isSub ? $$.$el.subchart : $$.$el;
|
|
30782
32114
|
const barPath = [];
|
|
30783
32115
|
const connectLineCache = /* @__PURE__ */ new Map();
|
|
30784
|
-
|
|
30785
|
-
|
|
30786
|
-
|
|
30787
|
-
|
|
30788
|
-
|
|
30789
|
-
|
|
30790
|
-
|
|
30791
|
-
|
|
30792
|
-
|
|
30793
|
-
|
|
30794
|
-
|
|
30795
|
-
|
|
30796
|
-
|
|
30797
|
-
|
|
30798
|
-
|
|
30799
|
-
|
|
30800
|
-
)
|
|
30801
|
-
|
|
30802
|
-
|
|
32116
|
+
const getRadius = getBarRadiusResolver($$);
|
|
32117
|
+
const barColor = $$.generateUpdateBarColor();
|
|
32118
|
+
const getBarPath = function(d, i, arr) {
|
|
32119
|
+
var _a;
|
|
32120
|
+
const isDrawable = isNumber(d.value) || $$.isBarRangeType(d) || ((_a = $$.isSubchartCandlestickBarValue) == null ? void 0 : _a.call($$, d, isSub));
|
|
32121
|
+
const path = isDrawable ? drawFn(d, i) : [""];
|
|
32122
|
+
let connectLineType = connectLineCache.get(d.id);
|
|
32123
|
+
if (connectLineType === void 0) {
|
|
32124
|
+
connectLineType = _getConnectLineType.call($$, d.id);
|
|
32125
|
+
connectLineCache.set(d.id, connectLineType);
|
|
32126
|
+
}
|
|
32127
|
+
if (path.length > 1) {
|
|
32128
|
+
barPath.push(path[1]);
|
|
32129
|
+
}
|
|
32130
|
+
if (i === arr.length - 1 && barPath.length) {
|
|
32131
|
+
const barConnectLineNode = $$.$T(
|
|
32132
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(
|
|
32133
|
+
this.parentNode.querySelector(`.${$BAR.barConnectLine}`)
|
|
32134
|
+
),
|
|
32135
|
+
withTransition,
|
|
32136
|
+
getRandom()
|
|
32137
|
+
);
|
|
32138
|
+
$$.updateConnectLine(barConnectLineNode, connectLineType, barPath);
|
|
32139
|
+
barPath.splice(0);
|
|
32140
|
+
}
|
|
32141
|
+
return path[0];
|
|
32142
|
+
};
|
|
32143
|
+
const barTransition = $$.$T(bar, withTransition, getRandom());
|
|
32144
|
+
if (getRadius && typeof barTransition.attrTween === "function") {
|
|
32145
|
+
barTransition.attrTween(
|
|
32146
|
+
"d",
|
|
32147
|
+
function(d, i, arr) {
|
|
32148
|
+
var _a;
|
|
32149
|
+
const target = getBarPath.call(this, d, i, arr);
|
|
32150
|
+
return getBarPathInterpolator((_a = this.getAttribute("d")) != null ? _a : "", target);
|
|
30803
32151
|
}
|
|
30804
|
-
|
|
30805
|
-
|
|
32152
|
+
);
|
|
32153
|
+
} else {
|
|
32154
|
+
barTransition.attr("d", getBarPath);
|
|
32155
|
+
}
|
|
32156
|
+
return [
|
|
32157
|
+
barTransition.style("fill", (d) => {
|
|
32158
|
+
var _a;
|
|
32159
|
+
return ((_a = $$.getSubchartCandlestickBarColor) == null ? void 0 : _a.call($$, d, isSub)) || barColor(d);
|
|
32160
|
+
}).style("clip-path", (d) => d.clipPath).style("opacity", null)
|
|
30806
32161
|
];
|
|
30807
32162
|
},
|
|
30808
32163
|
/**
|
|
@@ -31236,7 +32591,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
31236
32591
|
const shapeOffset = $$.getShapeOffset($$.isCandlestickType, indices, !!isSub);
|
|
31237
32592
|
const yScale = $$.getYScaleById.bind($$);
|
|
31238
32593
|
return (d, i) => {
|
|
31239
|
-
const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
|
|
32594
|
+
const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
|
|
31240
32595
|
const offset = shapeOffset(d, i) || y0;
|
|
31241
32596
|
const width = isNumber(barW) ? barW : barW[d.id] || barW._$width;
|
|
31242
32597
|
const value = $$.getCandlestickData(d);
|
|
@@ -31817,7 +33172,7 @@ let candlestick_candlestick = () => (extendAxis(
|
|
|
31817
33172
|
});
|
|
31818
33173
|
|
|
31819
33174
|
// EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"}
|
|
31820
|
-
var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(
|
|
33175
|
+
var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(10);
|
|
31821
33176
|
;// ./src/ChartInternal/internals/text.arc.ts
|
|
31822
33177
|
|
|
31823
33178
|
|
|
@@ -32925,7 +34280,6 @@ var funnel_spreadValues = (a, b) => {
|
|
|
32925
34280
|
|
|
32926
34281
|
|
|
32927
34282
|
|
|
32928
|
-
|
|
32929
34283
|
function _getSize(checkNeck = false) {
|
|
32930
34284
|
const $$ = this;
|
|
32931
34285
|
const { config, state: { current: { width, height } } } = $$;
|
|
@@ -33158,7 +34512,7 @@ function _getSplineClipPath() {
|
|
|
33158
34512
|
},
|
|
33159
34513
|
/**
|
|
33160
34514
|
* Generate funnel coordinate points data for text labels
|
|
33161
|
-
* @returns {(
|
|
34515
|
+
* @returns {function(IDataRow): Array.<Array.<number>>} Point getter function
|
|
33162
34516
|
* @private
|
|
33163
34517
|
*/
|
|
33164
34518
|
generateGetFunnelPoints() {
|
|
@@ -33374,7 +34728,7 @@ let funnel_funnel = () => (extendArc([funnel], [shape_funnel]), (funnel_funnel =
|
|
|
33374
34728
|
* @property {number} [gauge.expand.rate=0.98] Set expand rate.
|
|
33375
34729
|
* @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
|
|
33376
34730
|
* @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
|
|
33377
|
-
* - **Note:**
|
|
34731
|
+
* - **Note:** Applies only to unstacked/multi-arc gauges; stacked gauge data is not supported.
|
|
33378
34732
|
* - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
|
|
33379
34733
|
* - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
|
|
33380
34734
|
* @property {number} [gauge.min=0] Set min value of the gauge.
|
|
@@ -34404,7 +35758,7 @@ let scatter_scatter = () => (extendAxis(
|
|
|
34404
35758
|
), (scatter_scatter = () => TYPE.SCATTER)());
|
|
34405
35759
|
|
|
34406
35760
|
// EXTERNAL MODULE: external {"commonjs":"d3-hierarchy","commonjs2":"d3-hierarchy","amd":"d3-hierarchy","root":"d3"}
|
|
34407
|
-
var external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_ = __webpack_require__(
|
|
35761
|
+
var external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_ = __webpack_require__(11);
|
|
34408
35762
|
;// ./src/ChartInternal/shape/core/treemap.ts
|
|
34409
35763
|
|
|
34410
35764
|
function convertDataToTreemapData(data) {
|
|
@@ -34678,7 +36032,7 @@ ${percentValue}%`;
|
|
|
34678
36032
|
* - dice ([d3.treemapDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapDice))
|
|
34679
36033
|
* - slice ([d3.treemapSlice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSlice))
|
|
34680
36034
|
* - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
|
|
34681
|
-
* -
|
|
36035
|
+
* - squarify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
|
|
34682
36036
|
* - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
|
|
34683
36037
|
* @property {function} [treemap.label.format] Set formatter for the label text.<br>
|
|
34684
36038
|
* - **Arguments:**
|
|
@@ -34691,7 +36045,7 @@ ${percentValue}%`;
|
|
|
34691
36045
|
* @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
|
|
34692
36046
|
* @example
|
|
34693
36047
|
* treemap: {
|
|
34694
|
-
* // "binary", "dice", "slice", "sliceDice", "
|
|
36048
|
+
* // "binary", "dice", "slice", "sliceDice", "squarify", "resquarify"
|
|
34695
36049
|
* tile: "dice",
|
|
34696
36050
|
*
|
|
34697
36051
|
* label: {
|
|
@@ -34772,7 +36126,7 @@ const bb = {
|
|
|
34772
36126
|
* bb.version; // "1.0.0"
|
|
34773
36127
|
* @memberof bb
|
|
34774
36128
|
*/
|
|
34775
|
-
version: "4.0.
|
|
36129
|
+
version: "4.1.0-next.2",
|
|
34776
36130
|
/**
|
|
34777
36131
|
* Generate chart
|
|
34778
36132
|
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|