billboard.js 3.13.0 → 3.14.0-next.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 (70) hide show
  1. package/README.md +1 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +349 -176
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +10 -10
  6. package/dist/billboard.pkgd.js +572 -399
  7. package/dist/billboard.pkgd.min.js +18 -18
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +7 -4
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +37 -11
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.js +41 -15
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.js +37 -11
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +6 -6
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +36 -10
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +50 -50
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +138 -115
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +6 -6
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +178 -155
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +11 -11
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +138 -115
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +150 -127
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -7
  28. package/dist/theme/dark.css +1 -1
  29. package/dist/theme/dark.min.css +1 -1
  30. package/dist/theme/datalab.css +1 -1
  31. package/dist/theme/datalab.min.css +1 -1
  32. package/dist/theme/graph.css +1 -1
  33. package/dist/theme/graph.min.css +1 -1
  34. package/dist/theme/insight.css +1 -1
  35. package/dist/theme/insight.min.css +1 -1
  36. package/dist/theme/modern.css +1 -1
  37. package/dist/theme/modern.min.css +1 -1
  38. package/dist-esm/billboard.js +267 -67
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -3
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -3
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -3
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -3
  44. package/package.json +32 -31
  45. package/src/Chart/Chart.ts +11 -0
  46. package/src/ChartInternal/Axis/AxisRenderer.ts +6 -2
  47. package/src/ChartInternal/Axis/AxisRendererHelper.ts +13 -8
  48. package/src/ChartInternal/ChartInternal.ts +9 -7
  49. package/src/ChartInternal/data/data.ts +18 -4
  50. package/src/ChartInternal/data/load.ts +4 -0
  51. package/src/ChartInternal/interactions/eventrect.ts +11 -7
  52. package/src/ChartInternal/interactions/interaction.ts +21 -6
  53. package/src/ChartInternal/interactions/zoom.ts +11 -3
  54. package/src/ChartInternal/internals/legend.ts +16 -6
  55. package/src/ChartInternal/internals/size.ts +10 -5
  56. package/src/ChartInternal/internals/tooltip.ts +54 -2
  57. package/src/ChartInternal/internals/type.ts +2 -1
  58. package/src/ChartInternal/shape/arc.ts +2 -1
  59. package/src/ChartInternal/shape/funnel.ts +4 -2
  60. package/src/ChartInternal/shape/radar.ts +5 -1
  61. package/src/ChartInternal/shape/treemap.ts +4 -2
  62. package/src/config/Options/axis/axis.ts +30 -0
  63. package/src/config/Options/axis/y2.ts +13 -0
  64. package/src/config/Options/common/legend.ts +6 -3
  65. package/src/config/Options/common/main.ts +18 -7
  66. package/src/config/Options/interaction/interaction.ts +8 -2
  67. package/src/module/error.ts +11 -7
  68. package/src/module/util.ts +61 -7
  69. package/types/axis.d.ts +7 -0
  70. package/types/options.d.ts +15 -5
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.13.0
8
+ * @version 3.14.0-next.2
9
9
  */
10
10
  import { pointer, select, namespaces, selectAll } from 'd3-selection';
11
11
  import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
@@ -35,7 +35,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
35
35
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
36
36
  PERFORMANCE OF THIS SOFTWARE.
37
37
  ***************************************************************************** */
38
- /* global Reflect, Promise, SuppressedError, Symbol */
38
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
39
39
 
40
40
 
41
41
  var __assign = function() {
@@ -476,9 +476,12 @@ var legend$2 = {
476
476
  * }
477
477
  *
478
478
  * // when set below callback, will disable corresponding default interactions
479
- * onclick: function(id) { ... },
480
- * onover: function(id) { ... },
481
- * onout: function(id) { ... },
479
+ * onclick: function(id, visible) {
480
+ * // toggle based on the data visibility
481
+ * this[visible ? "hide" : "show"](id);
482
+ * },
483
+ * onover: function(id, visible) { ... },
484
+ * onout: function(id, visible) { ... },
482
485
  *
483
486
  * // set tile's size
484
487
  * tile: {
@@ -683,24 +686,32 @@ var main = {
683
686
  * @memberof Options
684
687
  * @type {object}
685
688
  * @property {object} [resize] resize object
686
- * @property {boolean} [resize.auto=true] Set chart resize automatically on viewport changes.
689
+ * @property {boolean|string} [resize.auto=true] Set chart resize automatically on viewport changes.
690
+ * - **NOTE:** Available options
691
+ * - true: Enables automatic resize.
692
+ * - false: Disables automatic resize.
693
+ * - "viewBox": Enables automatic resize, and size will be fixed based on the viewbox.
687
694
  * @property {boolean|number} [resize.timer=true] Set resize timer option.
688
- * - **NOTE:**
695
+ * - **NOTE:** Available options
689
696
  * - The resize function will be called using:
690
697
  * - true: `setTimeout()`
691
698
  * - false: `requestIdleCallback()`
692
- * - Given number(delay in ms) value, resize function will be triggered using `setTimer()` with given delay.
699
+ * - Given number(delay in ms) value, resize function will be triggered using `setTimeout()` with given delay.
700
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeViewBox)
693
701
  * @example
694
702
  * resize: {
695
703
  * auto: false,
696
704
  *
697
- * // set resize function will be triggered using `setTimer()`
705
+ * // set resize based on viewBox value
706
+ * auto: "viewBox",
707
+ *
708
+ * // set resize function will be triggered using `setTimeout()`
698
709
  * timer: true,
699
710
  *
700
711
  * // set resize function will be triggered using `requestIdleCallback()`
701
712
  * timer: false,
702
713
  *
703
- * // set resize function will be triggered using `setTimer()` with a delay of `100ms`.
714
+ * // set resize function will be triggered using `setTimeout()` with a delay of `100ms`.
704
715
  * timer: 100
705
716
  * }
706
717
  */
@@ -859,7 +870,10 @@ var main = {
859
870
  * @memberof Options
860
871
  * @type {object}
861
872
  * @property {object} [render] render object
862
- * @property {boolean} [render.lazy=true] Make to not render at initialization (enabled by default when bind element's visibility is hidden).
873
+ * @property {boolean} [render.lazy=true] Make to not render at initialization.
874
+ * - **NOTE**:
875
+ * - Enabled by default when bind element's visibility is hidden.
876
+ * - When set to `false`, will initialize the chart regardless the bind element's visibility state, but in this case chart can't be guaranteed to be rendered properly.
863
877
  * @property {boolean} [render.observe=true] Observe bind element's visibility(`display` or `visiblity` inline css property or class value) & render when is visible automatically (for IEs, only works IE11+). When set to **false**, call [`.flush()`](./Chart.html#flush) to render.
864
878
  * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.LazyRender)
865
879
  * @example
@@ -2100,6 +2114,8 @@ var interaction$1 = {
2100
2114
  * @property {boolean} [interaction.inputType.mouse=true] enable or disable mouse interaction
2101
2115
  * @property {boolean} [interaction.inputType.touch=true] enable or disable touch interaction
2102
2116
  * @property {boolean|number} [interaction.inputType.touch.preventDefault=false] enable or disable to call event.preventDefault on touchstart & touchmove event. It's usually used to prevent document scrolling.
2117
+ * @property {boolean} [interaction.onout=true] Enable or disable "onout" event.<br>
2118
+ * When is disabled, defocus(hiding tooltip, focused gridline, etc.) event won't work.
2103
2119
  * @see [Demo: touch.preventDefault](https://naver.github.io/billboard.js/demo/#Interaction.PreventScrollOnTouch)
2104
2120
  * @example
2105
2121
  * interaction: {
@@ -2117,13 +2133,17 @@ var interaction$1 = {
2117
2133
  * // or threshold pixel value (pixel moved from touchstart to touchmove)
2118
2134
  * preventDefault: 5
2119
2135
  * }
2120
- * }
2136
+ * },
2137
+ *
2138
+ * // disable "onout" event
2139
+ * onout: false
2121
2140
  * }
2122
2141
  */
2123
2142
  interaction_enabled: true,
2124
2143
  interaction_brighten: true,
2125
2144
  interaction_inputType_mouse: true,
2126
- interaction_inputType_touch: {}
2145
+ interaction_inputType_touch: {},
2146
+ interaction_onout: true
2127
2147
  };
2128
2148
 
2129
2149
  /**
@@ -2587,6 +2607,22 @@ function getScrollPosition(node) {
2587
2607
  y: ((_e = (_d = win.pageYOffset) !== null && _d !== void 0 ? _d : win.scrollY) !== null && _e !== void 0 ? _e : 0) + ((_f = node.scrollTop) !== null && _f !== void 0 ? _f : 0)
2588
2608
  };
2589
2609
  }
2610
+ /**
2611
+ * Get translation string from screen <--> svg point
2612
+ * @param {SVGGraphicsElement} node graphics element
2613
+ * @param {number} x target x point
2614
+ * @param {number} y target y point
2615
+ * @param {boolean} inverse inverse flag
2616
+ * @returns {object}
2617
+ */
2618
+ function getTransformCTM(node, x, y, inverse) {
2619
+ if (x === void 0) { x = 0; }
2620
+ if (y === void 0) { y = 0; }
2621
+ if (inverse === void 0) { inverse = true; }
2622
+ var point = new DOMPoint(x, y);
2623
+ var screen = node.getScreenCTM();
2624
+ return point.matrixTransform(inverse ? screen === null || screen === void 0 ? void 0 : screen.inverse() : screen);
2625
+ }
2590
2626
  /**
2591
2627
  * Gets the SVGMatrix of an SVGGElement
2592
2628
  * @param {SVGElement} node Node element
@@ -2805,6 +2841,35 @@ function parseDate(date) {
2805
2841
  }
2806
2842
  return parsedDate;
2807
2843
  }
2844
+ /**
2845
+ * Check if svg element has viewBox attribute
2846
+ * @param {d3Selection} svg Target svg selection
2847
+ * @returns {boolean}
2848
+ */
2849
+ function hasViewBox(svg) {
2850
+ var attr = svg.attr("viewBox");
2851
+ return attr ? /(\d+(\.\d+)?){3}/.test(attr) : false;
2852
+ }
2853
+ /**
2854
+ * Determine if given node has the specified style
2855
+ * @param {d3Selection|SVGElement} node Target node
2856
+ * @param {object} condition Conditional style props object
2857
+ * @param {boolean} all If true, all condition should be matched
2858
+ * @returns {boolean}
2859
+ */
2860
+ function hasStyle(node, condition, all) {
2861
+ if (all === void 0) { all = false; }
2862
+ var isD3Node = !!node.node;
2863
+ var has = false;
2864
+ for (var _i = 0, _a = Object.entries(condition); _i < _a.length; _i++) {
2865
+ var _b = _a[_i], key = _b[0], value = _b[1];
2866
+ has = isD3Node ? node.style(key) === value : node.style[key] === value;
2867
+ if (all === false && has) {
2868
+ break;
2869
+ }
2870
+ }
2871
+ return has;
2872
+ }
2808
2873
  /**
2809
2874
  * Return if the current doc is visible or not
2810
2875
  * @returns {boolean}
@@ -2822,6 +2887,8 @@ function isTabVisible() {
2822
2887
  */
2823
2888
  function convertInputType(mouse, touch) {
2824
2889
  var DocumentTouch = win.DocumentTouch, matchMedia = win.matchMedia, navigator = win.navigator;
2890
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer#coarse
2891
+ var hasPointerCoarse = matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(pointer:coarse)").matches;
2825
2892
  var hasTouch = false;
2826
2893
  if (touch) {
2827
2894
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
@@ -2835,7 +2902,7 @@ function convertInputType(mouse, touch) {
2835
2902
  }
2836
2903
  else {
2837
2904
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
2838
- if (matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(pointer:coarse)").matches) {
2905
+ if (hasPointerCoarse) {
2839
2906
  hasTouch = true;
2840
2907
  }
2841
2908
  else {
@@ -2846,11 +2913,9 @@ function convertInputType(mouse, touch) {
2846
2913
  }
2847
2914
  }
2848
2915
  }
2849
- // Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
2850
- // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
2851
- // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
2852
- var hasMouse = mouse &&
2853
- ((matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("any-hover:hover").matches) || (matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("any-pointer:fine").matches));
2916
+ // For non-touch device, media feature condition is: '(pointer:coarse) = false' and '(pointer:fine) = true'
2917
+ // https://github.com/naver/billboard.js/issues/3854#issuecomment-2404183158
2918
+ var hasMouse = mouse && !hasPointerCoarse && (matchMedia === null || matchMedia === void 0 ? void 0 : matchMedia("(pointer:fine)").matches);
2854
2919
  // fallback to 'mouse' if no input type is detected.
2855
2920
  return (hasMouse && "mouse") || (hasTouch && "touch") || "mouse";
2856
2921
  }
@@ -3354,24 +3419,25 @@ function checkModuleImport(ctx) {
3354
3419
  }
3355
3420
  }
3356
3421
  type &&
3357
- logError("Please, make sure if %c".concat(camelize(type)), "module has been imported and specified correctly.");
3422
+ logError("Please, make sure if %c".concat(camelize(type)), "module has been imported and specified correctly.", "https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality");
3358
3423
  }
3359
3424
  /**
3360
3425
  * Log error and throw error
3361
3426
  * @param {string} head Message header
3362
3427
  * @param {string} tail Message tail
3428
+ * @param {string} info Info message
3363
3429
  * @private
3364
3430
  */
3365
- function logError(head, tail) {
3431
+ function logError(head, tail, info) {
3366
3432
  var _a;
3367
3433
  var prefix = "[billboard.js]";
3368
- var info = "https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality";
3369
3434
  var hasConsole = (_a = win.console) === null || _a === void 0 ? void 0 : _a.error;
3370
3435
  if (hasConsole) {
3371
- console.error("\u274C ".concat(prefix, " ").concat(head), "background:red;color:white;display:block;font-size:15px", tail);
3436
+ var tailMsg = ["background:red;color:white;display:block;font-size:15px", tail] ;
3437
+ console.error.apply(console, __spreadArray(["\u274C ".concat(prefix, " ").concat(head), "background:red;color:white;display:block;font-size:15px"], tailMsg, false));
3372
3438
  console.info("%cℹ️", "font-size:15px", info);
3373
3439
  }
3374
- throw Error("".concat(prefix, " ").concat(head.replace(/\%c([a-z-]+)/i, "'$1' "), " ").concat(tail));
3440
+ throw Error("".concat(prefix, " ").concat(head.replace(/\%c([a-z-]+)/i, "'$1' "), " ").concat(tail ));
3375
3441
  }
3376
3442
 
3377
3443
  var setTimeout$1 = win.setTimeout, clearTimeout$1 = win.clearTimeout;
@@ -4494,9 +4560,15 @@ var data$1 = {
4494
4560
  var e = inputType === "touch" && event.changedTouches ?
4495
4561
  event.changedTouches[0] :
4496
4562
  event;
4497
- index = findIndex(coords, isRotated ?
4563
+ var point = isRotated ?
4498
4564
  e.clientY + scrollPos.y - rect.top :
4499
- e.clientX + scrollPos.x - rect.left, 0, coords.length - 1, isRotated);
4565
+ e.clientX + scrollPos.x - rect.left;
4566
+ if (hasViewBox($el.svg)) {
4567
+ var pos = [point, 0];
4568
+ isRotated && pos.reverse();
4569
+ point = getTransformCTM.apply(void 0, __spreadArray([$el.svg.node()], pos, false))[isRotated ? "y" : "x"];
4570
+ }
4571
+ index = findIndex(coords, point, 0, coords.length - 1, isRotated);
4500
4572
  }
4501
4573
  return index;
4502
4574
  },
@@ -4894,6 +4966,10 @@ var dataLoad = {
4894
4966
  org.xScale = zoomState.x.domain(org.xDomain);
4895
4967
  }
4896
4968
  $$.updateCurrentZoomTransform(zoomState.x, zoomState.currentDomain);
4969
+ // https://github.com/naver/billboard.js/issues/3878
4970
+ }
4971
+ else if (org.xScale) {
4972
+ org.xScale.domain(org.xDomain);
4897
4973
  }
4898
4974
  // Update current state chart type and elements list after redraw
4899
4975
  $$.updateTypesElements();
@@ -5108,7 +5184,7 @@ var interaction = {
5108
5184
  dispatchEvent: function (type, index, mouse) {
5109
5185
  var _a, _b;
5110
5186
  var $$ = this;
5111
- var config = $$.config, _c = $$.state, eventReceiver = _c.eventReceiver, hasAxis = _c.hasAxis, hasFunnel = _c.hasFunnel, hasRadar = _c.hasRadar, hasTreemap = _c.hasTreemap, _d = $$.$el, eventRect = _d.eventRect, funnel = _d.funnel, radar = _d.radar, treemap = _d.treemap;
5187
+ var config = $$.config, _c = $$.state, eventReceiver = _c.eventReceiver, hasAxis = _c.hasAxis, hasFunnel = _c.hasFunnel, hasRadar = _c.hasRadar, hasTreemap = _c.hasTreemap, _d = $$.$el, eventRect = _d.eventRect, funnel = _d.funnel, radar = _d.radar, svg = _d.svg, treemap = _d.treemap;
5112
5188
  var element = (_b = (((hasFunnel || hasTreemap) && eventReceiver.rect) ||
5113
5189
  (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();
5114
5190
  if (element) {
@@ -5131,6 +5207,11 @@ var interaction = {
5131
5207
  var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || isRotated ? 0 : (width / 2));
5132
5208
  // value 4, is to adjust coordinate value set from: scale.ts - updateScales(): $$.getResettedPadding(1)
5133
5209
  var y = top_1 + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0);
5210
+ if (hasViewBox(svg)) {
5211
+ var ctm = getTransformCTM($$.$el.svg.node(), x, y, false);
5212
+ x = ctm.x;
5213
+ y = ctm.y;
5214
+ }
5134
5215
  var params = {
5135
5216
  screenX: x,
5136
5217
  screenY: y,
@@ -6285,9 +6366,10 @@ var legend$1 = {
6285
6366
  var $$ = this;
6286
6367
  var _b = $$.state, current = _b.current, isLegendRight = _b.isLegendRight, legendItemHeight = _b.legendItemHeight, legendStep = _b.legendStep;
6287
6368
  var isFitPadding = ((_a = $$.config.padding) === null || _a === void 0 ? void 0 : _a.mode) === "fit";
6288
- return $$.config.legend_show ?
6289
- (isLegendRight ? current.height : (isFitPadding ? 10 : Math.max(20, legendItemHeight)) * (legendStep + 1)) :
6369
+ var height = $$.config.legend_show ?
6370
+ (isLegendRight ? current.height : (Math.max(isFitPadding ? 10 : 20, legendItemHeight)) * (legendStep + 1)) :
6290
6371
  0;
6372
+ return height;
6291
6373
  },
6292
6374
  /**
6293
6375
  * Get the opacity of the legend that is unfocused
@@ -6418,7 +6500,7 @@ var legend$1 = {
6418
6500
  item
6419
6501
  .on(interaction.dblclick ? "dblclick" : "click", interaction || isFunction(config.legend_item_onclick) ?
6420
6502
  function (event, id) {
6421
- if (!callFn(config.legend_item_onclick, api, id)) {
6503
+ if (!callFn(config.legend_item_onclick, api, id, !state.hiddenTargetIds.includes(id))) {
6422
6504
  var altKey = event.altKey, target = event.target, type = event.type;
6423
6505
  if (type === "dblclick" || altKey) {
6424
6506
  // when focused legend is clicked(with altKey or double clicked), reset all hiding.
@@ -6443,7 +6525,7 @@ var legend$1 = {
6443
6525
  !isTouch && item
6444
6526
  .on("mouseout", interaction || isFunction(config.legend_item_onout) ?
6445
6527
  function (event, id) {
6446
- if (!callFn(config.legend_item_onout, api, id)) {
6528
+ if (!callFn(config.legend_item_onout, api, id, !state.hiddenTargetIds.includes(id))) {
6447
6529
  select(this).classed($FOCUS.legendItemFocused, false);
6448
6530
  if (hasGauge) {
6449
6531
  $$.undoMarkOverlapped($$, ".".concat($GAUGE.gaugeValue));
@@ -6454,7 +6536,7 @@ var legend$1 = {
6454
6536
  null)
6455
6537
  .on("mouseover", interaction || isFunction(config.legend_item_onover) ?
6456
6538
  function (event, id) {
6457
- if (!callFn(config.legend_item_onover, api, id)) {
6539
+ if (!callFn(config.legend_item_onover, api, id, !state.hiddenTargetIds.includes(id))) {
6458
6540
  select(this).classed($FOCUS.legendItemFocused, true);
6459
6541
  if (hasGauge) {
6460
6542
  $$.markOverlapped(id, $$, ".".concat($GAUGE.gaugeValue));
@@ -7341,10 +7423,16 @@ var size = {
7341
7423
  },
7342
7424
  updateSvgSize: function () {
7343
7425
  var $$ = this;
7344
- var _a = $$.state, clip = _a.clip, current = _a.current, hasAxis = _a.hasAxis, width = _a.width, height = _a.height, svg = $$.$el.svg;
7345
- svg
7346
- .attr("width", current.width)
7347
- .attr("height", current.height);
7426
+ var config = $$.config, _a = $$.state, clip = _a.clip, current = _a.current, hasAxis = _a.hasAxis, width = _a.width, height = _a.height, svg = $$.$el.svg;
7427
+ if (config.resize_auto === "viewBox") {
7428
+ svg
7429
+ .attr("viewBox", "0 0 ".concat(current.width, " ").concat(current.height));
7430
+ }
7431
+ else {
7432
+ svg
7433
+ .attr("width", current.width)
7434
+ .attr("height", current.height);
7435
+ }
7348
7436
  if (hasAxis) {
7349
7437
  var brush = svg.select(".".concat($SUBCHART.brush, " .overlay"));
7350
7438
  var brushSize = { width: 0, height: 0 };
@@ -7443,6 +7531,7 @@ var size = {
7443
7531
  padding += 1;
7444
7532
  }
7445
7533
  }
7534
+ // console.log(type, padding + (axisSize * axesLen) - gap)
7446
7535
  return padding + (axisSize * axesLen) - gap;
7447
7536
  },
7448
7537
  getCurrentPadding: function (withXAxisTickTextOverflow) {
@@ -8512,7 +8601,7 @@ var tooltip$1 = {
8512
8601
  setTooltipPosition: function (dataToShow, eventTarget) {
8513
8602
  var _a, _b;
8514
8603
  var $$ = this;
8515
- var config = $$.config, scale = $$.scale, state = $$.state, _c = $$.$el, eventRect = _c.eventRect, tooltip = _c.tooltip;
8604
+ var config = $$.config, scale = $$.scale, state = $$.state, _c = $$.$el, eventRect = _c.eventRect, tooltip = _c.tooltip, svg = _c.svg;
8516
8605
  var bindto = config.tooltip_contents.bindto;
8517
8606
  var isRotated = config.axis_rotated;
8518
8607
  var datum = tooltip === null || tooltip === void 0 ? void 0 : tooltip.datum();
@@ -8542,7 +8631,9 @@ var tooltip$1 = {
8542
8631
  }
8543
8632
  var _e = datum.width, width = _e === void 0 ? 0 : _e, _f = datum.height, height = _f === void 0 ? 0 : _f;
8544
8633
  // Get tooltip position
8545
- var pos_1 = (_b = (_a = config.tooltip_position) === null || _a === void 0 ? void 0 : _a.bind($$.api)(data, width, height, eventRect === null || eventRect === void 0 ? void 0 : eventRect.node(), currPos)) !== null && _b !== void 0 ? _b : $$.getTooltipPosition.bind($$)(width, height, currPos);
8634
+ var pos_1 = (_b = (_a = config.tooltip_position) === null || _a === void 0 ? void 0 : _a.bind($$.api)(data, width, height, eventRect === null || eventRect === void 0 ? void 0 : eventRect.node(), currPos)) !== null && _b !== void 0 ? _b : (hasViewBox(svg) ?
8635
+ $$.getTooltipPositionViewBox.bind($$)(width, height, currPos) :
8636
+ $$.getTooltipPosition.bind($$)(width, height, currPos));
8546
8637
  ["top", "left"].forEach(function (v) {
8547
8638
  var value = pos_1[v];
8548
8639
  tooltip.style(v, "".concat(value, "px"));
@@ -8553,6 +8644,40 @@ var tooltip$1 = {
8553
8644
  });
8554
8645
  }
8555
8646
  },
8647
+ getTooltipPositionViewBox: function (tWidth, tHeight, currPos) {
8648
+ var _a, _b;
8649
+ var $$ = this;
8650
+ var _c = $$.$el, eventRect = _c.eventRect, main = _c.main, config = $$.config, state = $$.state;
8651
+ var isRotated = config.axis_rotated;
8652
+ var hasArcType = $$.hasArcType(undefined, ["radar"]) || state.hasFunnel ||
8653
+ state.hasTreemap;
8654
+ var target = (_b = (_a = (state.hasRadar ? main : eventRect)) === null || _a === void 0 ? void 0 : _a.node()) !== null && _b !== void 0 ? _b : state.event.target;
8655
+ var size = 38; // getTransformCTM($el.svg.node(), 10, 0, false).x;
8656
+ var x = currPos.x, y = currPos.y;
8657
+ if (state.hasAxis) {
8658
+ x = isRotated ? x : currPos.xAxis;
8659
+ y = isRotated ? currPos.xAxis : y;
8660
+ }
8661
+ // currPos는 SVG 좌표계 기준으로 전달됨
8662
+ var ctm = getTransformCTM(target, x, y, false);
8663
+ var top = ctm.y;
8664
+ var left = ctm.x + size;
8665
+ if (hasArcType) {
8666
+ top += tHeight;
8667
+ left -= size; // (tWidth / 2);
8668
+ }
8669
+ var rect = (hasArcType ? main.node() : target).getBoundingClientRect();
8670
+ if (left + tWidth > rect.right) {
8671
+ left = rect.right - tWidth - size;
8672
+ }
8673
+ if (top + tHeight > rect.bottom) {
8674
+ top -= tHeight + size;
8675
+ }
8676
+ return {
8677
+ top: top,
8678
+ left: left
8679
+ };
8680
+ },
8556
8681
  /**
8557
8682
  * Returns the position of the tooltip
8558
8683
  * @param {string} tWidth Width value of tooltip element
@@ -9676,6 +9801,7 @@ var ChartInternal = /** @class */ (function () {
9676
9801
  !state.resizing &&
9677
9802
  state.rendered &&
9678
9803
  !subchart;
9804
+ // @ts-ignore
9679
9805
  t = (transit ? t.transition(name).duration(duration) : t);
9680
9806
  }
9681
9807
  return t;
@@ -9746,10 +9872,8 @@ var ChartInternal = /** @class */ (function () {
9746
9872
  ChartInternal.prototype.initToRender = function (forced) {
9747
9873
  var $$ = this;
9748
9874
  var config = $$.config, state = $$.state, chart = $$.$el.chart;
9749
- var isHidden = function () {
9750
- return chart.style("display") === "none" || chart.style("visibility") === "hidden";
9751
- };
9752
- var isLazy = config.render.lazy || isHidden();
9875
+ var isHidden = function () { return hasStyle(chart, { display: "none", visibility: "hidden" }); };
9876
+ var isLazy = config.render.lazy === false ? false : config.render.lazy || isHidden();
9753
9877
  var MutationObserver = win.MutationObserver;
9754
9878
  if (isLazy && MutationObserver && config.render.observe !== false && !forced) {
9755
9879
  new MutationObserver(function (mutation, observer) {
@@ -9886,7 +10010,7 @@ var ChartInternal = /** @class */ (function () {
9886
10010
  labelsBGColor || ((_a = $$.hasLegendDefsPoint) === null || _a === void 0 ? void 0 : _a.call($$))) {
9887
10011
  $el.defs = $el.svg.append("defs");
9888
10012
  if (hasAxis) {
9889
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
10013
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(function (v) {
9890
10014
  $$.appendClip($el.defs, state.clip[v]);
9891
10015
  });
9892
10016
  }
@@ -10165,7 +10289,7 @@ var ChartInternal = /** @class */ (function () {
10165
10289
  var resizeFunction = generateResize(config.resize_timer);
10166
10290
  var list = [];
10167
10291
  list.push(function () { return callFn(config.onresize, $$.api); });
10168
- if (config.resize_auto) {
10292
+ if (config.resize_auto === true) {
10169
10293
  list.push(function () {
10170
10294
  state.resizing = true;
10171
10295
  // https://github.com/naver/billboard.js/issues/2650
@@ -11635,6 +11759,7 @@ var Chart = /** @class */ (function () {
11635
11759
  function Chart(options) {
11636
11760
  this.plugins = [];
11637
11761
  var $$ = new ChartInternal(this);
11762
+ // let hook = () => {};
11638
11763
  this.internal = $$;
11639
11764
  // bind to namespaced APIs
11640
11765
  (function bindThis(fn, target, argThis) {
@@ -11643,6 +11768,10 @@ var Chart = /** @class */ (function () {
11643
11768
  var isChild = target !== argThis;
11644
11769
  var isNotNil = notEmpty(fn[key]);
11645
11770
  var hasChild = isNotNil && Object.keys(fn[key]).length > 0;
11771
+ // const hookFn = function(...params) {
11772
+ // hook();
11773
+ // return fn[key].bind(argThis)(...params);
11774
+ // }
11646
11775
  if (isFunc && ((!isChild && hasChild) || isChild)) {
11647
11776
  target[key] = fn[key].bind(argThis);
11648
11777
  }
@@ -11658,6 +11787,11 @@ var Chart = /** @class */ (function () {
11658
11787
  loadConfig.call($$, options);
11659
11788
  $$.beforeInit();
11660
11789
  $$.init();
11790
+ // if ($$.config.render.lazy !== false && hasStyle($$.$el.chart, {"display": "none", "visibility": "hidden"})) {
11791
+ // hook = () => {
11792
+ // logError(`The call of APIs won't work. Please, make sure if chart element is %cvisible.`);
11793
+ // };
11794
+ // }
11661
11795
  }
11662
11796
  return Chart;
11663
11797
  }());
@@ -12589,17 +12723,19 @@ var AxisRendererHelper = /** @class */ (function () {
12589
12723
  }
12590
12724
  /**
12591
12725
  * Compute a character dimension
12592
- * @param {d3.selection} node <g class=tick> node
12726
+ * @param {d3.selection} text SVG text selection
12727
+ * @param {boolean} memoize memoize the calculated size
12593
12728
  * @returns {{w: number, h: number}}
12594
12729
  * @private
12595
12730
  */
12596
- AxisRendererHelper.getSizeFor1Char = function (node) {
12731
+ AxisRendererHelper.getSizeFor1Char = function (text, memoize) {
12732
+ if (memoize === void 0) { memoize = true; }
12597
12733
  // default size for one character
12598
12734
  var size = {
12599
12735
  w: 5.5,
12600
12736
  h: 11.5
12601
12737
  };
12602
- !node.empty() && node.select("text")
12738
+ !text.empty() && text
12603
12739
  .text("0")
12604
12740
  .call(function (el) {
12605
12741
  try {
@@ -12613,7 +12749,9 @@ var AxisRendererHelper = /** @class */ (function () {
12613
12749
  el.text("");
12614
12750
  }
12615
12751
  });
12616
- this.getSizeFor1Char = function () { return size; };
12752
+ if (memoize) {
12753
+ this.getSizeFor1Char = function () { return size; };
12754
+ }
12617
12755
  return size;
12618
12756
  };
12619
12757
  /**
@@ -12628,7 +12766,10 @@ var AxisRendererHelper = /** @class */ (function () {
12628
12766
  function (value) { return "translate(".concat(value + config.tickOffset, ",0)"); } :
12629
12767
  function (value) { return "translate(0,".concat(value, ")"); };
12630
12768
  return function (selection, scale) {
12631
- selection.attr("transform", function (d) { return (isValue(d) ? fn(Math.ceil(scale(d))) : null); });
12769
+ selection.attr("transform", function (d) {
12770
+ var x = scale(d);
12771
+ return isValue(d) ? fn(Math.ceil(x)) : null;
12772
+ });
12632
12773
  };
12633
12774
  };
12634
12775
  AxisRendererHelper.prototype.scaleExtent = function (domain) {
@@ -12773,6 +12914,7 @@ var AxisRenderer = /** @class */ (function () {
12773
12914
  tick: axisShow ? params.config["".concat(prefix, "_tick_show")] : false,
12774
12915
  text: axisShow ? params.config["".concat(prefix, "_tick_text_show")] : false
12775
12916
  };
12917
+ var evalTextSize = params.config.axis_evalTextSize;
12776
12918
  var $g;
12777
12919
  g.each(function () {
12778
12920
  var g = select(this);
@@ -12813,9 +12955,12 @@ var AxisRenderer = /** @class */ (function () {
12813
12955
  tick = tickEnter.merge(tick);
12814
12956
  tickShow.tick && tickEnter.append("line");
12815
12957
  tickShow.text && tickEnter.append("text");
12816
- var sizeFor1Char_1 = AxisRendererHelper.getSizeFor1Char(tick);
12958
+ var tickText = tick.select("text");
12959
+ var sizeFor1Char_1 = isFunction(evalTextSize) ?
12960
+ evalTextSize.bind(ctx.params.owner.api)(tickText.node()) :
12961
+ AxisRendererHelper.getSizeFor1Char(tickText, evalTextSize);
12817
12962
  var counts_1 = [];
12818
- var tspan = tick.select("text")
12963
+ var tspan = tickText
12819
12964
  .selectAll("tspan")
12820
12965
  .data(function (d, index) {
12821
12966
  var split = params.tickMultiline ?
@@ -14329,7 +14474,7 @@ var eventrect = {
14329
14474
  .filter(function (d) {
14330
14475
  return $$.isWithinShape(this, d);
14331
14476
  });
14332
- if (shapeAtIndex.empty() && !isTooltipGrouped) {
14477
+ if (shapeAtIndex.empty() && !isTooltipGrouped && config.interaction_onout) {
14333
14478
  (_b = $$.hideGridFocus) === null || _b === void 0 ? void 0 : _b.call($$);
14334
14479
  $$.hideTooltip();
14335
14480
  !isSelectionGrouped && $$.setExpand(index);
@@ -14484,7 +14629,8 @@ var eventrect = {
14484
14629
  .on("mouseout", function (event) {
14485
14630
  state.event = event;
14486
14631
  // chart is destroyed
14487
- if (!config || $$.hasArcType() || eventReceiver.currentIdx === -1) {
14632
+ if (!config || $$.hasArcType() || eventReceiver.currentIdx === -1 ||
14633
+ !config.interaction_onout) {
14488
14634
  return;
14489
14635
  }
14490
14636
  $$.hideAxisGridFocus();
@@ -14521,7 +14667,7 @@ var eventrect = {
14521
14667
  */
14522
14668
  generateEventRectsForMultipleXs: function (eventRectEnter) {
14523
14669
  var $$ = this;
14524
- var state = $$.state;
14670
+ var config = $$.config, state = $$.state;
14525
14671
  eventRectEnter
14526
14672
  .on("click", function (event) {
14527
14673
  state.event = event;
@@ -14537,7 +14683,7 @@ var eventrect = {
14537
14683
  .on("mouseout", function (event) {
14538
14684
  state.event = event;
14539
14685
  // chart is destroyed
14540
- if (!$$.config || $$.hasArcType()) {
14686
+ if (!$$.config || $$.hasArcType() || !config.interaction_onout) {
14541
14687
  return;
14542
14688
  }
14543
14689
  $$.unselectRect();
@@ -14547,15 +14693,14 @@ var eventrect = {
14547
14693
  clickHandlerForMultipleXS: function (ctx) {
14548
14694
  var $$ = ctx;
14549
14695
  var config = $$.config, state = $$.state;
14696
+ var pointSensitivity = config.point_sensitivity;
14550
14697
  var targetsToShow = $$.filterTargetsToShow($$.data.targets);
14551
14698
  if ($$.hasArcType(targetsToShow)) {
14552
14699
  return;
14553
14700
  }
14554
14701
  var mouse = getPointer(state.event, this);
14555
14702
  var closest = $$.findClosestFromTargets(targetsToShow, mouse);
14556
- var sensitivity = config.point_sensitivity === "radius" ?
14557
- closest.r :
14558
- config.point_sensitivity;
14703
+ var sensitivity = pointSensitivity === "radius" ? closest === null || closest === void 0 ? void 0 : closest.r : (isFunction(pointSensitivity) ? closest && pointSensitivity(closest) : pointSensitivity);
14559
14704
  if (!closest) {
14560
14705
  return;
14561
14706
  }
@@ -16845,6 +16990,18 @@ var y = {
16845
16990
  * y2 Axis config options
16846
16991
  */
16847
16992
  var y2 = {
16993
+ /**
16994
+ * Set clip-path attribute for y2 axis element
16995
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
16996
+ * @name axis․y2․clipPath
16997
+ * @memberof Options
16998
+ * @type {boolean}
16999
+ * @default true
17000
+ * @example
17001
+ * // don't set 'clip-path' attribute
17002
+ * clipPath: false
17003
+ */
17004
+ axis_y2_clipPath: true,
16848
17005
  /**
16849
17006
  * Show or hide y2 axis.
16850
17007
  * - **NOTE**:
@@ -17291,6 +17448,35 @@ var y2 = {
17291
17448
  * y Axis config options
17292
17449
  */
17293
17450
  var optAxis = __assign(__assign(__assign({
17451
+ /**
17452
+ * Setup the way to evaluate tick text size.
17453
+ * - **NOTE:**
17454
+ * - Setting `false` or custom evaluator, highly recommended to memoize evaluated text dimension value to not degrade performance.
17455
+ * @name axis․evalTextSize
17456
+ * @memberof Options
17457
+ * @type {boolean|Function}
17458
+ * @default true
17459
+ * @example
17460
+ * axis: {
17461
+ * // will evaluate getting text size every time.
17462
+ * evalTextSize: false.
17463
+ *
17464
+ * // set a custom evaluator
17465
+ * evalTextSize: function(textElement) {
17466
+ * // set some character to be evaluated
17467
+ * text.textContent = "0";
17468
+ *
17469
+ * // get the size
17470
+ * const box = text.getBBox();
17471
+ *
17472
+ * // clear text
17473
+ * text.textContent = "";
17474
+ *
17475
+ * return { w: 7, h: 12};
17476
+ * }
17477
+ * }
17478
+ */
17479
+ axis_evalTextSize: true,
17294
17480
  /**
17295
17481
  * Switch x and y axis position.
17296
17482
  * @name axis․rotated
@@ -18054,6 +18240,7 @@ var shapeArc = {
18054
18240
  var expandDuration = $$.getExpandConfig(d.data.id, "duration");
18055
18241
  var svgArcExpandedSub = $$.getSvgArcExpanded($$.getExpandConfig(d.data.id, "rate"));
18056
18242
  select(this).selectAll("path")
18243
+ // @ts-ignore
18057
18244
  .transition()
18058
18245
  .duration(expandDuration)
18059
18246
  .attrTween("d", getAttrTweenFn($$.svgArcExpanded.bind($$)))
@@ -18496,7 +18683,7 @@ var shapeArc = {
18496
18683
  $$.setOverOut(true, arcData);
18497
18684
  })
18498
18685
  .on("mouseout", function (event, d) {
18499
- if (state.transiting) { // skip while transiting
18686
+ if (state.transiting || !config.interaction_onout) { // skip while transiting
18500
18687
  return;
18501
18688
  }
18502
18689
  state.event = event;
@@ -19440,8 +19627,10 @@ var shapeFunnel = {
19440
19627
  })
19441
19628
  .on(isTouch ? "touchend" : "mouseout", function (event) {
19442
19629
  var data = getTarget(event);
19443
- $$.hideTooltip();
19444
- $$.setOverOut(false, data);
19630
+ if (config.interaction_onout) {
19631
+ $$.hideTooltip();
19632
+ $$.setOverOut(false, data);
19633
+ }
19445
19634
  });
19446
19635
  }
19447
19636
  },
@@ -20931,12 +21120,15 @@ var shapeRadar = {
20931
21120
  },
20932
21121
  bindRadarEvent: function () {
20933
21122
  var $$ = this;
20934
- var state = $$.state, _a = $$.$el, radar = _a.radar, svg = _a.svg;
21123
+ var config = $$.config, state = $$.state, _a = $$.$el, radar = _a.radar, svg = _a.svg;
20935
21124
  var focusOnly = $$.isPointFocusOnly();
20936
21125
  var inputType = state.inputType, transiting = state.transiting;
20937
21126
  var isMouse = inputType === "mouse";
20938
21127
  var hide = function (event) {
20939
21128
  state.event = event;
21129
+ if (!config.interaction_onout) {
21130
+ return;
21131
+ }
20940
21132
  // const index = getIndex(event);
20941
21133
  var index = $$.getDataIndexFromEvent(event);
20942
21134
  var noIndex = isUndefined(index);
@@ -21105,8 +21297,10 @@ var shapeTreemap = {
21105
21297
  })
21106
21298
  .on(isTouch ? "touchend" : "mouseout", function (event) {
21107
21299
  var data = getTarget(event);
21108
- $$.hideTooltip();
21109
- $$.setOverOut(false, data);
21300
+ if (config.interaction_onout) {
21301
+ $$.hideTooltip();
21302
+ $$.setOverOut(false, data);
21303
+ }
21110
21304
  });
21111
21305
  }
21112
21306
  },
@@ -23470,7 +23664,8 @@ var zoom = {
23470
23664
  var $$ = this;
23471
23665
  $$.scale.zoom = null;
23472
23666
  $$.generateZoom();
23473
- $$.initZoomBehaviour();
23667
+ $$.config.zoom_type === "drag" &&
23668
+ $$.initZoomBehaviour();
23474
23669
  },
23475
23670
  /**
23476
23671
  * Bind zoom event
@@ -23513,6 +23708,7 @@ var zoom = {
23513
23708
  zoom.updateScaleExtent = function () {
23514
23709
  var ratio = diffDomain($$.scale.x.orgDomain()) / diffDomain($$.getZoomDomain());
23515
23710
  var extent = this.orgScaleExtent();
23711
+ // https://d3js.org/d3-zoom#zoom_scaleExtent
23516
23712
  this.scaleExtent([extent[0] * ratio, extent[1] * ratio]);
23517
23713
  return this;
23518
23714
  };
@@ -23530,6 +23726,10 @@ var zoom = {
23530
23726
  (_a = org.xScale) === null || _a === void 0 ? void 0 : _a.range(scale.x.range());
23531
23727
  // rescale from the original scale
23532
23728
  var newScale = transform[isRotated ? "rescaleY" : "rescaleX"](org.xScale || scale.x);
23729
+ // prevent drag zoom to be out of range
23730
+ if (newScale.domain().some(function (v) { return /(Invalid Date|NaN)/.test(v.toString()); })) {
23731
+ return;
23732
+ }
23533
23733
  var domain = $$.trimXDomain(newScale.domain());
23534
23734
  var rescale = config.zoom_rescale;
23535
23735
  newScale.domain(domain, org.xDomain);
@@ -24387,7 +24587,7 @@ var zoomModule = function () {
24387
24587
  var defaults = {};
24388
24588
  /**
24389
24589
  * @namespace bb
24390
- * @version 3.13.0
24590
+ * @version 3.14.0-next.2
24391
24591
  */
24392
24592
  var bb = {
24393
24593
  /**
@@ -24397,7 +24597,7 @@ var bb = {
24397
24597
  * bb.version; // "1.0.0"
24398
24598
  * @memberof bb
24399
24599
  */
24400
- version: "3.13.0",
24600
+ version: "3.14.0-next.2",
24401
24601
  /**
24402
24602
  * Generate chart
24403
24603
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: