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