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.pkgd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.1
|
|
9
9
|
*
|
|
10
10
|
* All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
|
|
11
11
|
* - @types/d3-selection ^3.0.11
|
|
@@ -27088,7 +27088,7 @@ function getScale(type = "linear", min, max) {
|
|
|
27088
27088
|
* @private
|
|
27089
27089
|
*/
|
|
27090
27090
|
updateScales(isInit, updateXDomain = true) {
|
|
27091
|
-
var _a, _b, _c, _d, _e, _f;
|
|
27091
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
27092
27092
|
const $$ = this;
|
|
27093
27093
|
const {
|
|
27094
27094
|
axis,
|
|
@@ -27124,7 +27124,12 @@ function getScale(type = "linear", min, max) {
|
|
|
27124
27124
|
format.subXAxisTick = axis.getXAxisTickFormat(true);
|
|
27125
27125
|
axis.setAxis("x", scale.x, config.axis_x_tick_outer, isInit);
|
|
27126
27126
|
if (config.subchart_show) {
|
|
27127
|
-
axis.setAxis(
|
|
27127
|
+
axis.setAxis(
|
|
27128
|
+
"subX",
|
|
27129
|
+
scale.subX,
|
|
27130
|
+
(_f = config.subchart_axis_x_tick_outer) != null ? _f : config.axis_x_tick_outer,
|
|
27131
|
+
isInit
|
|
27132
|
+
);
|
|
27128
27133
|
}
|
|
27129
27134
|
scale.y = $$.getYScale(
|
|
27130
27135
|
"y",
|
|
@@ -27141,7 +27146,13 @@ function getScale(type = "linear", min, max) {
|
|
|
27141
27146
|
scale.subY
|
|
27142
27147
|
);
|
|
27143
27148
|
axis.setAxis("y", scale.y, config.axis_y_tick_outer, isInit);
|
|
27144
|
-
|
|
27149
|
+
config.subchart_show && config.subchart_axis_y_show && axis.setAxis(
|
|
27150
|
+
"subY",
|
|
27151
|
+
scale.subY,
|
|
27152
|
+
(_g = config.subchart_axis_y_tick_outer) != null ? _g : config.axis_y_tick_outer,
|
|
27153
|
+
isInit
|
|
27154
|
+
);
|
|
27155
|
+
if (config.axis_y2_show || config.subchart_axis_y2_show) {
|
|
27145
27156
|
scale.y2 = $$.getYScale(
|
|
27146
27157
|
"y2",
|
|
27147
27158
|
min.y,
|
|
@@ -27157,13 +27168,19 @@ function getScale(type = "linear", min, max) {
|
|
|
27157
27168
|
scale.subY2
|
|
27158
27169
|
);
|
|
27159
27170
|
axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit);
|
|
27171
|
+
config.subchart_show && config.subchart_axis_y2_show && axis.setAxis(
|
|
27172
|
+
"subY2",
|
|
27173
|
+
scale.subY2,
|
|
27174
|
+
(_h = config.subchart_axis_y2_tick_outer) != null ? _h : config.axis_y2_tick_outer,
|
|
27175
|
+
isInit
|
|
27176
|
+
);
|
|
27160
27177
|
}
|
|
27161
27178
|
} else if (hasTreemap) {
|
|
27162
27179
|
const padding = $$.getCurrentPadding();
|
|
27163
27180
|
scale.x = linear_linear().rangeRound([padding.left, current.width - padding.right]);
|
|
27164
27181
|
scale.y = linear_linear().rangeRound([padding.top, current.height - padding.bottom]);
|
|
27165
27182
|
} else {
|
|
27166
|
-
(
|
|
27183
|
+
(_i = $$.updateArc) == null ? void 0 : _i.call($$);
|
|
27167
27184
|
}
|
|
27168
27185
|
},
|
|
27169
27186
|
/**
|
|
@@ -27372,6 +27389,10 @@ function markCanvasPointOccupancy(grid, x, y) {
|
|
|
27372
27389
|
|
|
27373
27390
|
|
|
27374
27391
|
|
|
27392
|
+
function getAxisTickOption(config, id, key, prefix = `axis_${id}`) {
|
|
27393
|
+
const value = config[`${prefix}_tick_${key}`];
|
|
27394
|
+
return value !== void 0 ? value : config[`axis_${id}_tick_${key}`];
|
|
27395
|
+
}
|
|
27375
27396
|
function getOptionTickValues(values, api) {
|
|
27376
27397
|
const resolved = typeof values === "function" ? values.call(api) : values;
|
|
27377
27398
|
return (resolved == null ? void 0 : resolved.length) ? resolved : void 0;
|
|
@@ -27664,52 +27685,59 @@ function getXTickValues($$, cull = true) {
|
|
|
27664
27685
|
function getSubXTickCullMax($$) {
|
|
27665
27686
|
const { config, state: { height2, width2 } } = $$;
|
|
27666
27687
|
const size = config.axis_rotated ? height2 : width2;
|
|
27667
|
-
|
|
27668
|
-
|
|
27688
|
+
const count = getAxisTickOption(config, "x", "count", "subchart_axis_x");
|
|
27689
|
+
const culling = getAxisTickOption(config, "x", "culling", "subchart_axis_x");
|
|
27690
|
+
const cullingMax = getAxisTickOption(config, "x", "culling_max", "subchart_axis_x");
|
|
27691
|
+
if (count) {
|
|
27692
|
+
return count;
|
|
27669
27693
|
}
|
|
27670
|
-
if (
|
|
27694
|
+
if (culling !== false) {
|
|
27671
27695
|
return Math.min(
|
|
27672
|
-
|
|
27696
|
+
cullingMax || AXIS_DEFAULT_TICK_COUNT,
|
|
27673
27697
|
Math.max(2, Math.floor(size / 70))
|
|
27674
27698
|
);
|
|
27675
27699
|
}
|
|
27676
27700
|
return void 0;
|
|
27677
27701
|
}
|
|
27678
|
-
function getSubXTickValues(
|
|
27702
|
+
function getSubXTickValues($$, culling = true) {
|
|
27679
27703
|
var _a, _b, _c, _d;
|
|
27680
27704
|
const { axis, config, scale } = $$;
|
|
27681
27705
|
const targetScale = scale.subX;
|
|
27682
27706
|
const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow();
|
|
27707
|
+
const tickCount = getAxisTickOption(config, "x", "count", "subchart_axis_x");
|
|
27683
27708
|
const cullMax = getSubXTickCullMax($$);
|
|
27684
|
-
const
|
|
27709
|
+
const cullData = (ticks, sorted = false) => culling ? cullDataTicks($$, ticks, sorted, "subchart_axis_x", cullMax) : ticks;
|
|
27685
27710
|
if (!targetScale || !(targetsToShow == null ? void 0 : targetsToShow.length)) {
|
|
27686
27711
|
return [];
|
|
27687
27712
|
}
|
|
27688
|
-
const explicit = getOptionTickValues(
|
|
27713
|
+
const explicit = getOptionTickValues(
|
|
27714
|
+
getAxisTickOption(config, "x", "values", "subchart_axis_x"),
|
|
27715
|
+
$$.api
|
|
27716
|
+
);
|
|
27689
27717
|
if (explicit) {
|
|
27690
|
-
return
|
|
27718
|
+
return cullData(normalizeXTickValues($$, explicit));
|
|
27691
27719
|
}
|
|
27692
27720
|
if (config.axis_x_tick_fit && $$.mapTargetsToUniqueXs) {
|
|
27693
27721
|
const generated2 = generateTickValues(
|
|
27694
27722
|
$$,
|
|
27695
27723
|
$$.mapTargetsToUniqueXs(targetsToShow),
|
|
27696
|
-
|
|
27724
|
+
tickCount,
|
|
27697
27725
|
(_b = axis == null ? void 0 : axis.isTimeSeries) == null ? void 0 : _b.call(axis)
|
|
27698
27726
|
);
|
|
27699
|
-
return
|
|
27727
|
+
return cullData(generated2, true);
|
|
27700
27728
|
}
|
|
27701
27729
|
if (((_c = axis == null ? void 0 : axis.isCategorized) == null ? void 0 : _c.call(axis)) && ((_d = config.axis_x_categories) == null ? void 0 : _d.length)) {
|
|
27702
|
-
return
|
|
27730
|
+
return cullData(config.axis_x_categories.map((_, i) => i), true);
|
|
27703
27731
|
}
|
|
27704
27732
|
const generated = getScaleTicks(
|
|
27705
27733
|
targetScale,
|
|
27706
|
-
|
|
27734
|
+
tickCount || AXIS_DEFAULT_TICK_COUNT
|
|
27707
27735
|
);
|
|
27708
|
-
return
|
|
27736
|
+
return cullData(generated, true);
|
|
27709
27737
|
}
|
|
27710
|
-
function getCategoryXTickLineValues($$) {
|
|
27738
|
+
function getCategoryXTickLineValues($$, targetScale = getXScale($$), outerTick = $$.config.axis_x_tick_outer) {
|
|
27711
27739
|
var _a, _b;
|
|
27712
|
-
const scale =
|
|
27740
|
+
const scale = targetScale;
|
|
27713
27741
|
const domain = ((_a = scale.orgDomain) == null ? void 0 : _a.call(scale)) || ((_b = scale.domain) == null ? void 0 : _b.call(scale));
|
|
27714
27742
|
if (!(domain == null ? void 0 : domain.length)) {
|
|
27715
27743
|
return [];
|
|
@@ -27722,7 +27750,7 @@ function getCategoryXTickLineValues($$) {
|
|
|
27722
27750
|
const min = Math.ceil(Math.min(start, end));
|
|
27723
27751
|
const max = Math.floor(Math.max(start, end));
|
|
27724
27752
|
const values = Array.from({ length: Math.max(0, max - min + 1) }, (_, i) => min + i);
|
|
27725
|
-
return
|
|
27753
|
+
return outerTick ? values.slice(1, -1) : values;
|
|
27726
27754
|
}
|
|
27727
27755
|
function getXTickLinePosition($$, value, targetScale = getXScale($$)) {
|
|
27728
27756
|
var _a, _b, _c, _d, _e;
|
|
@@ -27738,12 +27766,12 @@ function getXTickLinePosition($$, value, targetScale = getXScale($$)) {
|
|
|
27738
27766
|
}
|
|
27739
27767
|
return scale(normalized);
|
|
27740
27768
|
}
|
|
27741
|
-
function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth) {
|
|
27769
|
+
function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth, targetScale = getXScale($$)) {
|
|
27742
27770
|
if (ticks.length < 2) {
|
|
27743
27771
|
return false;
|
|
27744
27772
|
}
|
|
27745
27773
|
const halfWidth = Math.max(1, tickLineWidth) / 2;
|
|
27746
|
-
const positions = ticks.map((tick) => getXTickLinePosition($$, tick)).filter(Number.isFinite).sort((a, b) => a - b);
|
|
27774
|
+
const positions = ticks.map((tick) => getXTickLinePosition($$, tick, targetScale)).filter(Number.isFinite).sort((a, b) => a - b);
|
|
27747
27775
|
if (positions.length < 2) {
|
|
27748
27776
|
return false;
|
|
27749
27777
|
}
|
|
@@ -27758,10 +27786,10 @@ function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth) {
|
|
|
27758
27786
|
}
|
|
27759
27787
|
return false;
|
|
27760
27788
|
}
|
|
27761
|
-
function dedupeXTickLineValues($$, ticks) {
|
|
27789
|
+
function dedupeXTickLineValues($$, ticks, targetScale = getXScale($$)) {
|
|
27762
27790
|
const seen = /* @__PURE__ */ new Set();
|
|
27763
27791
|
return ticks.filter((tick) => {
|
|
27764
|
-
const pos = getXTickLinePosition($$, tick);
|
|
27792
|
+
const pos = getXTickLinePosition($$, tick, targetScale);
|
|
27765
27793
|
const key = Math.round(pos);
|
|
27766
27794
|
if (!Number.isFinite(pos) || seen.has(key)) {
|
|
27767
27795
|
return false;
|
|
@@ -27783,13 +27811,35 @@ function getXTickLineValues($$, textTicks, tickLineWidth = 1) {
|
|
|
27783
27811
|
const lineTicks = getXTickValues($$, false);
|
|
27784
27812
|
return hasOverlappedXTickLineIntervals($$, lineTicks, tickLineWidth) ? textTicks : dedupeXTickLineValues($$, lineTicks);
|
|
27785
27813
|
}
|
|
27786
|
-
function
|
|
27787
|
-
var _a
|
|
27814
|
+
function getSubXTickLineValues($$, textTicks, tickLineWidth = 1) {
|
|
27815
|
+
var _a;
|
|
27788
27816
|
const { axis, config, scale } = $$;
|
|
27817
|
+
const targetScale = scale.subX;
|
|
27818
|
+
const culling = getAxisTickOption(config, "x", "culling", "subchart_axis_x");
|
|
27819
|
+
const cullingLines = getAxisTickOption(config, "x", "culling_lines", "subchart_axis_x");
|
|
27820
|
+
const outerTick = getAxisTickOption(config, "x", "outer", "subchart_axis_x");
|
|
27821
|
+
if (!targetScale) {
|
|
27822
|
+
return [];
|
|
27823
|
+
}
|
|
27824
|
+
if ((_a = axis == null ? void 0 : axis.isCategorized) == null ? void 0 : _a.call(axis)) {
|
|
27825
|
+
const categoryLineTicks = getCategoryXTickLineValues($$, targetScale, outerTick);
|
|
27826
|
+
return dedupeXTickLineValues($$, categoryLineTicks, targetScale);
|
|
27827
|
+
}
|
|
27828
|
+
if (culling === false || cullingLines === false) {
|
|
27829
|
+
return textTicks;
|
|
27830
|
+
}
|
|
27831
|
+
const lineTicks = getSubXTickValues($$, false);
|
|
27832
|
+
return hasOverlappedXTickLineIntervals($$, lineTicks, tickLineWidth, targetScale) ? textTicks : dedupeXTickLineValues($$, lineTicks, targetScale);
|
|
27833
|
+
}
|
|
27834
|
+
function getYTickValues($$, id = "y", count, culling = true, targetScale = $$.scale[id], optionPrefix = `axis_${id}`) {
|
|
27835
|
+
var _a, _b, _c;
|
|
27836
|
+
const { axis, config } = $$;
|
|
27789
27837
|
const prefix = `axis_${id}`;
|
|
27790
|
-
const
|
|
27791
|
-
|
|
27792
|
-
|
|
27838
|
+
const explicit = getOptionTickValues(
|
|
27839
|
+
getAxisTickOption(config, id, "values", optionPrefix),
|
|
27840
|
+
$$.api
|
|
27841
|
+
);
|
|
27842
|
+
const maybeCull = (ticks) => culling ? cullAxisTicks($$, id, ticks, optionPrefix) : ticks;
|
|
27793
27843
|
if (explicit) {
|
|
27794
27844
|
return maybeCull(normalizeYTickValues($$, explicit, id));
|
|
27795
27845
|
}
|
|
@@ -27797,7 +27847,7 @@ function getYTickValues($$, id = "y", count, culling = true) {
|
|
|
27797
27847
|
if (stepTicks.length) {
|
|
27798
27848
|
return maybeCull(stepTicks);
|
|
27799
27849
|
}
|
|
27800
|
-
const tickCount = count != null ? count : config
|
|
27850
|
+
const tickCount = count != null ? count : getAxisTickOption(config, id, "count", optionPrefix);
|
|
27801
27851
|
if (((_a = axis == null ? void 0 : axis.isTimeSeries) == null ? void 0 : _a.call(axis, id)) && config[`${prefix}_tick_time_value`]) {
|
|
27802
27852
|
return maybeCull(getScaleTicks(targetScale, config[`${prefix}_tick_time_value`]));
|
|
27803
27853
|
}
|
|
@@ -27851,20 +27901,21 @@ function cullTicks(ticks, count) {
|
|
|
27851
27901
|
}
|
|
27852
27902
|
return ticks;
|
|
27853
27903
|
}
|
|
27854
|
-
function cullAxisTicks($$, id, ticks) {
|
|
27904
|
+
function cullAxisTicks($$, id, ticks, optionPrefix = `axis_${id}`) {
|
|
27855
27905
|
const { config } = $$;
|
|
27856
|
-
const
|
|
27857
|
-
if (!
|
|
27906
|
+
const culling = getAxisTickOption(config, id, "culling", optionPrefix);
|
|
27907
|
+
if (!culling) {
|
|
27858
27908
|
return ticks;
|
|
27859
27909
|
}
|
|
27910
|
+
const cullingMax = getAxisTickOption(config, id, "culling_max", optionPrefix) || AXIS_DEFAULT_TICK_COUNT;
|
|
27911
|
+
const reverse = getAxisTickOption(config, id, "culling_reverse", optionPrefix);
|
|
27860
27912
|
const sortedTicks = ticks.slice().sort((a, b) => {
|
|
27861
27913
|
const av = +a;
|
|
27862
27914
|
const bv = +b;
|
|
27863
27915
|
const order = Number.isFinite(av) && Number.isFinite(bv) ? av - bv : String(a).localeCompare(String(b));
|
|
27864
|
-
return
|
|
27916
|
+
return reverse ? -order : order;
|
|
27865
27917
|
});
|
|
27866
27918
|
const tickSize = sortedTicks.length;
|
|
27867
|
-
const cullingMax = config[`${prefix}_max`] || AXIS_DEFAULT_TICK_COUNT;
|
|
27868
27919
|
let intervalForCulling = 0;
|
|
27869
27920
|
for (let i = 1; i < tickSize; i++) {
|
|
27870
27921
|
if (tickSize / i < cullingMax) {
|
|
@@ -27880,19 +27931,21 @@ function cullAxisTicks($$, id, ticks) {
|
|
|
27880
27931
|
);
|
|
27881
27932
|
return ticks.filter((tick) => visible.has(tick));
|
|
27882
27933
|
}
|
|
27883
|
-
function cullDataTicks($$, ticks, sorted = false) {
|
|
27934
|
+
function cullDataTicks($$, ticks, sorted = false, optionPrefix = "axis_x", max) {
|
|
27884
27935
|
const { config } = $$;
|
|
27885
|
-
|
|
27936
|
+
const culling = getAxisTickOption(config, "x", "culling", optionPrefix);
|
|
27937
|
+
if (culling === false) {
|
|
27886
27938
|
return ticks;
|
|
27887
27939
|
}
|
|
27888
|
-
const cullingMax = config
|
|
27940
|
+
const cullingMax = max || getAxisTickOption(config, "x", "culling_max", optionPrefix) || AXIS_DEFAULT_TICK_COUNT;
|
|
27941
|
+
const reverse = getAxisTickOption(config, "x", "culling_reverse", optionPrefix);
|
|
27889
27942
|
const sortedTicks = sorted ? ticks : ticks.slice().sort((a, b) => {
|
|
27890
27943
|
const av = +a;
|
|
27891
27944
|
const bv = +b;
|
|
27892
27945
|
if (Number.isFinite(av) && Number.isFinite(bv)) {
|
|
27893
|
-
return
|
|
27946
|
+
return reverse ? bv - av : av - bv;
|
|
27894
27947
|
}
|
|
27895
|
-
return
|
|
27948
|
+
return reverse ? String(b).localeCompare(String(a)) : String(a).localeCompare(String(b));
|
|
27896
27949
|
});
|
|
27897
27950
|
const tickSize = sortedTicks.length;
|
|
27898
27951
|
let intervalForCulling = 0;
|
|
@@ -27907,7 +27960,7 @@ function cullDataTicks($$, ticks, sorted = false) {
|
|
|
27907
27960
|
}
|
|
27908
27961
|
if (sorted) {
|
|
27909
27962
|
return ticks.filter(
|
|
27910
|
-
(_, i) =>
|
|
27963
|
+
(_, i) => reverse ? (tickSize - 1 - i) % intervalForCulling === 0 : i % intervalForCulling === 0
|
|
27911
27964
|
);
|
|
27912
27965
|
}
|
|
27913
27966
|
const visible = new Set(
|
|
@@ -28369,6 +28422,29 @@ function getXTickTextDirection(isRotated) {
|
|
|
28369
28422
|
function getYTickTextDirection(isRotated, isY2) {
|
|
28370
28423
|
return isRotated ? isY2 ? -1 : 1 : isY2 ? 1 : -1;
|
|
28371
28424
|
}
|
|
28425
|
+
function getSubYTickFormat($$, id) {
|
|
28426
|
+
var _a, _b, _c;
|
|
28427
|
+
const subAxisId = id === "y2" ? "subY2" : "subY";
|
|
28428
|
+
const axisFormat = (_c = (_b = (_a = $$.axis) == null ? void 0 : _a[subAxisId]) == null ? void 0 : _b.tickFormat) == null ? void 0 : _c.call(_b);
|
|
28429
|
+
const configFormat = $$.config[`subchart_axis_${id}_tick_format`] || $$.config[`axis_${id}_tick_format`];
|
|
28430
|
+
if (axisFormat) {
|
|
28431
|
+
return axisFormat;
|
|
28432
|
+
}
|
|
28433
|
+
return typeof configFormat === "function" ? configFormat.bind($$.api) : ((v) => v);
|
|
28434
|
+
}
|
|
28435
|
+
function getGridLineCanvasStyle(style) {
|
|
28436
|
+
return style ? {
|
|
28437
|
+
stroke: style.lineColor,
|
|
28438
|
+
lineWidth: style.lineWidth,
|
|
28439
|
+
lineDash: style.dashArray
|
|
28440
|
+
} : void 0;
|
|
28441
|
+
}
|
|
28442
|
+
function getGridTextCanvasStyle(style) {
|
|
28443
|
+
return style ? {
|
|
28444
|
+
fill: style.labelColor,
|
|
28445
|
+
font: style.labelFont
|
|
28446
|
+
} : void 0;
|
|
28447
|
+
}
|
|
28372
28448
|
function getHorizontalXAxisClipRect(margin, width, height) {
|
|
28373
28449
|
return {
|
|
28374
28450
|
x: margin.left - X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING,
|
|
@@ -28693,7 +28769,7 @@ class CanvasAxisRenderer {
|
|
|
28693
28769
|
* @private
|
|
28694
28770
|
*/
|
|
28695
28771
|
drawSubXAxis($$) {
|
|
28696
|
-
var _a, _b, _c;
|
|
28772
|
+
var _a, _b, _c, _d;
|
|
28697
28773
|
const { ctx, painter, theme: { style: { axis } } } = this;
|
|
28698
28774
|
const {
|
|
28699
28775
|
config,
|
|
@@ -28714,12 +28790,14 @@ class CanvasAxisRenderer {
|
|
|
28714
28790
|
const rangeStart = isRotated ? y1 : x1;
|
|
28715
28791
|
const rangeEnd = isRotated ? y2 : x2;
|
|
28716
28792
|
const ticks = getSubXTickValues($$);
|
|
28793
|
+
const lineTicks = getSubXTickLineValues($$, ticks, axis.tickWidth);
|
|
28794
|
+
const outerTick = (_a = config.subchart_axis_x_tick_outer) != null ? _a : config.axis_x_tick_outer;
|
|
28717
28795
|
const tickDirection = isRotated ? config.axis_x_tick_inner ? 1 : -1 : config.axis_x_tick_inner ? -1 : 1;
|
|
28718
28796
|
const outerTickDirection = getXOuterTickDirection(isRotated);
|
|
28719
28797
|
const tickTextDirection = getXTickTextDirection(isRotated);
|
|
28720
28798
|
const tickTextPosition = config.axis_x_tick_text_position;
|
|
28721
|
-
const tickRotate = !isRotated ? ((
|
|
28722
|
-
const tickFormat = format.subXAxisTick || ((
|
|
28799
|
+
const tickRotate = !isRotated ? ((_b = $$.getAxisTickRotate) == null ? void 0 : _b.call($$, "x")) || 0 : 0;
|
|
28800
|
+
const tickFormat = format.subXAxisTick || ((_d = (_c = $$.axis) == null ? void 0 : _c.getXAxisTickFormat) == null ? void 0 : _d.call(_c, true));
|
|
28723
28801
|
painter.clipRect(
|
|
28724
28802
|
isRotated ? getRotatedXAxisClipRect(margin2, current.width, height2) : __spreadProps(CanvasAxisRenderer_spreadValues({}, getHorizontalXAxisClipRect(
|
|
28725
28803
|
margin2,
|
|
@@ -28729,15 +28807,17 @@ class CanvasAxisRenderer {
|
|
|
28729
28807
|
y: margin2.top
|
|
28730
28808
|
}),
|
|
28731
28809
|
() => {
|
|
28810
|
+
ctx.globalAlpha = 1;
|
|
28732
28811
|
ctx.strokeStyle = axis.lineColor;
|
|
28733
28812
|
ctx.lineWidth = axis.lineWidth;
|
|
28813
|
+
ctx.setLineDash([]);
|
|
28734
28814
|
painter.strokePath(() => {
|
|
28735
28815
|
if (isRotated) {
|
|
28736
28816
|
painter.traceLine(x, y1, x, y2);
|
|
28737
28817
|
} else {
|
|
28738
28818
|
painter.traceLine(x1, y, x2, y);
|
|
28739
28819
|
}
|
|
28740
|
-
if (
|
|
28820
|
+
if (outerTick) {
|
|
28741
28821
|
if (isRotated) {
|
|
28742
28822
|
painter.traceLine(x, y1, x + AXIS_TICK_SIZE * outerTickDirection, y1);
|
|
28743
28823
|
painter.traceLine(x, y2, x + AXIS_TICK_SIZE * outerTickDirection, y2);
|
|
@@ -28756,15 +28836,15 @@ class CanvasAxisRenderer {
|
|
|
28756
28836
|
ctx.lineWidth = axis.tickWidth;
|
|
28757
28837
|
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
28758
28838
|
const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, scale.subX);
|
|
28759
|
-
|
|
28760
|
-
const
|
|
28761
|
-
|
|
28762
|
-
|
|
28763
|
-
|
|
28764
|
-
|
|
28765
|
-
|
|
28766
|
-
|
|
28767
|
-
|
|
28839
|
+
if (config.subchart_axis_x_tick_show) {
|
|
28840
|
+
for (const tick of lineTicks) {
|
|
28841
|
+
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
28842
|
+
const tx = margin2.left + tickPos;
|
|
28843
|
+
const ty = margin2.top + tickPos;
|
|
28844
|
+
const pos = isRotated ? ty : tx;
|
|
28845
|
+
if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
|
|
28846
|
+
continue;
|
|
28847
|
+
}
|
|
28768
28848
|
painter.strokePath(() => {
|
|
28769
28849
|
if (isRotated) {
|
|
28770
28850
|
painter.traceLine(x, ty, x + AXIS_TICK_SIZE * tickDirection, ty);
|
|
@@ -28773,6 +28853,15 @@ class CanvasAxisRenderer {
|
|
|
28773
28853
|
}
|
|
28774
28854
|
});
|
|
28775
28855
|
}
|
|
28856
|
+
}
|
|
28857
|
+
for (const tick of ticks) {
|
|
28858
|
+
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
28859
|
+
const tx = margin2.left + tickPos;
|
|
28860
|
+
const ty = margin2.top + tickPos;
|
|
28861
|
+
const pos = isRotated ? ty : tx;
|
|
28862
|
+
if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
|
|
28863
|
+
continue;
|
|
28864
|
+
}
|
|
28776
28865
|
if (!config.subchart_axis_x_tick_text_show) {
|
|
28777
28866
|
continue;
|
|
28778
28867
|
}
|
|
@@ -28810,6 +28899,42 @@ class CanvasAxisRenderer {
|
|
|
28810
28899
|
}
|
|
28811
28900
|
);
|
|
28812
28901
|
}
|
|
28902
|
+
/**
|
|
28903
|
+
* Draw the canvas subchart y/y2 axes.
|
|
28904
|
+
* @param {object} $$ ChartInternal instance
|
|
28905
|
+
* @private
|
|
28906
|
+
*/
|
|
28907
|
+
drawSubYAxes($$) {
|
|
28908
|
+
const {
|
|
28909
|
+
config,
|
|
28910
|
+
scale,
|
|
28911
|
+
state: { margin2, width2, height2 }
|
|
28912
|
+
} = $$;
|
|
28913
|
+
if (!config.subchart_show || width2 <= 0 || height2 <= 0) {
|
|
28914
|
+
return;
|
|
28915
|
+
}
|
|
28916
|
+
["y", "y2"].forEach((id) => {
|
|
28917
|
+
var _a;
|
|
28918
|
+
const subScale = id === "y2" ? scale.subY2 : scale.subY;
|
|
28919
|
+
if (!config[`subchart_axis_${id}_show`] || !subScale) {
|
|
28920
|
+
return;
|
|
28921
|
+
}
|
|
28922
|
+
this.drawYAxis($$, id, {
|
|
28923
|
+
scale: subScale,
|
|
28924
|
+
ticks: getYTickValues($$, id, void 0, true, subScale, `subchart_axis_${id}`),
|
|
28925
|
+
format: getSubYTickFormat($$, id),
|
|
28926
|
+
index: 0,
|
|
28927
|
+
outerTick: (_a = config[`subchart_axis_${id}_tick_outer`]) != null ? _a : config[`axis_${id}_tick_outer`],
|
|
28928
|
+
margin: margin2,
|
|
28929
|
+
width: width2,
|
|
28930
|
+
height: height2,
|
|
28931
|
+
prefix: `subchart_axis_${id}`,
|
|
28932
|
+
tickShow: config[`subchart_axis_${id}_tick_show`],
|
|
28933
|
+
tickTextShow: config[`subchart_axis_${id}_tick_text_show`],
|
|
28934
|
+
tickTextPosition: config[`axis_${id}_tick_text_position`]
|
|
28935
|
+
});
|
|
28936
|
+
});
|
|
28937
|
+
}
|
|
28813
28938
|
/**
|
|
28814
28939
|
* Draw chart title.
|
|
28815
28940
|
* @param {object} $$ ChartInternal instance
|
|
@@ -29040,14 +29165,21 @@ class CanvasAxisRenderer {
|
|
|
29040
29165
|
ctx.fillStyle = grid.labelColor;
|
|
29041
29166
|
ctx.textBaseline = "middle";
|
|
29042
29167
|
ctx.setLineDash([]);
|
|
29043
|
-
const drawLabel = (text, x, y, rotated = false) => {
|
|
29168
|
+
const drawLabel = (text, x, y, rotated = false, style) => {
|
|
29044
29169
|
if (!text) {
|
|
29045
29170
|
return;
|
|
29046
29171
|
}
|
|
29047
|
-
painter.text(text, x, y, {
|
|
29172
|
+
painter.text(text, x, y, __spreadProps(CanvasAxisRenderer_spreadValues({}, style), {
|
|
29048
29173
|
angle: rotated ? -90 : 0
|
|
29049
|
-
});
|
|
29174
|
+
}));
|
|
29175
|
+
};
|
|
29176
|
+
const drawLine = (line, axisId, draw) => {
|
|
29177
|
+
const style = getGridLineCanvasStyle(
|
|
29178
|
+
this.theme.getGridLineStyle(axisId, line, "line")
|
|
29179
|
+
);
|
|
29180
|
+
painter.strokePath(draw, style);
|
|
29050
29181
|
};
|
|
29182
|
+
const getTextStyle = (axisId, line) => getGridTextCanvasStyle(this.theme.getGridLineStyle(axisId, line, "text"));
|
|
29051
29183
|
const drawXLine = (line) => {
|
|
29052
29184
|
if (line.value === void 0 || !scale.x) {
|
|
29053
29185
|
return;
|
|
@@ -29058,18 +29190,20 @@ class CanvasAxisRenderer {
|
|
|
29058
29190
|
}
|
|
29059
29191
|
if (isRotated) {
|
|
29060
29192
|
const y = margin.top + pos;
|
|
29061
|
-
|
|
29193
|
+
drawLine(line, "x", () => {
|
|
29062
29194
|
painter.traceLine(x1, y, x2, y);
|
|
29063
29195
|
});
|
|
29064
29196
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
29065
29197
|
drawLabel(
|
|
29066
29198
|
line.text,
|
|
29067
29199
|
getLineTextPosition(line.position, x1, x2),
|
|
29068
|
-
y - 5
|
|
29200
|
+
y - 5,
|
|
29201
|
+
false,
|
|
29202
|
+
getTextStyle("x", line)
|
|
29069
29203
|
);
|
|
29070
29204
|
} else {
|
|
29071
29205
|
const x = margin.left + pos;
|
|
29072
|
-
|
|
29206
|
+
drawLine(line, "x", () => {
|
|
29073
29207
|
painter.traceLine(x, y1, x, y2);
|
|
29074
29208
|
});
|
|
29075
29209
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
@@ -29077,7 +29211,8 @@ class CanvasAxisRenderer {
|
|
|
29077
29211
|
line.text,
|
|
29078
29212
|
x - 5,
|
|
29079
29213
|
getRotatedLineTextPosition(line.position, y1, y2),
|
|
29080
|
-
true
|
|
29214
|
+
true,
|
|
29215
|
+
getTextStyle("x", line)
|
|
29081
29216
|
);
|
|
29082
29217
|
}
|
|
29083
29218
|
};
|
|
@@ -29094,7 +29229,7 @@ class CanvasAxisRenderer {
|
|
|
29094
29229
|
}
|
|
29095
29230
|
if (isRotated) {
|
|
29096
29231
|
const x = margin.left + pos;
|
|
29097
|
-
|
|
29232
|
+
drawLine(line, "y", () => {
|
|
29098
29233
|
painter.traceLine(x, y1, x, y2);
|
|
29099
29234
|
});
|
|
29100
29235
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
@@ -29102,18 +29237,21 @@ class CanvasAxisRenderer {
|
|
|
29102
29237
|
line.text,
|
|
29103
29238
|
x - 5,
|
|
29104
29239
|
getRotatedLineTextPosition(line.position, y1, y2),
|
|
29105
|
-
true
|
|
29240
|
+
true,
|
|
29241
|
+
getTextStyle("y", line)
|
|
29106
29242
|
);
|
|
29107
29243
|
} else {
|
|
29108
29244
|
const y = margin.top + pos;
|
|
29109
|
-
|
|
29245
|
+
drawLine(line, "y", () => {
|
|
29110
29246
|
painter.traceLine(x1, y, x2, y);
|
|
29111
29247
|
});
|
|
29112
29248
|
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
29113
29249
|
drawLabel(
|
|
29114
29250
|
line.text,
|
|
29115
29251
|
getLineTextPosition(line.position, x1, x2),
|
|
29116
|
-
y - 5
|
|
29252
|
+
y - 5,
|
|
29253
|
+
false,
|
|
29254
|
+
getTextStyle("y", line)
|
|
29117
29255
|
);
|
|
29118
29256
|
}
|
|
29119
29257
|
};
|
|
@@ -29504,31 +29642,37 @@ class CanvasAxisRenderer {
|
|
|
29504
29642
|
* @private
|
|
29505
29643
|
*/
|
|
29506
29644
|
drawYAxis($$, id = "y", axisOptions) {
|
|
29507
|
-
var _a, _b, _c, _d;
|
|
29645
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
29508
29646
|
const { ctx, painter, theme: { style: { axis } } } = this;
|
|
29509
|
-
const { config, scale, state
|
|
29510
|
-
const
|
|
29647
|
+
const { config, scale, state } = $$;
|
|
29648
|
+
const { margin, width, height } = state;
|
|
29649
|
+
const plotMargin = (axisOptions == null ? void 0 : axisOptions.margin) || margin;
|
|
29650
|
+
const plotWidth = (_a = axisOptions == null ? void 0 : axisOptions.width) != null ? _a : width;
|
|
29651
|
+
const plotHeight = (_b = axisOptions == null ? void 0 : axisOptions.height) != null ? _b : height;
|
|
29652
|
+
const prefix = (axisOptions == null ? void 0 : axisOptions.prefix) || `axis_${id}`;
|
|
29511
29653
|
const targetScale = (axisOptions == null ? void 0 : axisOptions.scale) || scale[id];
|
|
29512
29654
|
const isY2 = id === "y2";
|
|
29513
29655
|
const isRotated = config.axis_rotated;
|
|
29514
29656
|
const axisOffset = (axisOptions == null ? void 0 : axisOptions.index) ? $$.getAxisSize(id) * axisOptions.index : 0;
|
|
29515
29657
|
const x = painter.crisp(
|
|
29516
|
-
|
|
29658
|
+
plotMargin.left + (isY2 ? plotWidth + (isRotated ? 0 : axisOffset) : -axisOffset),
|
|
29517
29659
|
axis.lineWidth
|
|
29518
29660
|
);
|
|
29519
|
-
const y = painter.crisp(
|
|
29520
|
-
const x1 =
|
|
29521
|
-
const x2 =
|
|
29522
|
-
const y1 =
|
|
29523
|
-
const y2 =
|
|
29661
|
+
const y = painter.crisp(plotMargin.top + (isRotated ? isY2 ? -axisOffset - 1 : plotHeight + axisOffset : 0), axis.lineWidth);
|
|
29662
|
+
const x1 = plotMargin.left;
|
|
29663
|
+
const x2 = plotMargin.left + plotWidth;
|
|
29664
|
+
const y1 = plotMargin.top;
|
|
29665
|
+
const y2 = plotMargin.top + plotHeight;
|
|
29524
29666
|
const ticks = (axisOptions == null ? void 0 : axisOptions.ticks) || getYTickValues($$, id);
|
|
29525
29667
|
const lineTicks = (axisOptions == null ? void 0 : axisOptions.ticks) || (config[`${prefix}_tick_culling`] && config[`${prefix}_tick_culling_lines`] !== false ? getYTickValues($$, id, void 0, false) : ticks);
|
|
29526
|
-
const format = (axisOptions == null ? void 0 : axisOptions.format) || ((
|
|
29668
|
+
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);
|
|
29527
29669
|
const outerTick = axisOptions ? axisOptions.outerTick : config[`${prefix}_tick_outer`];
|
|
29528
29670
|
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;
|
|
29529
29671
|
const outerTickDirection = getYOuterTickDirection(config, isRotated, isY2);
|
|
29530
29672
|
const tickTextDirection = getYTickTextDirection(isRotated, isY2);
|
|
29531
|
-
const tickTextPosition = config[`${prefix}_tick_text_position`];
|
|
29673
|
+
const tickTextPosition = (axisOptions == null ? void 0 : axisOptions.tickTextPosition) || config[`${prefix}_tick_text_position`] || config[`axis_${id}_tick_text_position`];
|
|
29674
|
+
const tickShow = (_g = axisOptions == null ? void 0 : axisOptions.tickShow) != null ? _g : axisOptions ? true : config[`${prefix}_tick_show`];
|
|
29675
|
+
const tickTextShow = (_h = axisOptions == null ? void 0 : axisOptions.tickTextShow) != null ? _h : axisOptions ? true : config[`${prefix}_tick_text_show`];
|
|
29532
29676
|
painter.withState(() => {
|
|
29533
29677
|
ctx.strokeStyle = axis.lineColor;
|
|
29534
29678
|
ctx.lineWidth = axis.lineWidth;
|
|
@@ -29559,8 +29703,8 @@ class CanvasAxisRenderer {
|
|
|
29559
29703
|
const drawableLineTicks = [];
|
|
29560
29704
|
const addDrawableTick = (tick, target) => {
|
|
29561
29705
|
const value = normalizeYValue($$, tick, id);
|
|
29562
|
-
const tx =
|
|
29563
|
-
const ty =
|
|
29706
|
+
const tx = plotMargin.left + targetScale(value);
|
|
29707
|
+
const ty = plotMargin.top + targetScale(value);
|
|
29564
29708
|
const pos = isRotated ? tx : ty;
|
|
29565
29709
|
if (!isDrawable(pos)) {
|
|
29566
29710
|
return;
|
|
@@ -29573,7 +29717,7 @@ class CanvasAxisRenderer {
|
|
|
29573
29717
|
for (const tick of lineTicks) {
|
|
29574
29718
|
addDrawableTick(tick, drawableLineTicks);
|
|
29575
29719
|
}
|
|
29576
|
-
if (
|
|
29720
|
+
if (tickShow) {
|
|
29577
29721
|
painter.strokePath(() => {
|
|
29578
29722
|
for (const { tx, ty } of drawableLineTicks) {
|
|
29579
29723
|
if (isRotated) {
|
|
@@ -29584,7 +29728,7 @@ class CanvasAxisRenderer {
|
|
|
29584
29728
|
}
|
|
29585
29729
|
});
|
|
29586
29730
|
}
|
|
29587
|
-
if (
|
|
29731
|
+
if (tickTextShow) {
|
|
29588
29732
|
for (const { tick, tx, ty } of drawableTicks) {
|
|
29589
29733
|
if (isRotated) {
|
|
29590
29734
|
painter.text(
|
|
@@ -29776,8 +29920,112 @@ class CanvasEngine {
|
|
|
29776
29920
|
}
|
|
29777
29921
|
}
|
|
29778
29922
|
|
|
29923
|
+
;// ./src/ChartInternal/internals/subchart.util.ts
|
|
29924
|
+
function isContinuousGridFocusEnabled($$) {
|
|
29925
|
+
const { config, state } = $$;
|
|
29926
|
+
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);
|
|
29927
|
+
}
|
|
29928
|
+
function getMainCoordFromSubchartCoord($$, subCoord) {
|
|
29929
|
+
var _a;
|
|
29930
|
+
const { config, scale, state } = $$;
|
|
29931
|
+
const mainX = scale.zoom || scale.x;
|
|
29932
|
+
const subX = scale.subX;
|
|
29933
|
+
if (!mainX || !subX) {
|
|
29934
|
+
return null;
|
|
29935
|
+
}
|
|
29936
|
+
const subLength = config.axis_rotated ? state.height2 : state.width2;
|
|
29937
|
+
const mainLength = config.axis_rotated ? state.height : state.width;
|
|
29938
|
+
const domainValue = (_a = subX.invert) == null ? void 0 : _a.call(subX, subCoord);
|
|
29939
|
+
let mainCoord = domainValue == null ? NaN : mainX(domainValue);
|
|
29940
|
+
if (!Number.isFinite(mainCoord) && subLength > 0) {
|
|
29941
|
+
mainCoord = Math.max(0, Math.min(1, subCoord / subLength)) * mainLength;
|
|
29942
|
+
}
|
|
29943
|
+
return Number.isFinite(mainCoord) ? Math.max(0, Math.min(mainLength, mainCoord)) : null;
|
|
29944
|
+
}
|
|
29945
|
+
|
|
29779
29946
|
;// ./src/ChartInternal/shape/core/barRadius.ts
|
|
29780
29947
|
|
|
29948
|
+
const RE_PATH_NUMBER = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
|
|
29949
|
+
const RE_PATH_TOKEN = /([aAcChHlLmMqQsStTvVzZ])|([-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?)/g;
|
|
29950
|
+
function getArcFlagTokenIndexes(path) {
|
|
29951
|
+
const flags = /* @__PURE__ */ new Set();
|
|
29952
|
+
let numIndex = -1;
|
|
29953
|
+
let argIndex = 0;
|
|
29954
|
+
let inArc = false;
|
|
29955
|
+
let token;
|
|
29956
|
+
RE_PATH_TOKEN.lastIndex = 0;
|
|
29957
|
+
while (token = RE_PATH_TOKEN.exec(path)) {
|
|
29958
|
+
if (token[1]) {
|
|
29959
|
+
inArc = token[1] === "a" || token[1] === "A";
|
|
29960
|
+
argIndex = 0;
|
|
29961
|
+
} else {
|
|
29962
|
+
numIndex++;
|
|
29963
|
+
if (inArc) {
|
|
29964
|
+
const pos = argIndex % 7;
|
|
29965
|
+
if (pos === 2 || pos === 3 || pos === 4) {
|
|
29966
|
+
flags.add(numIndex);
|
|
29967
|
+
}
|
|
29968
|
+
argIndex++;
|
|
29969
|
+
}
|
|
29970
|
+
}
|
|
29971
|
+
}
|
|
29972
|
+
return flags;
|
|
29973
|
+
}
|
|
29974
|
+
function getBarPathInterpolator(a, b) {
|
|
29975
|
+
const flagSet = getArcFlagTokenIndexes(b);
|
|
29976
|
+
const segments = [];
|
|
29977
|
+
const interpolators = [];
|
|
29978
|
+
let bIndex = 0;
|
|
29979
|
+
let segIndex = -1;
|
|
29980
|
+
let numIndex = -1;
|
|
29981
|
+
let am;
|
|
29982
|
+
let bm;
|
|
29983
|
+
const append = (text) => {
|
|
29984
|
+
if (segments[segIndex]) {
|
|
29985
|
+
segments[segIndex] += text;
|
|
29986
|
+
} else {
|
|
29987
|
+
segments[++segIndex] = text;
|
|
29988
|
+
}
|
|
29989
|
+
};
|
|
29990
|
+
RE_PATH_NUMBER.lastIndex = 0;
|
|
29991
|
+
const reA = RE_PATH_NUMBER;
|
|
29992
|
+
const reB = new RegExp(RE_PATH_NUMBER.source, "g");
|
|
29993
|
+
a += "";
|
|
29994
|
+
b += "";
|
|
29995
|
+
while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
|
|
29996
|
+
numIndex++;
|
|
29997
|
+
if (bm.index > bIndex) {
|
|
29998
|
+
append(b.slice(bIndex, bm.index));
|
|
29999
|
+
}
|
|
30000
|
+
if (am[0] === bm[0]) {
|
|
30001
|
+
append(bm[0]);
|
|
30002
|
+
} else {
|
|
30003
|
+
const from = +am[0];
|
|
30004
|
+
const to = +bm[0];
|
|
30005
|
+
const isFlag = flagSet.has(numIndex);
|
|
30006
|
+
segments[++segIndex] = null;
|
|
30007
|
+
interpolators.push({
|
|
30008
|
+
index: segIndex,
|
|
30009
|
+
fn: isFlag ? (t) => Math.round(from + (to - from) * t) : (t) => from + (to - from) * t
|
|
30010
|
+
});
|
|
30011
|
+
}
|
|
30012
|
+
bIndex = reB.lastIndex;
|
|
30013
|
+
}
|
|
30014
|
+
if (bIndex < b.length) {
|
|
30015
|
+
append(b.slice(bIndex));
|
|
30016
|
+
}
|
|
30017
|
+
if (!interpolators.length) {
|
|
30018
|
+
const result = segments.join("");
|
|
30019
|
+
return () => result;
|
|
30020
|
+
}
|
|
30021
|
+
return (t) => {
|
|
30022
|
+
for (let i = 0, len = interpolators.length; i < len; i++) {
|
|
30023
|
+
const { index, fn } = interpolators[i];
|
|
30024
|
+
segments[index] = String(fn(t));
|
|
30025
|
+
}
|
|
30026
|
+
return segments.join("");
|
|
30027
|
+
};
|
|
30028
|
+
}
|
|
29781
30029
|
function getBarRadiusResolver($$) {
|
|
29782
30030
|
const { bar_radius: radius, bar_radius_ratio: ratio } = $$.config;
|
|
29783
30031
|
return isNumber(radius) && radius > 0 ? () => radius : isNumber(ratio) ? (width) => width * ratio : null;
|
|
@@ -30305,6 +30553,26 @@ var path_spreadValues = (a, b) => {
|
|
|
30305
30553
|
};
|
|
30306
30554
|
var path_spreadProps = (a, b) => path_defProps(a, path_getOwnPropDescs(b));
|
|
30307
30555
|
|
|
30556
|
+
function getPathValueFn($$, isSub) {
|
|
30557
|
+
if (!isSub) {
|
|
30558
|
+
return (d) => $$.getBaseValue(d);
|
|
30559
|
+
}
|
|
30560
|
+
return (d) => {
|
|
30561
|
+
var _a;
|
|
30562
|
+
const value = (_a = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _a.call($$, d, true);
|
|
30563
|
+
return value === void 0 ? $$.getBaseValue(d) : value;
|
|
30564
|
+
};
|
|
30565
|
+
}
|
|
30566
|
+
function getProjectedValues($$, values, isSub) {
|
|
30567
|
+
if (!isSub) {
|
|
30568
|
+
return values;
|
|
30569
|
+
}
|
|
30570
|
+
return values.map((d) => {
|
|
30571
|
+
var _a;
|
|
30572
|
+
const value = (_a = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _a.call($$, d, isSub);
|
|
30573
|
+
return value === void 0 ? d : path_spreadProps(path_spreadValues({}, d), { value });
|
|
30574
|
+
});
|
|
30575
|
+
}
|
|
30308
30576
|
function getLineValues($$, d, values) {
|
|
30309
30577
|
return $$.isStepType(d) ? $$.convertValuesToStep(values) : values;
|
|
30310
30578
|
}
|
|
@@ -30314,13 +30582,16 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
30314
30582
|
const isRotated = config.axis_rotated;
|
|
30315
30583
|
const getPoints = $$.generateGetLinePoints(lineIndices, isSub);
|
|
30316
30584
|
const yScale = $$.getYScaleById.bind($$);
|
|
30585
|
+
const pathValue = getPathValueFn($$, isSub);
|
|
30317
30586
|
const xValue = (d) => (isSub ? $$.subxx : $$.xx).call($$, d);
|
|
30318
|
-
const yValue = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
|
|
30587
|
+
const yValue = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
|
|
30588
|
+
pathValue(d)
|
|
30589
|
+
);
|
|
30319
30590
|
let line = src_line();
|
|
30320
30591
|
line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue);
|
|
30321
30592
|
context && (line = line.context(context));
|
|
30322
30593
|
if (!lineConnectNull) {
|
|
30323
|
-
line = line.defined((d) =>
|
|
30594
|
+
line = line.defined((d) => pathValue(d) !== null);
|
|
30324
30595
|
}
|
|
30325
30596
|
const x = isSub ? scale.subX : scale.x;
|
|
30326
30597
|
return (d) => {
|
|
@@ -30332,6 +30603,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
30332
30603
|
if ($$.isLineType(d)) {
|
|
30333
30604
|
const regions = config.data_regions[d.id];
|
|
30334
30605
|
if (regions && !context && $$.lineWithRegions) {
|
|
30606
|
+
values = getProjectedValues($$, values, isSub);
|
|
30335
30607
|
if ($$.isAreaRangeType(d)) {
|
|
30336
30608
|
values = values.map((dv) => path_spreadProps(path_spreadValues({}, dv), { value: $$.getRangedData(dv, "mid") }));
|
|
30337
30609
|
}
|
|
@@ -30345,7 +30617,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
|
|
|
30345
30617
|
} else {
|
|
30346
30618
|
if (values[0]) {
|
|
30347
30619
|
x0 = x(values[0].x);
|
|
30348
|
-
y0 = y(values[0]
|
|
30620
|
+
y0 = y(pathValue(values[0]));
|
|
30349
30621
|
}
|
|
30350
30622
|
path = isRotated ? `M ${y0} ${x0}` : `M ${x0} ${y0}`;
|
|
30351
30623
|
}
|
|
@@ -30358,12 +30630,22 @@ function generateDrawAreaPath($$, areaIndices, isSub, context) {
|
|
|
30358
30630
|
const isRotated = config.axis_rotated;
|
|
30359
30631
|
const getPoints = $$.generateGetAreaPoints(areaIndices, isSub);
|
|
30360
30632
|
const yScale = $$.getYScaleById.bind($$);
|
|
30633
|
+
const pathValue = getPathValueFn($$, isSub);
|
|
30634
|
+
const shapeYMin = /* @__PURE__ */ new Map();
|
|
30635
|
+
const getShapeYMin = (id) => {
|
|
30636
|
+
let min = shapeYMin.get(id);
|
|
30637
|
+
if (min === void 0) {
|
|
30638
|
+
min = $$.getShapeYMin(id, isSub);
|
|
30639
|
+
shapeYMin.set(id, min);
|
|
30640
|
+
}
|
|
30641
|
+
return min;
|
|
30642
|
+
};
|
|
30361
30643
|
const xValue = (d) => (isSub ? $$.subxx : $$.xx).call($$, d);
|
|
30362
30644
|
const value0 = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
|
|
30363
|
-
$$.isAreaRangeType(d) ? $$.getRangedData(d, "high") :
|
|
30645
|
+
$$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : getShapeYMin(d.id)
|
|
30364
30646
|
);
|
|
30365
30647
|
const value1 = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScale(d.id, isSub)(
|
|
30366
|
-
$$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : d
|
|
30648
|
+
$$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : pathValue(d)
|
|
30367
30649
|
);
|
|
30368
30650
|
return (d) => {
|
|
30369
30651
|
let values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values;
|
|
@@ -30372,19 +30654,20 @@ function generateDrawAreaPath($$, areaIndices, isSub, context) {
|
|
|
30372
30654
|
let path;
|
|
30373
30655
|
if ($$.isAreaType(d)) {
|
|
30374
30656
|
let area = src_area();
|
|
30375
|
-
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);
|
|
30657
|
+
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);
|
|
30376
30658
|
context && (area = area.context(context));
|
|
30377
30659
|
if (!lineConnectNull) {
|
|
30378
|
-
area = area.defined((d2) =>
|
|
30660
|
+
area = area.defined((d2) => pathValue(d2) !== null);
|
|
30379
30661
|
}
|
|
30662
|
+
values = getProjectedValues($$, values, isSub);
|
|
30380
30663
|
if ($$.isStepType(d)) {
|
|
30381
30664
|
values = $$.convertValuesToStep(values);
|
|
30382
30665
|
}
|
|
30383
30666
|
path = area.curve($$.getCurve(d))(values);
|
|
30384
30667
|
} else {
|
|
30385
30668
|
if (values[0]) {
|
|
30386
|
-
x0 = $$.scale.x(values[0].x);
|
|
30387
|
-
y0 = $$.getYScaleById(d.id)(values[0]
|
|
30669
|
+
x0 = (isSub ? $$.scale.subX : $$.scale.x)(values[0].x);
|
|
30670
|
+
y0 = $$.getYScaleById(d.id, isSub)(pathValue(values[0]));
|
|
30388
30671
|
}
|
|
30389
30672
|
path = isRotated ? `M ${y0} ${x0}` : `M ${x0} ${y0}`;
|
|
30390
30673
|
}
|
|
@@ -31244,6 +31527,7 @@ var CanvasRenderer_publicField = (obj, key, value) => CanvasRenderer_defNormalPr
|
|
|
31244
31527
|
|
|
31245
31528
|
|
|
31246
31529
|
|
|
31530
|
+
|
|
31247
31531
|
const RENDERER_GROUPED_TYPE_FILTERS = [
|
|
31248
31532
|
isCanvasAreaType,
|
|
31249
31533
|
isCanvasBarType,
|
|
@@ -31925,165 +32209,175 @@ class CanvasRenderer {
|
|
|
31925
32209
|
/**
|
|
31926
32210
|
* Draw the canvas subchart overview and brush selection.
|
|
31927
32211
|
* @param {object} $$ ChartInternal instance
|
|
31928
|
-
* @param {object}
|
|
32212
|
+
* @param {object} _shape Cached main shape object
|
|
31929
32213
|
* @private
|
|
31930
32214
|
*/
|
|
31931
|
-
drawSubchart($$,
|
|
32215
|
+
drawSubchart($$, _shape) {
|
|
31932
32216
|
const { config, state } = $$;
|
|
32217
|
+
void _shape;
|
|
31933
32218
|
if (!config.subchart_show || !state.hasAxis || state.width2 <= 0 || state.height2 <= 0) {
|
|
31934
32219
|
return;
|
|
31935
32220
|
}
|
|
31936
32221
|
const { ctx, painter, theme: { style } } = this;
|
|
31937
32222
|
const { margin2, width2, height2 } = state;
|
|
31938
32223
|
const rect = { x: margin2.left, y: margin2.top, w: width2, h: height2 };
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31951
|
-
|
|
31952
|
-
|
|
31953
|
-
|
|
31954
|
-
|
|
31955
|
-
|
|
31956
|
-
|
|
31957
|
-
|
|
31958
|
-
|
|
31959
|
-
|
|
31960
|
-
ctx.globalAlpha = style.shape.areaOpacity;
|
|
31961
|
-
for (const target of areaTargets) {
|
|
31962
|
-
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
31963
|
-
continue;
|
|
31964
|
-
}
|
|
31965
|
-
ctx.fillStyle = $$.color(target.id);
|
|
31966
|
-
drawCanvasArea($$, target, areaIndices, painter, true);
|
|
31967
|
-
}
|
|
31968
|
-
ctx.globalAlpha = 1;
|
|
31969
|
-
const barTargets = targets.filter(isCanvasBarType.bind(null, $$));
|
|
31970
|
-
const barIndices = getCanvasShapeIndices(
|
|
31971
|
-
$$,
|
|
31972
|
-
shape,
|
|
31973
|
-
TYPE.BAR,
|
|
31974
|
-
isCanvasBarType.bind(null, $$)
|
|
31975
|
-
);
|
|
31976
|
-
const getBarPoints = (_a = $$.generateGetBarPoints) == null ? void 0 : _a.call($$, barIndices, true);
|
|
31977
|
-
if (getBarPoints) {
|
|
31978
|
-
ctx.globalAlpha = style.shape.barOpacity;
|
|
31979
|
-
for (const target of barTargets) {
|
|
32224
|
+
$$.withSubchartTypeContext(() => {
|
|
32225
|
+
var _a;
|
|
32226
|
+
const targets = $$.filterTargetsToShow().filter(isCanvasRenderableTarget.bind(null, $$));
|
|
32227
|
+
const shape = $$.getDrawShape();
|
|
32228
|
+
(_a = $$.updateSubchartYDomain) == null ? void 0 : _a.call($$, targets);
|
|
32229
|
+
painter.withState(() => {
|
|
32230
|
+
painter.clipRect(rect, () => {
|
|
32231
|
+
painter.withTranslation(rect.x, rect.y, () => {
|
|
32232
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
32233
|
+
const areaTargets = targets.filter(isCanvasAreaType.bind(null, $$));
|
|
32234
|
+
const areaIndices = getCanvasShapeIndices(
|
|
32235
|
+
$$,
|
|
32236
|
+
shape,
|
|
32237
|
+
TYPE.AREA,
|
|
32238
|
+
isCanvasAreaType.bind(null, $$)
|
|
32239
|
+
);
|
|
32240
|
+
for (const target of areaTargets) {
|
|
32241
|
+
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
32242
|
+
continue;
|
|
32243
|
+
}
|
|
32244
|
+
ctx.globalAlpha = style.shape.areaOpacity * getCanvasTargetFocusOpacity($$, target);
|
|
31980
32245
|
ctx.fillStyle = $$.color(target.id);
|
|
31981
|
-
target
|
|
31982
|
-
if (!hasCanvasDrawableValue($$, d)) {
|
|
31983
|
-
return;
|
|
31984
|
-
}
|
|
31985
|
-
const geometry = getCanvasBarGeometry($$, getBarPoints, d, i);
|
|
31986
|
-
geometry && painter.fillRect(geometry.rect, { fill: ctx.fillStyle });
|
|
31987
|
-
});
|
|
32246
|
+
drawCanvasArea($$, target, areaIndices, painter, true);
|
|
31988
32247
|
}
|
|
31989
32248
|
ctx.globalAlpha = 1;
|
|
31990
|
-
|
|
31991
|
-
|
|
31992
|
-
|
|
31993
|
-
|
|
31994
|
-
|
|
31995
|
-
|
|
31996
|
-
|
|
31997
|
-
|
|
31998
|
-
|
|
31999
|
-
|
|
32000
|
-
|
|
32001
|
-
|
|
32002
|
-
candlestickIndices,
|
|
32003
|
-
true
|
|
32004
|
-
);
|
|
32005
|
-
if (getCandlestickPoints) {
|
|
32006
|
-
ctx.lineWidth = style.shape.candlestickLineWidth;
|
|
32007
|
-
for (const target of candlestickTargets) {
|
|
32008
|
-
target.values.forEach((d, i) => {
|
|
32009
|
-
var _a2;
|
|
32010
|
-
const value = (_a2 = $$.getCandlestickData) == null ? void 0 : _a2.call($$, d);
|
|
32011
|
-
const geometry = value && getCanvasCandlestickGeometry(
|
|
32012
|
-
$$,
|
|
32013
|
-
getCandlestickPoints,
|
|
32014
|
-
d,
|
|
32015
|
-
i
|
|
32016
|
-
);
|
|
32017
|
-
if (!geometry) {
|
|
32018
|
-
return;
|
|
32019
|
-
}
|
|
32020
|
-
const color = getCandlestickColor($$, { id: target.id }, value);
|
|
32021
|
-
ctx.strokeStyle = color;
|
|
32022
|
-
ctx.fillStyle = color;
|
|
32023
|
-
painter.strokePath(() => {
|
|
32024
|
-
painter.traceLine(
|
|
32025
|
-
geometry.wickStart[0],
|
|
32026
|
-
geometry.wickStart[1],
|
|
32027
|
-
geometry.wickEnd[0],
|
|
32028
|
-
geometry.wickEnd[1]
|
|
32029
|
-
);
|
|
32030
|
-
});
|
|
32031
|
-
painter.fillRect(geometry.body, { fill: ctx.fillStyle });
|
|
32032
|
-
});
|
|
32033
|
-
}
|
|
32034
|
-
}
|
|
32035
|
-
const lineTargets = targets.filter(isCanvasLineType.bind(null, $$));
|
|
32036
|
-
const lineIndices = getCanvasShapeIndices(
|
|
32037
|
-
$$,
|
|
32038
|
-
shape,
|
|
32039
|
-
TYPE.LINE,
|
|
32040
|
-
isCanvasLineType.bind(null, $$)
|
|
32041
|
-
);
|
|
32042
|
-
ctx.globalAlpha = 1;
|
|
32043
|
-
ctx.lineWidth = style.shape.lineWidth;
|
|
32044
|
-
for (const target of lineTargets) {
|
|
32045
|
-
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
32046
|
-
continue;
|
|
32047
|
-
}
|
|
32048
|
-
ctx.strokeStyle = $$.color(target.id);
|
|
32049
|
-
drawCanvasLine($$, target, lineIndices, painter, true);
|
|
32050
|
-
}
|
|
32051
|
-
if (config.point_show && !((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$))) {
|
|
32052
|
-
const cy = (_d = $$.updateCircleY) == null ? void 0 : _d.call($$, true);
|
|
32053
|
-
const cx = (_e = $$.subxx) == null ? void 0 : _e.bind($$);
|
|
32054
|
-
if (cx && cy) {
|
|
32055
|
-
for (const target of targets) {
|
|
32056
|
-
if (!isCanvasScatterType($$, target) && !isCanvasBubbleType($$, target)) {
|
|
32057
|
-
continue;
|
|
32058
|
-
}
|
|
32059
|
-
const color = $$.color(target.id);
|
|
32060
|
-
const pointFill = style.shape.pointFillColor || color;
|
|
32061
|
-
const pointStroke = style.shape.pointStrokeColor || color;
|
|
32062
|
-
const pointLineWidth = pointStroke ? (_f = style.shape.pointLineWidth) != null ? _f : 1 : 0;
|
|
32063
|
-
const pointStyle = pointStroke && pointLineWidth > 0 ? {
|
|
32064
|
-
fill: pointFill,
|
|
32065
|
-
stroke: pointStroke,
|
|
32066
|
-
lineWidth: pointLineWidth
|
|
32067
|
-
} : { fill: pointFill };
|
|
32068
|
-
ctx.globalAlpha = getPointOpacity($$, target);
|
|
32249
|
+
const barTargets = targets.filter(isCanvasBarType.bind(null, $$));
|
|
32250
|
+
const barIndices = getCanvasShapeIndices(
|
|
32251
|
+
$$,
|
|
32252
|
+
shape,
|
|
32253
|
+
TYPE.BAR,
|
|
32254
|
+
isCanvasBarType.bind(null, $$)
|
|
32255
|
+
);
|
|
32256
|
+
const getBarPoints = (_a2 = $$.generateGetBarPoints) == null ? void 0 : _a2.call($$, barIndices, true);
|
|
32257
|
+
if (getBarPoints) {
|
|
32258
|
+
for (const target of barTargets) {
|
|
32259
|
+
ctx.globalAlpha = style.shape.barOpacity * getCanvasTargetFocusOpacity($$, target);
|
|
32260
|
+
ctx.fillStyle = $$.color(target.id);
|
|
32069
32261
|
target.values.forEach((d, i) => {
|
|
32262
|
+
var _a3;
|
|
32070
32263
|
if (!hasCanvasDrawableValue($$, d)) {
|
|
32071
32264
|
return;
|
|
32072
32265
|
}
|
|
32073
|
-
const
|
|
32074
|
-
const
|
|
32075
|
-
|
|
32076
|
-
if (isFiniteCanvasCoordinate(x, y)) {
|
|
32077
|
-
drawPointPattern(painter, "circle", x, y, r, pointStyle);
|
|
32078
|
-
}
|
|
32266
|
+
const geometry = getCanvasBarGeometry($$, getBarPoints, d, i);
|
|
32267
|
+
const fill = ((_a3 = $$.getSubchartCandlestickBarColor) == null ? void 0 : _a3.call($$, d, true)) || ctx.fillStyle;
|
|
32268
|
+
geometry && painter.fillRect(geometry.rect, { fill });
|
|
32079
32269
|
});
|
|
32080
32270
|
}
|
|
32081
32271
|
ctx.globalAlpha = 1;
|
|
32082
32272
|
}
|
|
32083
|
-
|
|
32273
|
+
const candlestickTargets = targets.filter(
|
|
32274
|
+
isCanvasCandlestickType.bind(null, $$)
|
|
32275
|
+
);
|
|
32276
|
+
const candlestickIndices = getCanvasShapeIndices(
|
|
32277
|
+
$$,
|
|
32278
|
+
shape,
|
|
32279
|
+
TYPE.CANDLESTICK,
|
|
32280
|
+
isCanvasCandlestickType.bind(null, $$)
|
|
32281
|
+
);
|
|
32282
|
+
const getCandlestickPoints = (_b = $$.generateGetCandlestickPoints) == null ? void 0 : _b.call(
|
|
32283
|
+
$$,
|
|
32284
|
+
candlestickIndices,
|
|
32285
|
+
true
|
|
32286
|
+
);
|
|
32287
|
+
if (getCandlestickPoints) {
|
|
32288
|
+
ctx.lineWidth = style.shape.candlestickLineWidth;
|
|
32289
|
+
for (const target of candlestickTargets) {
|
|
32290
|
+
const targetOpacity = getCanvasTargetFocusOpacity($$, target);
|
|
32291
|
+
ctx.globalAlpha = targetOpacity;
|
|
32292
|
+
target.values.forEach((d, i) => {
|
|
32293
|
+
var _a3;
|
|
32294
|
+
const value = (_a3 = $$.getCandlestickData) == null ? void 0 : _a3.call($$, d);
|
|
32295
|
+
const geometry = value && getCanvasCandlestickGeometry(
|
|
32296
|
+
$$,
|
|
32297
|
+
getCandlestickPoints,
|
|
32298
|
+
d,
|
|
32299
|
+
i
|
|
32300
|
+
);
|
|
32301
|
+
if (!geometry) {
|
|
32302
|
+
return;
|
|
32303
|
+
}
|
|
32304
|
+
const color = getCandlestickColor($$, { id: target.id }, value);
|
|
32305
|
+
ctx.strokeStyle = color;
|
|
32306
|
+
ctx.fillStyle = color;
|
|
32307
|
+
painter.strokePath(() => {
|
|
32308
|
+
painter.traceLine(
|
|
32309
|
+
geometry.wickStart[0],
|
|
32310
|
+
geometry.wickStart[1],
|
|
32311
|
+
geometry.wickEnd[0],
|
|
32312
|
+
geometry.wickEnd[1]
|
|
32313
|
+
);
|
|
32314
|
+
});
|
|
32315
|
+
painter.fillRect(geometry.body, { fill: ctx.fillStyle });
|
|
32316
|
+
});
|
|
32317
|
+
}
|
|
32318
|
+
}
|
|
32319
|
+
const lineTargets = targets.filter(isCanvasLineType.bind(null, $$));
|
|
32320
|
+
const lineIndices = getCanvasShapeIndices(
|
|
32321
|
+
$$,
|
|
32322
|
+
shape,
|
|
32323
|
+
TYPE.LINE,
|
|
32324
|
+
isCanvasLineType.bind(null, $$)
|
|
32325
|
+
);
|
|
32326
|
+
ctx.globalAlpha = 1;
|
|
32327
|
+
for (const target of lineTargets) {
|
|
32328
|
+
if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
32329
|
+
continue;
|
|
32330
|
+
}
|
|
32331
|
+
ctx.globalAlpha = getCanvasTargetFocusOpacity($$, target);
|
|
32332
|
+
ctx.lineWidth = isCanvasTargetFocused($$, target) ? style.shape.lineFocusedWidth : style.shape.lineWidth;
|
|
32333
|
+
ctx.strokeStyle = $$.color(target.id);
|
|
32334
|
+
drawCanvasLine($$, target, lineIndices, painter, true);
|
|
32335
|
+
}
|
|
32336
|
+
ctx.globalAlpha = 1;
|
|
32337
|
+
if (config.point_show && !((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$))) {
|
|
32338
|
+
const cy = (_d = $$.updateCircleY) == null ? void 0 : _d.call($$, true);
|
|
32339
|
+
const cx = (_e = $$.subxx) == null ? void 0 : _e.bind($$);
|
|
32340
|
+
if (cx && cy) {
|
|
32341
|
+
for (const target of targets) {
|
|
32342
|
+
if (!isCanvasScatterType($$, target) && !isCanvasBubbleType($$, target)) {
|
|
32343
|
+
continue;
|
|
32344
|
+
}
|
|
32345
|
+
const color = $$.color(target.id);
|
|
32346
|
+
const pointFill = style.shape.pointFillColor || color;
|
|
32347
|
+
const pointStroke = style.shape.pointStrokeColor || color;
|
|
32348
|
+
const pointLineWidth = pointStroke ? (_f = style.shape.pointLineWidth) != null ? _f : 1 : 0;
|
|
32349
|
+
const pointStyle = pointStroke && pointLineWidth > 0 ? {
|
|
32350
|
+
fill: pointFill,
|
|
32351
|
+
stroke: pointStroke,
|
|
32352
|
+
lineWidth: pointLineWidth
|
|
32353
|
+
} : { fill: pointFill };
|
|
32354
|
+
ctx.globalAlpha = getPointOpacity($$, target) * getCanvasTargetFocusOpacity($$, target);
|
|
32355
|
+
target.values.forEach((d, i) => {
|
|
32356
|
+
if (!hasCanvasDrawableValue($$, d)) {
|
|
32357
|
+
return;
|
|
32358
|
+
}
|
|
32359
|
+
const x = config.axis_rotated ? cy(d, i) : cx(d);
|
|
32360
|
+
const y = config.axis_rotated ? cx(d) : cy(d, i);
|
|
32361
|
+
const r = Math.min(getTargetPointRadius($$, target, d), 3);
|
|
32362
|
+
if (isFiniteCanvasCoordinate(x, y)) {
|
|
32363
|
+
drawPointPattern(
|
|
32364
|
+
painter,
|
|
32365
|
+
"circle",
|
|
32366
|
+
x,
|
|
32367
|
+
y,
|
|
32368
|
+
r,
|
|
32369
|
+
pointStyle
|
|
32370
|
+
);
|
|
32371
|
+
}
|
|
32372
|
+
});
|
|
32373
|
+
}
|
|
32374
|
+
ctx.globalAlpha = 1;
|
|
32375
|
+
}
|
|
32376
|
+
}
|
|
32377
|
+
});
|
|
32084
32378
|
});
|
|
32379
|
+
this.drawSubchartBrush($$);
|
|
32085
32380
|
});
|
|
32086
|
-
this.drawSubchartBrush($$);
|
|
32087
32381
|
});
|
|
32088
32382
|
}
|
|
32089
32383
|
/**
|
|
@@ -32095,7 +32389,7 @@ class CanvasRenderer {
|
|
|
32095
32389
|
var _a, _b;
|
|
32096
32390
|
const { config, scale, state } = $$;
|
|
32097
32391
|
const domain = state.domain;
|
|
32098
|
-
if (!config.subchart_show || !(domain == null ? void 0 : domain.length) || !scale.subX) {
|
|
32392
|
+
if (!config.subchart_show || config.subchart_brush_enabled === false || !(domain == null ? void 0 : domain.length) || !scale.subX) {
|
|
32099
32393
|
return;
|
|
32100
32394
|
}
|
|
32101
32395
|
const { margin2, width2, height2 } = state;
|
|
@@ -32556,7 +32850,7 @@ class CanvasRenderer {
|
|
|
32556
32850
|
const stackingRadiusSet = getRadius ? getStackingBarRadiusSet($$) : /* @__PURE__ */ new Set();
|
|
32557
32851
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
32558
32852
|
selectedData.forEach((d) => {
|
|
32559
|
-
var _a2, _b2, _c, _d, _e, _f;
|
|
32853
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
32560
32854
|
const color = $$.color(d.id);
|
|
32561
32855
|
if (isBar(d) && barPoints) {
|
|
32562
32856
|
const geometry = getCanvasBarGeometry($$, barPoints, d, d.index);
|
|
@@ -32600,11 +32894,13 @@ class CanvasRenderer {
|
|
|
32600
32894
|
lineWidth: style.selectedPoint.lineWidth,
|
|
32601
32895
|
stroke: style.selectedPoint.stroke || color
|
|
32602
32896
|
});
|
|
32603
|
-
|
|
32604
|
-
|
|
32605
|
-
|
|
32606
|
-
|
|
32607
|
-
|
|
32897
|
+
if (!((_f = $$.isPointFocusOnly) == null ? void 0 : _f.call($$))) {
|
|
32898
|
+
drawPointPattern(painter, pointType, x, y, r, {
|
|
32899
|
+
fill: style.shape.pointFillColor || color,
|
|
32900
|
+
stroke: style.shape.pointStrokeColor || color,
|
|
32901
|
+
lineWidth: (_g = style.shape.pointLineWidth) != null ? _g : 1
|
|
32902
|
+
});
|
|
32903
|
+
}
|
|
32608
32904
|
}
|
|
32609
32905
|
});
|
|
32610
32906
|
ctx.globalAlpha = 1;
|
|
@@ -32848,6 +33144,37 @@ class CanvasRenderer {
|
|
|
32848
33144
|
}
|
|
32849
33145
|
});
|
|
32850
33146
|
}
|
|
33147
|
+
/**
|
|
33148
|
+
* Draw synchronized focus grid on the canvas subchart.
|
|
33149
|
+
* @param {object} $$ ChartInternal instance
|
|
33150
|
+
* @param {Array} selectedData Focused data rows
|
|
33151
|
+
* @private
|
|
33152
|
+
*/
|
|
33153
|
+
drawSubchartFocus($$, selectedData) {
|
|
33154
|
+
const { config, scale, state } = $$;
|
|
33155
|
+
const focus = selectedData == null ? void 0 : selectedData.find(
|
|
33156
|
+
(d) => d && hasCanvasDrawableValue($$, d)
|
|
33157
|
+
);
|
|
33158
|
+
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) {
|
|
33159
|
+
return;
|
|
33160
|
+
}
|
|
33161
|
+
const { margin2, width2, height2 } = state;
|
|
33162
|
+
const pos = scale.subX(focus.x);
|
|
33163
|
+
if (!Number.isFinite(pos)) {
|
|
33164
|
+
return;
|
|
33165
|
+
}
|
|
33166
|
+
const { painter, theme: { style } } = this;
|
|
33167
|
+
const lineWidth = style.axis.lineWidth;
|
|
33168
|
+
const x = painter.crisp(margin2.left + pos, lineWidth);
|
|
33169
|
+
const y = painter.crisp(margin2.top + pos, lineWidth);
|
|
33170
|
+
painter.strokePath(() => {
|
|
33171
|
+
config.axis_rotated ? painter.traceLine(margin2.left, y, margin2.left + width2, y) : painter.traceLine(x, margin2.top, x, margin2.top + height2);
|
|
33172
|
+
}, {
|
|
33173
|
+
lineDash: style.focusGrid.dashArray,
|
|
33174
|
+
lineWidth: style.focusGrid.lineWidth,
|
|
33175
|
+
stroke: style.focusGrid.lineColor
|
|
33176
|
+
});
|
|
33177
|
+
}
|
|
32851
33178
|
/**
|
|
32852
33179
|
* Draw focus grid and focused points on canvas.
|
|
32853
33180
|
* @param {object} $$ ChartInternal instance
|
|
@@ -32864,6 +33191,7 @@ class CanvasRenderer {
|
|
|
32864
33191
|
const focus = selectedData.find(
|
|
32865
33192
|
(d) => d && hasCanvasDrawableValue($$, d)
|
|
32866
33193
|
);
|
|
33194
|
+
$$.config.subchart_grid_focus !== false && !isContinuousGridFocusEnabled($$) && this.drawSubchartFocus($$, selectedData);
|
|
32867
33195
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
32868
33196
|
if ($$.config.tooltip_show && $$.config.grid_focus_show !== false && !$$.config.axis_tooltip && focus) {
|
|
32869
33197
|
const { x, y } = getRenderDataPoint($$, focus);
|
|
@@ -32874,6 +33202,9 @@ class CanvasRenderer {
|
|
|
32874
33202
|
const crispEdgeX = (value) => painter.crisp(margin.left + value, axisLineWidth) - margin.left;
|
|
32875
33203
|
const crispEdgeY = (value) => painter.crisp(margin.top + value, axisLineWidth) - margin.top;
|
|
32876
33204
|
const isEdge = $$.config.grid_focus_edge && !$$.config.tooltip_grouped;
|
|
33205
|
+
const continuousFocus = isContinuousGridFocusEnabled($$);
|
|
33206
|
+
const focusEndX = continuousFocus ? $$.state.margin2.left - margin.left + $$.state.width2 : $$.state.width;
|
|
33207
|
+
const focusEndY = continuousFocus ? $$.state.margin2.top - margin.top + $$.state.height2 : $$.state.height;
|
|
32877
33208
|
if (hasIndexCoordinate) {
|
|
32878
33209
|
painter.strokePath(() => {
|
|
32879
33210
|
var _a, _b;
|
|
@@ -32881,7 +33212,7 @@ class CanvasRenderer {
|
|
|
32881
33212
|
painter.traceLine(
|
|
32882
33213
|
crispEdgeX(0),
|
|
32883
33214
|
y,
|
|
32884
|
-
isEdge && hasValueCoordinate ? x : crispEdgeX(
|
|
33215
|
+
isEdge && hasValueCoordinate ? x : crispEdgeX(focusEndX),
|
|
32885
33216
|
y
|
|
32886
33217
|
);
|
|
32887
33218
|
if (hasValueCoordinate && $$.config.grid_focus_y && !$$.config.tooltip_grouped) {
|
|
@@ -32898,7 +33229,7 @@ class CanvasRenderer {
|
|
|
32898
33229
|
x,
|
|
32899
33230
|
isEdge && hasValueCoordinate ? y : crispEdgeY(0),
|
|
32900
33231
|
x,
|
|
32901
|
-
crispEdgeY(
|
|
33232
|
+
crispEdgeY(focusEndY)
|
|
32902
33233
|
);
|
|
32903
33234
|
if (hasValueCoordinate && $$.config.grid_focus_y && !$$.config.tooltip_grouped) {
|
|
32904
33235
|
const isY2 = ((_b = $$.axis) == null ? void 0 : _b.getId(focus.id)) === "y2";
|
|
@@ -33096,6 +33427,77 @@ function normalizeThemeSelectors(selector) {
|
|
|
33096
33427
|
(value) => value.trim().replace(/\s*>\s*/g, " ").replace(/\s+/g, " ").replace(/^(?:svg)?\.bb\s+/, "").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g, "$1.")
|
|
33097
33428
|
).filter(Boolean);
|
|
33098
33429
|
}
|
|
33430
|
+
function getDefinedKeys(values) {
|
|
33431
|
+
return Object.keys(values).filter((key) => values[key] !== void 0);
|
|
33432
|
+
}
|
|
33433
|
+
function assignDefined(target, source, skip) {
|
|
33434
|
+
getDefinedKeys(source).forEach((key) => {
|
|
33435
|
+
if (!(skip == null ? void 0 : skip.has(key))) {
|
|
33436
|
+
target[key] = source[key];
|
|
33437
|
+
}
|
|
33438
|
+
});
|
|
33439
|
+
return target;
|
|
33440
|
+
}
|
|
33441
|
+
function isSimpleGridLineSelector(selector) {
|
|
33442
|
+
const tokens = selector.split(" ");
|
|
33443
|
+
return tokens.every(
|
|
33444
|
+
(token, index) => token === "line" || token === "text" ? index === tokens.length - 1 : /^(\.[A-Za-z_-][\w-]*)+$/.test(token)
|
|
33445
|
+
);
|
|
33446
|
+
}
|
|
33447
|
+
function getGridLineSelectorTarget(selector) {
|
|
33448
|
+
const tokens = selector.split(" ");
|
|
33449
|
+
const target = tokens[tokens.length - 1];
|
|
33450
|
+
return target === "line" || target === "text" ? target : null;
|
|
33451
|
+
}
|
|
33452
|
+
function getClassNames(className) {
|
|
33453
|
+
return (className || "").split(/\s+/).filter(Boolean);
|
|
33454
|
+
}
|
|
33455
|
+
function getGridLineSelectorStyle(style, target) {
|
|
33456
|
+
const values = target === "text" ? {
|
|
33457
|
+
labelColor: readColorValue(style, "fill"),
|
|
33458
|
+
labelFont: readFontValue(style)
|
|
33459
|
+
} : {
|
|
33460
|
+
lineColor: readColorValue(style, "stroke"),
|
|
33461
|
+
lineWidth: readNumberValue(style, "stroke-width"),
|
|
33462
|
+
dashArray: readDashArrayValue(style)
|
|
33463
|
+
};
|
|
33464
|
+
return assignDefined({}, values);
|
|
33465
|
+
}
|
|
33466
|
+
function getGridLineSelectorOverrides(selectors) {
|
|
33467
|
+
const overrides = [];
|
|
33468
|
+
Object.keys(selectors != null ? selectors : {}).forEach((selector) => {
|
|
33469
|
+
normalizeThemeSelectors(selector).forEach((normalizedSelector) => {
|
|
33470
|
+
const target = getGridLineSelectorTarget(normalizedSelector) || "line";
|
|
33471
|
+
const style = getGridLineSelectorStyle(selectors[selector], target);
|
|
33472
|
+
if (isSimpleGridLineSelector(normalizedSelector) && getDefinedKeys(style).length) {
|
|
33473
|
+
overrides.push({ selector: normalizedSelector, target, style });
|
|
33474
|
+
}
|
|
33475
|
+
});
|
|
33476
|
+
});
|
|
33477
|
+
return overrides;
|
|
33478
|
+
}
|
|
33479
|
+
function matchesGridLineSelector(selector, axis, className, target) {
|
|
33480
|
+
if (!isSimpleGridLineSelector(selector)) {
|
|
33481
|
+
return false;
|
|
33482
|
+
}
|
|
33483
|
+
const selectorTarget = getGridLineSelectorTarget(selector);
|
|
33484
|
+
if (selectorTarget && selectorTarget !== target) {
|
|
33485
|
+
return false;
|
|
33486
|
+
} else if (!selectorTarget && target === "text") {
|
|
33487
|
+
return false;
|
|
33488
|
+
}
|
|
33489
|
+
const customClasses = getClassNames(className);
|
|
33490
|
+
const axisLineClass = `bb-${axis}grid-line`;
|
|
33491
|
+
const availableClasses = /* @__PURE__ */ new Set([
|
|
33492
|
+
"bb-grid",
|
|
33493
|
+
"bb-grid-lines",
|
|
33494
|
+
`bb-${axis}grid-lines`,
|
|
33495
|
+
axisLineClass,
|
|
33496
|
+
...customClasses
|
|
33497
|
+
]);
|
|
33498
|
+
const selectorClasses = (selector.match(/\.[A-Za-z_-][\w-]*/g) || []).map((match) => match.slice(1));
|
|
33499
|
+
return !!selectorClasses.length && selectorClasses.every((cls) => availableClasses.has(cls)) && (selectorClasses.includes(axisLineClass) || customClasses.some((cls) => selectorClasses.includes(cls)));
|
|
33500
|
+
}
|
|
33099
33501
|
function applySelectorStyle(target, selector, style) {
|
|
33100
33502
|
switch (selector) {
|
|
33101
33503
|
case ".bb-axis path.domain":
|
|
@@ -33372,6 +33774,8 @@ class CanvasTheme {
|
|
|
33372
33774
|
CanvasTheme_publicField(this, "style");
|
|
33373
33775
|
CanvasTheme_publicField(this, "cacheContainer", null);
|
|
33374
33776
|
CanvasTheme_publicField(this, "cacheKey", null);
|
|
33777
|
+
CanvasTheme_publicField(this, "gridLineSelectorOverrides", []);
|
|
33778
|
+
CanvasTheme_publicField(this, "directGridOverrideKeys", /* @__PURE__ */ new Set());
|
|
33375
33779
|
}
|
|
33376
33780
|
/**
|
|
33377
33781
|
* Read theme values from temporary SVG probes.
|
|
@@ -33380,8 +33784,12 @@ class CanvasTheme {
|
|
|
33380
33784
|
* @private
|
|
33381
33785
|
*/
|
|
33382
33786
|
load(container, userOverride) {
|
|
33383
|
-
var _a, _b, _c, _d;
|
|
33787
|
+
var _a, _b, _c, _d, _e;
|
|
33384
33788
|
const svg = browser_doc.createElementNS(SVG_NS, "svg");
|
|
33789
|
+
this.gridLineSelectorOverrides = getGridLineSelectorOverrides(userOverride == null ? void 0 : userOverride.selectors);
|
|
33790
|
+
this.directGridOverrideKeys = new Set(
|
|
33791
|
+
Object.keys((_a = userOverride == null ? void 0 : userOverride.grid) != null ? _a : {})
|
|
33792
|
+
);
|
|
33385
33793
|
svg.setAttribute("class", "bb");
|
|
33386
33794
|
svg.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden";
|
|
33387
33795
|
container.appendChild(svg);
|
|
@@ -33546,7 +33954,7 @@ class CanvasTheme {
|
|
|
33546
33954
|
subchartBrushSelection.fill,
|
|
33547
33955
|
toColor(subchartBrushExtent.fill, zoomBrushFill)
|
|
33548
33956
|
);
|
|
33549
|
-
const subchartBrushOpacity = (
|
|
33957
|
+
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;
|
|
33550
33958
|
const subchartBrushHandleStroke = toColor(subchartBrushHandle.stroke, "transparent");
|
|
33551
33959
|
const defaultStyle = {
|
|
33552
33960
|
axis: {
|
|
@@ -33772,6 +34180,25 @@ class CanvasTheme {
|
|
|
33772
34180
|
}
|
|
33773
34181
|
this.load(container, userOverride);
|
|
33774
34182
|
}
|
|
34183
|
+
/**
|
|
34184
|
+
* Resolve selector based style for one configured optional grid line.
|
|
34185
|
+
* @param {string} axis Grid axis
|
|
34186
|
+
* @param {object} line Grid line options
|
|
34187
|
+
* @param {string} line.class Grid line custom class
|
|
34188
|
+
* @param {string} target Draw target
|
|
34189
|
+
* @returns {object|undefined} Grid line style override
|
|
34190
|
+
* @private
|
|
34191
|
+
*/
|
|
34192
|
+
getGridLineStyle(axis, line = {}, target = "line") {
|
|
34193
|
+
const style = {};
|
|
34194
|
+
for (const override of this.gridLineSelectorOverrides) {
|
|
34195
|
+
if (!matchesGridLineSelector(override.selector, axis, line.class, target)) {
|
|
34196
|
+
continue;
|
|
34197
|
+
}
|
|
34198
|
+
assignDefined(style, override.style, this.directGridOverrideKeys);
|
|
34199
|
+
}
|
|
34200
|
+
return getDefinedKeys(style).length ? style : void 0;
|
|
34201
|
+
}
|
|
33775
34202
|
}
|
|
33776
34203
|
|
|
33777
34204
|
;// ./src/canvas/HitDetector.ts
|
|
@@ -34307,6 +34734,7 @@ const $FOCUS = {
|
|
|
34307
34734
|
defocused: "bb-defocused",
|
|
34308
34735
|
legendItemFocused: "bb-legend-item-focused",
|
|
34309
34736
|
xgridFocus: "bb-xgrid-focus",
|
|
34737
|
+
xgridFocusContinuous: "bb-xgrid-focus-continuous",
|
|
34310
34738
|
ygridFocus: "bb-ygrid-focus"
|
|
34311
34739
|
};
|
|
34312
34740
|
const $GRID = {
|
|
@@ -34384,19 +34812,79 @@ const $ZOOM = {
|
|
|
34384
34812
|
* - **NOTE:**
|
|
34385
34813
|
* - Will append <style> to the head tag and will add shpes' CSS rules dynamically.
|
|
34386
34814
|
* - For now, covers colors related properties (fill, stroke, etc.) only.
|
|
34387
|
-
* @property {boolean} [boost.useWorker=false] Use Web Worker as possible for processing.
|
|
34815
|
+
* @property {boolean|string} [boost.useWorker=false] Use Web Worker as possible for processing.
|
|
34816
|
+
* - **Available values:**
|
|
34817
|
+
* - `false`: never offload.
|
|
34818
|
+
* - `true`: always offload when a Worker can be created.
|
|
34819
|
+
* - `"auto"`: offload only when the given data exceeds ~5,000 cells, since smaller
|
|
34820
|
+
* payloads lose more to structured cloning than they gain.
|
|
34388
34821
|
* - **NOTE:**
|
|
34389
34822
|
* - For now, only applies for data conversion at the initial time.
|
|
34390
|
-
* - As of Web Worker's async nature, handling chart instance
|
|
34823
|
+
* - As of Web Worker's async nature, handling chart instance synchronously is not recommended.
|
|
34824
|
+
* - When Worker isn't available, fails or times out, data conversion falls back to main thread.
|
|
34391
34825
|
* - When given data is empty, useWorker will be ignored.
|
|
34826
|
+
* @property {string} [boost.workerUrl=undefined] Use a custom static worker script URL instead of an inline Blob worker.
|
|
34827
|
+
* - **NOTE:**
|
|
34828
|
+
* - **Requires `boost.useWorker` to be enabled** — this option only selects where the
|
|
34829
|
+
* worker source comes from, it does not turn offloading on by itself.
|
|
34830
|
+
* - Useful for strict CSP environments that disallow `blob:` workers. Without it under
|
|
34831
|
+
* such a policy, worker creation throws and each conversion waits out the 5s timeout
|
|
34832
|
+
* before falling back, so the chart still renders but the initial draw is delayed.
|
|
34833
|
+
* - Point it at `dist/billboard.worker.js`, shipped in the package, or any script
|
|
34834
|
+
* implementing the same protocol: receive `{id, op, args}` and post back
|
|
34835
|
+
* `{id, result}` or `{id, error}`. No `eval()` is involved.
|
|
34836
|
+
* - With a bundler, make sure the file is emitted as a **real asset**, not inlined:
|
|
34837
|
+
* it is ~1.5KB, and inlining turns it into a `data:` URI, which a strict CSP
|
|
34838
|
+
* blocks exactly like `blob:`. Copying it into the static/public directory is the
|
|
34839
|
+
* option that works everywhere.
|
|
34840
|
+
* - Any failure (load error, unknown op, timeout, result mismatch) falls back to the main thread.
|
|
34392
34841
|
* @example
|
|
34842
|
+
* // offload data conversion on a Worker, using the inline Blob worker
|
|
34393
34843
|
* boost: {
|
|
34394
34844
|
* useCssRule: true,
|
|
34395
|
-
* useWorker:
|
|
34845
|
+
* useWorker: true
|
|
34846
|
+
* }
|
|
34847
|
+
* @example
|
|
34848
|
+
* // offload only past ~5,000 cells
|
|
34849
|
+
* boost: {
|
|
34850
|
+
* useWorker: "auto"
|
|
34851
|
+
* }
|
|
34852
|
+
* @example
|
|
34853
|
+
* // strict CSP: serve the shipped script and point at it.
|
|
34854
|
+
* // 'useWorker' still has to be on - 'workerUrl' alone offloads nothing.
|
|
34855
|
+
* boost: {
|
|
34856
|
+
* useWorker: true,
|
|
34857
|
+
* workerUrl: "$YOUR_PATH/dist/billboard.worker.js"
|
|
34396
34858
|
* }
|
|
34859
|
+
* @example
|
|
34860
|
+
* // ESM: the file is reachable as a package subpath.
|
|
34861
|
+
* // Vite - '?url' resolves it, but assets under 4KB are inlined as a 'data:' URI,
|
|
34862
|
+
* // which a strict CSP rejects. Opt that one file out of inlining:
|
|
34863
|
+
* //
|
|
34864
|
+
* // // vite.config.js
|
|
34865
|
+
* // export default {
|
|
34866
|
+
* // build: {
|
|
34867
|
+
* // assetsInlineLimit: path => /billboard\.worker\.js$/.test(path) ? false : undefined
|
|
34868
|
+
* // }
|
|
34869
|
+
* // };
|
|
34870
|
+
* import bb, {bar} from "billboard.js";
|
|
34871
|
+
* import workerUrl from "billboard.js/dist/billboard.worker.js?url";
|
|
34872
|
+
*
|
|
34873
|
+
* bb.generate({
|
|
34874
|
+
* boost: {useWorker: true, workerUrl},
|
|
34875
|
+
* data: {columns: [["data1", 30, 200, 100]], type: bar()}
|
|
34876
|
+
* });
|
|
34877
|
+
* @example
|
|
34878
|
+
* // ESM, bundler-agnostic: copy the file into the served static directory
|
|
34879
|
+
* // cp node_modules/billboard.js/dist/billboard.worker.js public/
|
|
34880
|
+
* bb.generate({
|
|
34881
|
+
* boost: {useWorker: true, workerUrl: "/billboard.worker.js"},
|
|
34882
|
+
* data: {columns: [["data1", 30, 200, 100]]}
|
|
34883
|
+
* });
|
|
34397
34884
|
*/
|
|
34398
34885
|
boost_useCssRule: false,
|
|
34399
|
-
boost_useWorker: false
|
|
34886
|
+
boost_useWorker: false,
|
|
34887
|
+
boost_workerUrl: void 0
|
|
34400
34888
|
});
|
|
34401
34889
|
|
|
34402
34890
|
;// ./src/config/Options/common/color.ts
|
|
@@ -34407,9 +34895,9 @@ const $ZOOM = {
|
|
|
34407
34895
|
* @memberof Options
|
|
34408
34896
|
* @type {object}
|
|
34409
34897
|
* @property {object} color color object
|
|
34410
|
-
* @property {string|object|(
|
|
34898
|
+
* @property {string|object|function(DataItem): string} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
|
|
34411
34899
|
* @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.
|
|
34412
|
-
* @property {(
|
|
34900
|
+
* @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).
|
|
34413
34901
|
* - **NOTE:** The pattern element's id will be defined as `bb-colorize-pattern-$COLOR-VALUE`.<br>
|
|
34414
34902
|
* ex. When color pattern value is `['red', '#fff']` and defined 2 patterns,then ids for pattern elements are:<br>
|
|
34415
34903
|
* - `bb-colorize-pattern-red`
|
|
@@ -36472,7 +36960,9 @@ class Element {
|
|
|
36472
36960
|
x: null,
|
|
36473
36961
|
y: null,
|
|
36474
36962
|
y2: null,
|
|
36475
|
-
subX: null
|
|
36963
|
+
subX: null,
|
|
36964
|
+
subY: null,
|
|
36965
|
+
subY2: null
|
|
36476
36966
|
},
|
|
36477
36967
|
axisTooltip: {
|
|
36478
36968
|
x: null,
|
|
@@ -36587,6 +37077,7 @@ class State {
|
|
|
36587
37077
|
loading: void 0,
|
|
36588
37078
|
// Zoom/subchart domain (different from current.domain which is for rendering)
|
|
36589
37079
|
domain: void 0,
|
|
37080
|
+
subchartSourceTypes: void 0,
|
|
36590
37081
|
current: {
|
|
36591
37082
|
// current domain value. Assigned when is zoom is called
|
|
36592
37083
|
domain: void 0,
|
|
@@ -37290,28 +37781,148 @@ function generateWait() {
|
|
|
37290
37781
|
;// ./src/module/worker.ts
|
|
37291
37782
|
|
|
37292
37783
|
const cache = {};
|
|
37784
|
+
const disabledKeys = /* @__PURE__ */ new Set();
|
|
37785
|
+
const verifiedOps = /* @__PURE__ */ new Map();
|
|
37786
|
+
const DEFAULT_WORKER_TIMEOUT = 5e3;
|
|
37787
|
+
const VERIFY_SAMPLE_SIZE = 3;
|
|
37293
37788
|
let messageId = 0;
|
|
37294
|
-
function
|
|
37295
|
-
|
|
37296
|
-
|
|
37297
|
-
|
|
37298
|
-
|
|
37789
|
+
function getWorkerSrc() {
|
|
37790
|
+
try {
|
|
37791
|
+
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})({});";
|
|
37792
|
+
} catch (e) {
|
|
37793
|
+
return "";
|
|
37794
|
+
}
|
|
37795
|
+
}
|
|
37796
|
+
function getWorkerAPI() {
|
|
37797
|
+
const { Blob, Worker, URL } = win;
|
|
37798
|
+
return Worker && Blob && (URL == null ? void 0 : URL.createObjectURL) && (URL == null ? void 0 : URL.revokeObjectURL) ? { Blob, Worker, URL } : null;
|
|
37799
|
+
}
|
|
37800
|
+
function getWorkerConstructor() {
|
|
37801
|
+
return win.Worker || null;
|
|
37802
|
+
}
|
|
37803
|
+
function normalizeWorkerOptions(options) {
|
|
37804
|
+
var _a, _b;
|
|
37805
|
+
return typeof options === "number" ? { timeout: options, workerUrl: "" } : {
|
|
37806
|
+
timeout: (_a = options == null ? void 0 : options.timeout) != null ? _a : DEFAULT_WORKER_TIMEOUT,
|
|
37807
|
+
workerUrl: (_b = options == null ? void 0 : options.workerUrl) != null ? _b : ""
|
|
37808
|
+
};
|
|
37809
|
+
}
|
|
37810
|
+
function releaseWorker(key, disable = false) {
|
|
37811
|
+
var _a, _b;
|
|
37812
|
+
const cached = cache[key];
|
|
37813
|
+
if (disable) {
|
|
37814
|
+
disabledKeys.add(key);
|
|
37815
|
+
}
|
|
37816
|
+
if (cached) {
|
|
37817
|
+
(_a = cached.worker) == null ? void 0 : _a.terminate();
|
|
37818
|
+
cached.revoke && ((_b = getWorkerAPI()) == null ? void 0 : _b.URL.revokeObjectURL(cached.src));
|
|
37819
|
+
delete cache[key];
|
|
37820
|
+
}
|
|
37821
|
+
for (const verified of verifiedOps.keys()) {
|
|
37822
|
+
if (verified.startsWith(`${key}:`)) {
|
|
37823
|
+
verifiedOps.delete(verified);
|
|
37824
|
+
}
|
|
37825
|
+
}
|
|
37826
|
+
}
|
|
37827
|
+
function isSameResult(actual, expected) {
|
|
37828
|
+
if (actual === expected) {
|
|
37829
|
+
return true;
|
|
37830
|
+
}
|
|
37831
|
+
try {
|
|
37832
|
+
return JSON.stringify(actual) === JSON.stringify(expected);
|
|
37833
|
+
} catch (e) {
|
|
37834
|
+
return true;
|
|
37835
|
+
}
|
|
37836
|
+
}
|
|
37837
|
+
function getVerifySample(args) {
|
|
37838
|
+
const [data, ...rest] = args;
|
|
37839
|
+
if (!Array.isArray(data)) {
|
|
37840
|
+
return args;
|
|
37841
|
+
}
|
|
37842
|
+
return [
|
|
37843
|
+
data.slice(0, VERIFY_SAMPLE_SIZE).map(
|
|
37844
|
+
(entry) => (
|
|
37845
|
+
// +1: a column/row entry leads with its name, which the values follow
|
|
37846
|
+
Array.isArray(entry) ? entry.slice(0, VERIFY_SAMPLE_SIZE + 1) : entry
|
|
37847
|
+
)
|
|
37848
|
+
),
|
|
37849
|
+
...rest
|
|
37850
|
+
];
|
|
37851
|
+
}
|
|
37852
|
+
function request(worker, op, args, timeout) {
|
|
37853
|
+
const id = ++messageId;
|
|
37854
|
+
let settled = false;
|
|
37855
|
+
let cleanup;
|
|
37856
|
+
const promise = new Promise((resolve, reject) => {
|
|
37857
|
+
const settle = (fn, value) => {
|
|
37858
|
+
if (!settled) {
|
|
37859
|
+
settled = true;
|
|
37860
|
+
cleanup();
|
|
37861
|
+
fn(value);
|
|
37862
|
+
}
|
|
37863
|
+
};
|
|
37864
|
+
const handler = function(e) {
|
|
37865
|
+
var _a;
|
|
37866
|
+
if (((_a = e.data) == null ? void 0 : _a.id) === id) {
|
|
37867
|
+
e.data.error ? settle(reject, new Error(e.data.error)) : settle(resolve, e.data.result);
|
|
37868
|
+
}
|
|
37869
|
+
};
|
|
37870
|
+
const errorHandler = function() {
|
|
37871
|
+
settle(reject, new Error("worker error"));
|
|
37872
|
+
};
|
|
37873
|
+
const timer = setTimeout(() => settle(reject, new Error("worker timeout")), timeout);
|
|
37874
|
+
cleanup = () => {
|
|
37875
|
+
clearTimeout(timer);
|
|
37876
|
+
worker.removeEventListener("message", handler);
|
|
37877
|
+
worker.removeEventListener("error", errorHandler);
|
|
37878
|
+
};
|
|
37879
|
+
worker.addEventListener("message", handler);
|
|
37880
|
+
worker.addEventListener("error", errorHandler);
|
|
37881
|
+
});
|
|
37882
|
+
try {
|
|
37883
|
+
worker.postMessage({ args, id, op });
|
|
37884
|
+
} catch (error) {
|
|
37885
|
+
settled = true;
|
|
37886
|
+
cleanup();
|
|
37887
|
+
throw error;
|
|
37888
|
+
}
|
|
37889
|
+
return promise;
|
|
37890
|
+
}
|
|
37891
|
+
function startVerify(worker, verifyKey, op, fn, args, timeout) {
|
|
37892
|
+
const sample = getVerifySample(args);
|
|
37893
|
+
const check = request(worker, op, sample, timeout).then((result) => isSameResult(result, fn(...sample)), () => false).then((matched) => {
|
|
37894
|
+
matched ? verifiedOps.set(verifyKey, true) : verifiedOps.delete(verifyKey);
|
|
37895
|
+
return matched;
|
|
37896
|
+
});
|
|
37897
|
+
verifiedOps.set(verifyKey, check);
|
|
37898
|
+
return check;
|
|
37899
|
+
}
|
|
37900
|
+
function getOrCreateWorkerResources(op, workerUrl = "") {
|
|
37901
|
+
const hasWorker = !!getWorkerConstructor();
|
|
37902
|
+
const api = workerUrl ? null : getWorkerAPI();
|
|
37903
|
+
const src = workerUrl ? "" : getWorkerSrc();
|
|
37904
|
+
const key = workerUrl || "blob";
|
|
37905
|
+
if (!hasWorker || !workerUrl && (!api || !src) || disabledKeys.has(key)) {
|
|
37906
|
+
return null;
|
|
37907
|
+
}
|
|
37299
37908
|
if (!(key in cache)) {
|
|
37300
37909
|
try {
|
|
37301
|
-
|
|
37302
|
-
|
|
37303
|
-
|
|
37304
|
-
|
|
37305
|
-
|
|
37306
|
-
|
|
37307
|
-
|
|
37308
|
-
|
|
37309
|
-
|
|
37310
|
-
|
|
37311
|
-
|
|
37312
|
-
|
|
37313
|
-
|
|
37314
|
-
|
|
37910
|
+
if (workerUrl) {
|
|
37911
|
+
cache[key] = {
|
|
37912
|
+
revoke: false,
|
|
37913
|
+
src: workerUrl,
|
|
37914
|
+
worker: null
|
|
37915
|
+
};
|
|
37916
|
+
} else if (api) {
|
|
37917
|
+
const blob = new api.Blob([src], {
|
|
37918
|
+
type: "text/javascript"
|
|
37919
|
+
});
|
|
37920
|
+
cache[key] = {
|
|
37921
|
+
revoke: true,
|
|
37922
|
+
src: api.URL.createObjectURL(blob),
|
|
37923
|
+
worker: null
|
|
37924
|
+
};
|
|
37925
|
+
}
|
|
37315
37926
|
} catch (e) {
|
|
37316
37927
|
return null;
|
|
37317
37928
|
}
|
|
@@ -37320,59 +37931,71 @@ function getOrCreateWorkerResources(fn, depsFn) {
|
|
|
37320
37931
|
}
|
|
37321
37932
|
function getWorker(key, src) {
|
|
37322
37933
|
const cached = cache[key];
|
|
37323
|
-
|
|
37934
|
+
const Worker = getWorkerConstructor();
|
|
37935
|
+
if (!cached || !Worker || disabledKeys.has(key)) {
|
|
37324
37936
|
return null;
|
|
37325
37937
|
}
|
|
37326
37938
|
if (!cached.worker) {
|
|
37327
37939
|
try {
|
|
37328
|
-
cached.worker = new
|
|
37940
|
+
cached.worker = new Worker(src);
|
|
37329
37941
|
} catch (e) {
|
|
37942
|
+
releaseWorker(key, true);
|
|
37330
37943
|
return null;
|
|
37331
37944
|
}
|
|
37332
|
-
if (cached.worker) {
|
|
37333
|
-
cached.worker.onerror = function(e) {
|
|
37334
|
-
console.error ? console.error(e) : console.log(e);
|
|
37335
|
-
};
|
|
37336
|
-
}
|
|
37337
37945
|
}
|
|
37338
37946
|
return cached.worker;
|
|
37339
37947
|
}
|
|
37340
|
-
function runWorker(useWorker = true, fn, callback,
|
|
37341
|
-
|
|
37948
|
+
function runWorker(useWorker = true, op, fn, callback, options) {
|
|
37949
|
+
const { timeout, workerUrl } = normalizeWorkerOptions(options);
|
|
37950
|
+
const runSync = function(...args) {
|
|
37342
37951
|
const res = fn(...args);
|
|
37343
37952
|
callback(res);
|
|
37344
37953
|
};
|
|
37345
|
-
|
|
37346
|
-
|
|
37347
|
-
const
|
|
37348
|
-
|
|
37954
|
+
let runFn = runSync;
|
|
37955
|
+
if (useWorker) {
|
|
37956
|
+
const workerResources = getOrCreateWorkerResources(op, workerUrl);
|
|
37957
|
+
const worker = workerResources ? getWorker(workerResources.key, workerResources.src) : null;
|
|
37958
|
+
if (worker && workerResources) {
|
|
37959
|
+
const { key } = workerResources;
|
|
37349
37960
|
runFn = function(...args) {
|
|
37350
|
-
|
|
37351
|
-
const
|
|
37352
|
-
|
|
37353
|
-
|
|
37354
|
-
|
|
37355
|
-
callback(e.data.result);
|
|
37356
|
-
}
|
|
37961
|
+
var _a;
|
|
37962
|
+
const fallback = () => {
|
|
37963
|
+
releaseWorker(key, true);
|
|
37964
|
+
runFn = runSync;
|
|
37965
|
+
runSync(...args);
|
|
37357
37966
|
};
|
|
37358
|
-
|
|
37359
|
-
|
|
37967
|
+
try {
|
|
37968
|
+
const verifyKey = `${key}:${op}`;
|
|
37969
|
+
const verified = (_a = verifiedOps.get(verifyKey)) != null ? _a : startVerify(worker, verifyKey, op, fn, args, timeout);
|
|
37970
|
+
request(worker, op, args, timeout).then((result) => {
|
|
37971
|
+
if (verified === true) {
|
|
37972
|
+
callback(result);
|
|
37973
|
+
} else {
|
|
37974
|
+
verified.then((matched) => matched ? callback(result) : fallback());
|
|
37975
|
+
}
|
|
37976
|
+
}, fallback);
|
|
37977
|
+
} catch (e) {
|
|
37978
|
+
fallback();
|
|
37979
|
+
}
|
|
37360
37980
|
};
|
|
37361
37981
|
}
|
|
37362
37982
|
}
|
|
37363
37983
|
return runFn;
|
|
37364
37984
|
}
|
|
37365
37985
|
function cleanupWorkers() {
|
|
37986
|
+
const api = getWorkerAPI();
|
|
37366
37987
|
for (const key in cache) {
|
|
37367
37988
|
const cached = cache[key];
|
|
37368
37989
|
if (cached.worker) {
|
|
37369
37990
|
cached.worker.terminate();
|
|
37370
37991
|
}
|
|
37371
37992
|
if (cached.src) {
|
|
37372
|
-
|
|
37993
|
+
cached.revoke && (api == null ? void 0 : api.URL.revokeObjectURL(cached.src));
|
|
37373
37994
|
}
|
|
37374
37995
|
delete cache[key];
|
|
37375
37996
|
}
|
|
37997
|
+
disabledKeys.clear();
|
|
37998
|
+
verifiedOps.clear();
|
|
37376
37999
|
}
|
|
37377
38000
|
|
|
37378
38001
|
;// ./src/module/dsv.ts
|
|
@@ -37611,6 +38234,19 @@ function convert_helper_tsv(tsv2) {
|
|
|
37611
38234
|
|
|
37612
38235
|
|
|
37613
38236
|
|
|
38237
|
+
const WORKER_CELL_THRESHOLD = 5e3;
|
|
38238
|
+
function _getCellCount(data) {
|
|
38239
|
+
var _a, _b;
|
|
38240
|
+
const first = data[0];
|
|
38241
|
+
if (isArray(first)) {
|
|
38242
|
+
let count = 0;
|
|
38243
|
+
for (let i = 0, len = data.length; i < len; i++) {
|
|
38244
|
+
count += (_b = (_a = data[i]) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
38245
|
+
}
|
|
38246
|
+
return count;
|
|
38247
|
+
}
|
|
38248
|
+
return data.length * Object.keys(first != null ? first : {}).length;
|
|
38249
|
+
}
|
|
37614
38250
|
function _getDataKeyForJson(keysParam, config) {
|
|
37615
38251
|
const keys = keysParam || (config == null ? void 0 : config.data_keys);
|
|
37616
38252
|
if (keys == null ? void 0 : keys.x) {
|
|
@@ -37656,7 +38292,15 @@ function _setXS(ids, data, params) {
|
|
|
37656
38292
|
*/
|
|
37657
38293
|
convertData(args, callback) {
|
|
37658
38294
|
const { config } = this;
|
|
37659
|
-
const useWorker = (d) =>
|
|
38295
|
+
const useWorker = (d) => {
|
|
38296
|
+
if (!(d == null ? void 0 : d.length) || isEmpty(d[0])) {
|
|
38297
|
+
return false;
|
|
38298
|
+
}
|
|
38299
|
+
return config.boost_useWorker === "auto" ? _getCellCount(d) >= WORKER_CELL_THRESHOLD : !!config.boost_useWorker;
|
|
38300
|
+
};
|
|
38301
|
+
const workerOptions = config.boost_workerUrl ? {
|
|
38302
|
+
workerUrl: config.boost_workerUrl
|
|
38303
|
+
} : void 0;
|
|
37660
38304
|
let data = args;
|
|
37661
38305
|
if (args.bindto) {
|
|
37662
38306
|
data = {};
|
|
@@ -37676,14 +38320,16 @@ function _setXS(ids, data, params) {
|
|
|
37676
38320
|
callback
|
|
37677
38321
|
);
|
|
37678
38322
|
} else if (data.json) {
|
|
37679
|
-
runWorker(useWorker(data.json), json,
|
|
38323
|
+
runWorker(useWorker(data.json), "json", json, callback, workerOptions)(
|
|
37680
38324
|
data.json,
|
|
37681
38325
|
_getDataKeyForJson(data.keys, config)
|
|
37682
38326
|
);
|
|
37683
38327
|
} else if (data.rows) {
|
|
37684
|
-
runWorker(useWorker(data.rows), rows, callback)(data.rows);
|
|
38328
|
+
runWorker(useWorker(data.rows), "rows", rows, callback, workerOptions)(data.rows);
|
|
37685
38329
|
} else if (data.columns) {
|
|
37686
|
-
runWorker(useWorker(data.columns), columns, callback)(
|
|
38330
|
+
runWorker(useWorker(data.columns), "columns", columns, callback, workerOptions)(
|
|
38331
|
+
data.columns
|
|
38332
|
+
);
|
|
37687
38333
|
} else if (args.bindto) {
|
|
37688
38334
|
throw Error("url or json or rows or columns is required.");
|
|
37689
38335
|
}
|
|
@@ -37800,6 +38446,7 @@ function _setXS(ids, data, params) {
|
|
|
37800
38446
|
|
|
37801
38447
|
|
|
37802
38448
|
|
|
38449
|
+
|
|
37803
38450
|
const rangedDataKeyIndex = {
|
|
37804
38451
|
areaRange: { high: 0, mid: 1, low: 2 },
|
|
37805
38452
|
candlestick: { open: 0, high: 1, low: 2, close: 3, volume: 4 }
|
|
@@ -38850,9 +39497,10 @@ function normalizeTargetIds(targetIds) {
|
|
|
38850
39497
|
* @private
|
|
38851
39498
|
*/
|
|
38852
39499
|
isBarRangeType(d) {
|
|
39500
|
+
var _a;
|
|
38853
39501
|
const $$ = this;
|
|
38854
39502
|
const { value } = d;
|
|
38855
|
-
return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(isNumber);
|
|
39503
|
+
return $$.isBarType(d) && !((_a = $$.isSubchartSourceTypeOf) == null ? void 0 : _a.call($$, d, TYPE.CANDLESTICK)) && isArray(value) && value.length >= 2 && value.every(isNumber);
|
|
38856
39504
|
},
|
|
38857
39505
|
/**
|
|
38858
39506
|
* Get data object by id
|
|
@@ -39664,107 +40312,12 @@ const RE_SELECTOR_SUFFIX = /[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`
|
|
|
39664
40312
|
}
|
|
39665
40313
|
});
|
|
39666
40314
|
|
|
39667
|
-
;// ./node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js
|
|
39668
|
-
class InternMap extends Map {
|
|
39669
|
-
constructor(entries, key = keyof) {
|
|
39670
|
-
super();
|
|
39671
|
-
Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
|
|
39672
|
-
if (entries != null) for (const [key2, value] of entries) this.set(key2, value);
|
|
39673
|
-
}
|
|
39674
|
-
get(key) {
|
|
39675
|
-
return super.get(intern_get(this, key));
|
|
39676
|
-
}
|
|
39677
|
-
has(key) {
|
|
39678
|
-
return super.has(intern_get(this, key));
|
|
39679
|
-
}
|
|
39680
|
-
set(key, value) {
|
|
39681
|
-
return super.set(intern_set(this, key), value);
|
|
39682
|
-
}
|
|
39683
|
-
delete(key) {
|
|
39684
|
-
return super.delete(intern_delete(this, key));
|
|
39685
|
-
}
|
|
39686
|
-
}
|
|
39687
|
-
class InternSet extends Set {
|
|
39688
|
-
constructor(values, key = keyof) {
|
|
39689
|
-
super();
|
|
39690
|
-
Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
|
|
39691
|
-
if (values != null) for (const value of values) this.add(value);
|
|
39692
|
-
}
|
|
39693
|
-
has(value) {
|
|
39694
|
-
return super.has(intern_get(this, value));
|
|
39695
|
-
}
|
|
39696
|
-
add(value) {
|
|
39697
|
-
return super.add(intern_set(this, value));
|
|
39698
|
-
}
|
|
39699
|
-
delete(value) {
|
|
39700
|
-
return super.delete(intern_delete(this, value));
|
|
39701
|
-
}
|
|
39702
|
-
}
|
|
39703
|
-
function intern_get({ _intern, _key }, value) {
|
|
39704
|
-
const key = _key(value);
|
|
39705
|
-
return _intern.has(key) ? _intern.get(key) : value;
|
|
39706
|
-
}
|
|
39707
|
-
function intern_set({ _intern, _key }, value) {
|
|
39708
|
-
const key = _key(value);
|
|
39709
|
-
if (_intern.has(key)) return _intern.get(key);
|
|
39710
|
-
_intern.set(key, value);
|
|
39711
|
-
return value;
|
|
39712
|
-
}
|
|
39713
|
-
function intern_delete({ _intern, _key }, value) {
|
|
39714
|
-
const key = _key(value);
|
|
39715
|
-
if (_intern.has(key)) {
|
|
39716
|
-
value = _intern.get(key);
|
|
39717
|
-
_intern.delete(key);
|
|
39718
|
-
}
|
|
39719
|
-
return value;
|
|
39720
|
-
}
|
|
39721
|
-
function keyof(value) {
|
|
39722
|
-
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
|
39723
|
-
}
|
|
39724
|
-
|
|
39725
|
-
;// ./node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js
|
|
39726
|
-
|
|
39727
|
-
|
|
39728
|
-
const implicit = /* @__PURE__ */ Symbol("implicit");
|
|
39729
|
-
function ordinal() {
|
|
39730
|
-
var index = new InternMap(), domain = [], range = [], unknown = implicit;
|
|
39731
|
-
function scale(d) {
|
|
39732
|
-
let i = index.get(d);
|
|
39733
|
-
if (i === void 0) {
|
|
39734
|
-
if (unknown !== implicit) return unknown;
|
|
39735
|
-
index.set(d, i = domain.push(d) - 1);
|
|
39736
|
-
}
|
|
39737
|
-
return range[i % range.length];
|
|
39738
|
-
}
|
|
39739
|
-
scale.domain = function(_) {
|
|
39740
|
-
if (!arguments.length) return domain.slice();
|
|
39741
|
-
domain = [], index = new InternMap();
|
|
39742
|
-
for (const value of _) {
|
|
39743
|
-
if (index.has(value)) continue;
|
|
39744
|
-
index.set(value, domain.push(value) - 1);
|
|
39745
|
-
}
|
|
39746
|
-
return scale;
|
|
39747
|
-
};
|
|
39748
|
-
scale.range = function(_) {
|
|
39749
|
-
return arguments.length ? (range = Array.from(_), scale) : range.slice();
|
|
39750
|
-
};
|
|
39751
|
-
scale.unknown = function(_) {
|
|
39752
|
-
return arguments.length ? (unknown = _, scale) : unknown;
|
|
39753
|
-
};
|
|
39754
|
-
scale.copy = function() {
|
|
39755
|
-
return ordinal(domain, range).unknown(unknown);
|
|
39756
|
-
};
|
|
39757
|
-
initRange.apply(scale, arguments);
|
|
39758
|
-
return scale;
|
|
39759
|
-
}
|
|
39760
|
-
|
|
39761
40315
|
;// ./src/ChartInternal/internals/color.ts
|
|
39762
40316
|
|
|
39763
40317
|
|
|
39764
40318
|
|
|
39765
40319
|
|
|
39766
40320
|
|
|
39767
|
-
|
|
39768
40321
|
const _colorizePattern = (pattern, color, id) => {
|
|
39769
40322
|
const node = src_select(pattern.cloneNode(true));
|
|
39770
40323
|
node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color);
|
|
@@ -39806,7 +40359,7 @@ const schemeCategory10 = [
|
|
|
39806
40359
|
const { $el, config } = $$;
|
|
39807
40360
|
const ids = [];
|
|
39808
40361
|
const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
|
|
39809
|
-
let pattern = notEmpty(config.color_pattern) ? config.color_pattern :
|
|
40362
|
+
let pattern = notEmpty(config.color_pattern) ? config.color_pattern : [..._getColorFromCss($el.chart) || schemeCategory10];
|
|
39810
40363
|
const originalColorPattern = pattern;
|
|
39811
40364
|
if (isFunction(config.color_tiles)) {
|
|
39812
40365
|
const tiles = config.color_tiles.bind($$.api)();
|
|
@@ -41508,13 +42061,15 @@ function brushEmpty(ctx) {
|
|
|
41508
42061
|
|
|
41509
42062
|
function getTargetDomainCacheKey($$, targets) {
|
|
41510
42063
|
return targets.map((target) => {
|
|
41511
|
-
var _a, _b, _c, _d;
|
|
42064
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
41512
42065
|
const { values } = target;
|
|
41513
42066
|
const first = values[0];
|
|
41514
42067
|
const last = values[values.length - 1];
|
|
41515
42068
|
const firstX = first ? (_b = (_a = $$.getXCacheKey) == null ? void 0 : _a.call($$, first.x)) != null ? _b : first.x : "";
|
|
41516
42069
|
const lastX = last ? (_d = (_c = $$.getXCacheKey) == null ? void 0 : _c.call($$, last.x)) != null ? _d : last.x : "";
|
|
41517
|
-
|
|
42070
|
+
const targetType = (_f = (_e = $$.getTargetType) == null ? void 0 : _e.call($$, target)) != null ? _f : "";
|
|
42071
|
+
const sourceType = (_i = (_h = (_g = $$.state) == null ? void 0 : _g.subchartSourceTypes) == null ? void 0 : _h[target.id]) != null ? _i : "";
|
|
42072
|
+
return `${target.id}:${targetType}:${sourceType}:${values.length}:${firstX}:${lastX}`;
|
|
41518
42073
|
}).join("|");
|
|
41519
42074
|
}
|
|
41520
42075
|
function canCacheTargetDomain($$, targets) {
|
|
@@ -41549,12 +42104,13 @@ function updateMinMaxFromValues(minMax, values) {
|
|
|
41549
42104
|
}
|
|
41550
42105
|
}
|
|
41551
42106
|
function getTargetValueMinMax($$, targets) {
|
|
41552
|
-
var _a, _b;
|
|
42107
|
+
var _a, _b, _c, _d;
|
|
41553
42108
|
const minMax = { min: void 0, max: void 0 };
|
|
41554
42109
|
const hasAxis = $$.state.hasAxis;
|
|
41555
42110
|
for (let i = 0; i < targets.length; i++) {
|
|
41556
42111
|
const target = targets[i];
|
|
41557
42112
|
const isCandlestick = (_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, target);
|
|
42113
|
+
const isSubchartCandlestick = !isCandlestick && !!((_b = $$.isSubchartSourceTypeOf) == null ? void 0 : _b.call($$, target, TYPE.CANDLESTICK));
|
|
41558
42114
|
const { values } = target;
|
|
41559
42115
|
for (let j = 0; j < values.length; j++) {
|
|
41560
42116
|
const row = values[j];
|
|
@@ -41562,14 +42118,17 @@ function getTargetValueMinMax($$, targets) {
|
|
|
41562
42118
|
if (!(isValue(value) || value === null)) {
|
|
41563
42119
|
continue;
|
|
41564
42120
|
}
|
|
41565
|
-
|
|
42121
|
+
const subchartCandlestickValue = isSubchartCandlestick ? (_c = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _c.call($$, row, true) : void 0;
|
|
42122
|
+
if (isNumber(subchartCandlestickValue)) {
|
|
42123
|
+
value = subchartCandlestickValue;
|
|
42124
|
+
} else if (value !== null && (isCandlestick || isSubchartCandlestick)) {
|
|
41566
42125
|
value = Array.isArray(value) ? value.slice(0, 4) : [value.open, value.high, value.low, value.close];
|
|
41567
42126
|
}
|
|
41568
42127
|
if (Array.isArray(value)) {
|
|
41569
42128
|
updateMinMaxFromValues(minMax, value);
|
|
41570
42129
|
} else if (isObject(value) && "high" in value) {
|
|
41571
42130
|
updateMinMaxFromValues(minMax, Object.values(value));
|
|
41572
|
-
} else if ((
|
|
42131
|
+
} else if ((_d = $$.isBubbleZType) == null ? void 0 : _d.call($$, row)) {
|
|
41573
42132
|
updateMinMax(minMax, hasAxis && $$.getBubbleZData(value, "y"));
|
|
41574
42133
|
} else {
|
|
41575
42134
|
updateMinMax(minMax, value);
|
|
@@ -41596,7 +42155,7 @@ function getTargetXMinMax(targets, type) {
|
|
|
41596
42155
|
* Get both min and max Y domain values in a single pass.
|
|
41597
42156
|
* Avoids calling getValuesAsIdKeyed twice.
|
|
41598
42157
|
* @param {Array} targets Target data
|
|
41599
|
-
* @returns {
|
|
42158
|
+
* @returns {Array.<number|Date|undefined>} [min, max]
|
|
41600
42159
|
* @private
|
|
41601
42160
|
*/
|
|
41602
42161
|
getYDomainMinMaxBoth(targets) {
|
|
@@ -44047,13 +44606,23 @@ function batchGetBBox(elements) {
|
|
|
44047
44606
|
const textNode = textNodes.filter((node) => node.data.id === id);
|
|
44048
44607
|
const translate = getTranslation(textNode.node());
|
|
44049
44608
|
const calcHypo = (x, y) => Math.sqrt(x * x + y * y);
|
|
44050
|
-
textNode.node()
|
|
44609
|
+
if (!textNode.node()) {
|
|
44610
|
+
return;
|
|
44611
|
+
}
|
|
44612
|
+
const fontSize = parseInt(textNode.style("font-size"), 10);
|
|
44613
|
+
const overlapStates = [];
|
|
44614
|
+
filteredTextNodes.each(function() {
|
|
44051
44615
|
const coordinate = getTranslation(this);
|
|
44052
|
-
const
|
|
44053
|
-
const nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : filteredTextNode;
|
|
44616
|
+
const nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : src_select(this);
|
|
44054
44617
|
const overlapsX = Math.ceil(Math.abs(translate.e - coordinate.e)) < Math.ceil(nodeForWidth.node().getComputedTextLength());
|
|
44055
|
-
const overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) <
|
|
44056
|
-
|
|
44618
|
+
const overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) < fontSize;
|
|
44619
|
+
overlapStates.push({
|
|
44620
|
+
node: this,
|
|
44621
|
+
overlaps: overlapsX && overlapsY
|
|
44622
|
+
});
|
|
44623
|
+
});
|
|
44624
|
+
overlapStates.forEach(({ node, overlaps }) => {
|
|
44625
|
+
src_select(node).classed($TEXT.TextOverlapping, overlaps);
|
|
44057
44626
|
});
|
|
44058
44627
|
},
|
|
44059
44628
|
/**
|
|
@@ -44737,6 +45306,12 @@ const RE_TOOLTIP_TPL = /{{(.*)}}/;
|
|
|
44737
45306
|
} else if (target === "subX") {
|
|
44738
45307
|
x = 0;
|
|
44739
45308
|
y = isRotated ? 0 : state.height2;
|
|
45309
|
+
} else if (target === "subY") {
|
|
45310
|
+
x = 0;
|
|
45311
|
+
y = isRotated ? state.height2 : 0;
|
|
45312
|
+
} else if (target === "subY2") {
|
|
45313
|
+
x = isRotated ? 0 : state.width2;
|
|
45314
|
+
y = isRotated ? -1 : 0;
|
|
44740
45315
|
} else if (target === "arc") {
|
|
44741
45316
|
x = state.arcWidth / 2;
|
|
44742
45317
|
y = state.arcHeight / 2;
|
|
@@ -44807,6 +45382,96 @@ const INTERPOLATION_TYPES = /* @__PURE__ */ new Set([
|
|
|
44807
45382
|
isValidChartType(type) {
|
|
44808
45383
|
return !!(type && Object.values(TYPE).indexOf(type) > -1);
|
|
44809
45384
|
},
|
|
45385
|
+
/**
|
|
45386
|
+
* Get the chart type to use for the subchart target.
|
|
45387
|
+
* subchart.types > subchart.type > data.types > data.type > line
|
|
45388
|
+
* @param {object|string} d Target data or id
|
|
45389
|
+
* @returns {string}
|
|
45390
|
+
* @private
|
|
45391
|
+
*/
|
|
45392
|
+
getSubchartTargetType(d) {
|
|
45393
|
+
const $$ = this;
|
|
45394
|
+
const { config } = $$;
|
|
45395
|
+
const id = isString(d) ? d : d == null ? void 0 : d.id;
|
|
45396
|
+
const subchartTypes = config.subchart_types || {};
|
|
45397
|
+
const subchartType = config.subchart_type;
|
|
45398
|
+
const dataTypes = config.data_types || {};
|
|
45399
|
+
const targetSubchartType = id && subchartTypes[id];
|
|
45400
|
+
if (targetSubchartType && $$.isValidChartType(targetSubchartType)) {
|
|
45401
|
+
return targetSubchartType;
|
|
45402
|
+
} else if (subchartType && $$.isValidChartType(subchartType)) {
|
|
45403
|
+
return subchartType;
|
|
45404
|
+
}
|
|
45405
|
+
return id && dataTypes[id] || config.data_type || TYPE.LINE;
|
|
45406
|
+
},
|
|
45407
|
+
/**
|
|
45408
|
+
* Get the regular chart type configured for the target.
|
|
45409
|
+
* @param {object|string} d Target data or id
|
|
45410
|
+
* @returns {string}
|
|
45411
|
+
* @private
|
|
45412
|
+
*/
|
|
45413
|
+
getTargetType(d) {
|
|
45414
|
+
var _a;
|
|
45415
|
+
const { config } = this;
|
|
45416
|
+
const id = isString(d) ? d : d == null ? void 0 : d.id;
|
|
45417
|
+
return id && ((_a = config.data_types) == null ? void 0 : _a[id]) || config.data_type || TYPE.LINE;
|
|
45418
|
+
},
|
|
45419
|
+
/**
|
|
45420
|
+
* Get the target's original chart type while subchart.type context is active.
|
|
45421
|
+
* @param {object|string} d Target data or id
|
|
45422
|
+
* @returns {string}
|
|
45423
|
+
* @private
|
|
45424
|
+
*/
|
|
45425
|
+
getSubchartSourceTargetType(d) {
|
|
45426
|
+
const { state } = this;
|
|
45427
|
+
const id = isString(d) ? d : d == null ? void 0 : d.id;
|
|
45428
|
+
const sourceTypes = state.subchartSourceTypes;
|
|
45429
|
+
return id && (sourceTypes == null ? void 0 : sourceTypes[id]) || this.getTargetType(d);
|
|
45430
|
+
},
|
|
45431
|
+
/**
|
|
45432
|
+
* Check whether a target had the given source type before subchart.type remapping.
|
|
45433
|
+
* @param {object|string} d Target data or id
|
|
45434
|
+
* @param {string|Array} type chart type
|
|
45435
|
+
* @returns {boolean}
|
|
45436
|
+
* @private
|
|
45437
|
+
*/
|
|
45438
|
+
isSubchartSourceTypeOf(d, type) {
|
|
45439
|
+
const sourceType = this.getSubchartSourceTargetType(d);
|
|
45440
|
+
return isArray(type) ? type.indexOf(sourceType) >= 0 : sourceType === type;
|
|
45441
|
+
},
|
|
45442
|
+
/**
|
|
45443
|
+
* Run a callback while regular type helpers resolve using subchart.type/types.
|
|
45444
|
+
* @param {function(): unknown} callback Callback to run
|
|
45445
|
+
* @returns {unknown} Callback return value
|
|
45446
|
+
* @private
|
|
45447
|
+
*/
|
|
45448
|
+
withSubchartTypeContext(callback) {
|
|
45449
|
+
const $$ = this;
|
|
45450
|
+
const { config, data, state } = $$;
|
|
45451
|
+
const dataType = config.data_type;
|
|
45452
|
+
const dataTypes = config.data_types;
|
|
45453
|
+
const currentTypes = state.current.types;
|
|
45454
|
+
const sourceTypes = state.subchartSourceTypes;
|
|
45455
|
+
const subchartTypes = {};
|
|
45456
|
+
const subchartSourceTypes = {};
|
|
45457
|
+
const subchartType = config.subchart_type;
|
|
45458
|
+
$$.mapToIds(data.targets).forEach((id) => {
|
|
45459
|
+
subchartSourceTypes[id] = $$.getTargetType(id);
|
|
45460
|
+
subchartTypes[id] = $$.getSubchartTargetType(id);
|
|
45461
|
+
});
|
|
45462
|
+
config.data_type = subchartType && $$.isValidChartType(subchartType) ? subchartType : dataType;
|
|
45463
|
+
config.data_types = subchartTypes;
|
|
45464
|
+
state.current.types = [];
|
|
45465
|
+
state.subchartSourceTypes = subchartSourceTypes;
|
|
45466
|
+
try {
|
|
45467
|
+
return callback();
|
|
45468
|
+
} finally {
|
|
45469
|
+
config.data_type = dataType;
|
|
45470
|
+
config.data_types = dataTypes;
|
|
45471
|
+
state.current.types = currentTypes;
|
|
45472
|
+
state.subchartSourceTypes = sourceTypes;
|
|
45473
|
+
}
|
|
45474
|
+
},
|
|
44810
45475
|
setTargetType(targetIds, type) {
|
|
44811
45476
|
const $$ = this;
|
|
44812
45477
|
const { config, state: { withoutFadeIn } } = $$;
|
|
@@ -44885,9 +45550,8 @@ const INTERPOLATION_TYPES = /* @__PURE__ */ new Set([
|
|
|
44885
45550
|
* @private
|
|
44886
45551
|
*/
|
|
44887
45552
|
isTypeOf(d, type) {
|
|
44888
|
-
var _a;
|
|
44889
45553
|
const id = isString(d) ? d : d.id;
|
|
44890
|
-
const dataType = this.config &&
|
|
45554
|
+
const dataType = this.config && this.getTargetType(id);
|
|
44891
45555
|
return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
|
|
44892
45556
|
},
|
|
44893
45557
|
hasPointType() {
|
|
@@ -45873,6 +46537,7 @@ function stepAfter(context) {
|
|
|
45873
46537
|
|
|
45874
46538
|
|
|
45875
46539
|
|
|
46540
|
+
|
|
45876
46541
|
const CURVE_MAP = {
|
|
45877
46542
|
basis: curve_basis,
|
|
45878
46543
|
"basis-closed": curve_basisClosed,
|
|
@@ -45900,13 +46565,48 @@ function isLinePointGroupType($$, d) {
|
|
|
45900
46565
|
function getLinePointGroupTypeFilter($$) {
|
|
45901
46566
|
return (d) => isLinePointGroupType($$, d);
|
|
45902
46567
|
}
|
|
45903
|
-
function getShapeOffsetValue($$, d) {
|
|
46568
|
+
function getShapeOffsetValue($$, d, isSub) {
|
|
45904
46569
|
var _a, _b, _c;
|
|
46570
|
+
const subchartCandlestickValue = isSub ? getSubchartCandlestickShapeValue($$, d, isSub) : void 0;
|
|
46571
|
+
if (isNumber(subchartCandlestickValue)) {
|
|
46572
|
+
return subchartCandlestickValue;
|
|
46573
|
+
}
|
|
45905
46574
|
if ((_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, d)) {
|
|
45906
46575
|
return (_c = (_b = $$.getCandlestickData) == null ? void 0 : _b.call($$, d)) == null ? void 0 : _c.close;
|
|
45907
46576
|
}
|
|
45908
46577
|
return $$.getBaseValue(d);
|
|
45909
46578
|
}
|
|
46579
|
+
function getSubchartCandlestickShapeValue($$, d, isSub) {
|
|
46580
|
+
var _a, _b, _c;
|
|
46581
|
+
if (!isSub || ((_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, d)) || !((_b = $$.isSubchartSourceTypeOf) == null ? void 0 : _b.call($$, d, TYPE.CANDLESTICK))) {
|
|
46582
|
+
return void 0;
|
|
46583
|
+
}
|
|
46584
|
+
const value = (_c = $$.getCandlestickData) == null ? void 0 : _c.call($$, d);
|
|
46585
|
+
if (!value) {
|
|
46586
|
+
return void 0;
|
|
46587
|
+
}
|
|
46588
|
+
if ($$.isBarType(d)) {
|
|
46589
|
+
return isNumber(value.open) && isNumber(value.close) ? value._isUp ? value.close : value.open : void 0;
|
|
46590
|
+
}
|
|
46591
|
+
return isNumber(value.close) ? value.close : void 0;
|
|
46592
|
+
}
|
|
46593
|
+
function isSubchartCandlestickBarValue($$, d, isSub) {
|
|
46594
|
+
const value = getSubchartCandlestickShapeValue($$, d, isSub);
|
|
46595
|
+
return isNumber(value) && $$.isBarType(d);
|
|
46596
|
+
}
|
|
46597
|
+
function getSubchartCandlestickBarColor($$, d, isSub) {
|
|
46598
|
+
var _a;
|
|
46599
|
+
if (!isSubchartCandlestickBarValue($$, d, isSub)) {
|
|
46600
|
+
return null;
|
|
46601
|
+
}
|
|
46602
|
+
const value = (_a = $$.getCandlestickData) == null ? void 0 : _a.call($$, d);
|
|
46603
|
+
if (value == null ? void 0 : value._isUp) {
|
|
46604
|
+
return $$.color(d);
|
|
46605
|
+
}
|
|
46606
|
+
const downColor = $$.config.candlestick_color_down;
|
|
46607
|
+
const color = downColor && typeof downColor === "object" ? downColor[d.id] : downColor;
|
|
46608
|
+
return color || $$.color(d);
|
|
46609
|
+
}
|
|
45910
46610
|
function _getGroupedDataPointsFn(d) {
|
|
45911
46611
|
var _a, _b;
|
|
45912
46612
|
const $$ = this;
|
|
@@ -46135,8 +46835,11 @@ function updateTargetsForShape(targets, config) {
|
|
|
46135
46835
|
const isStackNormalized = $$.isStackNormalized();
|
|
46136
46836
|
return (d) => {
|
|
46137
46837
|
let { value } = d;
|
|
46838
|
+
const subchartCandlestickValue = isSub ? getSubchartCandlestickShapeValue($$, d, isSub) : void 0;
|
|
46138
46839
|
if (isNumber(d)) {
|
|
46139
46840
|
value = d;
|
|
46841
|
+
} else if (isNumber(subchartCandlestickValue)) {
|
|
46842
|
+
value = subchartCandlestickValue;
|
|
46140
46843
|
} else if ($$.isAreaRangeType(d)) {
|
|
46141
46844
|
value = $$.getBaseValue(d, "mid");
|
|
46142
46845
|
} else if (isStackNormalized) {
|
|
@@ -46152,13 +46855,14 @@ function updateTargetsForShape(targets, config) {
|
|
|
46152
46855
|
/**
|
|
46153
46856
|
* Get shape based y Axis min value
|
|
46154
46857
|
* @param {string} id Data id
|
|
46858
|
+
* @param {boolean} isSub Whether to use subchart scale
|
|
46155
46859
|
* @returns {number}
|
|
46156
46860
|
* @private
|
|
46157
46861
|
*/
|
|
46158
|
-
getShapeYMin(id) {
|
|
46862
|
+
getShapeYMin(id, isSub = false) {
|
|
46159
46863
|
const $$ = this;
|
|
46160
46864
|
const axisId = $$.axis.getId(id);
|
|
46161
|
-
const scale = $$.
|
|
46865
|
+
const scale = $$.getYScaleById(id, isSub);
|
|
46162
46866
|
const [yMin] = scale.domain();
|
|
46163
46867
|
const inverted = $$.config[`axis_${axisId}_inverted`];
|
|
46164
46868
|
return !$$.isGrouped(id) && !inverted && yMin > 0 ? yMin : 0;
|
|
@@ -46166,17 +46870,18 @@ function updateTargetsForShape(targets, config) {
|
|
|
46166
46870
|
/**
|
|
46167
46871
|
* Get Shape's offset data
|
|
46168
46872
|
* @param {function} typeFilter Type filter function
|
|
46873
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
46169
46874
|
* @returns {object}
|
|
46170
46875
|
* @private
|
|
46171
46876
|
*/
|
|
46172
|
-
getShapeOffsetData(typeFilter) {
|
|
46877
|
+
getShapeOffsetData(typeFilter, isSub) {
|
|
46173
46878
|
const $$ = this;
|
|
46174
46879
|
const targets = $$.orderTargets(
|
|
46175
46880
|
$$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))
|
|
46176
46881
|
);
|
|
46177
46882
|
const dataGeneration = $$.state.dataGeneration;
|
|
46178
46883
|
const targetIds = targets.map((t) => t.id).join("_");
|
|
46179
|
-
const cacheKey = `${KEY.shapeOffset}_${targetIds}`;
|
|
46884
|
+
const cacheKey = `${KEY.shapeOffset}_${isSub ? "sub" : "main"}_${targetIds}`;
|
|
46180
46885
|
const cachedData = $$.cache.get(cacheKey);
|
|
46181
46886
|
if ((cachedData == null ? void 0 : cachedData.generation) === dataGeneration) {
|
|
46182
46887
|
return cachedData;
|
|
@@ -46190,7 +46895,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
46190
46895
|
}
|
|
46191
46896
|
const rowValueMapByXValue = rowValues.reduce((out, d) => {
|
|
46192
46897
|
const key = Number(d.x);
|
|
46193
|
-
const value = getShapeOffsetValue($$, d);
|
|
46898
|
+
const value = getShapeOffsetValue($$, d, isSub);
|
|
46194
46899
|
out[key] = d;
|
|
46195
46900
|
values[key] = isStackNormalized ? $$.getRatio("index", d, true) : value;
|
|
46196
46901
|
return out;
|
|
@@ -46213,7 +46918,8 @@ function updateTargetsForShape(targets, config) {
|
|
|
46213
46918
|
getShapeOffset(typeFilter, indices, isSub) {
|
|
46214
46919
|
const $$ = this;
|
|
46215
46920
|
const { shapeOffsetTargets, indexMapByTargetId } = $$.getShapeOffsetData(
|
|
46216
|
-
typeFilter
|
|
46921
|
+
typeFilter,
|
|
46922
|
+
isSub
|
|
46217
46923
|
);
|
|
46218
46924
|
const groupsZeroAs = $$.config.data_groupsZeroAs;
|
|
46219
46925
|
let sameGroupByTargetId = null;
|
|
@@ -46232,14 +46938,14 @@ function updateTargetsForShape(targets, config) {
|
|
|
46232
46938
|
return (d, idx) => {
|
|
46233
46939
|
var _a;
|
|
46234
46940
|
const { id, value, x } = d;
|
|
46235
|
-
const baseValue = getShapeOffsetValue($$, d);
|
|
46941
|
+
const baseValue = getShapeOffsetValue($$, d, isSub);
|
|
46236
46942
|
const ind = $$.getIndices(indices, d);
|
|
46237
46943
|
const scale = $$.getYScaleById(id, isSub);
|
|
46238
46944
|
if ($$.isBarRangeType(d)) {
|
|
46239
46945
|
return scale(value[0]);
|
|
46240
46946
|
}
|
|
46241
46947
|
const dataXAsNumber = Number(x);
|
|
46242
|
-
const y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id));
|
|
46948
|
+
const y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id, isSub));
|
|
46243
46949
|
let offset = y0;
|
|
46244
46950
|
const sameGroupTargets = (_a = sameGroupByTargetId == null ? void 0 : sameGroupByTargetId.get(id)) != null ? _a : shapeOffsetTargets.filter((t) => t.id !== id && ind[t.id] === ind[id]);
|
|
46245
46951
|
for (const t of sameGroupTargets) {
|
|
@@ -46255,7 +46961,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
46255
46961
|
if (!row || Number(row.x) !== dataXAsNumber) {
|
|
46256
46962
|
row = rowValueMapByXValue[dataXAsNumber];
|
|
46257
46963
|
}
|
|
46258
|
-
const rowValue = row && getShapeOffsetValue($$, row);
|
|
46964
|
+
const rowValue = row && getShapeOffsetValue($$, row, isSub);
|
|
46259
46965
|
if (isNumber(rowValue) && isNumber(baseValue) && rowValue * baseValue >= 0 && isNumber(rValue)) {
|
|
46260
46966
|
const addOffset = baseValue === 0 ? groupsZeroAs === "positive" && rValue > 0 || groupsZeroAs === "negative" && rValue < 0 : true;
|
|
46261
46967
|
if (addOffset) {
|
|
@@ -46282,8 +46988,13 @@ function updateTargetsForShape(targets, config) {
|
|
|
46282
46988
|
const y = $$.getShapeY(isSub);
|
|
46283
46989
|
const lineOffset = $$.getShapeOffset(typeFilter || $$.isLineType, lineIndices, isSub);
|
|
46284
46990
|
const yScale = $$.getYScaleById.bind($$);
|
|
46991
|
+
const y0Cache = /* @__PURE__ */ new Map();
|
|
46285
46992
|
return (d, i) => {
|
|
46286
|
-
|
|
46993
|
+
let y0 = y0Cache.get(d.id);
|
|
46994
|
+
if (y0 === void 0) {
|
|
46995
|
+
y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
|
|
46996
|
+
y0Cache.set(d.id, y0);
|
|
46997
|
+
}
|
|
46287
46998
|
const offset = lineOffset(d, i) || y0;
|
|
46288
46999
|
const posX = x(d);
|
|
46289
47000
|
let posY = y(d);
|
|
@@ -46317,7 +47028,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
46317
47028
|
return function(d, i) {
|
|
46318
47029
|
let y0 = y0Cache.get(d.id);
|
|
46319
47030
|
if (y0 === void 0) {
|
|
46320
|
-
y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
|
|
47031
|
+
y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
|
|
46321
47032
|
y0Cache.set(d.id, y0);
|
|
46322
47033
|
}
|
|
46323
47034
|
const offset = areaOffset(d, i) || y0;
|
|
@@ -46358,7 +47069,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
46358
47069
|
let idInfo = idCache.get(id);
|
|
46359
47070
|
if (!idInfo) {
|
|
46360
47071
|
idInfo = {
|
|
46361
|
-
y0: yScale.call($$, id, isSub)($$.getShapeYMin(id)),
|
|
47072
|
+
y0: yScale.call($$, id, isSub)($$.getShapeYMin(id, isSub)),
|
|
46362
47073
|
isInverted: config[`axis_${$$.axis.getId(id)}_inverted`]
|
|
46363
47074
|
};
|
|
46364
47075
|
idCache.set(id, idInfo);
|
|
@@ -46423,11 +47134,42 @@ function updateTargetsForShape(targets, config) {
|
|
|
46423
47134
|
isSub,
|
|
46424
47135
|
typeFilter
|
|
46425
47136
|
);
|
|
47137
|
+
const y = $$.getShapeY(isSub);
|
|
46426
47138
|
return (d, i) => {
|
|
46427
47139
|
const id = d.id;
|
|
46428
|
-
return $$.isGrouped(id) && isLinePointGroupType($$, d) ? getPoints(d, i)[0][1] :
|
|
47140
|
+
return $$.isGrouped(id) && isLinePointGroupType($$, d) ? getPoints(d, i)[0][1] : y(d);
|
|
46429
47141
|
};
|
|
46430
47142
|
},
|
|
47143
|
+
/**
|
|
47144
|
+
* Get candlestick data projected for alternate subchart shapes.
|
|
47145
|
+
* @param {object} d Data row
|
|
47146
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
47147
|
+
* @returns {number|undefined} Projected value
|
|
47148
|
+
* @private
|
|
47149
|
+
*/
|
|
47150
|
+
getSubchartCandlestickShapeValue(d, isSub) {
|
|
47151
|
+
return getSubchartCandlestickShapeValue(this, d, isSub);
|
|
47152
|
+
},
|
|
47153
|
+
/**
|
|
47154
|
+
* Check whether the row should be drawn as a candlestick-derived subchart bar.
|
|
47155
|
+
* @param {object} d Data row
|
|
47156
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
47157
|
+
* @returns {boolean}
|
|
47158
|
+
* @private
|
|
47159
|
+
*/
|
|
47160
|
+
isSubchartCandlestickBarValue(d, isSub) {
|
|
47161
|
+
return isSubchartCandlestickBarValue(this, d, isSub);
|
|
47162
|
+
},
|
|
47163
|
+
/**
|
|
47164
|
+
* Get subchart bar color projected from candlestick up/down state.
|
|
47165
|
+
* @param {object} d Data row
|
|
47166
|
+
* @param {boolean} isSub Whether coordinates are for the subchart
|
|
47167
|
+
* @returns {string|null} Bar color
|
|
47168
|
+
* @private
|
|
47169
|
+
*/
|
|
47170
|
+
getSubchartCandlestickBarColor(d, isSub) {
|
|
47171
|
+
return getSubchartCandlestickBarColor(this, d, isSub);
|
|
47172
|
+
},
|
|
46431
47173
|
/**
|
|
46432
47174
|
* Get point radius.
|
|
46433
47175
|
* @param {object} d Data row
|
|
@@ -46985,7 +47727,7 @@ class ChartInternal {
|
|
|
46985
47727
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_b = $$.hasLegendDefsPoint) == null ? void 0 : _b.call($$))) {
|
|
46986
47728
|
$el.defs = $el.svg.append("defs");
|
|
46987
47729
|
if (hasAxis) {
|
|
46988
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
47730
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
46989
47731
|
$$.appendClip($el.defs, state.clip[v]);
|
|
46990
47732
|
});
|
|
46991
47733
|
}
|
|
@@ -47328,6 +48070,7 @@ object_extend(ChartInternal.prototype, [
|
|
|
47328
48070
|
|
|
47329
48071
|
|
|
47330
48072
|
|
|
48073
|
+
|
|
47331
48074
|
const CANVAS_SELECTABLE_TYPE_FILTERS = [
|
|
47332
48075
|
isCanvasPointType,
|
|
47333
48076
|
isCanvasBarType,
|
|
@@ -47636,6 +48379,21 @@ function isCanvasSubchartPoint($$, point) {
|
|
|
47636
48379
|
const rect = getCanvasSubchartRect($$);
|
|
47637
48380
|
return !!rect && point[0] >= rect.x && point[0] <= rect.x + rect.w && point[1] >= rect.y && point[1] <= rect.y + rect.h;
|
|
47638
48381
|
}
|
|
48382
|
+
function getCanvasMainPointFromSubchart($$, point) {
|
|
48383
|
+
const { config, state } = $$;
|
|
48384
|
+
const rect = getCanvasSubchartRect($$);
|
|
48385
|
+
if (config.subchart_brush_enabled !== false || !rect || !isCanvasSubchartPoint($$, point)) {
|
|
48386
|
+
return null;
|
|
48387
|
+
}
|
|
48388
|
+
const mainCoord = getMainCoordFromSubchartCoord(
|
|
48389
|
+
$$,
|
|
48390
|
+
config.axis_rotated ? point[1] - rect.y : point[0] - rect.x
|
|
48391
|
+
);
|
|
48392
|
+
if (mainCoord === null) {
|
|
48393
|
+
return null;
|
|
48394
|
+
}
|
|
48395
|
+
return config.axis_rotated ? [state.margin.left + state.width / 2, state.margin.top + mainCoord] : [state.margin.left + mainCoord, state.margin.top + state.height / 2];
|
|
48396
|
+
}
|
|
47639
48397
|
function getCanvasSubchartBrushExtent($$) {
|
|
47640
48398
|
var _a, _b;
|
|
47641
48399
|
const rect = getCanvasSubchartRect($$);
|
|
@@ -47827,15 +48585,17 @@ function getCanvasFlowValueCount($$) {
|
|
|
47827
48585
|
return $$.data.targets.reduce((sum, target) => sum + target.values.length, 0);
|
|
47828
48586
|
}
|
|
47829
48587
|
function syncCanvasFlowYDomains($$) {
|
|
47830
|
-
var _a, _b;
|
|
47831
48588
|
const { scale } = $$;
|
|
47832
48589
|
const targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
47833
48590
|
["y", "y2"].forEach((key) => {
|
|
47834
|
-
var
|
|
47835
|
-
(
|
|
48591
|
+
var _a;
|
|
48592
|
+
(_a = scale[key]) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, key));
|
|
48593
|
+
});
|
|
48594
|
+
$$.withSubchartTypeContext(() => {
|
|
48595
|
+
var _a, _b;
|
|
48596
|
+
(_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
|
|
48597
|
+
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
47836
48598
|
});
|
|
47837
|
-
(_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
|
|
47838
|
-
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
47839
48599
|
}
|
|
47840
48600
|
const canvasInternal = {
|
|
47841
48601
|
/**
|
|
@@ -48512,22 +49272,42 @@ const canvasInternal = {
|
|
|
48512
49272
|
const { config, state } = $$;
|
|
48513
49273
|
const selected = state.canvasSelection;
|
|
48514
49274
|
const selectionGrouped = config.data_selection_grouped;
|
|
48515
|
-
|
|
49275
|
+
let targetIds = getCanvasSelectionIds(ids);
|
|
48516
49276
|
let changed = false;
|
|
49277
|
+
const singleSelection = isSelection && !config.data_selection_multiple;
|
|
49278
|
+
let resetDone = !singleSelection;
|
|
48517
49279
|
if (!config.data_selection_enabled) {
|
|
48518
49280
|
return;
|
|
48519
49281
|
}
|
|
49282
|
+
if (singleSelection) {
|
|
49283
|
+
indices = (indices == null ? void 0 : indices.length) ? [indices[0]] : [0];
|
|
49284
|
+
if (!selectionGrouped) {
|
|
49285
|
+
if (targetIds) {
|
|
49286
|
+
targetIds = targetIds.slice(0, 1);
|
|
49287
|
+
} else {
|
|
49288
|
+
const [firstTarget] = $$.filterTargetsToShow($$.data.targets);
|
|
49289
|
+
targetIds = firstTarget ? [firstTarget.id] : [];
|
|
49290
|
+
}
|
|
49291
|
+
}
|
|
49292
|
+
}
|
|
48520
49293
|
eachCanvasSelectableData($$, (d) => {
|
|
48521
49294
|
const key = getCanvasDataKey(d);
|
|
48522
49295
|
const isTargetId = selectionGrouped || !targetIds || targetIds.indexOf(d.id) >= 0;
|
|
48523
49296
|
const isTargetIndex = !indices || indices.indexOf(d.index) >= 0;
|
|
48524
49297
|
const isSelected = selected.has(key);
|
|
48525
49298
|
if (isSelection) {
|
|
48526
|
-
if (isTargetId && isTargetIndex && !isSelected) {
|
|
49299
|
+
if (isTargetId && isTargetIndex && (!isSelected || singleSelection)) {
|
|
49300
|
+
if (!resetDone) {
|
|
49301
|
+
$$.setCanvasSelection(false);
|
|
49302
|
+
resetDone = true;
|
|
49303
|
+
}
|
|
49304
|
+
if (selected.has(key)) {
|
|
49305
|
+
return;
|
|
49306
|
+
}
|
|
48527
49307
|
selected.add(key);
|
|
48528
49308
|
callFn(config.data_onselected, $$.api, d, $$.canvasEngine.canvas);
|
|
48529
49309
|
changed = true;
|
|
48530
|
-
} else if (resetOther && isSelected) {
|
|
49310
|
+
} else if ((!singleSelection || resetDone) && resetOther && isSelected) {
|
|
48531
49311
|
selected.delete(key);
|
|
48532
49312
|
callFn(config.data_onunselected, $$.api, d, $$.canvasEngine.canvas);
|
|
48533
49313
|
changed = true;
|
|
@@ -48774,12 +49554,12 @@ const canvasInternal = {
|
|
|
48774
49554
|
updateCanvasSubchartBrush(event) {
|
|
48775
49555
|
var _a, _b;
|
|
48776
49556
|
const $$ = this;
|
|
48777
|
-
const { state } = $$;
|
|
49557
|
+
const { config, state } = $$;
|
|
48778
49558
|
const start = state.canvasSubchartBrushStart;
|
|
48779
49559
|
const origin = state.canvasSubchartBrushOrigin;
|
|
48780
49560
|
const mode = state.canvasSubchartBrushMode;
|
|
48781
49561
|
const coord = getCanvasSubchartBrushCoord($$, event, true);
|
|
48782
|
-
if (!state.canvasSubchartBrushDragging || start === null || coord === null || !mode) {
|
|
49562
|
+
if (config.subchart_brush_enabled === false || !state.canvasSubchartBrushDragging || start === null || coord === null || !mode) {
|
|
48783
49563
|
return false;
|
|
48784
49564
|
}
|
|
48785
49565
|
const delta = coord - start;
|
|
@@ -48830,6 +49610,10 @@ const canvasInternal = {
|
|
|
48830
49610
|
updateCanvasSubchartCursor(event) {
|
|
48831
49611
|
const $$ = this;
|
|
48832
49612
|
const canvas2 = $$.$el.canvas.node();
|
|
49613
|
+
if ($$.config.subchart_brush_enabled === false) {
|
|
49614
|
+
canvas2.style.cursor = "";
|
|
49615
|
+
return false;
|
|
49616
|
+
}
|
|
48833
49617
|
const coord = getCanvasSubchartBrushCoord($$, event);
|
|
48834
49618
|
if (coord === null) {
|
|
48835
49619
|
canvas2.style.cursor = "";
|
|
@@ -48849,6 +49633,9 @@ const canvasInternal = {
|
|
|
48849
49633
|
var _a;
|
|
48850
49634
|
const $$ = this;
|
|
48851
49635
|
const { state } = $$;
|
|
49636
|
+
if ($$.config.subchart_brush_enabled === false) {
|
|
49637
|
+
return false;
|
|
49638
|
+
}
|
|
48852
49639
|
const coord = getCanvasSubchartBrushCoord($$, event);
|
|
48853
49640
|
if (coord === null) {
|
|
48854
49641
|
return false;
|
|
@@ -49208,7 +49995,8 @@ const canvasInternal = {
|
|
|
49208
49995
|
(_b = $$.hideTooltip) == null ? void 0 : _b.call($$);
|
|
49209
49996
|
return;
|
|
49210
49997
|
}
|
|
49211
|
-
const
|
|
49998
|
+
const rawPoint = getCanvasEventPoint($$, event);
|
|
49999
|
+
const point = rawPoint && (getCanvasMainPointFromSubchart($$, rawPoint) || rawPoint);
|
|
49212
50000
|
const d = point ? getCanvasHoverDatumFromPoint($$, point) : null;
|
|
49213
50001
|
if (!d) {
|
|
49214
50002
|
$$.dispatchCanvasDataOut(canvas2);
|
|
@@ -49216,8 +50004,8 @@ const canvasInternal = {
|
|
|
49216
50004
|
state.canvasFocusKey = null;
|
|
49217
50005
|
$$.clearCanvasFocus();
|
|
49218
50006
|
}
|
|
49219
|
-
if (
|
|
49220
|
-
$$.renderCanvasAxisTooltip(
|
|
50007
|
+
if (rawPoint && config.axis_tooltip && isCanvasAxisTooltipArea($$, rawPoint)) {
|
|
50008
|
+
$$.renderCanvasAxisTooltip(rawPoint);
|
|
49221
50009
|
(_c = $$.hideTooltip) == null ? void 0 : _c.call($$);
|
|
49222
50010
|
return;
|
|
49223
50011
|
}
|
|
@@ -49348,6 +50136,7 @@ const canvasInternal = {
|
|
|
49348
50136
|
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
49349
50137
|
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
49350
50138
|
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
50139
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubYAxes($$);
|
|
49351
50140
|
$$.canvasRenderer.drawEmptyLabel($$);
|
|
49352
50141
|
rebuildHit && $$.hitDetector.rebuild($$, drawShape);
|
|
49353
50142
|
} finally {
|
|
@@ -49379,6 +50168,7 @@ const canvasInternal = {
|
|
|
49379
50168
|
state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
|
|
49380
50169
|
$$.canvasRenderer.drawSubchart($$, drawShape);
|
|
49381
50170
|
state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
|
|
50171
|
+
state.hasAxis && $$.canvasAxisRenderer.drawSubYAxes($$);
|
|
49382
50172
|
$$.canvasRenderer.drawEmptyLabel($$);
|
|
49383
50173
|
} finally {
|
|
49384
50174
|
$$.canvasEngine.endFrame();
|
|
@@ -51465,7 +52255,7 @@ object_extend(ygrids, {
|
|
|
51465
52255
|
|
|
51466
52256
|
|
|
51467
52257
|
|
|
51468
|
-
const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`;
|
|
52258
|
+
const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}:not(.${$FOCUS.xgridFocusContinuous}), line.${$FOCUS.ygridFocus}`;
|
|
51469
52259
|
const _getGridTextAnchor = (d) => isValue(d.position) || "end";
|
|
51470
52260
|
const _getGridTextDx = (d) => d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
|
|
51471
52261
|
function _getGridFocusEl($$) {
|
|
@@ -51476,6 +52266,9 @@ function _getGridFocusEl($$) {
|
|
|
51476
52266
|
const cachedNodes = ((_a = cached == null ? void 0 : cached.nodes) == null ? void 0 : _a.call(cached)) || [];
|
|
51477
52267
|
return cachedNodes.length && cachedNodes.every((node) => mainNode == null ? void 0 : mainNode.contains(node)) ? cached : state._gridFocusEl = main.selectAll(GRID_FOCUS_SELECTOR);
|
|
51478
52268
|
}
|
|
52269
|
+
function _hideContinuousGridFocus($$) {
|
|
52270
|
+
$$.$el.main.select(`line.${$FOCUS.xgridFocusContinuous}`).style("visibility", "hidden");
|
|
52271
|
+
}
|
|
51479
52272
|
function _getGridTextX(isX, width, height) {
|
|
51480
52273
|
return (d) => {
|
|
51481
52274
|
let x = isX ? 0 : width;
|
|
@@ -51646,6 +52439,7 @@ function _smoothLines(el, type) {
|
|
|
51646
52439
|
if (config.grid_focus_y && !config.tooltip_grouped) {
|
|
51647
52440
|
grid.append("g").attr("class", $FOCUS.ygridFocus).append("line").attr("class", $FOCUS.ygridFocus);
|
|
51648
52441
|
}
|
|
52442
|
+
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");
|
|
51649
52443
|
}
|
|
51650
52444
|
},
|
|
51651
52445
|
showAxisGridFocus() {
|
|
@@ -51754,6 +52548,7 @@ function _smoothLines(el, type) {
|
|
|
51754
52548
|
if (force || inputType === "mouse" || !resizing) {
|
|
51755
52549
|
const focusEl = _getGridFocusEl($$);
|
|
51756
52550
|
focusEl.style("visibility", "hidden");
|
|
52551
|
+
_hideContinuousGridFocus($$);
|
|
51757
52552
|
(_a = $$.hideCircleFocus) == null ? void 0 : _a.call($$);
|
|
51758
52553
|
}
|
|
51759
52554
|
},
|
|
@@ -51771,6 +52566,7 @@ function _smoothLines(el, type) {
|
|
|
51771
52566
|
} else {
|
|
51772
52567
|
const isRotated = $$.config.axis_rotated;
|
|
51773
52568
|
xgridFocus.attr("x1", isRotated ? 0 : -10).attr("x2", isRotated ? width : -10).attr("y1", isRotated ? -10 : 0).attr("y2", isRotated ? -10 : height);
|
|
52569
|
+
_hideContinuousGridFocus($$);
|
|
51774
52570
|
}
|
|
51775
52571
|
return true;
|
|
51776
52572
|
},
|
|
@@ -51909,28 +52705,85 @@ let grid_grid = () => {
|
|
|
51909
52705
|
|
|
51910
52706
|
|
|
51911
52707
|
|
|
52708
|
+
function setSelectionForFocusOnly(isSelection, ids, indices, resetOther) {
|
|
52709
|
+
const $$ = this;
|
|
52710
|
+
const { config, $el: { main } } = $$;
|
|
52711
|
+
const selectionGrouped = config.data_selection_grouped;
|
|
52712
|
+
const isSelectable = config.data_selection_isselectable.bind($$.api);
|
|
52713
|
+
const targetIds = isDefined(ids) ? [].concat(ids) : null;
|
|
52714
|
+
const singleSelection = isSelection && !config.data_selection_multiple;
|
|
52715
|
+
let resetDone = !singleSelection;
|
|
52716
|
+
const unselect = (circle, d, index) => {
|
|
52717
|
+
$$.unselectPoint(circle, d, index);
|
|
52718
|
+
circle.interrupt().remove();
|
|
52719
|
+
};
|
|
52720
|
+
$$.getTargetsToShow().forEach((target) => {
|
|
52721
|
+
const { id } = target;
|
|
52722
|
+
const isTargetId = selectionGrouped || !targetIds || targetIds.indexOf(id) >= 0;
|
|
52723
|
+
const selectedCircles = main.select(
|
|
52724
|
+
`.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(id)}`
|
|
52725
|
+
);
|
|
52726
|
+
target.values.forEach((d) => {
|
|
52727
|
+
const { index } = d;
|
|
52728
|
+
const isTargetIndex = !indices || indices.indexOf(index) >= 0;
|
|
52729
|
+
const circle = selectedCircles.selectAll(`.${$SELECT.selectedCircle}-${index}`);
|
|
52730
|
+
const isSelected = !circle.empty();
|
|
52731
|
+
if (isSelection) {
|
|
52732
|
+
if (isTargetId && isTargetIndex && isSelectable(d) && (!isSelected || singleSelection)) {
|
|
52733
|
+
if (!resetDone) {
|
|
52734
|
+
setSelectionForFocusOnly.call($$, false);
|
|
52735
|
+
resetDone = true;
|
|
52736
|
+
}
|
|
52737
|
+
$$.selectPoint(null, d, index);
|
|
52738
|
+
} else if ((!singleSelection || resetDone) && isDefined(resetOther) && resetOther && isSelected) {
|
|
52739
|
+
unselect(circle, d, index);
|
|
52740
|
+
}
|
|
52741
|
+
} else if (isTargetId && isTargetIndex && isSelected) {
|
|
52742
|
+
unselect(circle, d, index);
|
|
52743
|
+
}
|
|
52744
|
+
});
|
|
52745
|
+
});
|
|
52746
|
+
}
|
|
51912
52747
|
function setSelection(isSelection = false, ids, indices, resetOther) {
|
|
52748
|
+
var _a;
|
|
51913
52749
|
const $$ = this;
|
|
51914
52750
|
const { config, $el: { main } } = $$;
|
|
51915
52751
|
const selectionGrouped = config.data_selection_grouped;
|
|
51916
52752
|
const isSelectable = config.data_selection_isselectable.bind($$.api);
|
|
52753
|
+
const singleSelection = isSelection && !config.data_selection_multiple;
|
|
52754
|
+
let resetDone = !singleSelection;
|
|
51917
52755
|
if (!config.data_selection_enabled) {
|
|
51918
52756
|
return;
|
|
51919
52757
|
}
|
|
52758
|
+
if (singleSelection) {
|
|
52759
|
+
indices = (indices == null ? void 0 : indices.length) ? [indices[0]] : [0];
|
|
52760
|
+
if (!selectionGrouped) {
|
|
52761
|
+
const targetIds = isDefined(ids) ? [].concat(ids) : $$.getTargetsToShow().map((t) => t.id);
|
|
52762
|
+
ids = targetIds.slice(0, 1);
|
|
52763
|
+
}
|
|
52764
|
+
}
|
|
52765
|
+
if ((_a = $$.isPointFocusOnly) == null ? void 0 : _a.call($$)) {
|
|
52766
|
+
setSelectionForFocusOnly.call($$, isSelection, ids, indices, resetOther);
|
|
52767
|
+
return;
|
|
52768
|
+
}
|
|
51920
52769
|
main.selectAll(`.${$SHAPE.shapes}`).selectAll(`.${$SHAPE.shape}`).each(function(d) {
|
|
51921
52770
|
const shape = src_select(this);
|
|
51922
52771
|
const { id, index } = d.data ? d.data : d;
|
|
51923
|
-
const toggle = $$.getToggle(this, d).bind($$);
|
|
51924
52772
|
const isTargetId = selectionGrouped || !ids || ids.indexOf(id) >= 0;
|
|
51925
52773
|
const isTargetIndex = !indices || indices.indexOf(index) >= 0;
|
|
51926
|
-
const isSelected = shape.classed($SELECT.SELECTED);
|
|
51927
52774
|
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
51928
52775
|
return;
|
|
51929
52776
|
}
|
|
52777
|
+
const toggle = $$.getToggle(this, d).bind($$);
|
|
52778
|
+
const isSelected = shape.classed($SELECT.SELECTED);
|
|
51930
52779
|
if (isSelection) {
|
|
51931
|
-
if (isTargetId && isTargetIndex && isSelectable(d) && !isSelected) {
|
|
51932
|
-
|
|
51933
|
-
|
|
52780
|
+
if (isTargetId && isTargetIndex && isSelectable(d) && (!isSelected || singleSelection)) {
|
|
52781
|
+
if (!resetDone) {
|
|
52782
|
+
setSelection.call($$, false);
|
|
52783
|
+
resetDone = true;
|
|
52784
|
+
}
|
|
52785
|
+
!shape.classed($SELECT.SELECTED) && toggle(true, shape.classed($SELECT.SELECTED, true), d, index);
|
|
52786
|
+
} else if ((!singleSelection || resetDone) && isDefined(resetOther) && resetOther && isSelected) {
|
|
51934
52787
|
toggle(false, shape.classed($SELECT.SELECTED, false), d, index);
|
|
51935
52788
|
}
|
|
51936
52789
|
} else {
|
|
@@ -51958,12 +52811,16 @@ function setSelection(isSelection = false, ids, indices, resetOther) {
|
|
|
51958
52811
|
* chart.selected("data1");
|
|
51959
52812
|
*/
|
|
51960
52813
|
selected(targetId) {
|
|
51961
|
-
var _a;
|
|
52814
|
+
var _a, _b;
|
|
51962
52815
|
const $$ = this.internal;
|
|
51963
52816
|
const dataPoint = [];
|
|
51964
52817
|
if ($$.state.isCanvasMode) {
|
|
51965
52818
|
return ((_a = $$.getCanvasSelectedData) == null ? void 0 : _a.call($$, targetId)) || dataPoint;
|
|
51966
52819
|
}
|
|
52820
|
+
if ((_b = $$.isPointFocusOnly) == null ? void 0 : _b.call($$)) {
|
|
52821
|
+
$$.$el.main.selectAll(`.${$SELECT.selectedCircles + $$.getTargetSelectorSuffix(targetId)}`).selectAll(`.${$SELECT.selectedCircle}`).each((d) => dataPoint.push(d));
|
|
52822
|
+
return dataPoint;
|
|
52823
|
+
}
|
|
51967
52824
|
$$.$el.main.selectAll(`.${$SHAPE.shapes + $$.getTargetSelectorSuffix(targetId)}`).selectAll(`.${$SHAPE.shape}`).filter(function() {
|
|
51968
52825
|
return src_select(this).classed($SELECT.SELECTED);
|
|
51969
52826
|
}).each((d) => dataPoint.push(d));
|
|
@@ -52161,7 +53018,7 @@ var selection_spreadProps = (a, b) => selection_defProps(a, selection_getOwnProp
|
|
|
52161
53018
|
const cx = (isRotated ? $$.circleY : $$.circleX).bind($$);
|
|
52162
53019
|
const cy = (isRotated ? $$.circleX : $$.circleY).bind($$);
|
|
52163
53020
|
const r = $$.pointSelectR.bind($$);
|
|
52164
|
-
callFn(config.data_onselected, $$.api, d, target.node());
|
|
53021
|
+
callFn(config.data_onselected, $$.api, d, target == null ? void 0 : target.node());
|
|
52165
53022
|
$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);
|
|
52166
53023
|
},
|
|
52167
53024
|
/**
|
|
@@ -52590,7 +53447,134 @@ object_extend(subchart, {
|
|
|
52590
53447
|
|
|
52591
53448
|
|
|
52592
53449
|
|
|
53450
|
+
|
|
53451
|
+
|
|
53452
|
+
const SUBCHART_TYPES = ["bar", "line", "bubble", "candlestick", "scatter"];
|
|
53453
|
+
const FOCUS_GRID_STYLE_PROPS = [
|
|
53454
|
+
"opacity",
|
|
53455
|
+
"stroke",
|
|
53456
|
+
"stroke-dasharray",
|
|
53457
|
+
"stroke-dashoffset",
|
|
53458
|
+
"stroke-linecap",
|
|
53459
|
+
"stroke-linejoin",
|
|
53460
|
+
"stroke-miterlimit",
|
|
53461
|
+
"stroke-opacity",
|
|
53462
|
+
"stroke-width"
|
|
53463
|
+
];
|
|
53464
|
+
function syncSubchartGridFocusStyle($$, line) {
|
|
53465
|
+
var _a, _b;
|
|
53466
|
+
const source = (_b = (_a = $$.$el.grid) == null ? void 0 : _a.main) == null ? void 0 : _b.select(`line.${config_classes.xgridFocus}`).node();
|
|
53467
|
+
if (!source || !win.getComputedStyle) {
|
|
53468
|
+
return;
|
|
53469
|
+
}
|
|
53470
|
+
const style = win.getComputedStyle(source);
|
|
53471
|
+
FOCUS_GRID_STYLE_PROPS.forEach((prop) => {
|
|
53472
|
+
const value = style.getPropertyValue(prop);
|
|
53473
|
+
value && line.style(prop, value);
|
|
53474
|
+
});
|
|
53475
|
+
}
|
|
53476
|
+
function getFiniteAttr(value, fallback) {
|
|
53477
|
+
const parsed = Number(value);
|
|
53478
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
53479
|
+
}
|
|
53480
|
+
function showContinuousSubchartGridFocus($$) {
|
|
53481
|
+
var _a, _b;
|
|
53482
|
+
if (!isContinuousGridFocusEnabled($$)) {
|
|
53483
|
+
return false;
|
|
53484
|
+
}
|
|
53485
|
+
const { config, state, $el } = $$;
|
|
53486
|
+
const mainLine = (_b = (_a = $el.grid) == null ? void 0 : _a.main) == null ? void 0 : _b.select(
|
|
53487
|
+
`line.${config_classes.xgridFocus}:not(.${config_classes.xgridFocusContinuous})`
|
|
53488
|
+
);
|
|
53489
|
+
const line = $el.main.select(`line.${config_classes.xgridFocusContinuous}`);
|
|
53490
|
+
if (!(mainLine == null ? void 0 : mainLine.node()) || !line.node()) {
|
|
53491
|
+
return false;
|
|
53492
|
+
}
|
|
53493
|
+
const x2 = state.margin2.left - state.margin.left + state.width2;
|
|
53494
|
+
const y2 = state.margin2.top - state.margin.top + state.height2;
|
|
53495
|
+
syncSubchartGridFocusStyle($$, line);
|
|
53496
|
+
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);
|
|
53497
|
+
line.style("visibility", null);
|
|
53498
|
+
mainLine.style("visibility", "hidden");
|
|
53499
|
+
return true;
|
|
53500
|
+
}
|
|
53501
|
+
function hideContinuousSubchartGridFocus($$) {
|
|
53502
|
+
var _a;
|
|
53503
|
+
(_a = $$.$el.main) == null ? void 0 : _a.select(`line.${config_classes.xgridFocusContinuous}`).style("visibility", "hidden");
|
|
53504
|
+
}
|
|
53505
|
+
function getMainPointFromSubchartEvent($$, event, context) {
|
|
53506
|
+
const { config, state } = $$;
|
|
53507
|
+
const [x, y] = getPointer(event, context);
|
|
53508
|
+
const mainCoord = getMainCoordFromSubchartCoord($$, config.axis_rotated ? y : x);
|
|
53509
|
+
if (mainCoord === null) {
|
|
53510
|
+
return null;
|
|
53511
|
+
}
|
|
53512
|
+
return config.axis_rotated ? [state.width / 2, mainCoord] : [mainCoord, state.height / 2];
|
|
53513
|
+
}
|
|
53514
|
+
function dispatchSubchartEvent($$, type, event, context) {
|
|
53515
|
+
var _a, _b;
|
|
53516
|
+
const mainEventRect = (_b = (_a = $$.$el.eventRect) == null ? void 0 : _a.node) == null ? void 0 : _b.call(_a);
|
|
53517
|
+
if (!mainEventRect) {
|
|
53518
|
+
return;
|
|
53519
|
+
}
|
|
53520
|
+
const point = getMainPointFromSubchartEvent($$, event, context) || [0, 0];
|
|
53521
|
+
const rect = getBoundingRect(mainEventRect, true);
|
|
53522
|
+
const clientX = rect.left + point[0];
|
|
53523
|
+
const clientY = rect.top + point[1];
|
|
53524
|
+
const params = {
|
|
53525
|
+
bubbles: true,
|
|
53526
|
+
cancelable: true,
|
|
53527
|
+
screenX: clientX,
|
|
53528
|
+
screenY: clientY,
|
|
53529
|
+
clientX,
|
|
53530
|
+
clientY
|
|
53531
|
+
};
|
|
53532
|
+
/^touch/.test(type) ? emulateEvent.touch(mainEventRect, type, params) : emulateEvent.mouse(mainEventRect, type, params);
|
|
53533
|
+
}
|
|
52593
53534
|
/* harmony default export */ var interactions_subchart = ({
|
|
53535
|
+
/**
|
|
53536
|
+
* Whether subchart brush interaction is enabled.
|
|
53537
|
+
* @returns {boolean}
|
|
53538
|
+
* @private
|
|
53539
|
+
*/
|
|
53540
|
+
isSubchartBrushEnabled() {
|
|
53541
|
+
const { config } = this;
|
|
53542
|
+
return config.subchart_show && config.subchart_brush_enabled !== false;
|
|
53543
|
+
},
|
|
53544
|
+
/**
|
|
53545
|
+
* Bind event rect handlers for subchart hover interactions.
|
|
53546
|
+
* @param {d3Selection} eventRect Subchart event rect selection
|
|
53547
|
+
* @private
|
|
53548
|
+
*/
|
|
53549
|
+
bindSubchartEventRect(eventRect) {
|
|
53550
|
+
const $$ = this;
|
|
53551
|
+
const { config, state } = $$;
|
|
53552
|
+
eventRect.on("mouseover mousemove mouseout touchstart touchmove touchend", null);
|
|
53553
|
+
if (!config.interaction_enabled) {
|
|
53554
|
+
return;
|
|
53555
|
+
}
|
|
53556
|
+
if (state.inputType === "mouse") {
|
|
53557
|
+
eventRect.on("mouseover mousemove", function(event) {
|
|
53558
|
+
if ($$.isSubchartBrushEnabled()) {
|
|
53559
|
+
return;
|
|
53560
|
+
}
|
|
53561
|
+
dispatchSubchartEvent($$, event.type, event, this);
|
|
53562
|
+
}).on("mouseout", function(event) {
|
|
53563
|
+
if ($$.isSubchartBrushEnabled()) {
|
|
53564
|
+
return;
|
|
53565
|
+
}
|
|
53566
|
+
dispatchSubchartEvent($$, "mouseout", event, this);
|
|
53567
|
+
});
|
|
53568
|
+
} else if (state.inputType === "touch") {
|
|
53569
|
+
eventRect.on("touchstart touchmove touchend", function(event) {
|
|
53570
|
+
var _a;
|
|
53571
|
+
if ($$.isSubchartBrushEnabled() || ((_a = event.touches) == null ? void 0 : _a.length) > 1) {
|
|
53572
|
+
return;
|
|
53573
|
+
}
|
|
53574
|
+
dispatchSubchartEvent($$, event.type, event, this);
|
|
53575
|
+
});
|
|
53576
|
+
}
|
|
53577
|
+
},
|
|
52594
53578
|
/**
|
|
52595
53579
|
* Initialize the brush.
|
|
52596
53580
|
* @private
|
|
@@ -52684,19 +53668,26 @@ object_extend(subchart, {
|
|
|
52684
53668
|
const { main } = subchart;
|
|
52685
53669
|
main.style("visibility", visibility);
|
|
52686
53670
|
main.append("g").attr("clip-path", clipPath).attr("class", config_classes.chart);
|
|
52687
|
-
|
|
52688
|
-
|
|
52689
|
-
|
|
52690
|
-
|
|
52691
|
-
|
|
52692
|
-
|
|
52693
|
-
chart.
|
|
53671
|
+
$$.withSubchartTypeContext(() => {
|
|
53672
|
+
SUBCHART_TYPES.forEach((v) => {
|
|
53673
|
+
const type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
|
|
53674
|
+
if ($$.hasType(v) || $$.hasTypeOf(type)) {
|
|
53675
|
+
const chart = main.select(`.${config_classes.chart}`);
|
|
53676
|
+
const chartClassName = config_classes[`chart${type}s`];
|
|
53677
|
+
if (chart.select(`.${chartClassName}`).empty()) {
|
|
53678
|
+
chart.append("g").attr("class", chartClassName);
|
|
53679
|
+
}
|
|
52694
53680
|
}
|
|
52695
|
-
}
|
|
53681
|
+
});
|
|
52696
53682
|
});
|
|
52697
|
-
const brush = main.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).call($$.brush);
|
|
53683
|
+
const brush = main.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).style("pointer-events", $$.isSubchartBrushEnabled() ? null : "none").call($$.brush);
|
|
52698
53684
|
config.subchart_showHandle && $$.addBrushHandle(brush);
|
|
53685
|
+
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);
|
|
53686
|
+
$$.bindSubchartEventRect(subchart.eventRect);
|
|
53687
|
+
main.append("g").attr("clip-path", clipPath).attr("class", config_classes.xgridFocus).append("line").attr("class", config_classes.xgridFocus).style("visibility", "hidden");
|
|
52699
53688
|
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");
|
|
53689
|
+
axis.subY = main.append("g").attr("class", config_classes.axisY).attr("transform", $$.getTranslate("subY")).style("visibility", config.subchart_axis_y_show ? visibility : "hidden");
|
|
53690
|
+
axis.subY2 = main.append("g").attr("class", config_classes.axisY2).attr("transform", $$.getTranslate("subY2")).style("visibility", config.subchart_axis_y2_show ? visibility : "hidden");
|
|
52700
53691
|
},
|
|
52701
53692
|
/**
|
|
52702
53693
|
* Add brush handle
|
|
@@ -52719,64 +53710,89 @@ object_extend(subchart, {
|
|
|
52719
53710
|
* @private
|
|
52720
53711
|
*/
|
|
52721
53712
|
updateTargetsForSubchart(targets) {
|
|
53713
|
+
var _a;
|
|
52722
53714
|
const $$ = this;
|
|
52723
53715
|
const { config, state, $el: { subchart: { main } } } = $$;
|
|
52724
53716
|
if (config.subchart_show) {
|
|
52725
|
-
|
|
52726
|
-
|
|
52727
|
-
|
|
52728
|
-
|
|
52729
|
-
|
|
52730
|
-
|
|
52731
|
-
|
|
52732
|
-
|
|
52733
|
-
|
|
52734
|
-
|
|
52735
|
-
|
|
52736
|
-
|
|
52737
|
-
|
|
52738
|
-
|
|
52739
|
-
|
|
52740
|
-
|
|
53717
|
+
$$.withSubchartTypeContext(() => {
|
|
53718
|
+
SUBCHART_TYPES.filter((v) => $$.hasType(v) || $$.hasTypeOf(capitalize(v))).forEach((v) => {
|
|
53719
|
+
const isPointType = /^(bubble|scatter)$/.test(v);
|
|
53720
|
+
const name = capitalize(isPointType ? "circle" : v);
|
|
53721
|
+
const chartClass = $$.getChartClass(name, true);
|
|
53722
|
+
const shapeClass = $$.getClass(isPointType ? "circles" : `${v}s`, true);
|
|
53723
|
+
const shapeChart = main.select(`.${config_classes[`chart${`${name}s`}`]}`);
|
|
53724
|
+
if (isPointType) {
|
|
53725
|
+
const circle = shapeChart.selectAll(`.${config_classes.circles}`).data(targets.filter($$[`is${capitalize(v)}Type`].bind($$))).attr("class", shapeClass);
|
|
53726
|
+
circle.exit().remove();
|
|
53727
|
+
circle.enter().append("g").attr("class", shapeClass);
|
|
53728
|
+
} else {
|
|
53729
|
+
const shapeUpdate = shapeChart.selectAll(`.${config_classes[`chart${name}`]}`).attr("class", chartClass).data(targets.filter($$[`is${name}Type`].bind($$)));
|
|
53730
|
+
const shapeEnter = shapeUpdate.enter().append("g").style("opacity", "0").attr("class", chartClass).append("g").attr("class", shapeClass);
|
|
53731
|
+
shapeUpdate.exit().remove();
|
|
53732
|
+
v === "line" && $$.hasTypeOf("Area") && shapeEnter.append("g").attr("class", $$.getClass("areas", true));
|
|
53733
|
+
}
|
|
53734
|
+
});
|
|
52741
53735
|
});
|
|
52742
53736
|
main.selectAll(`.${config_classes.brush} rect`).attr(
|
|
52743
53737
|
config.axis_rotated ? "width" : "height",
|
|
52744
53738
|
config.axis_rotated ? state.width2 : state.height2
|
|
52745
53739
|
);
|
|
53740
|
+
(_a = $$.$el.subchart.eventRect) == null ? void 0 : _a.attr("width", state.width2).attr("height", state.height2).style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all");
|
|
52746
53741
|
}
|
|
52747
53742
|
},
|
|
53743
|
+
/**
|
|
53744
|
+
* Update subchart y domains using subchart type options.
|
|
53745
|
+
* @param {object} targets Targets to show
|
|
53746
|
+
* @private
|
|
53747
|
+
*/
|
|
53748
|
+
updateSubchartYDomain(targets) {
|
|
53749
|
+
var _a, _b;
|
|
53750
|
+
const $$ = this;
|
|
53751
|
+
const { scale } = $$;
|
|
53752
|
+
const targetsToShow = targets || $$.filterTargetsToShow($$.data.targets);
|
|
53753
|
+
(_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
|
|
53754
|
+
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
53755
|
+
},
|
|
52748
53756
|
/**
|
|
52749
53757
|
* Redraw subchart.
|
|
52750
53758
|
* @private
|
|
52751
53759
|
* @param {boolean} withSubchart whether or not to show subchart
|
|
52752
53760
|
* @param {number} duration duration
|
|
52753
|
-
* @param {object} shape Shape's info
|
|
52754
53761
|
*/
|
|
52755
|
-
redrawSubchart(withSubchart, duration
|
|
52756
|
-
var _a;
|
|
53762
|
+
redrawSubchart(withSubchart, duration) {
|
|
53763
|
+
var _a, _b, _c, _d;
|
|
52757
53764
|
const $$ = this;
|
|
52758
53765
|
const { config, $el: { subchart: { main } }, state } = $$;
|
|
52759
53766
|
const withTransition = !!duration;
|
|
52760
53767
|
main.style("visibility", config.subchart_show ? null : "hidden");
|
|
53768
|
+
main.select(`.${config_classes.brush}`).style("pointer-events", $$.isSubchartBrushEnabled() ? null : "none");
|
|
53769
|
+
(_a = $$.$el.subchart.eventRect) == null ? void 0 : _a.style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all");
|
|
53770
|
+
(_b = $$.$el.axis.subY) == null ? void 0 : _b.style("visibility", config.subchart_axis_y_show ? null : "hidden");
|
|
53771
|
+
(_c = $$.$el.axis.subY2) == null ? void 0 : _c.style("visibility", config.subchart_axis_y2_show ? null : "hidden");
|
|
52761
53772
|
if (config.subchart_show) {
|
|
52762
|
-
if (((
|
|
53773
|
+
if (((_d = state.event) == null ? void 0 : _d.type) === "zoom") {
|
|
52763
53774
|
$$.brush.update();
|
|
52764
53775
|
}
|
|
52765
53776
|
if (withSubchart) {
|
|
52766
53777
|
const initRange = config.subchart_init_range;
|
|
52767
53778
|
!brushEmpty($$) && $$.brush.update();
|
|
52768
|
-
|
|
52769
|
-
const
|
|
52770
|
-
|
|
52771
|
-
|
|
52772
|
-
|
|
53779
|
+
$$.withSubchartTypeContext(() => {
|
|
53780
|
+
const targetsToShow = state._targetsToShow || $$.filterTargetsToShow($$.data.targets);
|
|
53781
|
+
$$.updateSubchartYDomain(targetsToShow);
|
|
53782
|
+
const subchartShape = $$.getDrawShape();
|
|
53783
|
+
Object.keys(subchartShape.type).forEach((v) => {
|
|
53784
|
+
const name = capitalize(v);
|
|
53785
|
+
const drawFn = $$[`generateDraw${name}`](subchartShape.indices[v], true);
|
|
53786
|
+
$$[`update${name}`](withTransition, true);
|
|
53787
|
+
$$[`redraw${name}`](drawFn, withTransition, true);
|
|
53788
|
+
});
|
|
53789
|
+
if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
|
53790
|
+
const { cx } = subchartShape.pos;
|
|
53791
|
+
const cy = $$.updateCircleY(true);
|
|
53792
|
+
$$.updateCircle(true);
|
|
53793
|
+
$$.redrawCircle(cx, cy, withTransition, void 0, true);
|
|
53794
|
+
}
|
|
52773
53795
|
});
|
|
52774
|
-
if ($$.hasType("bubble") || $$.hasType("scatter")) {
|
|
52775
|
-
const { cx } = shape.pos;
|
|
52776
|
-
const cy = $$.updateCircleY(true);
|
|
52777
|
-
$$.updateCircle(true);
|
|
52778
|
-
$$.redrawCircle(cx, cy, withTransition, void 0, true);
|
|
52779
|
-
}
|
|
52780
53796
|
if (!state.rendered && initRange) {
|
|
52781
53797
|
state.domain = initRange;
|
|
52782
53798
|
$$.brush.move(
|
|
@@ -52787,6 +53803,46 @@ object_extend(subchart, {
|
|
|
52787
53803
|
}
|
|
52788
53804
|
}
|
|
52789
53805
|
},
|
|
53806
|
+
/**
|
|
53807
|
+
* Show a focus grid line on subchart following main chart focus.
|
|
53808
|
+
* @param {Array} data Selected data
|
|
53809
|
+
* @private
|
|
53810
|
+
*/
|
|
53811
|
+
showSubchartGridFocus(data) {
|
|
53812
|
+
const $$ = this;
|
|
53813
|
+
const { config, state, $el: { subchart: { main } } } = $$;
|
|
53814
|
+
if (!main || !config.subchart_show || $$.isSubchartBrushEnabled() || config.grid_focus_show === false || config.subchart_grid_focus === false || !config.tooltip_show || config.axis_tooltip) {
|
|
53815
|
+
return;
|
|
53816
|
+
}
|
|
53817
|
+
const focusData = Array.isArray(data) ? data : [data];
|
|
53818
|
+
const focus = focusData.find((d) => d && $$.getBaseValue(d) != null);
|
|
53819
|
+
if (!focus) {
|
|
53820
|
+
$$.hideSubchartGridFocus();
|
|
53821
|
+
return;
|
|
53822
|
+
}
|
|
53823
|
+
const pos = $$.scale.subX(focus.x);
|
|
53824
|
+
if (!Number.isFinite(pos)) {
|
|
53825
|
+
$$.hideSubchartGridFocus();
|
|
53826
|
+
return;
|
|
53827
|
+
}
|
|
53828
|
+
const line = main.select(`g.${config_classes.xgridFocus} line.${config_classes.xgridFocus}`);
|
|
53829
|
+
if (showContinuousSubchartGridFocus($$)) {
|
|
53830
|
+
line.style("visibility", "hidden");
|
|
53831
|
+
return;
|
|
53832
|
+
}
|
|
53833
|
+
syncSubchartGridFocusStyle($$, line);
|
|
53834
|
+
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);
|
|
53835
|
+
line.style("visibility", null);
|
|
53836
|
+
},
|
|
53837
|
+
/**
|
|
53838
|
+
* Hide subchart focus grid line.
|
|
53839
|
+
* @private
|
|
53840
|
+
*/
|
|
53841
|
+
hideSubchartGridFocus() {
|
|
53842
|
+
var _a;
|
|
53843
|
+
hideContinuousSubchartGridFocus(this);
|
|
53844
|
+
(_a = this.$el.subchart.main) == null ? void 0 : _a.select(`g.${config_classes.xgridFocus} line.${config_classes.xgridFocus}`).style("visibility", "hidden");
|
|
53845
|
+
},
|
|
52790
53846
|
/**
|
|
52791
53847
|
* Redraw the brush.
|
|
52792
53848
|
* @param {boolean} [callCallbck=true] Call 'onbrush' callback or not.
|
|
@@ -52822,8 +53878,12 @@ object_extend(subchart, {
|
|
|
52822
53878
|
const $$ = this;
|
|
52823
53879
|
const { $el: { subchart }, $T } = $$;
|
|
52824
53880
|
const subXAxis = (transitions == null ? void 0 : transitions.axisSubX) ? transitions.axisSubX : $T(subchart.main.select(`.${config_classes.axisX}`), withTransition);
|
|
53881
|
+
const subYAxis = (transitions == null ? void 0 : transitions.axisSubY) ? transitions.axisSubY : $T(subchart.main.select(`.${config_classes.axisY}`), withTransition);
|
|
53882
|
+
const subY2Axis = (transitions == null ? void 0 : transitions.axisSubY2) ? transitions.axisSubY2 : $T(subchart.main.select(`.${config_classes.axisY2}`), withTransition);
|
|
52825
53883
|
subchart.main.attr("transform", $$.getTranslate("context"));
|
|
52826
53884
|
subXAxis.attr("transform", $$.getTranslate("subX"));
|
|
53885
|
+
subYAxis.attr("transform", $$.getTranslate("subY"));
|
|
53886
|
+
subY2Axis.attr("transform", $$.getTranslate("subY2"));
|
|
52827
53887
|
}
|
|
52828
53888
|
});
|
|
52829
53889
|
|
|
@@ -52831,7 +53891,7 @@ object_extend(subchart, {
|
|
|
52831
53891
|
/* harmony default export */ var interaction_subchart = ({
|
|
52832
53892
|
/**
|
|
52833
53893
|
* Set subchart options.
|
|
52834
|
-
* - **NOTE:** Not supported for
|
|
53894
|
+
* - **NOTE:** Not supported for non-Axis based(pie, donut, gauge, radar) types.
|
|
52835
53895
|
* @name subchart
|
|
52836
53896
|
* @memberof Options
|
|
52837
53897
|
* @type {object}
|
|
@@ -52839,11 +53899,45 @@ object_extend(subchart, {
|
|
|
52839
53899
|
* @property {boolean} [subchart.show=false] Show sub chart on the bottom of the chart.
|
|
52840
53900
|
* - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
|
|
52841
53901
|
* - `show: subchart()`
|
|
53902
|
+
* @property {string} [subchart.type] Set chart type for the subchart. Defaults to data.type.
|
|
53903
|
+
* @property {object} [subchart.types] Set chart type for each data in the subchart. Defaults to data.types.
|
|
53904
|
+
* @property {boolean} [subchart.brush.enabled=true] Enable subchart brush interaction.
|
|
52842
53905
|
* @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
|
|
53906
|
+
* @property {boolean|object} [subchart.grid.focus=true] Show x focus grid line in subchart when subchart brush is disabled.
|
|
53907
|
+
* @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.
|
|
52843
53908
|
* @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
|
|
52844
53909
|
* @property {boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line.
|
|
53910
|
+
* @property {number} [subchart.axis.x.tick.count] Set the number of x axis ticks.
|
|
53911
|
+
* @property {Array|function} [subchart.axis.x.tick.values] Set x axis tick values manually.
|
|
53912
|
+
* @property {boolean|object} [subchart.axis.x.tick.culling] Setting for culling x axis ticks.
|
|
53913
|
+
* @property {number} [subchart.axis.x.tick.culling.max] The number of x axis tick texts will be adjusted to less than this value.
|
|
53914
|
+
* @property {boolean} [subchart.axis.x.tick.culling.lines=true] Control x axis tick line visibility within culling option.
|
|
53915
|
+
* @property {boolean} [subchart.axis.x.tick.culling.reverse=false] Control x axis culling start point to be reversed.
|
|
53916
|
+
* @property {boolean} [subchart.axis.x.tick.outer] Show or hide x axis outer tick.
|
|
52845
53917
|
* @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.
|
|
52846
53918
|
* @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
|
|
53919
|
+
* @property {boolean} [subchart.axis.y.show=false] Show or hide y axis.
|
|
53920
|
+
* @property {boolean} [subchart.axis.y.tick.show=true] Show or hide y axis tick line.
|
|
53921
|
+
* @property {number} [subchart.axis.y.tick.count] Set the number of y axis ticks.
|
|
53922
|
+
* @property {Array|function} [subchart.axis.y.tick.values] Set y axis tick values manually.
|
|
53923
|
+
* @property {boolean|object} [subchart.axis.y.tick.culling] Setting for culling y axis ticks.
|
|
53924
|
+
* @property {number} [subchart.axis.y.tick.culling.max] The number of y axis tick texts will be adjusted to less than this value.
|
|
53925
|
+
* @property {boolean} [subchart.axis.y.tick.culling.lines=true] Control y axis tick line visibility within culling option.
|
|
53926
|
+
* @property {boolean} [subchart.axis.y.tick.culling.reverse=false] Control y axis culling start point to be reversed.
|
|
53927
|
+
* @property {boolean} [subchart.axis.y.tick.outer] Show or hide y axis outer tick.
|
|
53928
|
+
* @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.
|
|
53929
|
+
* @property {boolean} [subchart.axis.y.tick.text.show=true] Show or hide y axis tick text.
|
|
53930
|
+
* @property {boolean} [subchart.axis.y2.show=false] Show or hide y2 axis.
|
|
53931
|
+
* @property {boolean} [subchart.axis.y2.tick.show=true] Show or hide y2 axis tick line.
|
|
53932
|
+
* @property {number} [subchart.axis.y2.tick.count] Set the number of y2 axis ticks.
|
|
53933
|
+
* @property {Array|function} [subchart.axis.y2.tick.values] Set y2 axis tick values manually.
|
|
53934
|
+
* @property {boolean|object} [subchart.axis.y2.tick.culling] Setting for culling y2 axis ticks.
|
|
53935
|
+
* @property {number} [subchart.axis.y2.tick.culling.max] The number of y2 axis tick texts will be adjusted to less than this value.
|
|
53936
|
+
* @property {boolean} [subchart.axis.y2.tick.culling.lines=true] Control y2 axis tick line visibility within culling option.
|
|
53937
|
+
* @property {boolean} [subchart.axis.y2.tick.culling.reverse=false] Control y2 axis culling start point to be reversed.
|
|
53938
|
+
* @property {boolean} [subchart.axis.y2.tick.outer] Show or hide y2 axis outer tick.
|
|
53939
|
+
* @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.
|
|
53940
|
+
* @property {boolean} [subchart.axis.y2.tick.text.show=true] Show or hide y2 axis tick text.
|
|
52847
53941
|
* @property {Array} [subchart.init.range] Set initial selection domain range.
|
|
52848
53942
|
* @property {number} [subchart.size.height] Change the height of the subchart.
|
|
52849
53943
|
* @property {function} [subchart.onbrush] Set callback for brush event.<br>
|
|
@@ -52853,9 +53947,29 @@ object_extend(subchart, {
|
|
|
52853
53947
|
* subchart: {
|
|
52854
53948
|
* show: true,
|
|
52855
53949
|
* showHandle: true,
|
|
53950
|
+
*
|
|
53951
|
+
* // render the overview with a different chart type than the main chart
|
|
53952
|
+
* type: "bar",
|
|
53953
|
+
*
|
|
53954
|
+
* // override the type per data series
|
|
53955
|
+
* types: {
|
|
53956
|
+
* data2: "area"
|
|
53957
|
+
* },
|
|
52856
53958
|
* size: {
|
|
52857
53959
|
* height: 20
|
|
52858
53960
|
* },
|
|
53961
|
+
* brush: {
|
|
53962
|
+
* // disable brush(zoom) interaction, rendering the subchart as a static overview
|
|
53963
|
+
* enabled: false
|
|
53964
|
+
* },
|
|
53965
|
+
* grid: {
|
|
53966
|
+
* // set false to hide focus grid line in subchart
|
|
53967
|
+
* // focus: false,
|
|
53968
|
+
* focus: {
|
|
53969
|
+
* // NOTE: works only when 'brush.enabled=false'
|
|
53970
|
+
* continuous: true
|
|
53971
|
+
* }
|
|
53972
|
+
* },
|
|
52859
53973
|
* init: {
|
|
52860
53974
|
* // specify initial range domain selection
|
|
52861
53975
|
* range: [1, 2]
|
|
@@ -52870,6 +53984,12 @@ object_extend(subchart, {
|
|
|
52870
53984
|
* show: false
|
|
52871
53985
|
* }
|
|
52872
53986
|
* }
|
|
53987
|
+
* },
|
|
53988
|
+
* y: {
|
|
53989
|
+
* show: true,
|
|
53990
|
+
* tick: {
|
|
53991
|
+
* count: 3
|
|
53992
|
+
* }
|
|
52873
53993
|
* }
|
|
52874
53994
|
* },
|
|
52875
53995
|
* onbrush: function(domain) { ... }
|
|
@@ -52884,12 +54004,46 @@ object_extend(subchart, {
|
|
|
52884
54004
|
* }
|
|
52885
54005
|
*/
|
|
52886
54006
|
subchart_show: false,
|
|
54007
|
+
subchart_type: void 0,
|
|
54008
|
+
subchart_types: {},
|
|
54009
|
+
subchart_brush_enabled: true,
|
|
52887
54010
|
subchart_showHandle: false,
|
|
52888
54011
|
subchart_size_height: 60,
|
|
54012
|
+
subchart_grid_focus: true,
|
|
54013
|
+
subchart_grid_focus_continuous: false,
|
|
52889
54014
|
subchart_axis_x_show: true,
|
|
52890
54015
|
subchart_axis_x_tick_show: true,
|
|
54016
|
+
subchart_axis_x_tick_count: void 0,
|
|
54017
|
+
subchart_axis_x_tick_values: void 0,
|
|
54018
|
+
subchart_axis_x_tick_culling: void 0,
|
|
54019
|
+
subchart_axis_x_tick_culling_max: void 0,
|
|
54020
|
+
subchart_axis_x_tick_culling_lines: void 0,
|
|
54021
|
+
subchart_axis_x_tick_culling_reverse: void 0,
|
|
54022
|
+
subchart_axis_x_tick_outer: void 0,
|
|
52891
54023
|
subchart_axis_x_tick_format: void 0,
|
|
52892
54024
|
subchart_axis_x_tick_text_show: true,
|
|
54025
|
+
subchart_axis_y_show: false,
|
|
54026
|
+
subchart_axis_y_tick_show: true,
|
|
54027
|
+
subchart_axis_y_tick_count: void 0,
|
|
54028
|
+
subchart_axis_y_tick_values: void 0,
|
|
54029
|
+
subchart_axis_y_tick_culling: void 0,
|
|
54030
|
+
subchart_axis_y_tick_culling_max: void 0,
|
|
54031
|
+
subchart_axis_y_tick_culling_lines: void 0,
|
|
54032
|
+
subchart_axis_y_tick_culling_reverse: void 0,
|
|
54033
|
+
subchart_axis_y_tick_outer: void 0,
|
|
54034
|
+
subchart_axis_y_tick_format: void 0,
|
|
54035
|
+
subchart_axis_y_tick_text_show: true,
|
|
54036
|
+
subchart_axis_y2_show: false,
|
|
54037
|
+
subchart_axis_y2_tick_show: true,
|
|
54038
|
+
subchart_axis_y2_tick_count: void 0,
|
|
54039
|
+
subchart_axis_y2_tick_values: void 0,
|
|
54040
|
+
subchart_axis_y2_tick_culling: void 0,
|
|
54041
|
+
subchart_axis_y2_tick_culling_max: void 0,
|
|
54042
|
+
subchart_axis_y2_tick_culling_lines: void 0,
|
|
54043
|
+
subchart_axis_y2_tick_culling_reverse: void 0,
|
|
54044
|
+
subchart_axis_y2_tick_outer: void 0,
|
|
54045
|
+
subchart_axis_y2_tick_format: void 0,
|
|
54046
|
+
subchart_axis_y2_tick_text_show: true,
|
|
52893
54047
|
subchart_init_range: void 0,
|
|
52894
54048
|
subchart_onbrush: () => {
|
|
52895
54049
|
}
|
|
@@ -55671,109 +56825,6 @@ const axis = {
|
|
|
55671
56825
|
}
|
|
55672
56826
|
});
|
|
55673
56827
|
|
|
55674
|
-
;// ./node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js
|
|
55675
|
-
/* harmony default export */ function d3_axis_src_identity(x) {
|
|
55676
|
-
return x;
|
|
55677
|
-
}
|
|
55678
|
-
|
|
55679
|
-
;// ./node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/axis.js
|
|
55680
|
-
|
|
55681
|
-
var axis_top = 1, right = 2, bottom = 3, left = 4, axis_epsilon = 1e-6;
|
|
55682
|
-
function translateX(x) {
|
|
55683
|
-
return "translate(" + x + ",0)";
|
|
55684
|
-
}
|
|
55685
|
-
function translateY(y) {
|
|
55686
|
-
return "translate(0," + y + ")";
|
|
55687
|
-
}
|
|
55688
|
-
function axis_number(scale) {
|
|
55689
|
-
return (d) => +scale(d);
|
|
55690
|
-
}
|
|
55691
|
-
function center(scale, offset) {
|
|
55692
|
-
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
|
|
55693
|
-
if (scale.round()) offset = Math.round(offset);
|
|
55694
|
-
return (d) => +scale(d) + offset;
|
|
55695
|
-
}
|
|
55696
|
-
function entering() {
|
|
55697
|
-
return !this.__axis;
|
|
55698
|
-
}
|
|
55699
|
-
function axis_axis(orient, scale) {
|
|
55700
|
-
var tickArguments = [], tickValues = null, tickFormat = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === axis_top || orient === left ? -1 : 1, x = orient === left || orient === right ? "x" : "y", transform = orient === axis_top || orient === bottom ? translateX : translateY;
|
|
55701
|
-
function axis2(context) {
|
|
55702
|
-
var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format = tickFormat == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity : tickFormat, spacing = Math.max(tickSizeInner, 0) + tickPadding, range = scale.range(), range0 = +range[0] + offset, range1 = +range[range.length - 1] + offset, position = (scale.bandwidth ? center : axis_number)(scale.copy(), offset), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([null]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line = tick.select("line"), text = tick.select("text");
|
|
55703
|
-
path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor"));
|
|
55704
|
-
tick = tick.merge(tickEnter);
|
|
55705
|
-
line = line.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x + "2", k * tickSizeInner));
|
|
55706
|
-
text = text.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x, k * spacing).attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
|
55707
|
-
if (context !== selection) {
|
|
55708
|
-
path = path.transition(context);
|
|
55709
|
-
tick = tick.transition(context);
|
|
55710
|
-
line = line.transition(context);
|
|
55711
|
-
text = text.transition(context);
|
|
55712
|
-
tickExit = tickExit.transition(context).attr("opacity", axis_epsilon).attr("transform", function(d) {
|
|
55713
|
-
return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform");
|
|
55714
|
-
});
|
|
55715
|
-
tickEnter.attr("opacity", axis_epsilon).attr("transform", function(d) {
|
|
55716
|
-
var p = this.parentNode.__axis;
|
|
55717
|
-
return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset);
|
|
55718
|
-
});
|
|
55719
|
-
}
|
|
55720
|
-
tickExit.remove();
|
|
55721
|
-
path.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1);
|
|
55722
|
-
tick.attr("opacity", 1).attr("transform", function(d) {
|
|
55723
|
-
return transform(position(d) + offset);
|
|
55724
|
-
});
|
|
55725
|
-
line.attr(x + "2", k * tickSizeInner);
|
|
55726
|
-
text.attr(x, k * spacing).text(format);
|
|
55727
|
-
selection.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
|
|
55728
|
-
selection.each(function() {
|
|
55729
|
-
this.__axis = position;
|
|
55730
|
-
});
|
|
55731
|
-
}
|
|
55732
|
-
axis2.scale = function(_) {
|
|
55733
|
-
return arguments.length ? (scale = _, axis2) : scale;
|
|
55734
|
-
};
|
|
55735
|
-
axis2.ticks = function() {
|
|
55736
|
-
return tickArguments = Array.from(arguments), axis2;
|
|
55737
|
-
};
|
|
55738
|
-
axis2.tickArguments = function(_) {
|
|
55739
|
-
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis2) : tickArguments.slice();
|
|
55740
|
-
};
|
|
55741
|
-
axis2.tickValues = function(_) {
|
|
55742
|
-
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis2) : tickValues && tickValues.slice();
|
|
55743
|
-
};
|
|
55744
|
-
axis2.tickFormat = function(_) {
|
|
55745
|
-
return arguments.length ? (tickFormat = _, axis2) : tickFormat;
|
|
55746
|
-
};
|
|
55747
|
-
axis2.tickSize = function(_) {
|
|
55748
|
-
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis2) : tickSizeInner;
|
|
55749
|
-
};
|
|
55750
|
-
axis2.tickSizeInner = function(_) {
|
|
55751
|
-
return arguments.length ? (tickSizeInner = +_, axis2) : tickSizeInner;
|
|
55752
|
-
};
|
|
55753
|
-
axis2.tickSizeOuter = function(_) {
|
|
55754
|
-
return arguments.length ? (tickSizeOuter = +_, axis2) : tickSizeOuter;
|
|
55755
|
-
};
|
|
55756
|
-
axis2.tickPadding = function(_) {
|
|
55757
|
-
return arguments.length ? (tickPadding = +_, axis2) : tickPadding;
|
|
55758
|
-
};
|
|
55759
|
-
axis2.offset = function(_) {
|
|
55760
|
-
return arguments.length ? (offset = +_, axis2) : offset;
|
|
55761
|
-
};
|
|
55762
|
-
return axis2;
|
|
55763
|
-
}
|
|
55764
|
-
function axisTop(scale) {
|
|
55765
|
-
return axis_axis(axis_top, scale);
|
|
55766
|
-
}
|
|
55767
|
-
function axisRight(scale) {
|
|
55768
|
-
return axis_axis(right, scale);
|
|
55769
|
-
}
|
|
55770
|
-
function axisBottom(scale) {
|
|
55771
|
-
return axis_axis(bottom, scale);
|
|
55772
|
-
}
|
|
55773
|
-
function axisLeft(scale) {
|
|
55774
|
-
return axis_axis(left, scale);
|
|
55775
|
-
}
|
|
55776
|
-
|
|
55777
56828
|
;// ./src/ChartInternal/Axis/AxisRendererHelper.ts
|
|
55778
56829
|
var AxisRendererHelper_defProp = Object.defineProperty;
|
|
55779
56830
|
var AxisRendererHelper_defNormalProp = (obj, key, value) => key in obj ? AxisRendererHelper_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -55829,7 +56880,7 @@ class AxisRendererHelper {
|
|
|
55829
56880
|
/**
|
|
55830
56881
|
* Get tick transform setter function
|
|
55831
56882
|
* @param {string} id Axis id
|
|
55832
|
-
* @returns {(
|
|
56883
|
+
* @returns {function(d3Selection, d3Scale): void} transform setter function
|
|
55833
56884
|
* @private
|
|
55834
56885
|
*/
|
|
55835
56886
|
getTickTransformSetter(id) {
|
|
@@ -55911,6 +56962,13 @@ var AxisRenderer_publicField = (obj, key, value) => AxisRenderer_defNormalProp(o
|
|
|
55911
56962
|
|
|
55912
56963
|
|
|
55913
56964
|
|
|
56965
|
+
function getBaseAxisId(id) {
|
|
56966
|
+
return id === "subX" ? "x" : id === "subY" ? "y" : id === "subY2" ? "y2" : id;
|
|
56967
|
+
}
|
|
56968
|
+
function getAxisOptionPrefix(id) {
|
|
56969
|
+
const type = getBaseAxisId(id);
|
|
56970
|
+
return /^sub/.test(id) ? `subchart_axis_${type}` : `axis_${type}`;
|
|
56971
|
+
}
|
|
55914
56972
|
class AxisRenderer {
|
|
55915
56973
|
constructor(params = {}) {
|
|
55916
56974
|
AxisRenderer_publicField(this, "helper");
|
|
@@ -55943,8 +57001,8 @@ class AxisRenderer {
|
|
|
55943
57001
|
const { config, params } = this;
|
|
55944
57002
|
const { config: chartConfig, id, owner } = params;
|
|
55945
57003
|
const isX = /^(x|subX)$/.test(id);
|
|
55946
|
-
const type = id
|
|
55947
|
-
const customTickFormat = id
|
|
57004
|
+
const type = getBaseAxisId(id);
|
|
57005
|
+
const customTickFormat = /^sub/.test(id) ? chartConfig[`subchart_axis_${type}_tick_format`] || chartConfig[`axis_${type}_tick_format`] : chartConfig[`axis_${type}_tick_format`];
|
|
55948
57006
|
const categoryAutoWrap = params.tickMultiline && params.isCategory && !isLeftRight && !(params.tickWidth > 0);
|
|
55949
57007
|
return !!(owner.state.resizing && !owner.state.flowing && !isFunction(chartConfig.axis_evalTextSize) && !customTickFormat && !params.tickTitle && !(isX && chartConfig.axis_x_tick_autorotate) && !categoryAutoWrap && config.withoutTransition);
|
|
55950
57008
|
}
|
|
@@ -55986,10 +57044,12 @@ class AxisRenderer {
|
|
|
55986
57044
|
this.config.range = scale.rangeExtent ? scale.rangeExtent() : helper.scaleExtent((params.orgXScale || scale).range());
|
|
55987
57045
|
const { innerTickSize, tickLength, range } = config;
|
|
55988
57046
|
const id = params.id;
|
|
55989
|
-
const
|
|
55990
|
-
const
|
|
57047
|
+
const type = getBaseAxisId(id);
|
|
57048
|
+
const { isSubAxes } = params;
|
|
57049
|
+
const tickTextPos = !isSubAxes && type && /^(x|y|y2)$/.test(type) ? params.config[`axis_${type}_tick_text_position`] : { x: 0, y: 0 };
|
|
57050
|
+
const prefix = getAxisOptionPrefix(id);
|
|
55991
57051
|
const axisShow = params.config[`${prefix}_show`];
|
|
55992
|
-
const tickShow = {
|
|
57052
|
+
const tickShow = isSubAxes ? { tick: true, text: true } : {
|
|
55993
57053
|
tick: axisShow ? params.config[`${prefix}_tick_show`] : false,
|
|
55994
57054
|
text: axisShow ? params.config[`${prefix}_tick_text_show`] : false
|
|
55995
57055
|
};
|
|
@@ -56188,7 +57248,7 @@ class AxisRenderer {
|
|
|
56188
57248
|
axis_x_tick_text_inner: inner
|
|
56189
57249
|
}
|
|
56190
57250
|
} = this.params.owner;
|
|
56191
|
-
const tickLineInner = this.params.config[`axis_${axisId}_tick_inner`];
|
|
57251
|
+
const tickLineInner = this.params.config[`axis_${getBaseAxisId(axisId)}_tick_inner`];
|
|
56192
57252
|
switch (orient) {
|
|
56193
57253
|
case "bottom":
|
|
56194
57254
|
lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", (d) => this.getTickSize.bind(this)(d) * (tickLineInner ? -1 : 1));
|
|
@@ -56383,7 +57443,17 @@ var Axis_publicField = (obj, key, value) => Axis_defNormalProp(obj, typeof key !
|
|
|
56383
57443
|
|
|
56384
57444
|
|
|
56385
57445
|
|
|
56386
|
-
|
|
57446
|
+
function Axis_getBaseAxisId(id) {
|
|
57447
|
+
return id === "subX" ? "x" : id === "subY" ? "y" : id === "subY2" ? "y2" : id;
|
|
57448
|
+
}
|
|
57449
|
+
function isSubAxis(id) {
|
|
57450
|
+
return /^sub/.test(id);
|
|
57451
|
+
}
|
|
57452
|
+
function Axis_getAxisTickOption(config, id, key) {
|
|
57453
|
+
const type = Axis_getBaseAxisId(id);
|
|
57454
|
+
const subValue = config[`subchart_axis_${type}_tick_${key}`];
|
|
57455
|
+
return isSubAxis(id) && subValue !== void 0 ? subValue : config[`axis_${type}_tick_${key}`];
|
|
57456
|
+
}
|
|
56387
57457
|
function _sampleTickNodes(nodes) {
|
|
56388
57458
|
var _a, _b;
|
|
56389
57459
|
const sampled = [nodes[0], nodes[nodes.length - 1]];
|
|
@@ -56587,6 +57657,8 @@ class Axis_Axis {
|
|
|
56587
57657
|
Axis_publicField(this, "owner");
|
|
56588
57658
|
Axis_publicField(this, "x");
|
|
56589
57659
|
Axis_publicField(this, "subX");
|
|
57660
|
+
Axis_publicField(this, "subY");
|
|
57661
|
+
Axis_publicField(this, "subY2");
|
|
56590
57662
|
Axis_publicField(this, "y");
|
|
56591
57663
|
Axis_publicField(this, "y2");
|
|
56592
57664
|
Axis_publicField(this, "axesList", {});
|
|
@@ -56600,7 +57672,9 @@ class Axis_Axis {
|
|
|
56600
57672
|
x: "bottom",
|
|
56601
57673
|
y: "left",
|
|
56602
57674
|
y2: "right",
|
|
56603
|
-
subX: "bottom"
|
|
57675
|
+
subX: "bottom",
|
|
57676
|
+
subY: "left",
|
|
57677
|
+
subY2: "right"
|
|
56604
57678
|
});
|
|
56605
57679
|
this.owner = owner;
|
|
56606
57680
|
this.setOrient();
|
|
@@ -56691,7 +57765,9 @@ class Axis_Axis {
|
|
|
56691
57765
|
x: isRotated ? "left" : "bottom",
|
|
56692
57766
|
y: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
|
|
56693
57767
|
y2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right",
|
|
56694
|
-
subX: isRotated ? "left" : "bottom"
|
|
57768
|
+
subX: isRotated ? "left" : "bottom",
|
|
57769
|
+
subY: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
|
|
57770
|
+
subY2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right"
|
|
56695
57771
|
};
|
|
56696
57772
|
}
|
|
56697
57773
|
/**
|
|
@@ -56706,24 +57782,32 @@ class Axis_Axis {
|
|
|
56706
57782
|
const axes = [];
|
|
56707
57783
|
const axesConfig = config[`axis_${id}_axes`];
|
|
56708
57784
|
const isRotated = config.axis_rotated;
|
|
56709
|
-
let
|
|
57785
|
+
let orient;
|
|
56710
57786
|
if (id === "x") {
|
|
56711
|
-
|
|
57787
|
+
orient = isRotated ? "left" : "bottom";
|
|
56712
57788
|
} else if (id === "y") {
|
|
56713
|
-
|
|
57789
|
+
orient = isRotated ? "bottom" : "left";
|
|
56714
57790
|
} else if (id === "y2") {
|
|
56715
|
-
|
|
57791
|
+
orient = isRotated ? "top" : "right";
|
|
56716
57792
|
}
|
|
56717
57793
|
if (axesConfig.length) {
|
|
56718
57794
|
axesConfig.forEach((v) => {
|
|
56719
57795
|
const tick = v.tick || {};
|
|
56720
57796
|
const scale = $$.scale[id].copy();
|
|
56721
57797
|
v.domain && scale.domain(v.domain);
|
|
56722
|
-
|
|
56723
|
-
|
|
56724
|
-
|
|
56725
|
-
|
|
57798
|
+
const axis = new AxisRenderer({
|
|
57799
|
+
outerTick: tick.outer !== false,
|
|
57800
|
+
noTransition: false,
|
|
57801
|
+
config,
|
|
57802
|
+
id,
|
|
57803
|
+
isSubAxes: true,
|
|
57804
|
+
owner: $$
|
|
57805
|
+
}).scale(scale).orient(orient).tickFormat(
|
|
57806
|
+
isFunction(tick.format) ? tick.format.bind($$.api) : ((x) => x)
|
|
56726
57807
|
);
|
|
57808
|
+
isValue(tick.count) && axis.ticks(tick.count);
|
|
57809
|
+
tick.values && axis.tickValues(tick.values);
|
|
57810
|
+
axes.push(axis);
|
|
56727
57811
|
});
|
|
56728
57812
|
}
|
|
56729
57813
|
this.axesList[id] = axes;
|
|
@@ -56747,10 +57831,11 @@ class Axis_Axis {
|
|
|
56747
57831
|
const className = `${this.getAxisClassName(id)}-${i + 1}`;
|
|
56748
57832
|
let g = main.select(`.${className.replace(/\s/, ".")}`);
|
|
56749
57833
|
if (g.empty()) {
|
|
56750
|
-
g = main.append("g").attr("class", className).style("visibility", config[`axis_${id}_show`] ? null : "hidden")
|
|
57834
|
+
g = main.append("g").attr("class", className).style("visibility", config[`axis_${id}_show`] ? null : "hidden");
|
|
57835
|
+
v.create(g);
|
|
56751
57836
|
} else {
|
|
56752
57837
|
axesConfig[i].domain && scale.domain(axesConfig[i].domain);
|
|
56753
|
-
|
|
57838
|
+
v.scale(scale).create($T(g));
|
|
56754
57839
|
}
|
|
56755
57840
|
g.attr("transform", $$.getTranslate(id, i + 1));
|
|
56756
57841
|
});
|
|
@@ -56767,8 +57852,9 @@ class Axis_Axis {
|
|
|
56767
57852
|
*/
|
|
56768
57853
|
setAxis(id, scale, outerTick, noTransition) {
|
|
56769
57854
|
const $$ = this.owner;
|
|
56770
|
-
|
|
56771
|
-
|
|
57855
|
+
const type = Axis_getBaseAxisId(id);
|
|
57856
|
+
if (!isSubAxis(id)) {
|
|
57857
|
+
this.tick[type] = this.getTickValues(type);
|
|
56772
57858
|
}
|
|
56773
57859
|
this[id] = this.getAxis(
|
|
56774
57860
|
id,
|
|
@@ -56784,7 +57870,7 @@ class Axis_Axis {
|
|
|
56784
57870
|
const $$ = this.owner;
|
|
56785
57871
|
const { config } = $$;
|
|
56786
57872
|
const isX = /^(x|subX)$/.test(id);
|
|
56787
|
-
const type =
|
|
57873
|
+
const type = Axis_getBaseAxisId(id);
|
|
56788
57874
|
const isCategory = isX && this.isCategorized();
|
|
56789
57875
|
const orient = this.orient[id];
|
|
56790
57876
|
const tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type);
|
|
@@ -56792,12 +57878,12 @@ class Axis_Axis {
|
|
|
56792
57878
|
if (isX) {
|
|
56793
57879
|
tickFormat = id === "subX" ? $$.format.subXAxisTick : $$.format.xAxisTick;
|
|
56794
57880
|
} else {
|
|
56795
|
-
const fn = config[`axis_${
|
|
57881
|
+
const fn = isSubAxis(id) ? config[`subchart_axis_${type}_tick_format`] || config[`axis_${type}_tick_format`] : config[`axis_${type}_tick_format`];
|
|
56796
57882
|
if (isFunction(fn)) {
|
|
56797
57883
|
tickFormat = fn.bind($$.api);
|
|
56798
57884
|
}
|
|
56799
57885
|
}
|
|
56800
|
-
let tickValues = this.tick[type];
|
|
57886
|
+
let tickValues = isSubAxis(id) ? this.getTickValues(type, true) : this.tick[type];
|
|
56801
57887
|
const axisParams = mergeObj({
|
|
56802
57888
|
outerTick,
|
|
56803
57889
|
noTransition,
|
|
@@ -56826,7 +57912,7 @@ class Axis_Axis {
|
|
|
56826
57912
|
}
|
|
56827
57913
|
tickValues && axis.tickValues(tickValues);
|
|
56828
57914
|
axis.tickFormat(
|
|
56829
|
-
tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(
|
|
57915
|
+
tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(type) && ((x) => `${x}%`))
|
|
56830
57916
|
);
|
|
56831
57917
|
if (isCategory) {
|
|
56832
57918
|
axis.tickCentered(config.axis_x_tick_centered);
|
|
@@ -56834,7 +57920,7 @@ class Axis_Axis {
|
|
|
56834
57920
|
config.axis_x_tick_culling = false;
|
|
56835
57921
|
}
|
|
56836
57922
|
}
|
|
56837
|
-
const tickCount = config
|
|
57923
|
+
const tickCount = Axis_getAxisTickOption(config, id, "count");
|
|
56838
57924
|
tickCount && axis.ticks(tickCount);
|
|
56839
57925
|
return axis;
|
|
56840
57926
|
}
|
|
@@ -56843,24 +57929,31 @@ class Axis_Axis {
|
|
|
56843
57929
|
const $$ = this.owner;
|
|
56844
57930
|
const { config } = $$;
|
|
56845
57931
|
const fit = config.axis_x_tick_fit;
|
|
56846
|
-
|
|
56847
|
-
|
|
56848
|
-
|
|
56849
|
-
|
|
56850
|
-
|
|
56851
|
-
count
|
|
56852
|
-
|
|
56853
|
-
|
|
56854
|
-
|
|
56855
|
-
|
|
56856
|
-
|
|
56857
|
-
|
|
56858
|
-
|
|
57932
|
+
const generateValues = (countOption = config.axis_x_tick_count) => {
|
|
57933
|
+
let count = countOption;
|
|
57934
|
+
let values2;
|
|
57935
|
+
if (fit) {
|
|
57936
|
+
values2 = $$.mapTargetsToUniqueXs(targets);
|
|
57937
|
+
if (this.isCategorized() && count > values2.length) {
|
|
57938
|
+
count = values2.length;
|
|
57939
|
+
}
|
|
57940
|
+
values2 = this.generateTickValues(
|
|
57941
|
+
values2,
|
|
57942
|
+
count,
|
|
57943
|
+
this.isTimeSeries()
|
|
57944
|
+
);
|
|
57945
|
+
}
|
|
57946
|
+
return values2;
|
|
57947
|
+
};
|
|
57948
|
+
const values = generateValues();
|
|
56859
57949
|
if (axis) {
|
|
56860
57950
|
axis.tickValues(values);
|
|
56861
57951
|
} else if (this.x) {
|
|
57952
|
+
const subTickValues = this.getTickValues("x", true);
|
|
57953
|
+
const subTickCount = Axis_getAxisTickOption(config, "subX", "count");
|
|
57954
|
+
const subValues = subTickValues != null ? subTickValues : subTickCount !== config.axis_x_tick_count ? generateValues(subTickCount) : values;
|
|
56862
57955
|
this.x.tickValues(values);
|
|
56863
|
-
(_a = this.subX) == null ? void 0 : _a.tickValues(
|
|
57956
|
+
(_a = this.subX) == null ? void 0 : _a.tickValues(subValues);
|
|
56864
57957
|
}
|
|
56865
57958
|
return values;
|
|
56866
57959
|
}
|
|
@@ -56890,11 +57983,12 @@ class Axis_Axis {
|
|
|
56890
57983
|
}
|
|
56891
57984
|
return isFunction(currFormat) ? (v) => currFormat.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]) : currFormat;
|
|
56892
57985
|
}
|
|
56893
|
-
getTickValues(id) {
|
|
57986
|
+
getTickValues(id, isSub = false) {
|
|
56894
57987
|
const $$ = this.owner;
|
|
56895
|
-
const tickValues = $$.config[`axis_${id}_tick_values`];
|
|
57988
|
+
const tickValues = isSub ? Axis_getAxisTickOption($$.config, `sub${capitalize(id)}`, "values") : $$.config[`axis_${id}_tick_values`];
|
|
57989
|
+
const values = isFunction(tickValues) ? tickValues.call($$.api) : tickValues;
|
|
56896
57990
|
const axis = $$[`${id}Axis`];
|
|
56897
|
-
return
|
|
57991
|
+
return isSub ? values != null ? values : void 0 : values || (axis ? axis.tickValues() : void 0);
|
|
56898
57992
|
}
|
|
56899
57993
|
getLabelOptionByAxisId(id) {
|
|
56900
57994
|
return this.owner.config[`axis_${id}_label`];
|
|
@@ -57329,14 +58423,21 @@ class Axis_Axis {
|
|
|
57329
58423
|
generateTransitions(withTransition) {
|
|
57330
58424
|
const $$ = this.owner;
|
|
57331
58425
|
const { $el: { axis }, $T } = $$;
|
|
57332
|
-
const [axisX, axisY, axisY2, axisSubX
|
|
57333
|
-
|
|
58426
|
+
const [axisX, axisY, axisY2, axisSubX, axisSubY, axisSubY2] = [
|
|
58427
|
+
"x",
|
|
58428
|
+
"y",
|
|
58429
|
+
"y2",
|
|
58430
|
+
"subX",
|
|
58431
|
+
"subY",
|
|
58432
|
+
"subY2"
|
|
58433
|
+
].map((v) => $T(axis[v], withTransition));
|
|
58434
|
+
return { axisX, axisY, axisY2, axisSubX, axisSubY, axisSubY2 };
|
|
57334
58435
|
}
|
|
57335
58436
|
redraw(transitions, isHidden, isInit) {
|
|
57336
58437
|
const $$ = this.owner;
|
|
57337
58438
|
const { config, state, $el } = $$;
|
|
57338
58439
|
const opacity = isHidden ? "0" : null;
|
|
57339
|
-
["x", "y", "y2", "subX"].forEach((id) => {
|
|
58440
|
+
["x", "y", "y2", "subX", "subY", "subY2"].forEach((id) => {
|
|
57340
58441
|
const axis = this[id];
|
|
57341
58442
|
const $axis = $el.axis[id];
|
|
57342
58443
|
if (axis && $axis) {
|
|
@@ -57358,7 +58459,7 @@ class Axis_Axis {
|
|
|
57358
58459
|
* @private
|
|
57359
58460
|
*/
|
|
57360
58461
|
syncAxisDomains(targetsToShow, wth, flow) {
|
|
57361
|
-
var _a
|
|
58462
|
+
var _a;
|
|
57362
58463
|
const $$ = this.owner;
|
|
57363
58464
|
const { config, scale, $el } = $$;
|
|
57364
58465
|
const hasZoom = !!scale.zoom;
|
|
@@ -57404,8 +58505,30 @@ class Axis_Axis {
|
|
|
57404
58505
|
}
|
|
57405
58506
|
});
|
|
57406
58507
|
if (wth.Y) {
|
|
57407
|
-
|
|
57408
|
-
|
|
58508
|
+
const updateSubDomain = () => {
|
|
58509
|
+
var _a2, _b;
|
|
58510
|
+
(_a2 = scale.subY) == null ? void 0 : _a2.domain($$.getYDomain(targetsToShow, "y"));
|
|
58511
|
+
(_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
|
|
58512
|
+
["y", "y2"].forEach((key) => {
|
|
58513
|
+
const subAxisId = key === "y2" ? "subY2" : "subY";
|
|
58514
|
+
const axisScale = scale[subAxisId];
|
|
58515
|
+
const axis = $$.axis[subAxisId];
|
|
58516
|
+
const tickValues = this.getTickValues(key, true);
|
|
58517
|
+
const tickCount = Axis_getAxisTickOption(config, subAxisId, "count");
|
|
58518
|
+
if (!axisScale || !axis || tickValues || !tickCount) {
|
|
58519
|
+
return;
|
|
58520
|
+
}
|
|
58521
|
+
const domain = axisScale.domain();
|
|
58522
|
+
axis.tickValues(
|
|
58523
|
+
this.generateTickValues(
|
|
58524
|
+
domain,
|
|
58525
|
+
domain.every((v) => v === 0) ? 1 : tickCount,
|
|
58526
|
+
this.isTimeSeriesY()
|
|
58527
|
+
)
|
|
58528
|
+
);
|
|
58529
|
+
});
|
|
58530
|
+
};
|
|
58531
|
+
config.subchart_show ? $$.withSubchartTypeContext(updateSubDomain) : updateSubDomain();
|
|
57409
58532
|
}
|
|
57410
58533
|
}
|
|
57411
58534
|
/**
|
|
@@ -57433,20 +58556,18 @@ class Axis_Axis {
|
|
|
57433
58556
|
setCulling() {
|
|
57434
58557
|
const $$ = this.owner;
|
|
57435
58558
|
const { config, state: { clip, current }, $el } = $$;
|
|
57436
|
-
["subX", "x", "y", "y2"].forEach((type) => {
|
|
58559
|
+
["subX", "x", "y", "y2", "subY", "subY2"].forEach((type) => {
|
|
57437
58560
|
const axis = $el.axis[type];
|
|
57438
|
-
const
|
|
57439
|
-
const cullingOptionPrefix = `axis_${id}_tick_culling`;
|
|
57440
|
-
const toCull = config[cullingOptionPrefix];
|
|
58561
|
+
const toCull = Axis_getAxisTickOption(config, type, "culling");
|
|
57441
58562
|
if (axis && toCull) {
|
|
57442
58563
|
const tickNodes = axis.selectAll(".tick");
|
|
57443
58564
|
const tickValues = sortValue(
|
|
57444
58565
|
tickNodes.data(),
|
|
57445
|
-
!config
|
|
58566
|
+
!Axis_getAxisTickOption(config, type, "culling_reverse")
|
|
57446
58567
|
);
|
|
57447
58568
|
const tickSize = tickValues.length;
|
|
57448
|
-
const cullingMax = config
|
|
57449
|
-
const lines = config
|
|
58569
|
+
const cullingMax = Axis_getAxisTickOption(config, type, "culling_max");
|
|
58570
|
+
const lines = Axis_getAxisTickOption(config, type, "culling_lines");
|
|
57450
58571
|
const cullTickLine = !lines || _hasOverlappedTickLineIntervals(
|
|
57451
58572
|
this[type],
|
|
57452
58573
|
tickValues,
|
|
@@ -57766,7 +58887,7 @@ var eventrect_pow = Math.pow;
|
|
|
57766
58887
|
* @private
|
|
57767
58888
|
*/
|
|
57768
58889
|
selectRectForSingle(context, index) {
|
|
57769
|
-
var _a, _b, _c, _d;
|
|
58890
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
57770
58891
|
const $$ = this;
|
|
57771
58892
|
const { config, state, $el: { main, circle } } = $$;
|
|
57772
58893
|
const isSelectionEnabled = config.data_selection_enabled;
|
|
@@ -57777,6 +58898,7 @@ var eventrect_pow = Math.pow;
|
|
|
57777
58898
|
if (isTooltipGrouped) {
|
|
57778
58899
|
$$.showTooltip(selectedData, context);
|
|
57779
58900
|
(_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
|
|
58901
|
+
(_b = $$.showSubchartGridFocus) == null ? void 0 : _b.call($$, selectedData);
|
|
57780
58902
|
if (!isSelectionEnabled || isSelectionGrouped) {
|
|
57781
58903
|
return;
|
|
57782
58904
|
}
|
|
@@ -57789,7 +58911,7 @@ var eventrect_pow = Math.pow;
|
|
|
57789
58911
|
return $$.isWithinShape(this, d);
|
|
57790
58912
|
});
|
|
57791
58913
|
shapeAtIndex.call((selected) => {
|
|
57792
|
-
var _a2, _b2;
|
|
58914
|
+
var _a2, _b2, _c2;
|
|
57793
58915
|
const d = selected.data();
|
|
57794
58916
|
if (isSelectionEnabled && (isSelectionGrouped || (isSelectable == null ? void 0 : isSelectable.bind($$.api)(d)))) {
|
|
57795
58917
|
context.style.cursor = "pointer";
|
|
@@ -57797,7 +58919,8 @@ var eventrect_pow = Math.pow;
|
|
|
57797
58919
|
if (!isTooltipGrouped) {
|
|
57798
58920
|
$$.showTooltip(d, context);
|
|
57799
58921
|
(_a2 = $$.showGridFocus) == null ? void 0 : _a2.call($$, d);
|
|
57800
|
-
(_b2 = $$.
|
|
58922
|
+
(_b2 = $$.showSubchartGridFocus) == null ? void 0 : _b2.call($$, d);
|
|
58923
|
+
(_c2 = $$.unexpandCircles) == null ? void 0 : _c2.call($$);
|
|
57801
58924
|
selected.each((d2) => $$.setExpand(index, d2.id));
|
|
57802
58925
|
}
|
|
57803
58926
|
});
|
|
@@ -57822,14 +58945,16 @@ var eventrect_pow = Math.pow;
|
|
|
57822
58945
|
}
|
|
57823
58946
|
}
|
|
57824
58947
|
$$.showTooltip([closest], context);
|
|
57825
|
-
(
|
|
57826
|
-
(
|
|
58948
|
+
(_c = $$.showGridFocus) == null ? void 0 : _c.call($$, [closest]);
|
|
58949
|
+
(_d = $$.showSubchartGridFocus) == null ? void 0 : _d.call($$, [closest]);
|
|
58950
|
+
(_e = $$.unexpandCircles) == null ? void 0 : _e.call($$);
|
|
57827
58951
|
$$.setExpand(index, closest.id, true);
|
|
57828
58952
|
if (isSelectionEnabled && (isSelectionGrouped || (isSelectable == null ? void 0 : isSelectable.bind($$.api)(closest)))) {
|
|
57829
58953
|
context.style.cursor = "pointer";
|
|
57830
58954
|
}
|
|
57831
58955
|
} else if (config.interaction_onout) {
|
|
57832
|
-
(
|
|
58956
|
+
(_f = $$.hideGridFocus) == null ? void 0 : _f.call($$);
|
|
58957
|
+
(_g = $$.hideSubchartGridFocus) == null ? void 0 : _g.call($$);
|
|
57833
58958
|
$$.hideTooltip();
|
|
57834
58959
|
!isSelectionGrouped && $$.setExpand(index);
|
|
57835
58960
|
}
|
|
@@ -57842,7 +58967,7 @@ var eventrect_pow = Math.pow;
|
|
|
57842
58967
|
* @private
|
|
57843
58968
|
*/
|
|
57844
58969
|
selectRectForMultipleXs(context, triggerEvent = true) {
|
|
57845
|
-
var _a;
|
|
58970
|
+
var _a, _b;
|
|
57846
58971
|
const $$ = this;
|
|
57847
58972
|
const { config, state } = $$;
|
|
57848
58973
|
const targetsToShow = $$.getTargetsToShow();
|
|
@@ -57864,6 +58989,7 @@ var eventrect_pow = Math.pow;
|
|
|
57864
58989
|
$$.showTooltip(selectedData, context);
|
|
57865
58990
|
$$.setExpand(closest.index, closest.id, true);
|
|
57866
58991
|
(_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
|
|
58992
|
+
(_b = $$.showSubchartGridFocus) == null ? void 0 : _b.call($$, selectedData);
|
|
57867
58993
|
const dist = $$.dist(closest, mouse);
|
|
57868
58994
|
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
57869
58995
|
$$.$el.eventRect.style("cursor", "pointer");
|
|
@@ -57878,7 +59004,7 @@ var eventrect_pow = Math.pow;
|
|
|
57878
59004
|
* @private
|
|
57879
59005
|
*/
|
|
57880
59006
|
unselectRect() {
|
|
57881
|
-
var _a, _b, _c;
|
|
59007
|
+
var _a, _b, _c, _d;
|
|
57882
59008
|
const $$ = this;
|
|
57883
59009
|
const { state, $el: { circle, tooltip } } = $$;
|
|
57884
59010
|
state._lastTooltipMouse = null;
|
|
@@ -57889,6 +59015,7 @@ var eventrect_pow = Math.pow;
|
|
|
57889
59015
|
}
|
|
57890
59016
|
(_b = $$.$el.eventRect) == null ? void 0 : _b.style("cursor", null);
|
|
57891
59017
|
(_c = $$.hideGridFocus) == null ? void 0 : _c.call($$);
|
|
59018
|
+
(_d = $$.hideSubchartGridFocus) == null ? void 0 : _d.call($$);
|
|
57892
59019
|
if (tooltip) {
|
|
57893
59020
|
$$.hideTooltip();
|
|
57894
59021
|
$$._handleLinkedCharts(false);
|
|
@@ -59521,6 +60648,18 @@ var eventrect_pow = Math.pow;
|
|
|
59521
60648
|
|
|
59522
60649
|
;// ./src/config/Options/axis/y2.ts
|
|
59523
60650
|
/* harmony default export */ var y2 = ({
|
|
60651
|
+
/**
|
|
60652
|
+
* Set clip-path attribute for y2 axis element
|
|
60653
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
60654
|
+
* @name axis․y2․clipPath
|
|
60655
|
+
* @memberof Options
|
|
60656
|
+
* @type {boolean}
|
|
60657
|
+
* @default true
|
|
60658
|
+
* @example
|
|
60659
|
+
* // don't set 'clip-path' attribute
|
|
60660
|
+
* clipPath: false
|
|
60661
|
+
*/
|
|
60662
|
+
axis_y2_clipPath: true,
|
|
59524
60663
|
/**
|
|
59525
60664
|
* Show or hide y2 axis.
|
|
59526
60665
|
* - **NOTE**:
|
|
@@ -60019,7 +61158,7 @@ var axis_spreadValues = (a, b) => {
|
|
|
60019
61158
|
|
|
60020
61159
|
|
|
60021
61160
|
|
|
60022
|
-
/* harmony default export */ var
|
|
61161
|
+
/* harmony default export */ var axis_axis = (axis_spreadValues(axis_spreadValues(axis_spreadValues({
|
|
60023
61162
|
/**
|
|
60024
61163
|
* Setup the way to evaluate tick text size.
|
|
60025
61164
|
* - **NOTE:**
|
|
@@ -60300,7 +61439,7 @@ const internal = {
|
|
|
60300
61439
|
};
|
|
60301
61440
|
const options = {
|
|
60302
61441
|
optDataAxis: data_axis,
|
|
60303
|
-
optAxis:
|
|
61442
|
+
optAxis: axis_axis
|
|
60304
61443
|
};
|
|
60305
61444
|
|
|
60306
61445
|
;// ./src/config/resolver/axis.core.ts
|
|
@@ -60451,28 +61590,51 @@ function _getConnectLineType(id) {
|
|
|
60451
61590
|
const { bar } = isSub ? $$.$el.subchart : $$.$el;
|
|
60452
61591
|
const barPath = [];
|
|
60453
61592
|
const connectLineCache = /* @__PURE__ */ new Map();
|
|
60454
|
-
|
|
60455
|
-
|
|
60456
|
-
|
|
60457
|
-
|
|
60458
|
-
|
|
60459
|
-
|
|
60460
|
-
|
|
60461
|
-
|
|
60462
|
-
|
|
60463
|
-
|
|
60464
|
-
|
|
60465
|
-
|
|
60466
|
-
|
|
60467
|
-
|
|
60468
|
-
|
|
60469
|
-
|
|
60470
|
-
|
|
60471
|
-
|
|
60472
|
-
|
|
61593
|
+
const getRadius = getBarRadiusResolver($$);
|
|
61594
|
+
const barColor = $$.generateUpdateBarColor();
|
|
61595
|
+
const getBarPath = function(d, i, arr) {
|
|
61596
|
+
var _a;
|
|
61597
|
+
const isDrawable = isNumber(d.value) || $$.isBarRangeType(d) || ((_a = $$.isSubchartCandlestickBarValue) == null ? void 0 : _a.call($$, d, isSub));
|
|
61598
|
+
const path = isDrawable ? drawFn(d, i) : [""];
|
|
61599
|
+
let connectLineType = connectLineCache.get(d.id);
|
|
61600
|
+
if (connectLineType === void 0) {
|
|
61601
|
+
connectLineType = _getConnectLineType.call($$, d.id);
|
|
61602
|
+
connectLineCache.set(d.id, connectLineType);
|
|
61603
|
+
}
|
|
61604
|
+
if (path.length > 1) {
|
|
61605
|
+
barPath.push(path[1]);
|
|
61606
|
+
}
|
|
61607
|
+
if (i === arr.length - 1 && barPath.length) {
|
|
61608
|
+
const barConnectLineNode = $$.$T(
|
|
61609
|
+
src_select(
|
|
61610
|
+
this.parentNode.querySelector(`.${$BAR.barConnectLine}`)
|
|
61611
|
+
),
|
|
61612
|
+
withTransition,
|
|
61613
|
+
getRandom()
|
|
61614
|
+
);
|
|
61615
|
+
$$.updateConnectLine(barConnectLineNode, connectLineType, barPath);
|
|
61616
|
+
barPath.splice(0);
|
|
61617
|
+
}
|
|
61618
|
+
return path[0];
|
|
61619
|
+
};
|
|
61620
|
+
const barTransition = $$.$T(bar, withTransition, getRandom());
|
|
61621
|
+
if (getRadius && typeof barTransition.attrTween === "function") {
|
|
61622
|
+
barTransition.attrTween(
|
|
61623
|
+
"d",
|
|
61624
|
+
function(d, i, arr) {
|
|
61625
|
+
var _a;
|
|
61626
|
+
const target = getBarPath.call(this, d, i, arr);
|
|
61627
|
+
return getBarPathInterpolator((_a = this.getAttribute("d")) != null ? _a : "", target);
|
|
60473
61628
|
}
|
|
60474
|
-
|
|
60475
|
-
|
|
61629
|
+
);
|
|
61630
|
+
} else {
|
|
61631
|
+
barTransition.attr("d", getBarPath);
|
|
61632
|
+
}
|
|
61633
|
+
return [
|
|
61634
|
+
barTransition.style("fill", (d) => {
|
|
61635
|
+
var _a;
|
|
61636
|
+
return ((_a = $$.getSubchartCandlestickBarColor) == null ? void 0 : _a.call($$, d, isSub)) || barColor(d);
|
|
61637
|
+
}).style("clip-path", (d) => d.clipPath).style("opacity", null)
|
|
60476
61638
|
];
|
|
60477
61639
|
},
|
|
60478
61640
|
/**
|
|
@@ -60906,7 +62068,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
60906
62068
|
const shapeOffset = $$.getShapeOffset($$.isCandlestickType, indices, !!isSub);
|
|
60907
62069
|
const yScale = $$.getYScaleById.bind($$);
|
|
60908
62070
|
return (d, i) => {
|
|
60909
|
-
const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
|
|
62071
|
+
const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
|
|
60910
62072
|
const offset = shapeOffset(d, i) || y0;
|
|
60911
62073
|
const width = isNumber(barW) ? barW : barW[d.id] || barW._$width;
|
|
60912
62074
|
const value = $$.getCandlestickData(d);
|
|
@@ -62789,7 +63951,6 @@ var funnel_spreadValues = (a, b) => {
|
|
|
62789
63951
|
|
|
62790
63952
|
|
|
62791
63953
|
|
|
62792
|
-
|
|
62793
63954
|
function _getSize(checkNeck = false) {
|
|
62794
63955
|
const $$ = this;
|
|
62795
63956
|
const { config, state: { current: { width, height } } } = $$;
|
|
@@ -63022,7 +64183,7 @@ function _getSplineClipPath() {
|
|
|
63022
64183
|
},
|
|
63023
64184
|
/**
|
|
63024
64185
|
* Generate funnel coordinate points data for text labels
|
|
63025
|
-
* @returns {(
|
|
64186
|
+
* @returns {function(IDataRow): Array.<Array.<number>>} Point getter function
|
|
63026
64187
|
* @private
|
|
63027
64188
|
*/
|
|
63028
64189
|
generateGetFunnelPoints() {
|
|
@@ -63238,7 +64399,7 @@ let funnel_funnel = () => (extendArc([funnel], [shape_funnel]), (funnel_funnel =
|
|
|
63238
64399
|
* @property {number} [gauge.expand.rate=0.98] Set expand rate.
|
|
63239
64400
|
* @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
|
|
63240
64401
|
* @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
|
|
63241
|
-
* - **Note:**
|
|
64402
|
+
* - **Note:** Applies only to unstacked/multi-arc gauges; stacked gauge data is not supported.
|
|
63242
64403
|
* - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
|
|
63243
64404
|
* - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
|
|
63244
64405
|
* @property {number} [gauge.min=0] Set min value of the gauge.
|
|
@@ -64998,7 +66159,7 @@ ${percentValue}%`;
|
|
|
64998
66159
|
* - dice ([d3.treemapDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapDice))
|
|
64999
66160
|
* - slice ([d3.treemapSlice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSlice))
|
|
65000
66161
|
* - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
|
|
65001
|
-
* -
|
|
66162
|
+
* - squarify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
|
|
65002
66163
|
* - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
|
|
65003
66164
|
* @property {function} [treemap.label.format] Set formatter for the label text.<br>
|
|
65004
66165
|
* - **Arguments:**
|
|
@@ -65011,7 +66172,7 @@ ${percentValue}%`;
|
|
|
65011
66172
|
* @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
|
|
65012
66173
|
* @example
|
|
65013
66174
|
* treemap: {
|
|
65014
|
-
* // "binary", "dice", "slice", "sliceDice", "
|
|
66175
|
+
* // "binary", "dice", "slice", "sliceDice", "squarify", "resquarify"
|
|
65015
66176
|
* tile: "dice",
|
|
65016
66177
|
*
|
|
65017
66178
|
* label: {
|
|
@@ -65092,7 +66253,7 @@ const bb = {
|
|
|
65092
66253
|
* bb.version; // "1.0.0"
|
|
65093
66254
|
* @memberof bb
|
|
65094
66255
|
*/
|
|
65095
|
-
version: "4.0.
|
|
66256
|
+
version: "4.1.0-next.1",
|
|
65096
66257
|
/**
|
|
65097
66258
|
* Generate chart
|
|
65098
66259
|
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|