billboard.js 3.9.0 → 3.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +321 -210
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +1443 -480
- package/dist/billboard.pkgd.min.js +2 -2
- 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 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1124 -272
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1126 -274
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1126 -274
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1127 -275
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1126 -274
- 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-esm/billboard.js +242 -136
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +25 -25
- package/src/Chart/api/load.ts +4 -2
- package/src/Chart/api/tooltip.ts +11 -3
- package/src/ChartInternal/data/data.ts +31 -24
- package/src/ChartInternal/interactions/eventrect.ts +82 -12
- package/src/ChartInternal/interactions/interaction.ts +2 -57
- package/src/ChartInternal/internals/redraw.ts +2 -0
- package/src/ChartInternal/internals/tooltip.ts +112 -42
- package/src/ChartInternal/shape/arc.ts +20 -2
- package/src/ChartInternal/shape/line.ts +0 -1
- package/src/ChartInternal/shape/point.ts +20 -2
- package/src/ChartInternal/shape/radar.ts +5 -14
package/dist-esm/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.9.
|
|
8
|
+
* @version 3.9.2
|
|
9
9
|
*/
|
|
10
10
|
import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
|
|
11
11
|
import { pointer, select, namespaces, selectAll } from 'd3-selection';
|
|
@@ -4295,11 +4295,23 @@ var data$1 = {
|
|
|
4295
4295
|
*/
|
|
4296
4296
|
getDataIndexFromEvent: function (event) {
|
|
4297
4297
|
var $$ = this;
|
|
4298
|
-
var config = $$.config, _a = $$.state, inputType = _a.inputType, _b = _a.eventReceiver, coords = _b.coords, rect = _b.rect;
|
|
4299
|
-
var
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4298
|
+
var config = $$.config, _a = $$.state, hasRadar = _a.hasRadar, inputType = _a.inputType, _b = _a.eventReceiver, coords = _b.coords, rect = _b.rect;
|
|
4299
|
+
var index;
|
|
4300
|
+
if (hasRadar) {
|
|
4301
|
+
var target = event.target;
|
|
4302
|
+
// in case of multilined axis text
|
|
4303
|
+
if (/tspan/i.test(target.tagName)) {
|
|
4304
|
+
target = target.parentNode;
|
|
4305
|
+
}
|
|
4306
|
+
var d = select(target).datum();
|
|
4307
|
+
index = d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
4308
|
+
}
|
|
4309
|
+
else {
|
|
4310
|
+
var isRotated = config.axis_rotated;
|
|
4311
|
+
// get data based on the mouse coords
|
|
4312
|
+
var e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event;
|
|
4313
|
+
index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
|
|
4314
|
+
}
|
|
4303
4315
|
return index;
|
|
4304
4316
|
},
|
|
4305
4317
|
getDataLabelLength: function (min, max, key) {
|
|
@@ -4349,18 +4361,8 @@ var data$1 = {
|
|
|
4349
4361
|
},
|
|
4350
4362
|
findClosest: function (values, pos) {
|
|
4351
4363
|
var $$ = this;
|
|
4352
|
-
var
|
|
4364
|
+
var main = $$.$el.main;
|
|
4353
4365
|
var data = values.filter(function (v) { return v && isValue(v.value); });
|
|
4354
|
-
var getSensitivity = function (d) {
|
|
4355
|
-
var sensitivity = config.point_sensitivity;
|
|
4356
|
-
if (isFunction(sensitivity)) {
|
|
4357
|
-
sensitivity = sensitivity.call($$.api, d);
|
|
4358
|
-
}
|
|
4359
|
-
else if (sensitivity === "radius") {
|
|
4360
|
-
sensitivity = d.r;
|
|
4361
|
-
}
|
|
4362
|
-
return sensitivity;
|
|
4363
|
-
};
|
|
4364
4366
|
var minDist;
|
|
4365
4367
|
var closest;
|
|
4366
4368
|
// find mouseovering bar/candlestick
|
|
@@ -4380,7 +4382,7 @@ var data$1 = {
|
|
|
4380
4382
|
.filter(function (v) { return !$$.isBarType(v.id) && !$$.isCandlestickType(v.id); })
|
|
4381
4383
|
.forEach(function (v) {
|
|
4382
4384
|
var d = $$.dist(v, pos);
|
|
4383
|
-
minDist =
|
|
4385
|
+
minDist = $$.getPointSensitivity(v);
|
|
4384
4386
|
if (d < minDist) {
|
|
4385
4387
|
minDist = d;
|
|
4386
4388
|
closest = v;
|
|
@@ -4731,51 +4733,6 @@ var dataLoad = {
|
|
|
4731
4733
|
* billboard.js project is licensed under the MIT license
|
|
4732
4734
|
*/
|
|
4733
4735
|
var interaction = {
|
|
4734
|
-
selectRectForSingle: function (context, eventRect, index) {
|
|
4735
|
-
var _a, _b;
|
|
4736
|
-
var $$ = this;
|
|
4737
|
-
var config = $$.config, _c = $$.$el, main = _c.main, circle = _c.circle;
|
|
4738
|
-
var isSelectionEnabled = config.data_selection_enabled;
|
|
4739
|
-
var isSelectionGrouped = config.data_selection_grouped;
|
|
4740
|
-
var isSelectable = config.data_selection_isselectable;
|
|
4741
|
-
var isTooltipGrouped = config.tooltip_grouped;
|
|
4742
|
-
var selectedData = $$.getAllValuesOnIndex(index);
|
|
4743
|
-
if (isTooltipGrouped) {
|
|
4744
|
-
$$.showTooltip(selectedData, context);
|
|
4745
|
-
(_a = $$.showGridFocus) === null || _a === void 0 ? void 0 : _a.call($$, selectedData);
|
|
4746
|
-
if (!isSelectionEnabled || isSelectionGrouped) {
|
|
4747
|
-
return;
|
|
4748
|
-
}
|
|
4749
|
-
}
|
|
4750
|
-
// remove possible previous focused state
|
|
4751
|
-
!circle && main.selectAll(".".concat($COMMON.EXPANDED, ":not(.").concat($SHAPE.shape, "-").concat(index, ")")).classed($COMMON.EXPANDED, false);
|
|
4752
|
-
var shapeAtIndex = main.selectAll(".".concat($SHAPE.shape, "-").concat(index))
|
|
4753
|
-
.classed($COMMON.EXPANDED, true)
|
|
4754
|
-
.style("cursor", isSelectable ? "pointer" : null)
|
|
4755
|
-
.filter(function (d) {
|
|
4756
|
-
return $$.isWithinShape(this, d);
|
|
4757
|
-
});
|
|
4758
|
-
if (shapeAtIndex.empty() && !isTooltipGrouped) {
|
|
4759
|
-
(_b = $$.hideGridFocus) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
4760
|
-
$$.hideTooltip();
|
|
4761
|
-
!isSelectionGrouped && $$.setExpand(index);
|
|
4762
|
-
}
|
|
4763
|
-
shapeAtIndex
|
|
4764
|
-
.call(function (selected) {
|
|
4765
|
-
var _a, _b;
|
|
4766
|
-
var d = selected.data();
|
|
4767
|
-
if (isSelectionEnabled &&
|
|
4768
|
-
(isSelectionGrouped || (isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind($$.api)(d)))) {
|
|
4769
|
-
eventRect.style("cursor", "pointer");
|
|
4770
|
-
}
|
|
4771
|
-
if (!isTooltipGrouped) {
|
|
4772
|
-
$$.showTooltip(d, context);
|
|
4773
|
-
(_a = $$.showGridFocus) === null || _a === void 0 ? void 0 : _a.call($$, d);
|
|
4774
|
-
(_b = $$.unexpandCircles) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
4775
|
-
selected.each(function (d) { return $$.setExpand(index, d.id); });
|
|
4776
|
-
}
|
|
4777
|
-
});
|
|
4778
|
-
},
|
|
4779
4736
|
/**
|
|
4780
4737
|
* Expand data shape/point
|
|
4781
4738
|
* @param {number} index Index number
|
|
@@ -4913,14 +4870,14 @@ var interaction = {
|
|
|
4913
4870
|
* @param {Array} mouse x and y coordinate value
|
|
4914
4871
|
*/
|
|
4915
4872
|
dispatchEvent: function (type, index, mouse) {
|
|
4916
|
-
var _a;
|
|
4873
|
+
var _a, _b;
|
|
4917
4874
|
var $$ = this;
|
|
4918
|
-
var config = $$.config,
|
|
4919
|
-
var element = (
|
|
4920
|
-
(hasRadar && radar.axes.select(".".concat($AXIS.axis, "-").concat(index, " text"))) || (eventRect || (
|
|
4875
|
+
var config = $$.config, _c = $$.state, eventReceiver = _c.eventReceiver, hasAxis = _c.hasAxis, hasRadar = _c.hasRadar, hasTreemap = _c.hasTreemap, _d = $$.$el, eventRect = _d.eventRect, radar = _d.radar, treemap = _d.treemap;
|
|
4876
|
+
var element = (_b = ((hasTreemap && eventReceiver.rect) ||
|
|
4877
|
+
(hasRadar && radar.axes.select(".".concat($AXIS.axis, "-").concat(index, " text"))) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) === null || _a === void 0 ? void 0 : _a.call($$, index))))) === null || _b === void 0 ? void 0 : _b.node();
|
|
4921
4878
|
if (element) {
|
|
4922
4879
|
var isMultipleX = $$.isMultipleX();
|
|
4923
|
-
var
|
|
4880
|
+
var _e = element.getBoundingClientRect(), width = _e.width, left = _e.left, top_1 = _e.top;
|
|
4924
4881
|
if (hasAxis && !hasRadar && !isMultipleX) {
|
|
4925
4882
|
var coords = eventReceiver.coords[index];
|
|
4926
4883
|
width = coords.w;
|
|
@@ -6538,6 +6495,7 @@ var redraw = {
|
|
|
6538
6495
|
(_c = $$.redrawTitle) === null || _c === void 0 ? void 0 : _c.call($$);
|
|
6539
6496
|
initializing && $$.updateTypesElements();
|
|
6540
6497
|
$$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart);
|
|
6498
|
+
$$.updateTooltipOnRedraw();
|
|
6541
6499
|
$$.callPluginHook("$redraw", options, duration);
|
|
6542
6500
|
},
|
|
6543
6501
|
/**
|
|
@@ -8513,19 +8471,49 @@ var tooltip$1 = {
|
|
|
8513
8471
|
.replace(/(\r?\n|\t)/g, "")
|
|
8514
8472
|
.split(/{{(.*)}}/);
|
|
8515
8473
|
},
|
|
8474
|
+
/**
|
|
8475
|
+
* Update tooltip position coordinate
|
|
8476
|
+
* @param {object} dataToShow Data object
|
|
8477
|
+
* @param {SVGElement} eventTarget Event element
|
|
8478
|
+
* @private
|
|
8479
|
+
*/
|
|
8480
|
+
setTooltipPosition: function (dataToShow, eventTarget) {
|
|
8481
|
+
var _a, _b;
|
|
8482
|
+
var $$ = this;
|
|
8483
|
+
var config = $$.config, scale = $$.scale, state = $$.state, _c = $$.$el, eventRect = _c.eventRect, tooltip = _c.tooltip;
|
|
8484
|
+
var bindto = config.tooltip_contents.bindto;
|
|
8485
|
+
var datum = tooltip.datum();
|
|
8486
|
+
if (!bindto && datum) {
|
|
8487
|
+
var _d = getPointer(state.event, eventTarget !== null && eventTarget !== void 0 ? eventTarget : eventRect === null || eventRect === void 0 ? void 0 : eventRect.node()), x = _d[0], y = _d[1]; // get mouse event position
|
|
8488
|
+
var currPos = { x: x, y: y };
|
|
8489
|
+
if (scale.x && datum && "x" in datum) {
|
|
8490
|
+
currPos.xAxis = scale.x(datum.x);
|
|
8491
|
+
}
|
|
8492
|
+
var _e = datum.width, width = _e === void 0 ? 0 : _e, _f = datum.height, height = _f === void 0 ? 0 : _f;
|
|
8493
|
+
// Get tooltip position
|
|
8494
|
+
var pos_1 = (_b = (_a = config.tooltip_position) === null || _a === void 0 ? void 0 : _a.bind($$.api)(dataToShow !== null && dataToShow !== void 0 ? dataToShow : JSON.parse(datum.current), width, height, eventRect === null || eventRect === void 0 ? void 0 : eventRect.node(), currPos)) !== null && _b !== void 0 ? _b : $$.getTooltipPosition.bind($$)(width, height, currPos);
|
|
8495
|
+
["top", "left"].forEach(function (v) {
|
|
8496
|
+
var value = pos_1[v];
|
|
8497
|
+
tooltip.style(v, "".concat(value, "px"));
|
|
8498
|
+
// Remember left pos in percentage to be used on resize call
|
|
8499
|
+
if (v === "left" && !datum.xPosInPercent) {
|
|
8500
|
+
datum.xPosInPercent = value / state.current.width * 100;
|
|
8501
|
+
}
|
|
8502
|
+
});
|
|
8503
|
+
}
|
|
8504
|
+
},
|
|
8516
8505
|
/**
|
|
8517
8506
|
* Returns the position of the tooltip
|
|
8518
|
-
* @param {object} dataToShow data
|
|
8519
8507
|
* @param {string} tWidth Width value of tooltip element
|
|
8520
8508
|
* @param {string} tHeight Height value of tooltip element
|
|
8521
|
-
* @param {
|
|
8509
|
+
* @param {object} currPos Current mouse position
|
|
8522
8510
|
* @returns {object} top, left value
|
|
8523
8511
|
* @private
|
|
8524
8512
|
*/
|
|
8525
|
-
|
|
8513
|
+
getTooltipPosition: function (tWidth, tHeight, currPos) {
|
|
8526
8514
|
var $$ = this;
|
|
8527
8515
|
var config = $$.config, scale = $$.scale, state = $$.state;
|
|
8528
|
-
var width = state.width, height = state.height, current = state.current, isLegendRight = state.isLegendRight, inputType = state.inputType
|
|
8516
|
+
var width = state.width, height = state.height, current = state.current, isLegendRight = state.isLegendRight, inputType = state.inputType;
|
|
8529
8517
|
var hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle;
|
|
8530
8518
|
var hasTreemap = state.hasTreemap;
|
|
8531
8519
|
var isRotated = config.axis_rotated;
|
|
@@ -8533,7 +8521,7 @@ var tooltip$1 = {
|
|
|
8533
8521
|
var chartRight = svgLeft + current.width - $$.getCurrentPaddingRight();
|
|
8534
8522
|
var chartLeft = $$.getCurrentPaddingLeft(true);
|
|
8535
8523
|
var size = 20;
|
|
8536
|
-
var
|
|
8524
|
+
var x = currPos.x, y = currPos.y;
|
|
8537
8525
|
// Determine tooltip position
|
|
8538
8526
|
if ($$.hasArcType()) {
|
|
8539
8527
|
var raw = inputType === "touch" || $$.hasType("radar");
|
|
@@ -8543,15 +8531,14 @@ var tooltip$1 = {
|
|
|
8543
8531
|
}
|
|
8544
8532
|
}
|
|
8545
8533
|
else if (!hasTreemap) {
|
|
8546
|
-
var dataScale = scale.x(dataToShow[0].x);
|
|
8547
8534
|
if (isRotated) {
|
|
8548
|
-
y =
|
|
8535
|
+
y = currPos.xAxis + size;
|
|
8549
8536
|
x += svgLeft;
|
|
8550
8537
|
chartRight -= svgLeft;
|
|
8551
8538
|
}
|
|
8552
8539
|
else {
|
|
8553
8540
|
y -= 5;
|
|
8554
|
-
x = svgLeft + chartLeft + size + (scale.zoom ? x :
|
|
8541
|
+
x = svgLeft + chartLeft + size + (scale.zoom ? x : currPos.xAxis);
|
|
8555
8542
|
}
|
|
8556
8543
|
}
|
|
8557
8544
|
// when tooltip left + tWidth > chart's width
|
|
@@ -8574,23 +8561,20 @@ var tooltip$1 = {
|
|
|
8574
8561
|
/**
|
|
8575
8562
|
* Show the tooltip
|
|
8576
8563
|
* @param {object} selectedData Data object
|
|
8577
|
-
* @param {SVGElement}
|
|
8564
|
+
* @param {SVGElement} eventTarget Event element
|
|
8578
8565
|
* @private
|
|
8579
8566
|
*/
|
|
8580
|
-
showTooltip: function (selectedData,
|
|
8581
|
-
var _a, _b;
|
|
8567
|
+
showTooltip: function (selectedData, eventTarget) {
|
|
8582
8568
|
var $$ = this;
|
|
8583
|
-
var config = $$.config,
|
|
8584
|
-
var bindto = config.tooltip_contents.bindto;
|
|
8569
|
+
var config = $$.config, tooltip = $$.$el.tooltip;
|
|
8585
8570
|
var dataToShow = selectedData.filter(function (d) { return d && isValue($$.getBaseValue(d)); });
|
|
8586
8571
|
if (!tooltip || dataToShow.length === 0 || !config.tooltip_show) {
|
|
8587
8572
|
return;
|
|
8588
8573
|
}
|
|
8589
8574
|
var datum = tooltip.datum();
|
|
8590
|
-
var _c = datum || {}, _d = _c.width, width = _d === void 0 ? 0 : _d, _e = _c.height, height = _e === void 0 ? 0 : _e;
|
|
8591
8575
|
var dataStr = JSON.stringify(selectedData);
|
|
8592
8576
|
if (!datum || datum.current !== dataStr) {
|
|
8593
|
-
var
|
|
8577
|
+
var _a = selectedData.concat().sort()[0], index = _a.index, x = _a.x;
|
|
8594
8578
|
callFn(config.tooltip_onshow, $$.api, selectedData);
|
|
8595
8579
|
// set tooltip content
|
|
8596
8580
|
tooltip
|
|
@@ -8603,32 +8587,15 @@ var tooltip$1 = {
|
|
|
8603
8587
|
.style("visibility", null) // for IE9
|
|
8604
8588
|
.datum(datum = {
|
|
8605
8589
|
index: index,
|
|
8590
|
+
x: x,
|
|
8606
8591
|
current: dataStr,
|
|
8607
|
-
width:
|
|
8608
|
-
height:
|
|
8592
|
+
width: tooltip.property("offsetWidth"),
|
|
8593
|
+
height: tooltip.property("offsetHeight")
|
|
8609
8594
|
});
|
|
8610
8595
|
callFn(config.tooltip_onshown, $$.api, selectedData);
|
|
8611
8596
|
$$._handleLinkedCharts(true, index);
|
|
8612
8597
|
}
|
|
8613
|
-
|
|
8614
|
-
var fnPos = ((_a = config.tooltip_position) === null || _a === void 0 ? void 0 : _a.bind($$.api)) || $$.tooltipPosition.bind($$);
|
|
8615
|
-
var _f = getPointer(state.event, eventRect), x = _f[0], y = _f[1]; // get mouse event position
|
|
8616
|
-
var currPos = { x: x, y: y };
|
|
8617
|
-
var data = (_b = selectedData.filter(Boolean)) === null || _b === void 0 ? void 0 : _b.shift();
|
|
8618
|
-
if (scale.x && data && "x" in data) {
|
|
8619
|
-
currPos.xAxis = scale.x(data.x);
|
|
8620
|
-
}
|
|
8621
|
-
// Get tooltip dimensions
|
|
8622
|
-
var pos_1 = fnPos(dataToShow, width, height, eventRect, currPos);
|
|
8623
|
-
["top", "left"].forEach(function (v) {
|
|
8624
|
-
var value = pos_1[v];
|
|
8625
|
-
tooltip.style(v, "".concat(value, "px"));
|
|
8626
|
-
// Remember left pos in percentage to be used on resize call
|
|
8627
|
-
if (v === "left" && !datum.xPosInPercent) {
|
|
8628
|
-
datum.xPosInPercent = value / state.current.width * 100;
|
|
8629
|
-
}
|
|
8630
|
-
});
|
|
8631
|
-
}
|
|
8598
|
+
$$.setTooltipPosition(dataToShow, eventTarget);
|
|
8632
8599
|
},
|
|
8633
8600
|
/**
|
|
8634
8601
|
* Adjust tooltip position on resize event
|
|
@@ -8700,6 +8667,55 @@ var tooltip$1 = {
|
|
|
8700
8667
|
}
|
|
8701
8668
|
});
|
|
8702
8669
|
}
|
|
8670
|
+
},
|
|
8671
|
+
/**
|
|
8672
|
+
* Update tooltip content on redraw
|
|
8673
|
+
* - In a situation where tooltip is displayed and data load happens, it should reflect loaded data to tooltip
|
|
8674
|
+
* @param {d3Selection} context Event rect element
|
|
8675
|
+
* @param {number} index Data index
|
|
8676
|
+
* @private
|
|
8677
|
+
*/
|
|
8678
|
+
updateTooltipOnRedraw: function (context, index) {
|
|
8679
|
+
var _a;
|
|
8680
|
+
var $$ = this;
|
|
8681
|
+
var config = $$.config, _b = $$.$el, eventRect = _b.eventRect, svg = _b.svg, tooltip = _b.tooltip, _c = $$.state, event = _c.event, hasAxis = _c.hasAxis, hasRadar = _c.hasRadar, hasTreemap = _c.hasTreemap;
|
|
8682
|
+
// Update tooltip, when tooltip is in shown state
|
|
8683
|
+
if ((tooltip === null || tooltip === void 0 ? void 0 : tooltip.style("display")) === "block" && event) {
|
|
8684
|
+
var rect = context !== null && context !== void 0 ? context : (_a = (hasRadar ? svg : eventRect)) === null || _a === void 0 ? void 0 : _a.node();
|
|
8685
|
+
// for Axis based & Radar
|
|
8686
|
+
if (hasAxis || hasRadar) {
|
|
8687
|
+
if ($$.isMultipleX()) {
|
|
8688
|
+
$$.selectRectForMultipleXs(rect, false);
|
|
8689
|
+
}
|
|
8690
|
+
else {
|
|
8691
|
+
var idx = index !== null && index !== void 0 ? index : $$.getDataIndexFromEvent(event);
|
|
8692
|
+
if (index === -1) {
|
|
8693
|
+
$$.api.tooltip.hide();
|
|
8694
|
+
}
|
|
8695
|
+
else {
|
|
8696
|
+
$$.selectRectForSingle(rect, idx);
|
|
8697
|
+
$$.setExpand(idx, null, true);
|
|
8698
|
+
}
|
|
8699
|
+
}
|
|
8700
|
+
// for Arc & Treemap
|
|
8701
|
+
}
|
|
8702
|
+
else {
|
|
8703
|
+
var clientX_1 = event.clientX, clientY_1 = event.clientY;
|
|
8704
|
+
setTimeout(function () {
|
|
8705
|
+
var target = doc.elementFromPoint(clientX_1, clientY_1);
|
|
8706
|
+
var data = select(target).datum();
|
|
8707
|
+
if (data) {
|
|
8708
|
+
var d = $$.hasArcType() ?
|
|
8709
|
+
$$.convertToArcData($$.updateAngle(data)) : data === null || data === void 0 ? void 0 : data.data;
|
|
8710
|
+
hasTreemap && (target = svg.node());
|
|
8711
|
+
d && $$.showTooltip([d], target);
|
|
8712
|
+
}
|
|
8713
|
+
else {
|
|
8714
|
+
$$.api.tooltip.hide();
|
|
8715
|
+
}
|
|
8716
|
+
}, config.transition_duration);
|
|
8717
|
+
}
|
|
8718
|
+
}
|
|
8703
8719
|
}
|
|
8704
8720
|
};
|
|
8705
8721
|
|
|
@@ -10655,7 +10671,6 @@ var apiLoad = {
|
|
|
10655
10671
|
});
|
|
10656
10672
|
}
|
|
10657
10673
|
else {
|
|
10658
|
-
$$.api.tooltip.hide();
|
|
10659
10674
|
$$.loadFromArgs(args);
|
|
10660
10675
|
}
|
|
10661
10676
|
},
|
|
@@ -10687,6 +10702,8 @@ var apiLoad = {
|
|
|
10687
10702
|
unload: function (argsValue) {
|
|
10688
10703
|
var $$ = this.internal;
|
|
10689
10704
|
var args = argsValue || {};
|
|
10705
|
+
// hide possible tooltip display when data is completely unloaded
|
|
10706
|
+
isEmpty(args) && this.tooltip.hide();
|
|
10690
10707
|
if (isArray(args)) {
|
|
10691
10708
|
args = { ids: args };
|
|
10692
10709
|
}
|
|
@@ -10879,6 +10896,10 @@ var tooltip = {
|
|
|
10879
10896
|
* }
|
|
10880
10897
|
* });
|
|
10881
10898
|
*
|
|
10899
|
+
* // for Arc types, specify 'id' or 'index'
|
|
10900
|
+
* chart.tooltip.show({ data: { id: "data2" }});
|
|
10901
|
+
* chart.tooltip.show({ data: { index: 2 }});
|
|
10902
|
+
*
|
|
10882
10903
|
* // when data.xs is used
|
|
10883
10904
|
* chart.tooltip.show({
|
|
10884
10905
|
* data: {
|
|
@@ -10898,8 +10919,9 @@ var tooltip = {
|
|
|
10898
10919
|
* });
|
|
10899
10920
|
*/
|
|
10900
10921
|
show: function (args) {
|
|
10922
|
+
var _a, _b, _c;
|
|
10901
10923
|
var $$ = this.internal;
|
|
10902
|
-
var $el = $$.$el, config = $$.config,
|
|
10924
|
+
var $el = $$.$el, config = $$.config, _d = $$.state, eventReceiver = _d.eventReceiver, hasTreemap = _d.hasTreemap, inputType = _d.inputType;
|
|
10903
10925
|
var index;
|
|
10904
10926
|
var mouse;
|
|
10905
10927
|
// determine mouse position on the chart
|
|
@@ -10909,7 +10931,7 @@ var tooltip = {
|
|
|
10909
10931
|
// determine focus data
|
|
10910
10932
|
if (args.data) {
|
|
10911
10933
|
var data = args.data;
|
|
10912
|
-
var y = $$.getYScaleById(data.id)(data.value);
|
|
10934
|
+
var y = (_a = $$.getYScaleById(data.id)) === null || _a === void 0 ? void 0 : _a(data.value);
|
|
10913
10935
|
if (hasTreemap && data.id) {
|
|
10914
10936
|
eventReceiver.rect = $el.main.select("".concat($$.selectorTarget(data.id, undefined, "rect")));
|
|
10915
10937
|
}
|
|
@@ -10921,7 +10943,9 @@ var tooltip = {
|
|
|
10921
10943
|
if (!config.tooltip_grouped) {
|
|
10922
10944
|
mouse = [0, y];
|
|
10923
10945
|
}
|
|
10924
|
-
index =
|
|
10946
|
+
index = (_b = data.index) !== null && _b !== void 0 ? _b : ($$.hasArcType() && data.id ?
|
|
10947
|
+
(_c = $$.getArcElementByIdOrIndex(data.id)) === null || _c === void 0 ? void 0 : _c.datum().index :
|
|
10948
|
+
$$.getIndexByX(data.x));
|
|
10925
10949
|
}
|
|
10926
10950
|
}
|
|
10927
10951
|
else if (isDefined(args.x)) {
|
|
@@ -13384,7 +13408,7 @@ var eventrect = {
|
|
|
13384
13408
|
eventRectUpdate.call($$.getDraggableSelection());
|
|
13385
13409
|
$el.eventRect = eventRectUpdate;
|
|
13386
13410
|
if ($$.state.inputType === "touch" && !$el.svg.on("touchstart.eventRect") && !$$.hasArcType()) {
|
|
13387
|
-
$$.bindTouchOnEventRect(
|
|
13411
|
+
$$.bindTouchOnEventRect();
|
|
13388
13412
|
}
|
|
13389
13413
|
// when initilazed with empty data and data loaded later, need to update eventRect
|
|
13390
13414
|
state.rendered && $$.updateEventRect($el.eventRect, true);
|
|
@@ -13403,11 +13427,11 @@ var eventrect = {
|
|
|
13403
13427
|
}
|
|
13404
13428
|
$$.updateEventRectData();
|
|
13405
13429
|
},
|
|
13406
|
-
bindTouchOnEventRect: function (
|
|
13430
|
+
bindTouchOnEventRect: function () {
|
|
13407
13431
|
var $$ = this;
|
|
13408
13432
|
var config = $$.config, state = $$.state, _a = $$.$el, eventRect = _a.eventRect, svg = _a.svg;
|
|
13409
13433
|
var selectRect = function (context) {
|
|
13410
|
-
if (isMultipleX) {
|
|
13434
|
+
if ($$.isMultipleX()) {
|
|
13411
13435
|
$$.selectRectForMultipleXs(context);
|
|
13412
13436
|
}
|
|
13413
13437
|
else {
|
|
@@ -13415,7 +13439,7 @@ var eventrect = {
|
|
|
13415
13439
|
$$.callOverOutForTouch(index);
|
|
13416
13440
|
index === -1 ?
|
|
13417
13441
|
$$.unselectRect() :
|
|
13418
|
-
$$.selectRectForSingle(context,
|
|
13442
|
+
$$.selectRectForSingle(context, index);
|
|
13419
13443
|
}
|
|
13420
13444
|
};
|
|
13421
13445
|
var unselectRect = function () {
|
|
@@ -13605,7 +13629,65 @@ var eventrect = {
|
|
|
13605
13629
|
};
|
|
13606
13630
|
});
|
|
13607
13631
|
},
|
|
13608
|
-
|
|
13632
|
+
/**
|
|
13633
|
+
* Seletct rect for single x value
|
|
13634
|
+
* @param {d3Selection} context Event rect element
|
|
13635
|
+
* @param {number} index x Axis index
|
|
13636
|
+
* @private
|
|
13637
|
+
*/
|
|
13638
|
+
selectRectForSingle: function (context, index) {
|
|
13639
|
+
var _a, _b;
|
|
13640
|
+
var $$ = this;
|
|
13641
|
+
var config = $$.config, _c = $$.$el, main = _c.main, circle = _c.circle;
|
|
13642
|
+
var isSelectionEnabled = config.data_selection_enabled;
|
|
13643
|
+
var isSelectionGrouped = config.data_selection_grouped;
|
|
13644
|
+
var isSelectable = config.data_selection_isselectable;
|
|
13645
|
+
var isTooltipGrouped = config.tooltip_grouped;
|
|
13646
|
+
var selectedData = $$.getAllValuesOnIndex(index);
|
|
13647
|
+
if (isTooltipGrouped) {
|
|
13648
|
+
$$.showTooltip(selectedData, context);
|
|
13649
|
+
(_a = $$.showGridFocus) === null || _a === void 0 ? void 0 : _a.call($$, selectedData);
|
|
13650
|
+
if (!isSelectionEnabled || isSelectionGrouped) {
|
|
13651
|
+
return;
|
|
13652
|
+
}
|
|
13653
|
+
}
|
|
13654
|
+
// remove possible previous focused state
|
|
13655
|
+
!circle && main.selectAll(".".concat($COMMON.EXPANDED, ":not(.").concat($SHAPE.shape, "-").concat(index, ")")).classed($COMMON.EXPANDED, false);
|
|
13656
|
+
var shapeAtIndex = main.selectAll(".".concat($SHAPE.shape, "-").concat(index))
|
|
13657
|
+
.classed($COMMON.EXPANDED, true)
|
|
13658
|
+
.style("cursor", isSelectable ? "pointer" : null)
|
|
13659
|
+
.filter(function (d) {
|
|
13660
|
+
return $$.isWithinShape(this, d);
|
|
13661
|
+
});
|
|
13662
|
+
if (shapeAtIndex.empty() && !isTooltipGrouped) {
|
|
13663
|
+
(_b = $$.hideGridFocus) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
13664
|
+
$$.hideTooltip();
|
|
13665
|
+
!isSelectionGrouped && $$.setExpand(index);
|
|
13666
|
+
}
|
|
13667
|
+
shapeAtIndex
|
|
13668
|
+
.call(function (selected) {
|
|
13669
|
+
var _a, _b;
|
|
13670
|
+
var d = selected.data();
|
|
13671
|
+
if (isSelectionEnabled &&
|
|
13672
|
+
(isSelectionGrouped || (isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind($$.api)(d)))) {
|
|
13673
|
+
context.style.cursor = "pointer";
|
|
13674
|
+
}
|
|
13675
|
+
if (!isTooltipGrouped) {
|
|
13676
|
+
$$.showTooltip(d, context);
|
|
13677
|
+
(_a = $$.showGridFocus) === null || _a === void 0 ? void 0 : _a.call($$, d);
|
|
13678
|
+
(_b = $$.unexpandCircles) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
13679
|
+
selected.each(function (d) { return $$.setExpand(index, d.id); });
|
|
13680
|
+
}
|
|
13681
|
+
});
|
|
13682
|
+
},
|
|
13683
|
+
/**
|
|
13684
|
+
* Select rect for multiple x values
|
|
13685
|
+
* @param {d3Selection} context Event rect element
|
|
13686
|
+
* @param {boolean} [triggerEvent=true] Whether trigger event or not
|
|
13687
|
+
* @private
|
|
13688
|
+
*/
|
|
13689
|
+
selectRectForMultipleXs: function (context, triggerEvent) {
|
|
13690
|
+
if (triggerEvent === void 0) { triggerEvent = true; }
|
|
13609
13691
|
var $$ = this;
|
|
13610
13692
|
var config = $$.config, state = $$.state;
|
|
13611
13693
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
@@ -13615,7 +13697,7 @@ var eventrect = {
|
|
|
13615
13697
|
}
|
|
13616
13698
|
var mouse = getPointer(state.event, context);
|
|
13617
13699
|
var closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
|
13618
|
-
if (state.mouseover && (!closest || closest.id !== state.mouseover.id)) {
|
|
13700
|
+
if (triggerEvent && state.mouseover && (!closest || closest.id !== state.mouseover.id)) {
|
|
13619
13701
|
config.data_onout.call($$.api, state.mouseover);
|
|
13620
13702
|
state.mouseover = undefined;
|
|
13621
13703
|
}
|
|
@@ -13631,10 +13713,11 @@ var eventrect = {
|
|
|
13631
13713
|
$$.setExpand(closest.index, closest.id, true);
|
|
13632
13714
|
// Show xgrid focus line
|
|
13633
13715
|
$$.showGridFocus(selectedData);
|
|
13716
|
+
var dist = $$.dist(closest, mouse);
|
|
13634
13717
|
// Show cursor as pointer if point is close to mouse position
|
|
13635
|
-
if ($$.isBarType(closest.id) ||
|
|
13718
|
+
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
13636
13719
|
$$.$el.svg.select(".".concat($EVENT.eventRect)).style("cursor", "pointer");
|
|
13637
|
-
if (!state.mouseover) {
|
|
13720
|
+
if (triggerEvent && !state.mouseover) {
|
|
13638
13721
|
config.data_onover.call($$.api, closest);
|
|
13639
13722
|
state.mouseover = closest;
|
|
13640
13723
|
}
|
|
@@ -13706,9 +13789,10 @@ var eventrect = {
|
|
|
13706
13789
|
index += 1;
|
|
13707
13790
|
}
|
|
13708
13791
|
}
|
|
13792
|
+
var eventOnSameIdx = config.tooltip_grouped && index === eventReceiver.currentIdx;
|
|
13709
13793
|
// do nothing while dragging/flowing
|
|
13710
|
-
if (state.dragging || state.flowing || $$.hasArcType() ||
|
|
13711
|
-
|
|
13794
|
+
if (state.dragging || state.flowing || $$.hasArcType() || eventOnSameIdx) {
|
|
13795
|
+
eventOnSameIdx && $$.setTooltipPosition();
|
|
13712
13796
|
return;
|
|
13713
13797
|
}
|
|
13714
13798
|
if (index !== eventReceiver.currentIdx) {
|
|
@@ -13716,7 +13800,7 @@ var eventrect = {
|
|
|
13716
13800
|
eventReceiver.currentIdx = index;
|
|
13717
13801
|
}
|
|
13718
13802
|
index === -1 ?
|
|
13719
|
-
$$.unselectRect() : $$.selectRectForSingle(this,
|
|
13803
|
+
$$.unselectRect() : $$.selectRectForSingle(this, index);
|
|
13720
13804
|
// As of individual data point(or <path>) element can't bind mouseover/out event
|
|
13721
13805
|
// to determine current interacting element, so use 'mousemove' event instead.
|
|
13722
13806
|
$$.setOverOut(index !== -1, index);
|
|
@@ -17233,7 +17317,8 @@ var shapeArc = {
|
|
|
17233
17317
|
.duration(durationForExit)
|
|
17234
17318
|
.style("opacity", "0")
|
|
17235
17319
|
.remove();
|
|
17236
|
-
mainArc = mainArc.enter()
|
|
17320
|
+
mainArc = mainArc.enter()
|
|
17321
|
+
.append("path")
|
|
17237
17322
|
.attr("class", $$.getClass("arc", true))
|
|
17238
17323
|
.style("fill", function (d) { return $$.color(d.data); })
|
|
17239
17324
|
.style("cursor", function (d) { var _a; return (((_a = isSelectable === null || isSelectable === void 0 ? void 0 : isSelectable.bind) === null || _a === void 0 ? void 0 : _a.call(isSelectable, $$.api)(d)) ? "pointer" : null); })
|
|
@@ -17297,7 +17382,7 @@ var shapeArc = {
|
|
|
17297
17382
|
.call(endall, function () {
|
|
17298
17383
|
if ($$.levelColor) {
|
|
17299
17384
|
var path = select(this);
|
|
17300
|
-
var d = path.datum();
|
|
17385
|
+
var d = path.datum(this._current);
|
|
17301
17386
|
$$.updateLegendItemColor(d.data.id, path.style("fill"));
|
|
17302
17387
|
}
|
|
17303
17388
|
state.transiting = false;
|
|
@@ -17576,6 +17661,20 @@ var shapeArc = {
|
|
|
17576
17661
|
.text($$.textForGaugeMinMax(config.gauge_max, true));
|
|
17577
17662
|
}
|
|
17578
17663
|
}
|
|
17664
|
+
},
|
|
17665
|
+
/**
|
|
17666
|
+
* Get Arc element by id or index
|
|
17667
|
+
* @param {string|number} value id or index of Arc
|
|
17668
|
+
* @returns {d3Selection} Arc path element
|
|
17669
|
+
* @private
|
|
17670
|
+
*/
|
|
17671
|
+
getArcElementByIdOrIndex: function (value) {
|
|
17672
|
+
var $$ = this;
|
|
17673
|
+
var arcs = $$.$el.arcs;
|
|
17674
|
+
var filterFn = isNumber(value) ?
|
|
17675
|
+
function (d) { return d.index === value; } :
|
|
17676
|
+
function (d) { return d.data.id === value; };
|
|
17677
|
+
return arcs === null || arcs === void 0 ? void 0 : arcs.selectAll(".".concat($COMMON.target, " path")).filter(filterFn);
|
|
17579
17678
|
}
|
|
17580
17679
|
};
|
|
17581
17680
|
|
|
@@ -18405,7 +18504,6 @@ var shapeLine = {
|
|
|
18405
18504
|
.style("stroke", $$.color)
|
|
18406
18505
|
.merge(line)
|
|
18407
18506
|
.style("opacity", $$.initialOpacity.bind($$))
|
|
18408
|
-
.style("shape-rendering", function (d) { return ($$.isStepType(d) ? "crispEdges" : ""); })
|
|
18409
18507
|
.attr("transform", null);
|
|
18410
18508
|
},
|
|
18411
18509
|
/**
|
|
@@ -18883,6 +18981,22 @@ var shapePoint = {
|
|
|
18883
18981
|
}
|
|
18884
18982
|
return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
|
|
18885
18983
|
},
|
|
18984
|
+
/**
|
|
18985
|
+
* Get data point sensitivity radius
|
|
18986
|
+
* @param {object} d Data point object
|
|
18987
|
+
* @returns {number} return the sensitivity value
|
|
18988
|
+
*/
|
|
18989
|
+
getPointSensitivity: function (d) {
|
|
18990
|
+
var $$ = this;
|
|
18991
|
+
var sensitivity = $$.config.point_sensitivity;
|
|
18992
|
+
if (isFunction(sensitivity)) {
|
|
18993
|
+
sensitivity = sensitivity.call($$.api, d);
|
|
18994
|
+
}
|
|
18995
|
+
else if (sensitivity === "radius") {
|
|
18996
|
+
sensitivity = d.r;
|
|
18997
|
+
}
|
|
18998
|
+
return sensitivity;
|
|
18999
|
+
},
|
|
18886
19000
|
insertPointInfoDefs: function (point, id) {
|
|
18887
19001
|
var _a;
|
|
18888
19002
|
var $$ = this;
|
|
@@ -19419,18 +19533,10 @@ var shapeRadar = {
|
|
|
19419
19533
|
var inputType = state.inputType, transiting = state.transiting;
|
|
19420
19534
|
if (config.interaction_enabled) {
|
|
19421
19535
|
var isMouse_1 = inputType === "mouse";
|
|
19422
|
-
var getIndex_1 = function (event) {
|
|
19423
|
-
var target = event.target;
|
|
19424
|
-
// in case of multilined axis text
|
|
19425
|
-
if (/tspan/i.test(target.tagName)) {
|
|
19426
|
-
target = target.parentNode;
|
|
19427
|
-
}
|
|
19428
|
-
var d = select(target).datum();
|
|
19429
|
-
return d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
19430
|
-
};
|
|
19431
19536
|
var hide = function (event) {
|
|
19432
19537
|
state.event = event;
|
|
19433
|
-
|
|
19538
|
+
// const index = getIndex(event);
|
|
19539
|
+
var index = $$.getDataIndexFromEvent(event);
|
|
19434
19540
|
var noIndex = isUndefined(index);
|
|
19435
19541
|
if (isMouse_1 || noIndex) {
|
|
19436
19542
|
$$.hideTooltip();
|
|
@@ -19451,8 +19557,8 @@ var shapeRadar = {
|
|
|
19451
19557
|
return;
|
|
19452
19558
|
}
|
|
19453
19559
|
state.event = event;
|
|
19454
|
-
var index =
|
|
19455
|
-
$$.selectRectForSingle(svg.node(),
|
|
19560
|
+
var index = $$.getDataIndexFromEvent(event);
|
|
19561
|
+
$$.selectRectForSingle(svg.node(), index);
|
|
19456
19562
|
isMouse_1 ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
|
|
19457
19563
|
})
|
|
19458
19564
|
.on("mouseout", isMouse_1 ? hide : null);
|
|
@@ -22635,7 +22741,7 @@ var zoomModule = function () {
|
|
|
22635
22741
|
var defaults = {};
|
|
22636
22742
|
/**
|
|
22637
22743
|
* @namespace bb
|
|
22638
|
-
* @version 3.9.
|
|
22744
|
+
* @version 3.9.2
|
|
22639
22745
|
*/
|
|
22640
22746
|
var bb = {
|
|
22641
22747
|
/**
|
|
@@ -22645,7 +22751,7 @@ var bb = {
|
|
|
22645
22751
|
* bb.version; // "1.0.0"
|
|
22646
22752
|
* @memberof bb
|
|
22647
22753
|
*/
|
|
22648
|
-
version: "3.9.
|
|
22754
|
+
version: "3.9.2",
|
|
22649
22755
|
/**
|
|
22650
22756
|
* Generate chart
|
|
22651
22757
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|