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.
Files changed (48) hide show
  1. package/README.md +5 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +321 -210
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +1443 -480
  7. package/dist/billboard.pkgd.min.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +3 -3
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +3 -3
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1124 -272
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1126 -274
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1126 -274
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1127 -275
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1126 -274
  23. package/dist/theme/dark.css +1 -1
  24. package/dist/theme/dark.min.css +1 -1
  25. package/dist/theme/datalab.css +1 -1
  26. package/dist/theme/datalab.min.css +1 -1
  27. package/dist/theme/graph.css +1 -1
  28. package/dist/theme/graph.min.css +1 -1
  29. package/dist/theme/insight.css +1 -1
  30. package/dist/theme/insight.min.css +1 -1
  31. package/dist-esm/billboard.js +242 -136
  32. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  34. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  35. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  36. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  37. package/package.json +25 -25
  38. package/src/Chart/api/load.ts +4 -2
  39. package/src/Chart/api/tooltip.ts +11 -3
  40. package/src/ChartInternal/data/data.ts +31 -24
  41. package/src/ChartInternal/interactions/eventrect.ts +82 -12
  42. package/src/ChartInternal/interactions/interaction.ts +2 -57
  43. package/src/ChartInternal/internals/redraw.ts +2 -0
  44. package/src/ChartInternal/internals/tooltip.ts +112 -42
  45. package/src/ChartInternal/shape/arc.ts +20 -2
  46. package/src/ChartInternal/shape/line.ts +0 -1
  47. package/src/ChartInternal/shape/point.ts +20 -2
  48. package/src/ChartInternal/shape/radar.ts +5 -14
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.9.0
8
+ * @version 3.9.2
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -4399,6 +4399,7 @@ function getDataKeyForJson(keysParam, config) {
4399
4399
 
4400
4400
 
4401
4401
 
4402
+
4402
4403
  /* harmony default export */ var data_data = ({
4403
4404
  isX: function isX(key) {
4404
4405
  var $$ = this,
@@ -5049,16 +5050,26 @@ function getDataKeyForJson(keysParam, config) {
5049
5050
  var $$ = this,
5050
5051
  config = $$.config,
5051
5052
  _$$$state = $$.state,
5053
+ hasRadar = _$$$state.hasRadar,
5052
5054
  inputType = _$$$state.inputType,
5053
5055
  _$$$state$eventReceiv = _$$$state.eventReceiver,
5054
5056
  coords = _$$$state$eventReceiv.coords,
5055
- rect = _$$$state$eventReceiv.rect,
5056
- isRotated = config.axis_rotated,
5057
- e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event,
5058
- index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
5059
-
5060
- // get data based on the mouse coords
5057
+ rect = _$$$state$eventReceiv.rect;
5058
+ var index;
5059
+ if (hasRadar) {
5060
+ var target = event.target;
5061
5061
 
5062
+ // in case of multilined axis text
5063
+ if (/tspan/i.test(target.tagName)) {
5064
+ target = target.parentNode;
5065
+ }
5066
+ var d = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
5067
+ index = d && Object.keys(d).length === 1 ? d.index : undefined;
5068
+ } else {
5069
+ var isRotated = config.axis_rotated,
5070
+ e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event; // get data based on the mouse coords
5071
+ index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
5072
+ }
5062
5073
  return index;
5063
5074
  },
5064
5075
  getDataLabelLength: function getDataLabelLength(min, max, key) {
@@ -5111,22 +5122,11 @@ function getDataKeyForJson(keysParam, config) {
5111
5122
  findClosest: function findClosest(values, pos) {
5112
5123
  var _this36 = this,
5113
5124
  $$ = this,
5114
- config = $$.config,
5115
5125
  main = $$.$el.main,
5116
5126
  data = values.filter(function (v) {
5117
5127
  _newArrowCheck(this, _this36);
5118
5128
  return v && isValue(v.value);
5119
5129
  }.bind(this)),
5120
- getSensitivity = function (d) {
5121
- _newArrowCheck(this, _this36);
5122
- var sensitivity = config.point_sensitivity;
5123
- if (isFunction(sensitivity)) {
5124
- sensitivity = sensitivity.call($$.api, d);
5125
- } else if (sensitivity === "radius") {
5126
- sensitivity = d.r;
5127
- }
5128
- return sensitivity;
5129
- }.bind(this),
5130
5130
  minDist,
5131
5131
  closest;
5132
5132
  // find mouseovering bar/candlestick
@@ -5149,7 +5149,7 @@ function getDataKeyForJson(keysParam, config) {
5149
5149
  }.bind(this)).forEach(function (v) {
5150
5150
  _newArrowCheck(this, _this36);
5151
5151
  var d = $$.dist(v, pos);
5152
- minDist = getSensitivity(v);
5152
+ minDist = $$.getPointSensitivity(v);
5153
5153
  if (d < minDist) {
5154
5154
  minDist = d;
5155
5155
  closest = v;
@@ -5600,54 +5600,6 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5600
5600
 
5601
5601
 
5602
5602
  /* harmony default export */ var interactions_interaction = ({
5603
- selectRectForSingle: function selectRectForSingle(context, eventRect, index) {
5604
- var _this = this,
5605
- $$ = this,
5606
- config = $$.config,
5607
- _$$$$el = $$.$el,
5608
- main = _$$$$el.main,
5609
- circle = _$$$$el.circle,
5610
- isSelectionEnabled = config.data_selection_enabled,
5611
- isSelectionGrouped = config.data_selection_grouped,
5612
- isSelectable = config.data_selection_isselectable,
5613
- isTooltipGrouped = config.tooltip_grouped,
5614
- selectedData = $$.getAllValuesOnIndex(index);
5615
- if (isTooltipGrouped) {
5616
- $$.showTooltip(selectedData, context);
5617
- $$.showGridFocus == null ? void 0 : $$.showGridFocus(selectedData);
5618
- if (!isSelectionEnabled || isSelectionGrouped) {
5619
- return;
5620
- }
5621
- }
5622
-
5623
- // remove possible previous focused state
5624
- circle || main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1);
5625
- var shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).classed($COMMON.EXPANDED, !0).style("cursor", isSelectable ? "pointer" : null).filter(function (d) {
5626
- return $$.isWithinShape(this, d);
5627
- });
5628
- if (shapeAtIndex.empty() && !isTooltipGrouped) {
5629
- $$.hideGridFocus == null ? void 0 : $$.hideGridFocus();
5630
- $$.hideTooltip();
5631
- isSelectionGrouped || $$.setExpand(index);
5632
- }
5633
- shapeAtIndex.call(function (selected) {
5634
- var _this2 = this;
5635
- _newArrowCheck(this, _this);
5636
- var d = selected.data();
5637
- if (isSelectionEnabled && (isSelectionGrouped || isSelectable != null && isSelectable.bind($$.api)(d))) {
5638
- eventRect.style("cursor", "pointer");
5639
- }
5640
- if (!isTooltipGrouped) {
5641
- $$.showTooltip(d, context);
5642
- $$.showGridFocus == null ? void 0 : $$.showGridFocus(d);
5643
- $$.unexpandCircles == null ? void 0 : $$.unexpandCircles();
5644
- selected.each(function (d) {
5645
- _newArrowCheck(this, _this2);
5646
- return $$.setExpand(index, d.id);
5647
- }.bind(this));
5648
- }
5649
- }.bind(this));
5650
- },
5651
5603
  /**
5652
5604
  * Expand data shape/point
5653
5605
  * @param {number} index Index number
@@ -5673,16 +5625,16 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5673
5625
  * @private
5674
5626
  */
5675
5627
  expandBarTypeShapes: function expandBarTypeShapes(expand, i, id, reset) {
5676
- var _this3 = this;
5628
+ var _this = this;
5677
5629
  if (expand === void 0) {
5678
5630
  expand = !0;
5679
5631
  }
5680
5632
  var $$ = this;
5681
5633
  ["bar", "candlestick"].filter(function (v) {
5682
- _newArrowCheck(this, _this3);
5634
+ _newArrowCheck(this, _this);
5683
5635
  return $$.$el[v];
5684
5636
  }.bind(this)).forEach(function (v) {
5685
- _newArrowCheck(this, _this3);
5637
+ _newArrowCheck(this, _this);
5686
5638
  reset && $$.$el[v].classed($COMMON.EXPANDED, !1);
5687
5639
  $$.getShapeByIndex(v, i, id).classed($COMMON.EXPANDED, expand);
5688
5640
  }.bind(this));
@@ -5694,7 +5646,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5694
5646
  * @private
5695
5647
  */
5696
5648
  setOverOut: function setOverOut(isOver, d) {
5697
- var _this5 = this,
5649
+ var _this3 = this,
5698
5650
  $$ = this,
5699
5651
  config = $$.config,
5700
5652
  _$$$state = $$.state,
@@ -5715,16 +5667,16 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5715
5667
  return $$.isWithinShape(this, d);
5716
5668
  }),
5717
5669
  shape = shapesAtIndex.filter(function () {
5718
- var _this4 = this;
5670
+ var _this2 = this;
5719
5671
  return last.every(function (v) {
5720
- _newArrowCheck(this, _this4);
5672
+ _newArrowCheck(this, _this2);
5721
5673
  return v !== this;
5722
5674
  }.bind(this));
5723
5675
  }); // select based on the index
5724
5676
  // filter if has new selection
5725
5677
  // call onout callback
5726
5678
  if (!isOver || shapesAtIndex.empty() || last.length === shape.size() && shape.nodes().every(function (v, i) {
5727
- _newArrowCheck(this, _this5);
5679
+ _newArrowCheck(this, _this3);
5728
5680
  return v !== last[i];
5729
5681
  }.bind(this))) {
5730
5682
  while (last.length) {
@@ -5771,7 +5723,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5771
5723
  * @private
5772
5724
  */
5773
5725
  getDraggableSelection: function getDraggableSelection() {
5774
- var _this6 = this,
5726
+ var _this4 = this,
5775
5727
  $$ = this,
5776
5728
  config = $$.config,
5777
5729
  state = $$.state;
@@ -5782,11 +5734,11 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5782
5734
  state.event = event;
5783
5735
  $$.dragstart(getPointer(event, this));
5784
5736
  }).on("end", function (event) {
5785
- _newArrowCheck(this, _this6);
5737
+ _newArrowCheck(this, _this4);
5786
5738
  state.event = event;
5787
5739
  $$.dragend();
5788
5740
  }.bind(this)) : function () {
5789
- _newArrowCheck(this, _this6);
5741
+ _newArrowCheck(this, _this4);
5790
5742
  }.bind(this);
5791
5743
  },
5792
5744
  /**
@@ -5798,7 +5750,6 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5798
5750
  */
5799
5751
  dispatchEvent: function dispatchEvent(type, index, mouse) {
5800
5752
  var _ref,
5801
- _this7 = this,
5802
5753
  $$ = this,
5803
5754
  config = $$.config,
5804
5755
  _$$$state2 = $$.state,
@@ -5806,15 +5757,11 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5806
5757
  hasAxis = _$$$state2.hasAxis,
5807
5758
  hasRadar = _$$$state2.hasRadar,
5808
5759
  hasTreemap = _$$$state2.hasTreemap,
5809
- _$$$$el2 = $$.$el,
5810
- eventRect = _$$$$el2.eventRect,
5811
- arcs = _$$$$el2.arcs,
5812
- radar = _$$$$el2.radar,
5813
- treemap = _$$$$el2.treemap,
5814
- element = (_ref = hasTreemap && eventReceiver.rect || hasRadar && radar.axes.select("." + $AXIS.axis + "-" + index + " text") || eventRect || (arcs == null ? void 0 : arcs.selectAll("." + $COMMON.target + " path").filter(function (d, i) {
5815
- _newArrowCheck(this, _this7);
5816
- return i === index;
5817
- }.bind(this)))) == null ? void 0 : _ref.node();
5760
+ _$$$$el = $$.$el,
5761
+ eventRect = _$$$$el.eventRect,
5762
+ radar = _$$$$el.radar,
5763
+ treemap = _$$$$el.treemap,
5764
+ element = (_ref = hasTreemap && eventReceiver.rect || hasRadar && radar.axes.select("." + $AXIS.axis + "-" + index + " text") || eventRect || ($$.getArcElementByIdOrIndex == null ? void 0 : $$.getArcElementByIdOrIndex(index))) == null ? void 0 : _ref.node();
5818
5765
  if (element) {
5819
5766
  var isMultipleX = $$.isMultipleX();
5820
5767
  var _element$getBoundingC = element.getBoundingClientRect(),
@@ -5846,9 +5793,9 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5846
5793
  */
5847
5794
  unbindZoomEvent: function unbindZoomEvent() {
5848
5795
  var $$ = this,
5849
- _$$$$el3 = $$.$el,
5850
- eventRect = _$$$$el3.eventRect,
5851
- zoomResetBtn = _$$$$el3.zoomResetBtn;
5796
+ _$$$$el2 = $$.$el,
5797
+ eventRect = _$$$$el2.eventRect,
5798
+ zoomResetBtn = _$$$$el2.zoomResetBtn;
5852
5799
  eventRect == null ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null);
5853
5800
  zoomResetBtn == null ? void 0 : zoomResetBtn.on("click", null).style("display", "none");
5854
5801
  },
@@ -5857,19 +5804,19 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5857
5804
  * @private
5858
5805
  */
5859
5806
  unbindAllEvents: function unbindAllEvents() {
5860
- var _this8 = this,
5807
+ var _this5 = this,
5861
5808
  $$ = this,
5862
- _$$$$el4 = $$.$el,
5863
- arcs = _$$$$el4.arcs,
5864
- eventRect = _$$$$el4.eventRect,
5865
- legend = _$$$$el4.legend,
5866
- region = _$$$$el4.region,
5867
- svg = _$$$$el4.svg,
5868
- treemap = _$$$$el4.treemap,
5809
+ _$$$$el3 = $$.$el,
5810
+ arcs = _$$$$el3.arcs,
5811
+ eventRect = _$$$$el3.eventRect,
5812
+ legend = _$$$$el3.legend,
5813
+ region = _$$$$el3.region,
5814
+ svg = _$$$$el3.svg,
5815
+ treemap = _$$$$el3.treemap,
5869
5816
  brush = $$.brush;
5870
5817
  // detach all possible event types
5871
5818
  [svg, eventRect, region == null ? void 0 : region.list, brush == null ? void 0 : brush.getSelection(), arcs == null ? void 0 : arcs.selectAll("path"), legend == null ? void 0 : legend.selectAll("g"), treemap].forEach(function (v) {
5872
- _newArrowCheck(this, _this8);
5819
+ _newArrowCheck(this, _this5);
5873
5820
  return v == null ? void 0 : v.on("wheel click mouseover mousemove mouseout touchstart touchmove touchend touchstart.eventRect touchmove.eventRect touchend.eventRect .brush .drag .zoom wheel.zoom dblclick.zoom", null);
5874
5821
  }.bind(this));
5875
5822
  $$.unbindZoomEvent == null ? void 0 : $$.unbindZoomEvent();
@@ -7584,6 +7531,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
7584
7531
  $$.redrawTitle == null ? void 0 : $$.redrawTitle();
7585
7532
  initializing && $$.updateTypesElements();
7586
7533
  $$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart);
7534
+ $$.updateTooltipOnRedraw();
7587
7535
  $$.callPluginHook("$redraw", options, duration);
7588
7536
  },
7589
7537
  /**
@@ -9722,17 +9670,65 @@ function title_getTextPos(pos, width) {
9722
9670
  getTooltipContentTemplate: function getTooltipContentTemplate(tplStr) {
9723
9671
  return (tplStr || "<table class=\"{=CLASS_TOOLTIP}\"><tbody>\n\t\t\t\t{=TITLE}\n\t\t\t\t{{<tr class=\"{=CLASS_TOOLTIP_NAME}\">\n\t\t\t\t\t<td class=\"name\">" + (this.patterns ? "{=COLOR}" : "<span style=\"background-color:{=COLOR}\"></span>") + "{=NAME}</td>\n\t\t\t\t\t<td class=\"value\">{=VALUE}</td>\n\t\t\t\t</tr>}}\n\t\t\t</tbody></table>").replace(/(\r?\n|\t)/g, "").split(/{{(.*)}}/);
9724
9672
  },
9673
+ /**
9674
+ * Update tooltip position coordinate
9675
+ * @param {object} dataToShow Data object
9676
+ * @param {SVGElement} eventTarget Event element
9677
+ * @private
9678
+ */
9679
+ setTooltipPosition: function setTooltipPosition(dataToShow, eventTarget) {
9680
+ var _this4 = this,
9681
+ $$ = this,
9682
+ config = $$.config,
9683
+ scale = $$.scale,
9684
+ state = $$.state,
9685
+ _$$$$el = $$.$el,
9686
+ eventRect = _$$$$el.eventRect,
9687
+ tooltip = _$$$$el.tooltip,
9688
+ bindto = config.tooltip_contents.bindto,
9689
+ datum = tooltip.datum();
9690
+ if (!bindto && datum) {
9691
+ var _config$tooltip_posit,
9692
+ _config$tooltip_posit2,
9693
+ _getPointer = getPointer(state.event, eventTarget != null ? eventTarget : eventRect == null ? void 0 : eventRect.node()),
9694
+ x = _getPointer[0],
9695
+ y = _getPointer[1],
9696
+ currPos = {
9697
+ x: x,
9698
+ y: y
9699
+ };
9700
+ // get mouse event position
9701
+
9702
+ if (scale.x && datum && "x" in datum) {
9703
+ currPos.xAxis = scale.x(datum.x);
9704
+ }
9705
+ var _datum$width = datum.width,
9706
+ width = _datum$width === void 0 ? 0 : _datum$width,
9707
+ _datum$height = datum.height,
9708
+ height = _datum$height === void 0 ? 0 : _datum$height,
9709
+ pos = (_config$tooltip_posit = (_config$tooltip_posit2 = config.tooltip_position) == null ? void 0 : _config$tooltip_posit2.bind($$.api)(dataToShow != null ? dataToShow : JSON.parse(datum.current), width, height, eventRect == null ? void 0 : eventRect.node(), currPos)) != null ? _config$tooltip_posit : $$.getTooltipPosition.bind($$)(width, height, currPos); // Get tooltip position
9710
+ ["top", "left"].forEach(function (v) {
9711
+ _newArrowCheck(this, _this4);
9712
+ var value = pos[v];
9713
+ tooltip.style(v, value + "px");
9714
+
9715
+ // Remember left pos in percentage to be used on resize call
9716
+ if (v === "left" && !datum.xPosInPercent) {
9717
+ datum.xPosInPercent = value / state.current.width * 100;
9718
+ }
9719
+ }.bind(this));
9720
+ }
9721
+ },
9725
9722
  /**
9726
9723
  * Returns the position of the tooltip
9727
- * @param {object} dataToShow data
9728
9724
  * @param {string} tWidth Width value of tooltip element
9729
9725
  * @param {string} tHeight Height value of tooltip element
9730
- * @param {HTMLElement} element Tooltip element
9726
+ * @param {object} currPos Current mouse position
9731
9727
  * @returns {object} top, left value
9732
9728
  * @private
9733
9729
  */
9734
- tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) {
9735
- var _this4 = this,
9730
+ getTooltipPosition: function getTooltipPosition(tWidth, tHeight, currPos) {
9731
+ var _this5 = this,
9736
9732
  $$ = this,
9737
9733
  config = $$.config,
9738
9734
  scale = $$.scale,
@@ -9743,16 +9739,14 @@ function title_getTextPos(pos, width) {
9743
9739
  current = _state.current,
9744
9740
  isLegendRight = _state.isLegendRight,
9745
9741
  inputType = _state.inputType,
9746
- event = _state.event,
9747
9742
  hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
9748
9743
  hasTreemap = state.hasTreemap,
9749
9744
  isRotated = config.axis_rotated,
9750
9745
  svgLeft = $$.getSvgLeft(!0),
9751
9746
  chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
9752
9747
  chartLeft = $$.getCurrentPaddingLeft(!0),
9753
- _getPointer = getPointer(event, element),
9754
- x = _getPointer[0],
9755
- y = _getPointer[1];
9748
+ x = currPos.x,
9749
+ y = currPos.y;
9756
9750
  // Determine tooltip position
9757
9751
  if ($$.hasArcType()) {
9758
9752
  var raw = inputType === "touch" || $$.hasType("radar");
@@ -9761,14 +9755,13 @@ function title_getTextPos(pos, width) {
9761
9755
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
9762
9756
  }
9763
9757
  } else if (!hasTreemap) {
9764
- var dataScale = scale.x(dataToShow[0].x);
9765
9758
  if (isRotated) {
9766
- y = dataScale + 20;
9759
+ y = currPos.xAxis + 20;
9767
9760
  x += svgLeft;
9768
9761
  chartRight -= svgLeft;
9769
9762
  } else {
9770
9763
  y -= 5;
9771
- x = svgLeft + chartLeft + 20 + (scale.zoom ? x : dataScale);
9764
+ x = svgLeft + chartLeft + 20 + (scale.zoom ? x : currPos.xAxis);
9772
9765
  }
9773
9766
  }
9774
9767
 
@@ -9787,7 +9780,7 @@ function title_getTextPos(pos, width) {
9787
9780
 
9788
9781
  // make sure to not be positioned out of viewport
9789
9782
  Object.keys(pos).forEach(function (v) {
9790
- _newArrowCheck(this, _this4);
9783
+ _newArrowCheck(this, _this5);
9791
9784
  if (pos[v] < 0) {
9792
9785
  pos[v] = 0;
9793
9786
  }
@@ -9797,33 +9790,27 @@ function title_getTextPos(pos, width) {
9797
9790
  /**
9798
9791
  * Show the tooltip
9799
9792
  * @param {object} selectedData Data object
9800
- * @param {SVGElement} eventRect Event <rect> element
9793
+ * @param {SVGElement} eventTarget Event element
9801
9794
  * @private
9802
9795
  */
9803
- showTooltip: function showTooltip(selectedData, eventRect) {
9804
- var _this5 = this,
9796
+ showTooltip: function showTooltip(selectedData, eventTarget) {
9797
+ var _this6 = this,
9805
9798
  $$ = this,
9806
9799
  config = $$.config,
9807
- scale = $$.scale,
9808
- state = $$.state,
9809
9800
  tooltip = $$.$el.tooltip,
9810
- bindto = config.tooltip_contents.bindto,
9811
9801
  dataToShow = selectedData.filter(function (d) {
9812
- _newArrowCheck(this, _this5);
9802
+ _newArrowCheck(this, _this6);
9813
9803
  return d && isValue($$.getBaseValue(d));
9814
9804
  }.bind(this));
9815
9805
  if (!tooltip || dataToShow.length === 0 || !config.tooltip_show) {
9816
9806
  return;
9817
9807
  }
9818
- var datum = tooltip.datum(),
9819
- _ref = datum || {},
9820
- _ref$width = _ref.width,
9821
- width = _ref$width === void 0 ? 0 : _ref$width,
9822
- _ref$height = _ref.height,
9823
- height = _ref$height === void 0 ? 0 : _ref$height;
9808
+ var datum = tooltip.datum();
9824
9809
  var dataStr = JSON.stringify(selectedData);
9825
9810
  if (!datum || datum.current !== dataStr) {
9826
- var index = selectedData.concat().sort()[0].index;
9811
+ var _selectedData$concat$ = selectedData.concat().sort()[0],
9812
+ index = _selectedData$concat$.index,
9813
+ x = _selectedData$concat$.x;
9827
9814
  callFn(config.tooltip_onshow, $$.api, selectedData);
9828
9815
 
9829
9816
  // set tooltip content
@@ -9837,57 +9824,28 @@ function title_getTextPos(pos, width) {
9837
9824
  )).style("display", null).style("visibility", null) // for IE9
9838
9825
  .datum(datum = {
9839
9826
  index: index,
9827
+ x: x,
9840
9828
  current: dataStr,
9841
- width: width = tooltip.property("offsetWidth"),
9842
- height: height = tooltip.property("offsetHeight")
9829
+ width: tooltip.property("offsetWidth"),
9830
+ height: tooltip.property("offsetHeight")
9843
9831
  });
9844
9832
  callFn(config.tooltip_onshown, $$.api, selectedData);
9845
9833
  $$._handleLinkedCharts(!0, index);
9846
9834
  }
9847
- if (!bindto) {
9848
- var _config$tooltip_posit,
9849
- _selectedData$filter,
9850
- fnPos = ((_config$tooltip_posit = config.tooltip_position) == null ? void 0 : _config$tooltip_posit.bind($$.api)) || $$.tooltipPosition.bind($$),
9851
- _getPointer2 = getPointer(state.event, eventRect),
9852
- x = _getPointer2[0],
9853
- y = _getPointer2[1],
9854
- currPos = {
9855
- x: x,
9856
- y: y
9857
- },
9858
- data = (_selectedData$filter = selectedData.filter(Boolean)) == null ? void 0 : _selectedData$filter.shift();
9859
- // get mouse event position
9860
-
9861
- if (scale.x && data && "x" in data) {
9862
- currPos.xAxis = scale.x(data.x);
9863
- }
9864
-
9865
- // Get tooltip dimensions
9866
- var pos = fnPos(dataToShow, width, height, eventRect, currPos);
9867
- ["top", "left"].forEach(function (v) {
9868
- _newArrowCheck(this, _this5);
9869
- var value = pos[v];
9870
- tooltip.style(v, value + "px");
9871
-
9872
- // Remember left pos in percentage to be used on resize call
9873
- if (v === "left" && !datum.xPosInPercent) {
9874
- datum.xPosInPercent = value / state.current.width * 100;
9875
- }
9876
- }.bind(this));
9877
- }
9835
+ $$.setTooltipPosition(dataToShow, eventTarget);
9878
9836
  },
9879
9837
  /**
9880
9838
  * Adjust tooltip position on resize event
9881
9839
  * @private
9882
9840
  */
9883
9841
  bindTooltipResizePos: function bindTooltipResizePos() {
9884
- var _this6 = this,
9842
+ var _this7 = this,
9885
9843
  $$ = this,
9886
9844
  resizeFunction = $$.resizeFunction,
9887
9845
  state = $$.state,
9888
9846
  tooltip = $$.$el.tooltip;
9889
9847
  resizeFunction.add(function () {
9890
- _newArrowCheck(this, _this6);
9848
+ _newArrowCheck(this, _this7);
9891
9849
  if (tooltip.style("display") === "block") {
9892
9850
  var current = state.current,
9893
9851
  _tooltip$datum = tooltip.datum(),
@@ -9931,7 +9889,7 @@ function title_getTextPos(pos, width) {
9931
9889
  * @private
9932
9890
  */
9933
9891
  _handleLinkedCharts: function _handleLinkedCharts(show, index) {
9934
- var _this7 = this,
9892
+ var _this8 = this,
9935
9893
  $$ = this,
9936
9894
  charts = $$.charts,
9937
9895
  config = $$.config,
@@ -9941,10 +9899,10 @@ function title_getTextPos(pos, width) {
9941
9899
  if (event != null && event.isTrusted && config.tooltip_linked && charts.length > 1) {
9942
9900
  var linkedName = config.tooltip_linked_name;
9943
9901
  charts.filter(function (c) {
9944
- _newArrowCheck(this, _this7);
9902
+ _newArrowCheck(this, _this8);
9945
9903
  return c !== $$.api;
9946
9904
  }.bind(this)).forEach(function (c) {
9947
- _newArrowCheck(this, _this7);
9905
+ _newArrowCheck(this, _this8);
9948
9906
  var _c$internal = c.internal,
9949
9907
  config = _c$internal.config,
9950
9908
  $el = _c$internal.$el,
@@ -9962,6 +9920,63 @@ function title_getTextPos(pos, width) {
9962
9920
  }
9963
9921
  }.bind(this));
9964
9922
  }
9923
+ },
9924
+ /**
9925
+ * Update tooltip content on redraw
9926
+ * - In a situation where tooltip is displayed and data load happens, it should reflect loaded data to tooltip
9927
+ * @param {d3Selection} context Event rect element
9928
+ * @param {number} index Data index
9929
+ * @private
9930
+ */
9931
+ updateTooltipOnRedraw: function updateTooltipOnRedraw(context, index) {
9932
+ var _this9 = this,
9933
+ $$ = this,
9934
+ config = $$.config,
9935
+ _$$$$el2 = $$.$el,
9936
+ eventRect = _$$$$el2.eventRect,
9937
+ svg = _$$$$el2.svg,
9938
+ tooltip = _$$$$el2.tooltip,
9939
+ _$$$state2 = $$.state,
9940
+ event = _$$$state2.event,
9941
+ hasAxis = _$$$state2.hasAxis,
9942
+ hasRadar = _$$$state2.hasRadar,
9943
+ hasTreemap = _$$$state2.hasTreemap;
9944
+ // Update tooltip, when tooltip is in shown state
9945
+ if ((tooltip == null ? void 0 : tooltip.style("display")) === "block" && event) {
9946
+ var _ref,
9947
+ rect = context != null ? context : (_ref = hasRadar ? svg : eventRect) == null ? void 0 : _ref.node();
9948
+ // for Axis based & Radar
9949
+ if (hasAxis || hasRadar) {
9950
+ if ($$.isMultipleX()) {
9951
+ $$.selectRectForMultipleXs(rect, !1);
9952
+ } else {
9953
+ var idx = index != null ? index : $$.getDataIndexFromEvent(event);
9954
+ if (index === -1) {
9955
+ $$.api.tooltip.hide();
9956
+ } else {
9957
+ $$.selectRectForSingle(rect, idx);
9958
+ $$.setExpand(idx, null, !0);
9959
+ }
9960
+ }
9961
+
9962
+ // for Arc & Treemap
9963
+ } else {
9964
+ var clientX = event.clientX,
9965
+ clientY = event.clientY;
9966
+ setTimeout(function () {
9967
+ _newArrowCheck(this, _this9);
9968
+ var target = browser_doc.elementFromPoint(clientX, clientY);
9969
+ var data = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
9970
+ if (data) {
9971
+ var d = $$.hasArcType() ? $$.convertToArcData($$.updateAngle(data)) : data == null ? void 0 : data.data;
9972
+ hasTreemap && (target = svg.node());
9973
+ d && $$.showTooltip([d], target);
9974
+ } else {
9975
+ $$.api.tooltip.hide();
9976
+ }
9977
+ }.bind(this), config.transition_duration);
9978
+ }
9979
+ }
9965
9980
  }
9966
9981
  });
9967
9982
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/transform.ts
@@ -12187,7 +12202,6 @@ var legend_legend = {
12187
12202
  }.bind(this));
12188
12203
  }.bind(this));
12189
12204
  } else {
12190
- $$.api.tooltip.hide();
12191
12205
  $$.loadFromArgs(args);
12192
12206
  }
12193
12207
  },
@@ -12220,6 +12234,8 @@ var legend_legend = {
12220
12234
  var _this3 = this,
12221
12235
  $$ = this.internal,
12222
12236
  args = argsValue || {};
12237
+ // hide possible tooltip display when data is completely unloaded
12238
+ isEmpty(args) && this.tooltip.hide();
12223
12239
  if (isArray(args)) {
12224
12240
  args = {
12225
12241
  ids: args
@@ -12437,6 +12453,10 @@ var tooltip_tooltip = {
12437
12453
  * }
12438
12454
  * });
12439
12455
  *
12456
+ * // for Arc types, specify 'id' or 'index'
12457
+ * chart.tooltip.show({ data: { id: "data2" }});
12458
+ * chart.tooltip.show({ data: { index: 2 }});
12459
+ *
12440
12460
  * // when data.xs is used
12441
12461
  * chart.tooltip.show({
12442
12462
  * data: {
@@ -12473,18 +12493,20 @@ var tooltip_tooltip = {
12473
12493
 
12474
12494
  // determine focus data
12475
12495
  if (args.data) {
12476
- var data = args.data,
12477
- y = $$.getYScaleById(data.id)(data.value);
12496
+ var _$$$getYScaleById,
12497
+ data = args.data,
12498
+ y = (_$$$getYScaleById = $$.getYScaleById(data.id)) == null ? void 0 : _$$$getYScaleById(data.value);
12478
12499
  if (hasTreemap && data.id) {
12479
12500
  eventReceiver.rect = $el.main.select("" + $$.selectorTarget(data.id, undefined, "rect"));
12480
12501
  } else if ($$.isMultipleX()) {
12481
12502
  // if multiple xs, target point will be determined by mouse
12482
12503
  mouse = [$$.xx(data), y];
12483
12504
  } else {
12505
+ var _data$index, _$$$getArcElementById;
12484
12506
  if (!config.tooltip_grouped) {
12485
12507
  mouse = [0, y];
12486
12508
  }
12487
- index = isValue(data.index) ? data.index : $$.getIndexByX(data.x);
12509
+ index = (_data$index = data.index) != null ? _data$index : $$.hasArcType() && data.id ? (_$$$getArcElementById = $$.getArcElementByIdOrIndex(data.id)) == null ? void 0 : _$$$getArcElementById.datum().index : $$.getIndexByX(data.x);
12488
12510
  }
12489
12511
  } else if (isDefined(args.x)) {
12490
12512
  index = $$.getIndexByX(args.x);
@@ -15125,7 +15147,7 @@ var Axis_Axis = /*#__PURE__*/function () {
15125
15147
  eventRectUpdate.call($$.getDraggableSelection());
15126
15148
  $el.eventRect = eventRectUpdate;
15127
15149
  if ($$.state.inputType === "touch" && !$el.svg.on("touchstart.eventRect") && !$$.hasArcType()) {
15128
- $$.bindTouchOnEventRect(isMultipleX);
15150
+ $$.bindTouchOnEventRect();
15129
15151
  }
15130
15152
 
15131
15153
  // when initilazed with empty data and data loaded later, need to update eventRect
@@ -15149,7 +15171,7 @@ var Axis_Axis = /*#__PURE__*/function () {
15149
15171
  }
15150
15172
  $$.updateEventRectData();
15151
15173
  },
15152
- bindTouchOnEventRect: function bindTouchOnEventRect(isMultipleX) {
15174
+ bindTouchOnEventRect: function bindTouchOnEventRect() {
15153
15175
  var _this2 = this,
15154
15176
  $$ = this,
15155
15177
  config = $$.config,
@@ -15159,12 +15181,12 @@ var Axis_Axis = /*#__PURE__*/function () {
15159
15181
  svg = _$$$$el.svg,
15160
15182
  selectRect = function (context) {
15161
15183
  _newArrowCheck(this, _this2);
15162
- if (isMultipleX) {
15184
+ if ($$.isMultipleX()) {
15163
15185
  $$.selectRectForMultipleXs(context);
15164
15186
  } else {
15165
15187
  var index = $$.getDataIndexFromEvent(state.event);
15166
15188
  $$.callOverOutForTouch(index);
15167
- index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, eventRect, index);
15189
+ index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, index);
15168
15190
  }
15169
15191
  }.bind(this),
15170
15192
  unselectRect = function () {
@@ -15369,9 +15391,72 @@ var Axis_Axis = /*#__PURE__*/function () {
15369
15391
  };
15370
15392
  }.bind(this));
15371
15393
  },
15372
- selectRectForMultipleXs: function selectRectForMultipleXs(context) {
15394
+ /**
15395
+ * Seletct rect for single x value
15396
+ * @param {d3Selection} context Event rect element
15397
+ * @param {number} index x Axis index
15398
+ * @private
15399
+ */
15400
+ selectRectForSingle: function selectRectForSingle(context, index) {
15373
15401
  var _this6 = this,
15374
15402
  $$ = this,
15403
+ config = $$.config,
15404
+ _$$$$el2 = $$.$el,
15405
+ main = _$$$$el2.main,
15406
+ circle = _$$$$el2.circle,
15407
+ isSelectionEnabled = config.data_selection_enabled,
15408
+ isSelectionGrouped = config.data_selection_grouped,
15409
+ isSelectable = config.data_selection_isselectable,
15410
+ isTooltipGrouped = config.tooltip_grouped,
15411
+ selectedData = $$.getAllValuesOnIndex(index);
15412
+ if (isTooltipGrouped) {
15413
+ $$.showTooltip(selectedData, context);
15414
+ $$.showGridFocus == null ? void 0 : $$.showGridFocus(selectedData);
15415
+ if (!isSelectionEnabled || isSelectionGrouped) {
15416
+ return;
15417
+ }
15418
+ }
15419
+
15420
+ // remove possible previous focused state
15421
+ circle || main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1);
15422
+ var shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).classed($COMMON.EXPANDED, !0).style("cursor", isSelectable ? "pointer" : null).filter(function (d) {
15423
+ return $$.isWithinShape(this, d);
15424
+ });
15425
+ if (shapeAtIndex.empty() && !isTooltipGrouped) {
15426
+ $$.hideGridFocus == null ? void 0 : $$.hideGridFocus();
15427
+ $$.hideTooltip();
15428
+ isSelectionGrouped || $$.setExpand(index);
15429
+ }
15430
+ shapeAtIndex.call(function (selected) {
15431
+ var _this7 = this;
15432
+ _newArrowCheck(this, _this6);
15433
+ var d = selected.data();
15434
+ if (isSelectionEnabled && (isSelectionGrouped || isSelectable != null && isSelectable.bind($$.api)(d))) {
15435
+ context.style.cursor = "pointer";
15436
+ }
15437
+ if (!isTooltipGrouped) {
15438
+ $$.showTooltip(d, context);
15439
+ $$.showGridFocus == null ? void 0 : $$.showGridFocus(d);
15440
+ $$.unexpandCircles == null ? void 0 : $$.unexpandCircles();
15441
+ selected.each(function (d) {
15442
+ _newArrowCheck(this, _this7);
15443
+ return $$.setExpand(index, d.id);
15444
+ }.bind(this));
15445
+ }
15446
+ }.bind(this));
15447
+ },
15448
+ /**
15449
+ * Select rect for multiple x values
15450
+ * @param {d3Selection} context Event rect element
15451
+ * @param {boolean} [triggerEvent=true] Whether trigger event or not
15452
+ * @private
15453
+ */
15454
+ selectRectForMultipleXs: function selectRectForMultipleXs(context, triggerEvent) {
15455
+ var _this8 = this;
15456
+ if (triggerEvent === void 0) {
15457
+ triggerEvent = !0;
15458
+ }
15459
+ var $$ = this,
15375
15460
  config = $$.config,
15376
15461
  state = $$.state,
15377
15462
  targetsToShow = $$.filterTargetsToShow($$.data.targets);
@@ -15381,7 +15466,7 @@ var Axis_Axis = /*#__PURE__*/function () {
15381
15466
  }
15382
15467
  var mouse = getPointer(state.event, context),
15383
15468
  closest = $$.findClosestFromTargets(targetsToShow, mouse);
15384
- if (state.mouseover && (!closest || closest.id !== state.mouseover.id)) {
15469
+ if (triggerEvent && state.mouseover && (!closest || closest.id !== state.mouseover.id)) {
15385
15470
  config.data_onout.call($$.api, state.mouseover);
15386
15471
  state.mouseover = undefined;
15387
15472
  }
@@ -15391,7 +15476,7 @@ var Axis_Axis = /*#__PURE__*/function () {
15391
15476
  }
15392
15477
  var sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x),
15393
15478
  selectedData = sameXData.map(function (d) {
15394
- _newArrowCheck(this, _this6);
15479
+ _newArrowCheck(this, _this8);
15395
15480
  return $$.addName(d);
15396
15481
  }.bind(this)); // show tooltip when cursor is close to some point
15397
15482
  $$.showTooltip(selectedData, context);
@@ -15401,11 +15486,12 @@ var Axis_Axis = /*#__PURE__*/function () {
15401
15486
 
15402
15487
  // Show xgrid focus line
15403
15488
  $$.showGridFocus(selectedData);
15489
+ var dist = $$.dist(closest, mouse);
15404
15490
 
15405
15491
  // Show cursor as pointer if point is close to mouse position
15406
- if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
15492
+ if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
15407
15493
  $$.$el.svg.select("." + $EVENT.eventRect).style("cursor", "pointer");
15408
- if (!state.mouseover) {
15494
+ if (triggerEvent && !state.mouseover) {
15409
15495
  config.data_onover.call($$.api, closest);
15410
15496
  state.mouseover = closest;
15411
15497
  }
@@ -15418,9 +15504,9 @@ var Axis_Axis = /*#__PURE__*/function () {
15418
15504
  unselectRect: function unselectRect() {
15419
15505
  var $$ = this,
15420
15506
  config = $$.config,
15421
- _$$$$el2 = $$.$el,
15422
- circle = _$$$$el2.circle,
15423
- tooltip = _$$$$el2.tooltip;
15507
+ _$$$$el3 = $$.$el,
15508
+ circle = _$$$$el3.circle,
15509
+ tooltip = _$$$$el3.tooltip;
15424
15510
  $$.$el.svg.select("." + $EVENT.eventRect).style("cursor", null);
15425
15511
  $$.hideGridFocus();
15426
15512
  if (tooltip) {
@@ -15438,7 +15524,7 @@ var Axis_Axis = /*#__PURE__*/function () {
15438
15524
  * @private
15439
15525
  */
15440
15526
  generateEventRectsForSingleX: function generateEventRectsForSingleX(eventRectEnter) {
15441
- var _this7 = this,
15527
+ var _this9 = this,
15442
15528
  $$ = this,
15443
15529
  config = $$.config,
15444
15530
  state = $$.state,
@@ -15452,12 +15538,12 @@ var Axis_Axis = /*#__PURE__*/function () {
15452
15538
  });
15453
15539
  if (state.inputType === "mouse") {
15454
15540
  var getData = function (event) {
15455
- _newArrowCheck(this, _this7);
15541
+ _newArrowCheck(this, _this9);
15456
15542
  var index = event ? $$.getDataIndexFromEvent(event) : eventReceiver.currentIdx;
15457
15543
  return index > -1 ? eventReceiver.data[index] : null;
15458
15544
  }.bind(this);
15459
15545
  rect.on("mouseover", function (event) {
15460
- _newArrowCheck(this, _this7);
15546
+ _newArrowCheck(this, _this9);
15461
15547
  state.event = event;
15462
15548
  $$.updateEventRect();
15463
15549
  }.bind(this)).on("mousemove", function (event) {
@@ -15480,22 +15566,24 @@ var Axis_Axis = /*#__PURE__*/function () {
15480
15566
  index += 1;
15481
15567
  }
15482
15568
  }
15569
+ var eventOnSameIdx = config.tooltip_grouped && index === eventReceiver.currentIdx;
15483
15570
 
15484
15571
  // do nothing while dragging/flowing
15485
- if (state.dragging || state.flowing || $$.hasArcType() || config.tooltip_grouped && index === eventReceiver.currentIdx) {
15572
+ if (state.dragging || state.flowing || $$.hasArcType() || eventOnSameIdx) {
15573
+ eventOnSameIdx && $$.setTooltipPosition();
15486
15574
  return;
15487
15575
  }
15488
15576
  if (index !== eventReceiver.currentIdx) {
15489
15577
  $$.setOverOut(!1, eventReceiver.currentIdx);
15490
15578
  eventReceiver.currentIdx = index;
15491
15579
  }
15492
- index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, rect, index);
15580
+ index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, index);
15493
15581
 
15494
15582
  // As of individual data point(or <path>) element can't bind mouseover/out event
15495
15583
  // to determine current interacting element, so use 'mousemove' event instead.
15496
15584
  $$.setOverOut(index !== -1, index);
15497
15585
  }).on("mouseout", function (event) {
15498
- _newArrowCheck(this, _this7);
15586
+ _newArrowCheck(this, _this9);
15499
15587
  state.event = event;
15500
15588
 
15501
15589
  // chart is destroyed
@@ -15535,7 +15623,7 @@ var Axis_Axis = /*#__PURE__*/function () {
15535
15623
  * @private
15536
15624
  */
15537
15625
  generateEventRectsForMultipleXs: function generateEventRectsForMultipleXs(eventRectEnter) {
15538
- var _this8 = this,
15626
+ var _this10 = this,
15539
15627
  $$ = this,
15540
15628
  state = $$.state;
15541
15629
  eventRectEnter.on("click", function (event) {
@@ -15547,7 +15635,7 @@ var Axis_Axis = /*#__PURE__*/function () {
15547
15635
  state.event = event;
15548
15636
  $$.selectRectForMultipleXs(this);
15549
15637
  }).on("mouseout", function (event) {
15550
- _newArrowCheck(this, _this8);
15638
+ _newArrowCheck(this, _this10);
15551
15639
  state.event = event;
15552
15640
 
15553
15641
  // chart is destroyed
@@ -19149,7 +19237,7 @@ function getAttrTweenFn(fn) {
19149
19237
  .style("opacity", null).call(endall, function () {
19150
19238
  if ($$.levelColor) {
19151
19239
  var path = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
19152
- d = path.datum();
19240
+ d = path.datum(this._current);
19153
19241
  $$.updateLegendItemColor(d.data.id, path.style("fill"));
19154
19242
  }
19155
19243
  state.transiting = !1;
@@ -19434,6 +19522,26 @@ function getAttrTweenFn(fn) {
19434
19522
  isFullCircle || arcs.select("." + $GAUGE.chartArcsGaugeMax).attr("dx", state.innerRadius + (state.radius - state.innerRadius) / 2 + "px").attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, !0));
19435
19523
  }
19436
19524
  }
19525
+ },
19526
+ /**
19527
+ * Get Arc element by id or index
19528
+ * @param {string|number} value id or index of Arc
19529
+ * @returns {d3Selection} Arc path element
19530
+ * @private
19531
+ */
19532
+ getArcElementByIdOrIndex: function getArcElementByIdOrIndex(value) {
19533
+ var _this19 = this,
19534
+ $$ = this,
19535
+ arcs = $$.$el.arcs,
19536
+ filterFn = isNumber(value) ? function (d) {
19537
+ _newArrowCheck(this, _this19);
19538
+ return d.index === value;
19539
+ }.bind(this) : function (d) {
19540
+ _newArrowCheck(this, _this19);
19541
+ return d.data.id === value;
19542
+ }.bind(this),
19543
+ _arcs;
19544
+ return (_arcs = arcs) == null ? void 0 : _arcs.selectAll("." + $COMMON.target + " path").filter(filterFn);
19437
19545
  }
19438
19546
  });
19439
19547
  ;// CONCATENATED MODULE: ./src/ChartInternal/shape/area.ts
@@ -20332,10 +20440,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
20332
20440
  $root.line = line.enter().append("path").attr("class", function (d) {
20333
20441
  _newArrowCheck(this, _this2);
20334
20442
  return $$.getClass("line", !0)(d) + " " + (extraLineClasses(d) || "");
20335
- }.bind(this)).style("stroke", $$.color).merge(line).style("opacity", $$.initialOpacity.bind($$)).style("shape-rendering", function (d) {
20336
- _newArrowCheck(this, _this2);
20337
- return $$.isStepType(d) ? "crispEdges" : "";
20338
- }.bind(this)).attr("transform", null);
20443
+ }.bind(this)).style("stroke", $$.color).merge(line).style("opacity", $$.initialOpacity.bind($$)).attr("transform", null);
20339
20444
  },
20340
20445
  /**
20341
20446
  * Redraw function
@@ -20865,6 +20970,21 @@ var getTransitionName = function () {
20865
20970
  }
20866
20971
  return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
20867
20972
  },
20973
+ /**
20974
+ * Get data point sensitivity radius
20975
+ * @param {object} d Data point object
20976
+ * @returns {number} return the sensitivity value
20977
+ */
20978
+ getPointSensitivity: function getPointSensitivity(d) {
20979
+ var $$ = this;
20980
+ var sensitivity = $$.config.point_sensitivity;
20981
+ if (isFunction(sensitivity)) {
20982
+ sensitivity = sensitivity.call($$.api, d);
20983
+ } else if (sensitivity === "radius") {
20984
+ sensitivity = d.r;
20985
+ }
20986
+ return sensitivity;
20987
+ },
20868
20988
  insertPointInfoDefs: function insertPointInfoDefs(point, id) {
20869
20989
  var _this7 = this,
20870
20990
  $$ = this,
@@ -21476,21 +21596,12 @@ var cacheKey = KEY.radarPoints;
21476
21596
  transiting = _state.transiting;
21477
21597
  if (config.interaction_enabled) {
21478
21598
  var isMouse = inputType === "mouse",
21479
- getIndex = function (event) {
21480
- _newArrowCheck(this, _this9);
21481
- var target = event.target;
21482
-
21483
- // in case of multilined axis text
21484
- if (/tspan/i.test(target.tagName)) {
21485
- target = target.parentNode;
21486
- }
21487
- var d = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum();
21488
- return d && Object.keys(d).length === 1 ? d.index : undefined;
21489
- }.bind(this),
21490
21599
  hide = function (event) {
21491
21600
  _newArrowCheck(this, _this9);
21492
21601
  state.event = event;
21493
- var index = getIndex(event),
21602
+
21603
+ // const index = getIndex(event);
21604
+ var index = $$.getDataIndexFromEvent(event),
21494
21605
  noIndex = isUndefined(index);
21495
21606
  if (isMouse || noIndex) {
21496
21607
  $$.hideTooltip();
@@ -21509,8 +21620,8 @@ var cacheKey = KEY.radarPoints;
21509
21620
  return;
21510
21621
  }
21511
21622
  state.event = event;
21512
- var index = getIndex(event);
21513
- $$.selectRectForSingle(svg.node(), null, index);
21623
+ var index = $$.getDataIndexFromEvent(event);
21624
+ $$.selectRectForSingle(svg.node(), index);
21514
21625
  isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
21515
21626
  }.bind(this)).on("mouseout", isMouse ? hide : null);
21516
21627
  if (!isMouse) {
@@ -24576,9 +24687,9 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
24576
24687
  e = event == null ? void 0 : event.sourceEvent,
24577
24688
  isUnZoom = (event == null ? void 0 : event.transform) === external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity;
24578
24689
  if (((_startEvent = startEvent) == null ? void 0 : _startEvent.type.indexOf("touch")) > -1) {
24579
- var _e, _e$changedTouches;
24690
+ var _e;
24580
24691
  startEvent = startEvent.changedTouches[0];
24581
- e = (_e = e) == null ? void 0 : (_e$changedTouches = _e.changedTouches) == null ? void 0 : _e$changedTouches[0];
24692
+ e = (_e = e) == null || (_e = _e.changedTouches) == null ? void 0 : _e[0];
24582
24693
  }
24583
24694
 
24584
24695
  // if click, do nothing. otherwise, click interaction will be canceled.
@@ -25084,7 +25195,7 @@ var _defaults = {};
25084
25195
 
25085
25196
  /**
25086
25197
  * @namespace bb
25087
- * @version 3.9.0
25198
+ * @version 3.9.2
25088
25199
  */
25089
25200
  var bb = {
25090
25201
  /**
@@ -25094,7 +25205,7 @@ var bb = {
25094
25205
  * bb.version; // "1.0.0"
25095
25206
  * @memberof bb
25096
25207
  */
25097
- version: "3.9.0",
25208
+ version: "3.9.2",
25098
25209
  /**
25099
25210
  * Generate chart
25100
25211
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: