billboard.js 3.9.0-next.2 → 3.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +5 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +156 -98
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +396 -207
  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 +242 -111
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +243 -112
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +242 -111
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +243 -112
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +242 -111
  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 +157 -93
  32. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
  33. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -3
  34. package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -3
  35. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -3
  36. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -3
  37. package/package.json +23 -23
  38. package/src/ChartInternal/data/data.ts +2 -12
  39. package/src/ChartInternal/interactions/eventrect.ts +7 -4
  40. package/src/ChartInternal/internals/legend.ts +50 -34
  41. package/src/ChartInternal/internals/tooltip.ts +55 -41
  42. package/src/ChartInternal/shape/point.ts +20 -2
  43. package/src/config/Options/common/legend.ts +37 -6
  44. package/types/options.d.ts +25 -0
package/README.md CHANGED
@@ -40,7 +40,7 @@ If you have any questions, checkout the previous posts or create a new one at:
40
40
  - [Issue with 'question' label](https://github.com/naver/billboard.js/issues?utf8=%E2%9C%93&q=label%3Aquestion)
41
41
 
42
42
  ## Supported chart types
43
- <img src="https://naver.github.io/billboard.js/img/chart-types.png?v=10" width=800>
43
+ <img src="https://naver.github.io/billboard.js/img/chart-types.png?v=11" width=800>
44
44
 
45
45
  ## Download and Installation
46
46
 
@@ -99,6 +99,10 @@ You can download the compressed files for production
99
99
  - https://naver.github.io/billboard.js/release/latest/dist/theme/datalab.min.css
100
100
 
101
101
 
102
+ #### dark
103
+ - https://naver.github.io/billboard.js/release/latest/dist/theme/dark.css
104
+ - https://naver.github.io/billboard.js/release/latest/dist/theme/dark.min.css
105
+
102
106
  #### insight
103
107
  - https://naver.github.io/billboard.js/release/latest/dist/theme/insight.css
104
108
  - https://naver.github.io/billboard.js/release/latest/dist/theme/insight.min.css
@@ -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-next.2
8
+ * @version 3.9.1
9
9
  */
10
10
  /*-- Chart --*/
11
11
  .bb svg {
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-next.2
8
+ * @version 3.9.1
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -3190,17 +3190,34 @@ var data_this = undefined;
3190
3190
  * - defines the max step the legend has (e.g. If 2 set and legend has 3 legend item, the legend 2 columns).
3191
3191
  * @property {boolean} [legend.equally=false] Set to all items have same width size.
3192
3192
  * @property {number} [legend.padding=0] Set padding value
3193
+ * @property {boolean} [legend.item.interaction=true] Set legend item interaction.
3194
+ * - **NOTE:**
3195
+ * - This setting will not have effect on `.toggle()` method.
3196
+ * - `legend.item.onXXX` listener options will work if set, regardless of this option value.
3197
+ * @property {boolean} [legend.item.interaction.dblclick=false] Set legend item to interact on double click.
3198
+ * - **NOTE:**
3199
+ * - Double clicking will make focused clicked dataseries only, hiding all others.
3200
+ * - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
3201
+ * - To return initial state(which all dataseries are showing), double click current focused legend item again.
3202
+ * - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
3203
+ * - In this case, default `click` interaction will be disabled.
3193
3204
  * @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
3205
+ * - **NOTE:**
3206
+ * - When set, default `click` interaction will be disabled.
3207
+ * - When `interaction.dblclick=true` is set, will be called on double click.
3194
3208
  * @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
3209
+ * - **NOTE:** When set, default `mouseover` interaction will be disabled.
3195
3210
  * @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
3211
+ * - **NOTE:** When set, default `mouseout` interaction will be disabled.
3196
3212
  * @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
3197
- * @property {number} [legend.item.tile.height=10] ㄹ
3213
+ * @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
3198
3214
  * @property {number} [legend.item.tile.r=5] Set the radius for 'circle' legend item tile type.
3199
3215
  * @property {string} [legend.item.tile.type="rectangle"] Set legend item shape type.<br>
3200
3216
  * - **Available Values:**
3201
3217
  * - circle
3202
3218
  * - rectangle
3203
3219
  * @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
3220
+ * @see [Demo: item.interaction](https://naver.github.io/billboard.js/demo/#Legend.LegendItemInteraction)
3204
3221
  * @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
3205
3222
  * @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
3206
3223
  * @see [Demo: contents.template](https://naver.github.io/billboard.js/demo/#Legend.LegendTemplate1)
@@ -3235,6 +3252,16 @@ var data_this = undefined;
3235
3252
  * equally: false,
3236
3253
  * padding: 10,
3237
3254
  * item: {
3255
+ * // will disable default interaction
3256
+ * interaction: false,
3257
+ *
3258
+ * // set legend interact on double click
3259
+ * // by double clicking, will make focused clicked dataseries only, hiding all others.
3260
+ * interaction: {
3261
+ * dblclick: true
3262
+ * }
3263
+ *
3264
+ * // when set below callback, will disable corresponding default interactions
3238
3265
  * onclick: function(id) { ... },
3239
3266
  * onover: function(id) { ... },
3240
3267
  * onout: function(id) { ... },
@@ -3255,24 +3282,26 @@ var data_this = undefined;
3255
3282
  * usePoint: true
3256
3283
  * }
3257
3284
  */
3258
- legend_show: !0,
3259
- legend_hide: !1,
3260
3285
  legend_contents_bindto: undefined,
3261
3286
  legend_contents_template: "<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",
3262
- legend_position: "bottom",
3287
+ legend_equally: !1,
3288
+ legend_hide: !1,
3263
3289
  legend_inset_anchor: "top-left",
3264
3290
  legend_inset_x: 10,
3265
3291
  legend_inset_y: 0,
3266
3292
  legend_inset_step: undefined,
3293
+ legend_item_interaction: !0,
3294
+ legend_item_dblclick: !1,
3267
3295
  legend_item_onclick: undefined,
3268
3296
  legend_item_onover: undefined,
3269
3297
  legend_item_onout: undefined,
3270
- legend_equally: !1,
3271
- legend_padding: 0,
3272
3298
  legend_item_tile_width: 10,
3273
3299
  legend_item_tile_height: 10,
3274
3300
  legend_item_tile_r: 5,
3275
3301
  legend_item_tile_type: "rectangle",
3302
+ legend_padding: 0,
3303
+ legend_position: "bottom",
3304
+ legend_show: !0,
3276
3305
  legend_usePoint: !1
3277
3306
  });
3278
3307
  ;// CONCATENATED MODULE: ./src/config/Options/common/title.ts
@@ -5082,22 +5111,11 @@ function getDataKeyForJson(keysParam, config) {
5082
5111
  findClosest: function findClosest(values, pos) {
5083
5112
  var _this36 = this,
5084
5113
  $$ = this,
5085
- config = $$.config,
5086
5114
  main = $$.$el.main,
5087
5115
  data = values.filter(function (v) {
5088
5116
  _newArrowCheck(this, _this36);
5089
5117
  return v && isValue(v.value);
5090
5118
  }.bind(this)),
5091
- getSensitivity = function (d) {
5092
- _newArrowCheck(this, _this36);
5093
- var sensitivity = config.point_sensitivity;
5094
- if (isFunction(sensitivity)) {
5095
- sensitivity = sensitivity.call($$.api, d);
5096
- } else if (sensitivity === "radius") {
5097
- sensitivity = d.r;
5098
- }
5099
- return sensitivity;
5100
- }.bind(this),
5101
5119
  minDist,
5102
5120
  closest;
5103
5121
  // find mouseovering bar/candlestick
@@ -5120,7 +5138,7 @@ function getDataKeyForJson(keysParam, config) {
5120
5138
  }.bind(this)).forEach(function (v) {
5121
5139
  _newArrowCheck(this, _this36);
5122
5140
  var d = $$.dist(v, pos);
5123
- minDist = getSensitivity(v);
5141
+ minDist = $$.getPointSensitivity(v);
5124
5142
  if (d < minDist) {
5125
5143
  minDist = d;
5126
5144
  closest = v;
@@ -7028,7 +7046,8 @@ function getLegendColor(id) {
7028
7046
  state = $$.state,
7029
7047
  isTouch = state.inputType === "touch",
7030
7048
  hasGauge = $$.hasType("gauge"),
7031
- useCssRule = config.boost_useCssRule;
7049
+ useCssRule = config.boost_useCssRule,
7050
+ interaction = config.legend_item_interaction;
7032
7051
  item.attr("class", function (id) {
7033
7052
  var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
7034
7053
  itemClass = !node.empty() && node.attr("class") || "";
@@ -7046,19 +7065,27 @@ function getLegendColor(id) {
7046
7065
  $$.setCssRule(!1, selector, [props])($el.legend);
7047
7066
  }.bind(this));
7048
7067
  }
7049
- item.style("cursor", $$.getStylePropValue("pointer")).on("click", function (event, id) {
7068
+ item.on(interaction.dblclick ? "dblclick" : "click", interaction || isFunction(config.legend_item_onclick) ? function (event, id) {
7050
7069
  if (!callFn(config.legend_item_onclick, api, id)) {
7051
- if (event.altKey) {
7052
- api.hide();
7053
- api.show(id);
7070
+ var altKey = event.altKey,
7071
+ target = event.target,
7072
+ type = event.type;
7073
+ if (type === "dblclick" || altKey) {
7074
+ // when focused legend is clicked(with altKey or double clicked), reset all hiding.
7075
+ if (state.hiddenTargetIds.length && target.parentNode.getAttribute("class").indexOf($LEGEND.legendItemHidden) === -1) {
7076
+ api.show();
7077
+ } else {
7078
+ api.hide();
7079
+ api.show(id);
7080
+ }
7054
7081
  } else {
7055
7082
  api.toggle(id);
7056
7083
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !1);
7057
7084
  }
7058
7085
  }
7059
7086
  isTouch && $$.hideTooltip();
7060
- });
7061
- isTouch || item.on("mouseout", function (event, id) {
7087
+ } : null);
7088
+ isTouch || item.on("mouseout", interaction || isFunction(config.legend_item_onout) ? function (event, id) {
7062
7089
  if (!callFn(config.legend_item_onout, api, id)) {
7063
7090
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !1);
7064
7091
  if (hasGauge) {
@@ -7066,7 +7093,7 @@ function getLegendColor(id) {
7066
7093
  }
7067
7094
  $$.api.revert();
7068
7095
  }
7069
- }).on("mouseover", function (event, id) {
7096
+ } : null).on("mouseover", interaction || isFunction(config.legend_item_onover) ? function (event, id) {
7070
7097
  if (!callFn(config.legend_item_onover, api, id)) {
7071
7098
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !0);
7072
7099
  if (hasGauge) {
@@ -7076,7 +7103,10 @@ function getLegendColor(id) {
7076
7103
  api.focus(id);
7077
7104
  }
7078
7105
  }
7079
- });
7106
+ } : null);
7107
+
7108
+ // set cursor when has some interaction
7109
+ !item.empty() && item.on("click mouseout mouseover") && item.style("cursor", $$.getStylePropValue("pointer"));
7080
7110
  }
7081
7111
  },
7082
7112
  /**
@@ -9681,17 +9711,65 @@ function title_getTextPos(pos, width) {
9681
9711
  getTooltipContentTemplate: function getTooltipContentTemplate(tplStr) {
9682
9712
  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(/{{(.*)}}/);
9683
9713
  },
9714
+ /**
9715
+ * Update tooltip position coordinate
9716
+ * @param {object} dataToShow Data object
9717
+ * @param {SVGElement} eventTarget Event element
9718
+ * @private
9719
+ */
9720
+ setTooltipPosition: function setTooltipPosition(dataToShow, eventTarget) {
9721
+ var _this4 = this,
9722
+ $$ = this,
9723
+ config = $$.config,
9724
+ scale = $$.scale,
9725
+ state = $$.state,
9726
+ _$$$$el = $$.$el,
9727
+ eventRect = _$$$$el.eventRect,
9728
+ tooltip = _$$$$el.tooltip,
9729
+ bindto = config.tooltip_contents.bindto,
9730
+ datum = tooltip.datum();
9731
+ if (!bindto && datum) {
9732
+ var _config$tooltip_posit,
9733
+ _config$tooltip_posit2,
9734
+ _getPointer = getPointer(state.event, eventTarget != null ? eventTarget : eventRect.node()),
9735
+ x = _getPointer[0],
9736
+ y = _getPointer[1],
9737
+ currPos = {
9738
+ x: x,
9739
+ y: y
9740
+ };
9741
+ // get mouse event position
9742
+
9743
+ if (scale.x && datum && "x" in datum) {
9744
+ currPos.xAxis = scale.x(datum.x);
9745
+ }
9746
+ var _datum$width = datum.width,
9747
+ width = _datum$width === void 0 ? 0 : _datum$width,
9748
+ _datum$height = datum.height,
9749
+ height = _datum$height === void 0 ? 0 : _datum$height,
9750
+ 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
9751
+ ["top", "left"].forEach(function (v) {
9752
+ _newArrowCheck(this, _this4);
9753
+ var value = pos[v];
9754
+ tooltip.style(v, value + "px");
9755
+
9756
+ // Remember left pos in percentage to be used on resize call
9757
+ if (v === "left" && !datum.xPosInPercent) {
9758
+ datum.xPosInPercent = value / state.current.width * 100;
9759
+ }
9760
+ }.bind(this));
9761
+ }
9762
+ },
9684
9763
  /**
9685
9764
  * Returns the position of the tooltip
9686
- * @param {object} dataToShow data
9687
9765
  * @param {string} tWidth Width value of tooltip element
9688
9766
  * @param {string} tHeight Height value of tooltip element
9689
- * @param {HTMLElement} element Tooltip element
9767
+ * @param {object} currPos Current mouse position
9690
9768
  * @returns {object} top, left value
9691
9769
  * @private
9692
9770
  */
9693
- tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) {
9694
- var _this4 = this,
9771
+ getTooltipPosition: function getTooltipPosition(tWidth, tHeight, currPos) {
9772
+ var _this5 = this,
9695
9773
  $$ = this,
9696
9774
  config = $$.config,
9697
9775
  scale = $$.scale,
@@ -9702,16 +9780,14 @@ function title_getTextPos(pos, width) {
9702
9780
  current = _state.current,
9703
9781
  isLegendRight = _state.isLegendRight,
9704
9782
  inputType = _state.inputType,
9705
- event = _state.event,
9706
9783
  hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
9707
9784
  hasTreemap = state.hasTreemap,
9708
9785
  isRotated = config.axis_rotated,
9709
9786
  svgLeft = $$.getSvgLeft(!0),
9710
9787
  chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
9711
9788
  chartLeft = $$.getCurrentPaddingLeft(!0),
9712
- _getPointer = getPointer(event, element),
9713
- x = _getPointer[0],
9714
- y = _getPointer[1];
9789
+ x = currPos.x,
9790
+ y = currPos.y;
9715
9791
  // Determine tooltip position
9716
9792
  if ($$.hasArcType()) {
9717
9793
  var raw = inputType === "touch" || $$.hasType("radar");
@@ -9720,14 +9796,13 @@ function title_getTextPos(pos, width) {
9720
9796
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
9721
9797
  }
9722
9798
  } else if (!hasTreemap) {
9723
- var dataScale = scale.x(dataToShow[0].x);
9724
9799
  if (isRotated) {
9725
- y = dataScale + 20;
9800
+ y = currPos.xAxis + 20;
9726
9801
  x += svgLeft;
9727
9802
  chartRight -= svgLeft;
9728
9803
  } else {
9729
9804
  y -= 5;
9730
- x = svgLeft + chartLeft + 20 + (scale.zoom ? x : dataScale);
9805
+ x = svgLeft + chartLeft + 20 + (scale.zoom ? x : currPos.xAxis);
9731
9806
  }
9732
9807
  }
9733
9808
 
@@ -9746,7 +9821,7 @@ function title_getTextPos(pos, width) {
9746
9821
 
9747
9822
  // make sure to not be positioned out of viewport
9748
9823
  Object.keys(pos).forEach(function (v) {
9749
- _newArrowCheck(this, _this4);
9824
+ _newArrowCheck(this, _this5);
9750
9825
  if (pos[v] < 0) {
9751
9826
  pos[v] = 0;
9752
9827
  }
@@ -9756,33 +9831,27 @@ function title_getTextPos(pos, width) {
9756
9831
  /**
9757
9832
  * Show the tooltip
9758
9833
  * @param {object} selectedData Data object
9759
- * @param {SVGElement} eventRect Event <rect> element
9834
+ * @param {SVGElement} eventTarget Event element
9760
9835
  * @private
9761
9836
  */
9762
- showTooltip: function showTooltip(selectedData, eventRect) {
9763
- var _this5 = this,
9837
+ showTooltip: function showTooltip(selectedData, eventTarget) {
9838
+ var _this6 = this,
9764
9839
  $$ = this,
9765
9840
  config = $$.config,
9766
- scale = $$.scale,
9767
- state = $$.state,
9768
9841
  tooltip = $$.$el.tooltip,
9769
- bindto = config.tooltip_contents.bindto,
9770
9842
  dataToShow = selectedData.filter(function (d) {
9771
- _newArrowCheck(this, _this5);
9843
+ _newArrowCheck(this, _this6);
9772
9844
  return d && isValue($$.getBaseValue(d));
9773
9845
  }.bind(this));
9774
9846
  if (!tooltip || dataToShow.length === 0 || !config.tooltip_show) {
9775
9847
  return;
9776
9848
  }
9777
- var datum = tooltip.datum(),
9778
- _ref = datum || {},
9779
- _ref$width = _ref.width,
9780
- width = _ref$width === void 0 ? 0 : _ref$width,
9781
- _ref$height = _ref.height,
9782
- height = _ref$height === void 0 ? 0 : _ref$height;
9849
+ var datum = tooltip.datum();
9783
9850
  var dataStr = JSON.stringify(selectedData);
9784
9851
  if (!datum || datum.current !== dataStr) {
9785
- var index = selectedData.concat().sort()[0].index;
9852
+ var _selectedData$concat$ = selectedData.concat().sort()[0],
9853
+ index = _selectedData$concat$.index,
9854
+ x = _selectedData$concat$.x;
9786
9855
  callFn(config.tooltip_onshow, $$.api, selectedData);
9787
9856
 
9788
9857
  // set tooltip content
@@ -9796,57 +9865,28 @@ function title_getTextPos(pos, width) {
9796
9865
  )).style("display", null).style("visibility", null) // for IE9
9797
9866
  .datum(datum = {
9798
9867
  index: index,
9868
+ x: x,
9799
9869
  current: dataStr,
9800
- width: width = tooltip.property("offsetWidth"),
9801
- height: height = tooltip.property("offsetHeight")
9870
+ width: tooltip.property("offsetWidth"),
9871
+ height: tooltip.property("offsetHeight")
9802
9872
  });
9803
9873
  callFn(config.tooltip_onshown, $$.api, selectedData);
9804
9874
  $$._handleLinkedCharts(!0, index);
9805
9875
  }
9806
- if (!bindto) {
9807
- var _config$tooltip_posit,
9808
- _selectedData$filter,
9809
- fnPos = ((_config$tooltip_posit = config.tooltip_position) == null ? void 0 : _config$tooltip_posit.bind($$.api)) || $$.tooltipPosition.bind($$),
9810
- _getPointer2 = getPointer(state.event, eventRect),
9811
- x = _getPointer2[0],
9812
- y = _getPointer2[1],
9813
- currPos = {
9814
- x: x,
9815
- y: y
9816
- },
9817
- data = (_selectedData$filter = selectedData.filter(Boolean)) == null ? void 0 : _selectedData$filter.shift();
9818
- // get mouse event position
9819
-
9820
- if (scale.x && data && "x" in data) {
9821
- currPos.xAxis = scale.x(data.x);
9822
- }
9823
-
9824
- // Get tooltip dimensions
9825
- var pos = fnPos(dataToShow, width, height, eventRect, currPos);
9826
- ["top", "left"].forEach(function (v) {
9827
- _newArrowCheck(this, _this5);
9828
- var value = pos[v];
9829
- tooltip.style(v, value + "px");
9830
-
9831
- // Remember left pos in percentage to be used on resize call
9832
- if (v === "left" && !datum.xPosInPercent) {
9833
- datum.xPosInPercent = value / state.current.width * 100;
9834
- }
9835
- }.bind(this));
9836
- }
9876
+ $$.setTooltipPosition(dataToShow, eventTarget);
9837
9877
  },
9838
9878
  /**
9839
9879
  * Adjust tooltip position on resize event
9840
9880
  * @private
9841
9881
  */
9842
9882
  bindTooltipResizePos: function bindTooltipResizePos() {
9843
- var _this6 = this,
9883
+ var _this7 = this,
9844
9884
  $$ = this,
9845
9885
  resizeFunction = $$.resizeFunction,
9846
9886
  state = $$.state,
9847
9887
  tooltip = $$.$el.tooltip;
9848
9888
  resizeFunction.add(function () {
9849
- _newArrowCheck(this, _this6);
9889
+ _newArrowCheck(this, _this7);
9850
9890
  if (tooltip.style("display") === "block") {
9851
9891
  var current = state.current,
9852
9892
  _tooltip$datum = tooltip.datum(),
@@ -9890,7 +9930,7 @@ function title_getTextPos(pos, width) {
9890
9930
  * @private
9891
9931
  */
9892
9932
  _handleLinkedCharts: function _handleLinkedCharts(show, index) {
9893
- var _this7 = this,
9933
+ var _this8 = this,
9894
9934
  $$ = this,
9895
9935
  charts = $$.charts,
9896
9936
  config = $$.config,
@@ -9900,10 +9940,10 @@ function title_getTextPos(pos, width) {
9900
9940
  if (event != null && event.isTrusted && config.tooltip_linked && charts.length > 1) {
9901
9941
  var linkedName = config.tooltip_linked_name;
9902
9942
  charts.filter(function (c) {
9903
- _newArrowCheck(this, _this7);
9943
+ _newArrowCheck(this, _this8);
9904
9944
  return c !== $$.api;
9905
9945
  }.bind(this)).forEach(function (c) {
9906
- _newArrowCheck(this, _this7);
9946
+ _newArrowCheck(this, _this8);
9907
9947
  var _c$internal = c.internal,
9908
9948
  config = _c$internal.config,
9909
9949
  $el = _c$internal.$el,
@@ -15360,9 +15400,10 @@ var Axis_Axis = /*#__PURE__*/function () {
15360
15400
 
15361
15401
  // Show xgrid focus line
15362
15402
  $$.showGridFocus(selectedData);
15403
+ var dist = $$.dist(closest, mouse);
15363
15404
 
15364
15405
  // Show cursor as pointer if point is close to mouse position
15365
- if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
15406
+ if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
15366
15407
  $$.$el.svg.select("." + $EVENT.eventRect).style("cursor", "pointer");
15367
15408
  if (!state.mouseover) {
15368
15409
  config.data_onover.call($$.api, closest);
@@ -15439,9 +15480,11 @@ var Axis_Axis = /*#__PURE__*/function () {
15439
15480
  index += 1;
15440
15481
  }
15441
15482
  }
15483
+ var eventOnSameIdx = config.tooltip_grouped && index === eventReceiver.currentIdx;
15442
15484
 
15443
15485
  // do nothing while dragging/flowing
15444
- if (state.dragging || state.flowing || $$.hasArcType() || config.tooltip_grouped && index === eventReceiver.currentIdx) {
15486
+ if (state.dragging || state.flowing || $$.hasArcType() || eventOnSameIdx) {
15487
+ eventOnSameIdx && $$.setTooltipPosition();
15445
15488
  return;
15446
15489
  }
15447
15490
  if (index !== eventReceiver.currentIdx) {
@@ -20824,6 +20867,21 @@ var getTransitionName = function () {
20824
20867
  }
20825
20868
  return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
20826
20869
  },
20870
+ /**
20871
+ * Get data point sensitivity radius
20872
+ * @param {object} d Data point object
20873
+ * @returns {number} return the sensitivity value
20874
+ */
20875
+ getPointSensitivity: function getPointSensitivity(d) {
20876
+ var $$ = this;
20877
+ var sensitivity = $$.config.point_sensitivity;
20878
+ if (isFunction(sensitivity)) {
20879
+ sensitivity = sensitivity.call($$.api, d);
20880
+ } else if (sensitivity === "radius") {
20881
+ sensitivity = d.r;
20882
+ }
20883
+ return sensitivity;
20884
+ },
20827
20885
  insertPointInfoDefs: function insertPointInfoDefs(point, id) {
20828
20886
  var _this7 = this,
20829
20887
  $$ = this,
@@ -24535,9 +24593,9 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
24535
24593
  e = event == null ? void 0 : event.sourceEvent,
24536
24594
  isUnZoom = (event == null ? void 0 : event.transform) === external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity;
24537
24595
  if (((_startEvent = startEvent) == null ? void 0 : _startEvent.type.indexOf("touch")) > -1) {
24538
- var _e, _e$changedTouches;
24596
+ var _e;
24539
24597
  startEvent = startEvent.changedTouches[0];
24540
- e = (_e = e) == null ? void 0 : (_e$changedTouches = _e.changedTouches) == null ? void 0 : _e$changedTouches[0];
24598
+ e = (_e = e) == null || (_e = _e.changedTouches) == null ? void 0 : _e[0];
24541
24599
  }
24542
24600
 
24543
24601
  // if click, do nothing. otherwise, click interaction will be canceled.
@@ -25043,7 +25101,7 @@ var _defaults = {};
25043
25101
 
25044
25102
  /**
25045
25103
  * @namespace bb
25046
- * @version 3.9.0-next.2
25104
+ * @version 3.9.1
25047
25105
  */
25048
25106
  var bb = {
25049
25107
  /**
@@ -25053,7 +25111,7 @@ var bb = {
25053
25111
  * bb.version; // "1.0.0"
25054
25112
  * @memberof bb
25055
25113
  */
25056
- version: "3.9.0-next.2",
25114
+ version: "3.9.1",
25057
25115
  /**
25058
25116
  * Generate chart
25059
25117
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -5,5 +5,5 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.9.0-next.2
8
+ * @version 3.9.1
9
9
  */.bb svg{-webkit-tap-highlight-color:rgba(0,0,0,0);font:10px sans-serif}.bb line,.bb path{fill:none;stroke:#000}.bb .bb-button,.bb text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid,.bb-ygrid-focus{shape-rendering:crispEdges}.bb-chart-arc .bb-gauge-value,.bb-chart-arcs .bb-needle{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-axis{shape-rendering:crispEdges}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:grey;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-circles.bb-focused,.bb-target.bb-focused{opacity:1}.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step,.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step{stroke-width:2px}.bb-circles.bb-defocused,.bb-target.bb-defocused{opacity:.3!important}.bb-circles.bb-defocused .text-overlapping,.bb-target.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-brush .extent,.bb-region,.bb-zoom-brush{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{fill:#fff;stroke:#d3d3d3;stroke-width:1;opacity:.75}.bb-title{font:14px sans-serif}.bb-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{user-select:none;z-index:10}.bb-tooltip{background-color:#fff;border-collapse:collapse;border-spacing:0;box-shadow:7px 7px 12px -9px #777;empty-cells:show;opacity:.9;white-space:nowrap}.bb-tooltip tr{border:1px solid #ccc}.bb-tooltip th{background-color:#aaa;color:#fff;font-size:14px;padding:2px 5px;text-align:left}.bb-tooltip td{background-color:#fff;border-left:1px dotted #999;font-size:13px;padding:3px 6px}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;height:10px;margin-right:6px;width:10px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{cursor:default;font-size:1.15em}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;right:10px;top:10px}.bb-button .bb-zoom-reset{background-color:#fff;border:1px solid #ccc;border-radius:5px;cursor:pointer;font-size:11px;padding:5px}