billboard.js 3.16.0-next.1 → 3.16.0
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/dist/billboard.css +2 -1
- package/dist/billboard.js +215 -165
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +9 -9
- package/dist/billboard.pkgd.js +215 -165
- package/dist/billboard.pkgd.min.js +17 -17
- 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 +23 -9
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +23 -9
- package/dist/plugin/billboardjs-plugin-stanford.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-tableview.js +18 -7
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +18 -7
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -4
- 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 +23 -9
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +23 -9
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +18 -7
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +4 -4
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +18 -7
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +5 -5
- package/dist/theme/dark.css +2 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +2 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +2 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +2 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +2 -1
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/billboard.js +293 -208
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +7 -4
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +7 -4
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +11 -11
- package/src/Chart/api/export.ts +11 -4
- package/src/ChartInternal/Axis/Axis.ts +18 -5
- package/src/ChartInternal/Axis/AxisRenderer.ts +15 -3
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +2 -2
- package/src/ChartInternal/ChartInternal.ts +51 -60
- package/src/ChartInternal/data/convert.ts +87 -48
- package/src/ChartInternal/data/data.ts +17 -38
- package/src/ChartInternal/interactions/eventrect.ts +8 -3
- package/src/ChartInternal/interactions/interaction.ts +2 -1
- package/src/ChartInternal/internals/domain.ts +1 -1
- package/src/ChartInternal/internals/grid.ts +1 -1
- package/src/ChartInternal/internals/size.ts +16 -5
- package/src/ChartInternal/internals/text.ts +30 -17
- package/src/ChartInternal/internals/tooltip.ts +2 -1
- package/src/ChartInternal/shape/arc.ts +2 -4
- package/src/ChartInternal/shape/point.ts +3 -2
- package/src/ChartInternal/shape/radar.ts +2 -1
- package/src/ChartInternal/shape/shape.ts +2 -1
- package/src/config/Options/axis/axis.ts +19 -5
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/main.ts +1 -1
- package/src/config/classes.ts +5 -2
- package/src/module/util.ts +45 -20
- package/src/scss/billboard.scss +1 -0
- package/src/scss/theme/dark.scss +1 -0
- package/src/scss/theme/datalab.scss +1 -0
- package/src/scss/theme/graph.scss +1 -0
- package/src/scss/theme/insight.scss +1 -0
- package/src/scss/theme/modern.scss +1 -0
package/dist/billboard.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.16.0
|
|
8
|
+
* @version 3.16.0
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -235,7 +235,8 @@ const $COMMON = {
|
|
|
235
235
|
empty: "bb-empty",
|
|
236
236
|
main: "bb-main",
|
|
237
237
|
target: "bb-target",
|
|
238
|
-
EXPANDED: "_expanded_"
|
|
238
|
+
EXPANDED: "_expanded_",
|
|
239
|
+
dummy: "_dummy_"
|
|
239
240
|
};
|
|
240
241
|
const $ARC = {
|
|
241
242
|
arc: "bb-arc",
|
|
@@ -262,7 +263,9 @@ const $AXIS = {
|
|
|
262
263
|
axisYLabel: "bb-axis-y-label",
|
|
263
264
|
axisXTooltip: "bb-axis-x-tooltip",
|
|
264
265
|
axisYTooltip: "bb-axis-y-tooltip",
|
|
265
|
-
axisY2Tooltip: "bb-axis-y2-tooltip"
|
|
266
|
+
axisY2Tooltip: "bb-axis-y2-tooltip",
|
|
267
|
+
axisTooltipX: "bb-axis-tooltip-x",
|
|
268
|
+
axisTooltipY: "bb-axis-tooltip-y"
|
|
266
269
|
};
|
|
267
270
|
const $BAR = {
|
|
268
271
|
bar: "bb-bar",
|
|
@@ -859,7 +862,7 @@ const $ZOOM = {
|
|
|
859
862
|
* }
|
|
860
863
|
*/
|
|
861
864
|
resize_auto: true,
|
|
862
|
-
resize_timer:
|
|
865
|
+
resize_timer: true,
|
|
863
866
|
/**
|
|
864
867
|
* Set a callback to execute when the chart is clicked.
|
|
865
868
|
* @name onclick
|
|
@@ -2416,7 +2419,7 @@ function getRectSegList(path) {
|
|
|
2416
2419
|
];
|
|
2417
2420
|
}
|
|
2418
2421
|
function getPathBox(path) {
|
|
2419
|
-
const { width, height } = path
|
|
2422
|
+
const { width, height } = getBoundingRect(path);
|
|
2420
2423
|
const items = getRectSegList(path);
|
|
2421
2424
|
const x = items[0].x;
|
|
2422
2425
|
const y = Math.min(items[0].y, items[1].y);
|
|
@@ -2448,9 +2451,20 @@ function getBrushSelection(ctx) {
|
|
|
2448
2451
|
}
|
|
2449
2452
|
return selection;
|
|
2450
2453
|
}
|
|
2451
|
-
function
|
|
2452
|
-
const
|
|
2453
|
-
|
|
2454
|
+
function getRect(relativeViewport, node, forceEval = false) {
|
|
2455
|
+
const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
|
|
2456
|
+
if (forceEval) {
|
|
2457
|
+
return _(node);
|
|
2458
|
+
} else {
|
|
2459
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
|
|
2460
|
+
return needEvaluate ? node.rect = _(node) : node.rect;
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
function getBoundingRect(node, forceEval = false) {
|
|
2464
|
+
return getRect(true, node, forceEval);
|
|
2465
|
+
}
|
|
2466
|
+
function getBBox(node, forceEval = false) {
|
|
2467
|
+
return getRect(false, node, forceEval);
|
|
2454
2468
|
}
|
|
2455
2469
|
function getRandom(asStr = true, min = 0, max = 1e4) {
|
|
2456
2470
|
const crpt = win.crypto || win.msCrypto;
|
|
@@ -2546,7 +2560,7 @@ function getTransformCTM(node, x = 0, y = 0, inverse = true) {
|
|
|
2546
2560
|
inverse ? screen == null ? void 0 : screen.inverse() : screen
|
|
2547
2561
|
);
|
|
2548
2562
|
if (inverse === false) {
|
|
2549
|
-
const rect = node
|
|
2563
|
+
const rect = getBoundingRect(node);
|
|
2550
2564
|
res.x -= rect.x;
|
|
2551
2565
|
res.y -= rect.y;
|
|
2552
2566
|
}
|
|
@@ -3523,6 +3537,35 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
3523
3537
|
}
|
|
3524
3538
|
return keys;
|
|
3525
3539
|
}
|
|
3540
|
+
function setXS(ids, data, params) {
|
|
3541
|
+
const $$ = this;
|
|
3542
|
+
const { config } = $$;
|
|
3543
|
+
let xsData;
|
|
3544
|
+
ids.forEach((id) => {
|
|
3545
|
+
const xKey = $$.getXKey(id);
|
|
3546
|
+
if (params.customX || params.timeSeries) {
|
|
3547
|
+
if (params.xs.indexOf(xKey) >= 0) {
|
|
3548
|
+
xsData = (params.appendXs && $$.data.xs[id] || []).concat(
|
|
3549
|
+
data.map((d, i) => {
|
|
3550
|
+
const rawX = isValue(d[xKey]);
|
|
3551
|
+
return rawX ? $$.generateTargetX(rawX, id, i) : false;
|
|
3552
|
+
}).filter((v) => v !== false)
|
|
3553
|
+
);
|
|
3554
|
+
} else if (config.data_x) {
|
|
3555
|
+
xsData = this.getOtherTargetXs();
|
|
3556
|
+
} else if (notEmpty(config.data_xs)) {
|
|
3557
|
+
xsData = $$.getXValuesOfXKey(xKey, $$.data.targets);
|
|
3558
|
+
}
|
|
3559
|
+
} else {
|
|
3560
|
+
xsData = data.map((d, i) => i);
|
|
3561
|
+
}
|
|
3562
|
+
if (xsData) {
|
|
3563
|
+
$$.data.xs[id] = xsData;
|
|
3564
|
+
} else {
|
|
3565
|
+
throw new Error(`x is not defined for id = "${id}".`);
|
|
3566
|
+
}
|
|
3567
|
+
});
|
|
3568
|
+
}
|
|
3526
3569
|
/* harmony default export */ var convert = ({
|
|
3527
3570
|
/**
|
|
3528
3571
|
* Convert data according its type
|
|
@@ -3564,49 +3607,43 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
3564
3607
|
throw Error("url or json or rows or columns is required.");
|
|
3565
3608
|
}
|
|
3566
3609
|
},
|
|
3610
|
+
/**
|
|
3611
|
+
* Convert data to targets
|
|
3612
|
+
* @param {object[]} data Data to convert
|
|
3613
|
+
* @param {boolean} appendXs Whether to append xs
|
|
3614
|
+
* @returns {IData[]} Converted targets
|
|
3615
|
+
* @private
|
|
3616
|
+
*/
|
|
3567
3617
|
convertDataToTargets(data, appendXs) {
|
|
3568
3618
|
const $$ = this;
|
|
3569
3619
|
const { axis, config, state } = $$;
|
|
3570
3620
|
const chartType = config.data_type;
|
|
3571
|
-
let isCategorized = false;
|
|
3572
|
-
let isTimeSeries = false;
|
|
3573
|
-
let isCustomX = false;
|
|
3574
|
-
if (axis) {
|
|
3575
|
-
isCategorized = axis.isCategorized();
|
|
3576
|
-
isTimeSeries = axis.isTimeSeries();
|
|
3577
|
-
isCustomX = axis.isCustomX();
|
|
3578
|
-
}
|
|
3579
3621
|
const dataKeys = Object.keys(data[0] || {});
|
|
3580
|
-
const ids = dataKeys.length ? dataKeys.
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
}
|
|
3598
|
-
xsData && (this.data.xs[id] = xsData);
|
|
3599
|
-
});
|
|
3600
|
-
ids.forEach((id) => {
|
|
3601
|
-
if (!this.data.xs[id]) {
|
|
3602
|
-
throw new Error(`x is not defined for id = "${id}".`);
|
|
3603
|
-
}
|
|
3604
|
-
});
|
|
3622
|
+
const { ids, xs } = dataKeys.length ? dataKeys.reduce((acc, key) => {
|
|
3623
|
+
if ($$.isX.call($$, key)) {
|
|
3624
|
+
acc.xs.push(key);
|
|
3625
|
+
} else if ($$.isNotX.call($$, key)) {
|
|
3626
|
+
acc.ids.push(key);
|
|
3627
|
+
}
|
|
3628
|
+
return acc;
|
|
3629
|
+
}, { ids: [], xs: [] }) : { ids: [], xs: [] };
|
|
3630
|
+
const params = {
|
|
3631
|
+
appendXs,
|
|
3632
|
+
xs,
|
|
3633
|
+
idConverter: config.data_idConverter.bind($$.api),
|
|
3634
|
+
categorized: axis == null ? void 0 : axis.isCategorized(),
|
|
3635
|
+
timeSeries: axis == null ? void 0 : axis.isTimeSeries(),
|
|
3636
|
+
customX: axis == null ? void 0 : axis.isCustomX()
|
|
3637
|
+
};
|
|
3638
|
+
setXS.bind($$)(ids, data, params);
|
|
3605
3639
|
const targets = ids.map((id, index) => {
|
|
3606
3640
|
const convertedId = config.data_idConverter.bind($$.api)(id);
|
|
3607
3641
|
const xKey = $$.getXKey(id);
|
|
3608
|
-
const isCategory =
|
|
3609
|
-
const hasCategory = isCategory &&
|
|
3642
|
+
const isCategory = params.customX && params.categorized;
|
|
3643
|
+
const hasCategory = isCategory && (() => {
|
|
3644
|
+
const categorySet = new Set(config.axis_x_categories);
|
|
3645
|
+
return data.every((v) => categorySet.has(v.x));
|
|
3646
|
+
})();
|
|
3610
3647
|
const isDataAppend = data.__append__;
|
|
3611
3648
|
const xIndex = xKey === null && isDataAppend ? $$.api.data.values(id).length : 0;
|
|
3612
3649
|
return {
|
|
@@ -3870,9 +3907,10 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
3870
3907
|
const minMax = $$.getMinMaxValue(data);
|
|
3871
3908
|
let min = [];
|
|
3872
3909
|
let max = [];
|
|
3910
|
+
const { min: minVal, max: maxVal } = minMax;
|
|
3873
3911
|
data.forEach((v) => {
|
|
3874
|
-
const minData = $$.getFilteredDataByValue(v,
|
|
3875
|
-
const maxData = $$.getFilteredDataByValue(v,
|
|
3912
|
+
const minData = $$.getFilteredDataByValue(v, minVal);
|
|
3913
|
+
const maxData = $$.getFilteredDataByValue(v, maxVal);
|
|
3876
3914
|
if (minData.length) {
|
|
3877
3915
|
min = min.concat(minData);
|
|
3878
3916
|
}
|
|
@@ -3900,7 +3938,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
3900
3938
|
if (!sum[i]) {
|
|
3901
3939
|
sum[i] = 0;
|
|
3902
3940
|
}
|
|
3903
|
-
sum[i] +=
|
|
3941
|
+
sum[i] += ~~v.value;
|
|
3904
3942
|
});
|
|
3905
3943
|
});
|
|
3906
3944
|
}
|
|
@@ -3917,8 +3955,9 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
3917
3955
|
const cacheKey = KEY.dataTotalSum;
|
|
3918
3956
|
let total = $$.cache.get(cacheKey);
|
|
3919
3957
|
if (!isNumber(total)) {
|
|
3920
|
-
|
|
3921
|
-
|
|
3958
|
+
total = $$.data.targets.reduce((acc, t) => {
|
|
3959
|
+
return acc + t.values.reduce((sum, v) => sum + ~~v.value, 0);
|
|
3960
|
+
}, 0);
|
|
3922
3961
|
$$.cache.add(cacheKey, total);
|
|
3923
3962
|
}
|
|
3924
3963
|
if (subtractHidden) {
|
|
@@ -4082,17 +4121,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4082
4121
|
return ys;
|
|
4083
4122
|
},
|
|
4084
4123
|
checkValueInTargets(targets, checker) {
|
|
4085
|
-
|
|
4086
|
-
let values;
|
|
4087
|
-
for (let i = 0; i < ids.length; i++) {
|
|
4088
|
-
values = targets[ids[i]].values;
|
|
4089
|
-
for (let j = 0; j < values.length; j++) {
|
|
4090
|
-
if (checker(values[j].value)) {
|
|
4091
|
-
return true;
|
|
4092
|
-
}
|
|
4093
|
-
}
|
|
4094
|
-
}
|
|
4095
|
-
return false;
|
|
4124
|
+
return Object.keys(targets).some((id) => targets[id].values.some((v) => checker(v.value)));
|
|
4096
4125
|
},
|
|
4097
4126
|
hasMultiTargets() {
|
|
4098
4127
|
return this.filterTargetsToShow().length > 1;
|
|
@@ -4219,13 +4248,12 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4219
4248
|
return index;
|
|
4220
4249
|
},
|
|
4221
4250
|
getDataLabelLength(min, max, key) {
|
|
4251
|
+
var _a;
|
|
4222
4252
|
const $$ = this;
|
|
4223
|
-
const lengths = [0, 0];
|
|
4224
4253
|
const paddingCoef = 1.3;
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
return lengths;
|
|
4254
|
+
return ((_a = $$.getTextRect(
|
|
4255
|
+
[min, max].map((v) => $$.dataLabelFormat()(v))
|
|
4256
|
+
)) == null ? void 0 : _a.map((rect) => rect[key] * paddingCoef)) || [0, 0];
|
|
4229
4257
|
},
|
|
4230
4258
|
isNoneArc(d) {
|
|
4231
4259
|
return this.hasTarget(this.data.targets, d.id);
|
|
@@ -4407,9 +4435,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4407
4435
|
if (state.hiddenTargetIds.length) {
|
|
4408
4436
|
let hiddenSum = dataValues(state.hiddenTargetIds, false);
|
|
4409
4437
|
if (hiddenSum.length) {
|
|
4410
|
-
hiddenSum = hiddenSum.reduce(
|
|
4411
|
-
(acc, curr) => acc.map((v, i) => (isNumber(v) ? v : 0) + curr[i])
|
|
4412
|
-
);
|
|
4438
|
+
hiddenSum = hiddenSum.reduce((acc, curr) => acc.map((v, i) => ~~v + curr[i]));
|
|
4413
4439
|
total = total.map((v, i) => v - hiddenSum[i]);
|
|
4414
4440
|
}
|
|
4415
4441
|
}
|
|
@@ -4470,7 +4496,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
4470
4496
|
isBarRangeType(d) {
|
|
4471
4497
|
const $$ = this;
|
|
4472
4498
|
const { value } = d;
|
|
4473
|
-
return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(
|
|
4499
|
+
return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(isNumber);
|
|
4474
4500
|
},
|
|
4475
4501
|
/**
|
|
4476
4502
|
* Get data object by id
|
|
@@ -4750,7 +4776,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
4750
4776
|
if (element) {
|
|
4751
4777
|
const isMultipleX = $$.isMultipleX();
|
|
4752
4778
|
const isRotated = config.axis_rotated;
|
|
4753
|
-
let { width, left, top } = element
|
|
4779
|
+
let { width, left, top } = getBoundingRect(element);
|
|
4754
4780
|
if (hasAxis && !hasRadar && !isMultipleX) {
|
|
4755
4781
|
const coords = eventReceiver.coords[index];
|
|
4756
4782
|
if (coords) {
|
|
@@ -6645,7 +6671,7 @@ function getScale(type = "linear", min, max) {
|
|
|
6645
6671
|
let v = 0;
|
|
6646
6672
|
while (v < 30 && parent && parent.tagName !== "BODY") {
|
|
6647
6673
|
try {
|
|
6648
|
-
v = parent
|
|
6674
|
+
v = getBoundingRect(parent, true)[key];
|
|
6649
6675
|
} catch (e) {
|
|
6650
6676
|
if (offsetName in parent) {
|
|
6651
6677
|
v = parent[offsetName];
|
|
@@ -6680,11 +6706,11 @@ function getScale(type = "linear", min, max) {
|
|
|
6680
6706
|
if (hasAxis && (isString(leftLabel) || isString(leftLabel.text) || /^inner-/.test(leftLabel == null ? void 0 : leftLabel.position))) {
|
|
6681
6707
|
const label = $el.main.select(`.${leftAxisClass}-label`);
|
|
6682
6708
|
if (!label.empty()) {
|
|
6683
|
-
labelWidth = label.node()
|
|
6709
|
+
labelWidth = getBoundingRect(label.node()).left;
|
|
6684
6710
|
}
|
|
6685
6711
|
}
|
|
6686
|
-
const svgRect = leftAxis && hasLeftAxisRect ? leftAxis
|
|
6687
|
-
const chartRectLeft = $el.chart.node()
|
|
6712
|
+
const svgRect = leftAxis && hasLeftAxisRect ? getBoundingRect(leftAxis, !withoutRecompute) : { right: 0 };
|
|
6713
|
+
const chartRectLeft = getBoundingRect($el.chart.node(), !withoutRecompute).left + labelWidth;
|
|
6688
6714
|
const hasArc = $$.hasArcType();
|
|
6689
6715
|
const svgLeft = svgRect.right - chartRectLeft - (hasArc ? 0 : $$.getCurrentPaddingByDirection("left", withoutRecompute));
|
|
6690
6716
|
return svgLeft > 0 ? svgLeft : 0;
|
|
@@ -7167,27 +7193,35 @@ function getTextPos(d, type) {
|
|
|
7167
7193
|
},
|
|
7168
7194
|
/**
|
|
7169
7195
|
* Gets the getBoundingClientRect value of the element
|
|
7170
|
-
* @param {HTMLElement|d3.selection}
|
|
7196
|
+
* @param {HTMLElement|d3.selection|Array} source Target element
|
|
7171
7197
|
* @param {string} className Class name
|
|
7172
7198
|
* @returns {object} value of element.getBoundingClientRect()
|
|
7173
7199
|
* @private
|
|
7174
7200
|
*/
|
|
7175
|
-
getTextRect(
|
|
7201
|
+
getTextRect(source, className) {
|
|
7202
|
+
var _a, _b;
|
|
7176
7203
|
const $$ = this;
|
|
7177
|
-
let
|
|
7178
|
-
|
|
7179
|
-
|
|
7204
|
+
let cacheKey;
|
|
7205
|
+
let base;
|
|
7206
|
+
let text;
|
|
7207
|
+
if (Array.isArray(source)) {
|
|
7208
|
+
cacheKey = `${KEY.textRect}-${source.join("_")}`;
|
|
7209
|
+
} else {
|
|
7210
|
+
base = (_b = (_a = source.node) == null ? void 0 : _a.call(source)) != null ? _b : source;
|
|
7211
|
+
if (!/text/i.test(base.tagName)) {
|
|
7212
|
+
base = base.querySelector("text");
|
|
7213
|
+
}
|
|
7214
|
+
text = base.textContent;
|
|
7215
|
+
cacheKey = `${KEY.textRect}-${text.replace(/\W/g, "_")}`;
|
|
7180
7216
|
}
|
|
7181
|
-
const
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
$$.$el.svg.append("text").style("visibility", "hidden").style("font", (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(base).style("font")).classed(className, true).text(text).call((v) => {
|
|
7186
|
-
rect = getBoundingRect(v.node());
|
|
7217
|
+
const rect = $$.cache.get(cacheKey) || [];
|
|
7218
|
+
if (rect.length === 0) {
|
|
7219
|
+
($$.$el.svg || $$.$el.chart.select("svg")).selectAll(`.${$COMMON.dummy}`).data(text ? [text] : source).enter().append("text").style("visibility", "hidden").style("font", base ? (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(base).style("font") : null).classed(className || $COMMON.dummy, true).text((d) => d).each(function(v, i) {
|
|
7220
|
+
rect[i] = getBoundingRect(this);
|
|
7187
7221
|
}).remove();
|
|
7188
7222
|
$$.cache.add(cacheKey, rect);
|
|
7189
7223
|
}
|
|
7190
|
-
return rect;
|
|
7224
|
+
return rect.length > 1 ? rect : rect[0];
|
|
7191
7225
|
},
|
|
7192
7226
|
/**
|
|
7193
7227
|
* Gets the x or y coordinate of the text
|
|
@@ -7717,7 +7751,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
7717
7751
|
y = isRotated ? currPos.xAxis : y;
|
|
7718
7752
|
}
|
|
7719
7753
|
const ctm = getTransformCTM(target, x, y, false);
|
|
7720
|
-
const rect = target
|
|
7754
|
+
const rect = getBoundingRect(target);
|
|
7721
7755
|
const size = getTransformCTM(target, 20, 0, false).x;
|
|
7722
7756
|
let top = ctm.y;
|
|
7723
7757
|
let left = ctm.x + tWidth / 2 + size;
|
|
@@ -8670,7 +8704,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8670
8704
|
const x = Math.min(seg0.x, seg1.x);
|
|
8671
8705
|
const y = Math.min(seg0.y, seg1.y);
|
|
8672
8706
|
const offset = this.config.bar_sensitivity;
|
|
8673
|
-
const { width, height } =
|
|
8707
|
+
const { width, height } = getBBox(that, true);
|
|
8674
8708
|
const sx = x - offset;
|
|
8675
8709
|
const ex = x + width + offset;
|
|
8676
8710
|
const sy = y + height + offset;
|
|
@@ -8812,14 +8846,15 @@ class ChartInternal {
|
|
|
8812
8846
|
init() {
|
|
8813
8847
|
const $$ = this;
|
|
8814
8848
|
const { config, state, $el } = $$;
|
|
8815
|
-
const
|
|
8849
|
+
const { boost_useCssRule, bindto } = config;
|
|
8816
8850
|
checkModuleImport($$);
|
|
8851
|
+
const hasArcType = $$.hasArcType();
|
|
8817
8852
|
state.hasRadar = !state.hasAxis && $$.hasType("radar");
|
|
8818
8853
|
state.hasFunnel = !state.hasAxis && $$.hasType("funnel");
|
|
8819
8854
|
state.hasTreemap = !state.hasAxis && $$.hasType("treemap");
|
|
8820
|
-
state.hasAxis =
|
|
8855
|
+
state.hasAxis = !hasArcType && !state.hasFunnel && !state.hasTreemap;
|
|
8821
8856
|
state.datetimeId = `bb-${+/* @__PURE__ */ new Date() * getRandom()}`;
|
|
8822
|
-
if (
|
|
8857
|
+
if (boost_useCssRule) {
|
|
8823
8858
|
const styleEl = browser_doc.createElement("style");
|
|
8824
8859
|
styleEl.type = "text/css";
|
|
8825
8860
|
browser_doc.head.appendChild(styleEl);
|
|
@@ -8829,19 +8864,19 @@ class ChartInternal {
|
|
|
8829
8864
|
};
|
|
8830
8865
|
$el.style = styleEl;
|
|
8831
8866
|
}
|
|
8832
|
-
const
|
|
8833
|
-
element:
|
|
8867
|
+
const bindConfig = {
|
|
8868
|
+
element: bindto,
|
|
8834
8869
|
classname: "bb"
|
|
8835
8870
|
};
|
|
8836
|
-
if (isObject(
|
|
8837
|
-
|
|
8838
|
-
|
|
8871
|
+
if (isObject(bindto)) {
|
|
8872
|
+
bindConfig.element = bindto.element || "#chart";
|
|
8873
|
+
bindConfig.classname = bindto.classname || bindConfig.classname;
|
|
8839
8874
|
}
|
|
8840
|
-
$el.chart = isFunction(
|
|
8875
|
+
$el.chart = isFunction(bindConfig.element.node) ? bindto.element : (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(bindConfig.element || []);
|
|
8841
8876
|
if ($el.chart.empty()) {
|
|
8842
8877
|
$el.chart = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.body.appendChild(browser_doc.createElement("div")));
|
|
8843
8878
|
}
|
|
8844
|
-
$el.chart.html("").classed(
|
|
8879
|
+
$el.chart.html("").classed(bindConfig.classname, true).classed(state.datetimeId, boost_useCssRule).style("position", "relative");
|
|
8845
8880
|
$$.initParams();
|
|
8846
8881
|
$$.initToRender();
|
|
8847
8882
|
}
|
|
@@ -8878,7 +8913,6 @@ class ChartInternal {
|
|
|
8878
8913
|
var _a;
|
|
8879
8914
|
const $$ = this;
|
|
8880
8915
|
const { config, format: format2, state } = $$;
|
|
8881
|
-
const isRotated = config.axis_rotated;
|
|
8882
8916
|
$$.color = $$.generateColor();
|
|
8883
8917
|
$$.levelColor = $$.generateLevelColor();
|
|
8884
8918
|
if (config.padding === false) {
|
|
@@ -8895,7 +8929,7 @@ class ChartInternal {
|
|
|
8895
8929
|
format2.extraLineClasses = $$.generateExtraLineClass();
|
|
8896
8930
|
format2.dataTime = config.data_xLocaltime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeParse : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcParse;
|
|
8897
8931
|
format2.axisTime = config.axis_x_localtime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeFormat : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcFormat;
|
|
8898
|
-
const isDragZoom =
|
|
8932
|
+
const isDragZoom = config.zoom_enabled && config.zoom_type === "drag";
|
|
8899
8933
|
format2.defaultAxisTime = (d) => {
|
|
8900
8934
|
const { x, zoom } = $$.scale;
|
|
8901
8935
|
const isZoomed = isDragZoom ? zoom : zoom && x.orgDomain().toString() !== zoom.domain().toString();
|
|
@@ -8903,12 +8937,13 @@ class ChartInternal {
|
|
|
8903
8937
|
return format2.axisTime(specifier)(d);
|
|
8904
8938
|
};
|
|
8905
8939
|
}
|
|
8906
|
-
|
|
8907
|
-
state.
|
|
8908
|
-
state.
|
|
8909
|
-
state.
|
|
8940
|
+
const { legend_position, legend_inset_anchor, axis_rotated } = config;
|
|
8941
|
+
state.isLegendRight = legend_position === "right";
|
|
8942
|
+
state.isLegendInset = legend_position === "inset";
|
|
8943
|
+
state.isLegendTop = legend_inset_anchor === "top-left" || legend_inset_anchor === "top-right";
|
|
8944
|
+
state.isLegendLeft = legend_inset_anchor === "top-left" || legend_inset_anchor === "bottom-left";
|
|
8910
8945
|
state.rotatedPadding.top = $$.getResettedPadding(state.rotatedPadding.top);
|
|
8911
|
-
state.rotatedPadding.right =
|
|
8946
|
+
state.rotatedPadding.right = axis_rotated && !config.axis_x_show ? 0 : 30;
|
|
8912
8947
|
state.inputType = convertInputType(
|
|
8913
8948
|
config.interaction_inputType_mouse,
|
|
8914
8949
|
config.interaction_inputType_touch
|
|
@@ -8970,7 +9005,7 @@ class ChartInternal {
|
|
|
8970
9005
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
|
|
8971
9006
|
$el.defs = $el.svg.append("defs");
|
|
8972
9007
|
if (hasAxis) {
|
|
8973
|
-
["id", "idXAxis", "idYAxis", "
|
|
9008
|
+
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
8974
9009
|
$$.appendClip($el.defs, state.clip[v]);
|
|
8975
9010
|
});
|
|
8976
9011
|
}
|
|
@@ -9035,22 +9070,23 @@ class ChartInternal {
|
|
|
9035
9070
|
if ($$.config.bar_front) {
|
|
9036
9071
|
shapes.push(shapes.shift());
|
|
9037
9072
|
}
|
|
9038
|
-
shapes
|
|
9039
|
-
const name = capitalize(
|
|
9040
|
-
if (
|
|
9073
|
+
for (const shape2 of shapes) {
|
|
9074
|
+
const name = capitalize(shape2);
|
|
9075
|
+
if (shape2 === "line" && $$.hasTypeOf(name) || $$.hasType(shape2)) {
|
|
9041
9076
|
types.push(name);
|
|
9042
9077
|
}
|
|
9043
|
-
}
|
|
9078
|
+
}
|
|
9044
9079
|
} else if (hasTreemap) {
|
|
9045
9080
|
types.push("Treemap");
|
|
9046
9081
|
} else if ($$.hasType("funnel")) {
|
|
9047
9082
|
types.push("Funnel");
|
|
9048
9083
|
} else {
|
|
9049
9084
|
const hasPolar = $$.hasType("polar");
|
|
9085
|
+
const hasGauge = $$.hasType("gauge");
|
|
9050
9086
|
if (!hasRadar) {
|
|
9051
9087
|
types.push("Arc", "Pie");
|
|
9052
9088
|
}
|
|
9053
|
-
if (
|
|
9089
|
+
if (hasGauge) {
|
|
9054
9090
|
types.push("Gauge");
|
|
9055
9091
|
} else if (hasRadar) {
|
|
9056
9092
|
types.push("Radar");
|
|
@@ -9058,10 +9094,12 @@ class ChartInternal {
|
|
|
9058
9094
|
types.push("Polar");
|
|
9059
9095
|
}
|
|
9060
9096
|
}
|
|
9061
|
-
types
|
|
9062
|
-
$$[`init${
|
|
9063
|
-
}
|
|
9064
|
-
notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"])
|
|
9097
|
+
for (const type of types) {
|
|
9098
|
+
$$[`init${type}`]();
|
|
9099
|
+
}
|
|
9100
|
+
if (notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"])) {
|
|
9101
|
+
$$.initText();
|
|
9102
|
+
}
|
|
9065
9103
|
}
|
|
9066
9104
|
/**
|
|
9067
9105
|
* Set chart elements
|
|
@@ -9130,7 +9168,7 @@ class ChartInternal {
|
|
|
9130
9168
|
* @private
|
|
9131
9169
|
*/
|
|
9132
9170
|
updateTargets(targets) {
|
|
9133
|
-
var _a;
|
|
9171
|
+
var _a, _b;
|
|
9134
9172
|
const $$ = this;
|
|
9135
9173
|
const { hasAxis, hasFunnel, hasRadar, hasTreemap } = $$.state;
|
|
9136
9174
|
const helper = (type) => $$[`updateTargetsFor${type}`](
|
|
@@ -9138,13 +9176,14 @@ class ChartInternal {
|
|
|
9138
9176
|
);
|
|
9139
9177
|
$$.updateTargetsForText(targets);
|
|
9140
9178
|
if (hasAxis) {
|
|
9141
|
-
["bar", "candlestick", "line"]
|
|
9142
|
-
|
|
9143
|
-
|
|
9179
|
+
const shapes = ["bar", "candlestick", "line"];
|
|
9180
|
+
for (const shape2 of shapes) {
|
|
9181
|
+
const name = capitalize(shape2);
|
|
9182
|
+
if (shape2 === "line" && $$.hasTypeOf(name) || $$.hasType(shape2)) {
|
|
9144
9183
|
helper(name);
|
|
9145
9184
|
}
|
|
9146
|
-
}
|
|
9147
|
-
$$.updateTargetsForSubchart
|
|
9185
|
+
}
|
|
9186
|
+
(_a = $$.updateTargetsForSubchart) == null ? void 0 : _a.call($$, targets);
|
|
9148
9187
|
} else if ($$.hasArcType(targets)) {
|
|
9149
9188
|
let type = "Arc";
|
|
9150
9189
|
if (hasRadar) {
|
|
@@ -9160,7 +9199,7 @@ class ChartInternal {
|
|
|
9160
9199
|
}
|
|
9161
9200
|
const hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
|
|
9162
9201
|
if (hasPointType) {
|
|
9163
|
-
(
|
|
9202
|
+
(_b = $$.updateTargetForCircle) == null ? void 0 : _b.call($$);
|
|
9164
9203
|
}
|
|
9165
9204
|
$$.filterTargetsToShowAtInit(hasPointType);
|
|
9166
9205
|
}
|
|
@@ -9194,28 +9233,25 @@ class ChartInternal {
|
|
|
9194
9233
|
TransitionForAxis: "Transition",
|
|
9195
9234
|
Y: true
|
|
9196
9235
|
};
|
|
9197
|
-
Object.
|
|
9198
|
-
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
}
|
|
9202
|
-
withOptions[key] = getOption(options, `with${key}`, defVal);
|
|
9203
|
-
});
|
|
9236
|
+
for (const [key, defVal] of Object.entries(withOptions)) {
|
|
9237
|
+
const value = isString(defVal) ? withOptions[defVal] : defVal;
|
|
9238
|
+
withOptions[key] = getOption(options, `with${key}`, value);
|
|
9239
|
+
}
|
|
9204
9240
|
return withOptions;
|
|
9205
9241
|
}
|
|
9206
9242
|
initialOpacity(d) {
|
|
9207
9243
|
const $$ = this;
|
|
9208
9244
|
const { withoutFadeIn } = $$.state;
|
|
9209
|
-
|
|
9210
|
-
return r;
|
|
9245
|
+
return $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
|
|
9211
9246
|
}
|
|
9212
9247
|
bindResize() {
|
|
9213
9248
|
const $$ = this;
|
|
9214
9249
|
const { $el, config, state } = $$;
|
|
9215
9250
|
const resizeFunction = generateResize(config.resize_timer);
|
|
9251
|
+
const { resize_auto } = config;
|
|
9216
9252
|
const list = [];
|
|
9217
9253
|
list.push(() => callFn(config.onresize, $$.api));
|
|
9218
|
-
if (/^(true|parent)$/.test(
|
|
9254
|
+
if (/^(true|parent)$/.test(resize_auto)) {
|
|
9219
9255
|
list.push(() => {
|
|
9220
9256
|
state.resizing = true;
|
|
9221
9257
|
if (config.legend_show) {
|
|
@@ -9231,7 +9267,7 @@ class ChartInternal {
|
|
|
9231
9267
|
});
|
|
9232
9268
|
list.forEach((v) => resizeFunction.add(v));
|
|
9233
9269
|
$$.resizeFunction = resizeFunction;
|
|
9234
|
-
if (
|
|
9270
|
+
if (resize_auto === "parent") {
|
|
9235
9271
|
($$.resizeFunction.resizeObserver = new ResizeObserver($$.resizeFunction.bind($$))).observe($el.chart.node().parentNode);
|
|
9236
9272
|
} else {
|
|
9237
9273
|
win.addEventListener("resize", $$.resizeFunction);
|
|
@@ -9693,9 +9729,9 @@ function nodeToSvgDataUrl(node, option, orgSize) {
|
|
|
9693
9729
|
}
|
|
9694
9730
|
function getCoords(elem, svgOffset) {
|
|
9695
9731
|
const { top, left } = svgOffset;
|
|
9696
|
-
const { x, y } =
|
|
9732
|
+
const { x, y } = getBBox(elem, true);
|
|
9697
9733
|
const { a, b, c, d, e, f } = elem.getScreenCTM();
|
|
9698
|
-
const { width, height } = elem
|
|
9734
|
+
const { width, height } = getBoundingRect(elem, true);
|
|
9699
9735
|
return {
|
|
9700
9736
|
x: a * x + c * y + e - left,
|
|
9701
9737
|
y: b * x + d * y + f - top + (height - Math.round(height / 4)),
|
|
@@ -9704,7 +9740,7 @@ function getCoords(elem, svgOffset) {
|
|
|
9704
9740
|
};
|
|
9705
9741
|
}
|
|
9706
9742
|
function getGlyph(svg) {
|
|
9707
|
-
const { left, top } = svg
|
|
9743
|
+
const { left, top } = getBoundingRect(svg);
|
|
9708
9744
|
const filterFn = (t) => t.textContent || t.childElementCount;
|
|
9709
9745
|
const glyph = [];
|
|
9710
9746
|
toArray(svg.querySelectorAll("text")).filter(filterFn).forEach((t) => {
|
|
@@ -12822,7 +12858,7 @@ class AxisRendererHelper {
|
|
|
12822
12858
|
};
|
|
12823
12859
|
!text.empty() && text.text("0").call((el) => {
|
|
12824
12860
|
try {
|
|
12825
|
-
const { width, height } = el.node()
|
|
12861
|
+
const { width, height } = getBBox(el.node(), true);
|
|
12826
12862
|
if (width && height) {
|
|
12827
12863
|
size.w = width;
|
|
12828
12864
|
size.h = height;
|
|
@@ -12923,6 +12959,7 @@ var AxisRenderer_publicField = (obj, key, value) => AxisRenderer_defNormalProp(o
|
|
|
12923
12959
|
|
|
12924
12960
|
|
|
12925
12961
|
|
|
12962
|
+
|
|
12926
12963
|
class AxisRenderer {
|
|
12927
12964
|
constructor(params = {}) {
|
|
12928
12965
|
AxisRenderer_publicField(this, "helper");
|
|
@@ -13002,8 +13039,17 @@ class AxisRenderer {
|
|
|
13002
13039
|
tickShow.tick && tickEnter.append("line");
|
|
13003
13040
|
tickShow.text && tickEnter.append("text");
|
|
13004
13041
|
const tickText = tick.select("text");
|
|
13005
|
-
const sizeFor1Char = isFunction(evalTextSize) ? evalTextSize.bind(ctx.params.owner.api)(tickText.node()) : AxisRendererHelper.getSizeFor1Char(tickText, evalTextSize);
|
|
13006
13042
|
const counts = [];
|
|
13043
|
+
let sizeFor1Char;
|
|
13044
|
+
if (isFunction(evalTextSize)) {
|
|
13045
|
+
sizeFor1Char = evalTextSize.bind(ctx.params.owner.api)(tickText.node(), id);
|
|
13046
|
+
if (this.classList.contains($COMMON.dummy)) {
|
|
13047
|
+
this.sizeFor1Char = sizeFor1Char;
|
|
13048
|
+
}
|
|
13049
|
+
}
|
|
13050
|
+
if (!sizeFor1Char) {
|
|
13051
|
+
sizeFor1Char = AxisRendererHelper.getSizeFor1Char(tickText, !!evalTextSize);
|
|
13052
|
+
}
|
|
13007
13053
|
let tspan = tickText.selectAll("tspan").data((d, index) => {
|
|
13008
13054
|
const split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helper.textFormatted(d)) ? helper.textFormatted(d).concat() : [helper.textFormatted(d)];
|
|
13009
13055
|
counts[index] = split.length;
|
|
@@ -13739,14 +13785,14 @@ class Axis_Axis {
|
|
|
13739
13785
|
*/
|
|
13740
13786
|
getMaxTickSize(id, withoutRecompute) {
|
|
13741
13787
|
const $$ = this.owner;
|
|
13742
|
-
const { config, state: { current }, $el: { svg, chart } } = $$;
|
|
13788
|
+
const { config, state: { current, resizing }, $el: { svg, chart } } = $$;
|
|
13743
13789
|
const currentTickMax = current.maxTickSize[id];
|
|
13744
13790
|
const configPrefix = `axis_${id}`;
|
|
13745
13791
|
const max = {
|
|
13746
13792
|
width: 0,
|
|
13747
13793
|
height: 0
|
|
13748
13794
|
};
|
|
13749
|
-
if (withoutRecompute || !config[`${configPrefix}_show`] || currentTickMax.width > 0 && $$.filterTargetsToShow().length === 0) {
|
|
13795
|
+
if (resizing || withoutRecompute || !config[`${configPrefix}_show`] || currentTickMax.width > 0 && $$.filterTargetsToShow().length === 0) {
|
|
13750
13796
|
return currentTickMax;
|
|
13751
13797
|
}
|
|
13752
13798
|
if (svg) {
|
|
@@ -13781,9 +13827,14 @@ class Axis_Axis {
|
|
|
13781
13827
|
}
|
|
13782
13828
|
!isYAxis && this.updateXAxisTickValues(targetsToShow, axis);
|
|
13783
13829
|
const dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0").style("left", "0");
|
|
13784
|
-
axis.
|
|
13830
|
+
const g = dummy.append("g").attr("class", `${$AXIS[`axis${capitalize(id)}`]} ${$COMMON.dummy}`);
|
|
13831
|
+
axis.create(g);
|
|
13832
|
+
const { sizeFor1Char } = g.node();
|
|
13785
13833
|
dummy.selectAll("text").attr("transform", isNumber(tickRotate) ? `rotate(${tickRotate})` : null).each(function(d, i) {
|
|
13786
|
-
const { width, height } =
|
|
13834
|
+
const { width, height } = sizeFor1Char ? {
|
|
13835
|
+
width: this.textContent.length * sizeFor1Char.w,
|
|
13836
|
+
height: sizeFor1Char.h
|
|
13837
|
+
} : getBoundingRect(this, true);
|
|
13787
13838
|
max.width = Math.max(max.width, width);
|
|
13788
13839
|
max.height = Math.max(max.height, height);
|
|
13789
13840
|
if (!isYAxis) {
|
|
@@ -14228,7 +14279,7 @@ class Axis_Axis {
|
|
|
14228
14279
|
const updateClientRect = () => {
|
|
14229
14280
|
if (eventReceiver) {
|
|
14230
14281
|
const scrollPos = getScrollPosition($el.chart.node());
|
|
14231
|
-
eventReceiver.rect = rectElement.node()
|
|
14282
|
+
eventReceiver.rect = getBoundingRect(rectElement.node(), true).toJSON();
|
|
14232
14283
|
eventReceiver.rect.top += scrollPos.y;
|
|
14233
14284
|
eventReceiver.rect.left += scrollPos.x;
|
|
14234
14285
|
}
|
|
@@ -15058,7 +15109,7 @@ function smoothLines(el, type) {
|
|
|
15058
15109
|
hideAxisGridFocus() {
|
|
15059
15110
|
const $$ = this;
|
|
15060
15111
|
$$.$el.main.selectAll(
|
|
15061
|
-
`line.
|
|
15112
|
+
`line.${$AXIS.axisTooltipX}, line.${$AXIS.axisTooltipY}`
|
|
15062
15113
|
).style("visibility", "hidden");
|
|
15063
15114
|
Object.values($$.$el.axisTooltip).forEach((v) => v == null ? void 0 : v.style("display", "none"));
|
|
15064
15115
|
},
|
|
@@ -16674,18 +16725,6 @@ function smoothLines(el, type) {
|
|
|
16674
16725
|
|
|
16675
16726
|
;// ./src/config/Options/axis/y2.ts
|
|
16676
16727
|
/* harmony default export */ var y2 = ({
|
|
16677
|
-
/**
|
|
16678
|
-
* Set clip-path attribute for y2 axis element
|
|
16679
|
-
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
16680
|
-
* @name axis․y2․clipPath
|
|
16681
|
-
* @memberof Options
|
|
16682
|
-
* @type {boolean}
|
|
16683
|
-
* @default true
|
|
16684
|
-
* @example
|
|
16685
|
-
* // don't set 'clip-path' attribute
|
|
16686
|
-
* clipPath: false
|
|
16687
|
-
*/
|
|
16688
|
-
axis_y2_clipPath: true,
|
|
16689
16728
|
/**
|
|
16690
16729
|
* Show or hide y2 axis.
|
|
16691
16730
|
* - **NOTE**:
|
|
@@ -17176,23 +17215,34 @@ var axis_spreadValues = (a, b) => {
|
|
|
17176
17215
|
* @memberof Options
|
|
17177
17216
|
* @type {boolean|Function}
|
|
17178
17217
|
* @default true
|
|
17218
|
+
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.AxisEvalTextSize)
|
|
17179
17219
|
* @example
|
|
17180
17220
|
* axis: {
|
|
17181
17221
|
* // will evaluate getting text size every time.
|
|
17182
17222
|
* evalTextSize: false.
|
|
17183
17223
|
*
|
|
17184
17224
|
* // set a custom evaluator
|
|
17185
|
-
* evalTextSize: function(textElement) {
|
|
17225
|
+
* evalTextSize: function(textElement, axisId) {
|
|
17186
17226
|
* // set some character to be evaluated
|
|
17187
|
-
*
|
|
17227
|
+
* // NOTE: The dummy textElement is a descendant of given axisId('x', 'y' or 'y2').
|
|
17228
|
+
* textElement.textContent = "0";
|
|
17188
17229
|
*
|
|
17189
17230
|
* // get the size
|
|
17190
|
-
*
|
|
17231
|
+
* const box = textElement.getBBox();
|
|
17191
17232
|
*
|
|
17192
17233
|
* // clear text
|
|
17193
|
-
*
|
|
17234
|
+
* textElement.textContent = "";
|
|
17194
17235
|
*
|
|
17195
17236
|
* return { w: 7, h: 12};
|
|
17237
|
+
* },
|
|
17238
|
+
*
|
|
17239
|
+
* // set a custom evaluator by returning fixed value
|
|
17240
|
+
* evalTextSize: function(textElement, axisId) {
|
|
17241
|
+
* return {
|
|
17242
|
+
* x: {w: 7, h: 12},
|
|
17243
|
+
* y: {w: 15.75, h: 30},
|
|
17244
|
+
* y2: {w: 9.5, h: 18}
|
|
17245
|
+
* }[axisId];
|
|
17196
17246
|
* }
|
|
17197
17247
|
* }
|
|
17198
17248
|
*/
|
|
@@ -18052,7 +18102,7 @@ function getAttrTweenFn(fn) {
|
|
|
18052
18102
|
value = config.arc_needle_value;
|
|
18053
18103
|
}
|
|
18054
18104
|
return tplProcess(title, {
|
|
18055
|
-
NEEDLE_VALUE:
|
|
18105
|
+
NEEDLE_VALUE: ~~value
|
|
18056
18106
|
});
|
|
18057
18107
|
}
|
|
18058
18108
|
return false;
|
|
@@ -19887,7 +19937,7 @@ const getTransitionName = () => getRandom();
|
|
|
19887
19937
|
if (this.tagName === "circle") {
|
|
19888
19938
|
point.attr("r", r);
|
|
19889
19939
|
} else {
|
|
19890
|
-
const { width, height } =
|
|
19940
|
+
const { width, height } = getBBox(this);
|
|
19891
19941
|
const x = ratio * (+point.attr("x") + width / 2);
|
|
19892
19942
|
const y = ratio * (+point.attr("y") + height / 2);
|
|
19893
19943
|
point.attr("transform", `translate(${x} ${y}) scale(${scale})`);
|
|
@@ -20020,7 +20070,7 @@ const getTransitionName = () => getRandom();
|
|
|
20020
20070
|
},
|
|
20021
20071
|
update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
|
|
20022
20072
|
const $$ = this;
|
|
20023
|
-
const { width, height } = element.node()
|
|
20073
|
+
const { width, height } = getBBox(element.node());
|
|
20024
20074
|
const xPosFn2 = (d) => isValue(d.value) ? xPosFn(d) - width / 2 : 0;
|
|
20025
20075
|
const yPosFn2 = (d) => isValue(d.value) ? yPosFn(d) - height / 2 : 0;
|
|
20026
20076
|
let mainCircles = element;
|
|
@@ -20428,7 +20478,7 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
|
|
|
20428
20478
|
});
|
|
20429
20479
|
}).datum((d, i) => ({ index: i })).attr("transform", function(d) {
|
|
20430
20480
|
if (isUndefined(this.width)) {
|
|
20431
|
-
this.width = this
|
|
20481
|
+
this.width = getBoundingRect(this, true).width / 2;
|
|
20432
20482
|
}
|
|
20433
20483
|
let posX = $$.getRadarPosition("x", d.index, void 0, 1);
|
|
20434
20484
|
let posY = Math.round($$.getRadarPosition("y", d.index, void 0, 1));
|
|
@@ -22091,7 +22141,7 @@ const bb = {
|
|
|
22091
22141
|
* bb.version; // "1.0.0"
|
|
22092
22142
|
* @memberof bb
|
|
22093
22143
|
*/
|
|
22094
|
-
version: "3.16.0
|
|
22144
|
+
version: "3.16.0",
|
|
22095
22145
|
/**
|
|
22096
22146
|
* Generate chart
|
|
22097
22147
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|