billboard.js 3.10.0-next.2 → 3.10.0-next.4

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 (58) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +178 -124
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +180 -126
  6. package/dist/billboard.pkgd.min.js +4 -4
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +8 -5
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +16 -5
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +8 -5
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +16 -5
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  27. package/dist/theme/dark.css +1 -1
  28. package/dist/theme/dark.min.css +1 -1
  29. package/dist/theme/datalab.css +1 -1
  30. package/dist/theme/datalab.min.css +1 -1
  31. package/dist/theme/graph.css +1 -1
  32. package/dist/theme/graph.min.css +1 -1
  33. package/dist/theme/insight.css +1 -1
  34. package/dist/theme/insight.min.css +1 -1
  35. package/dist-esm/billboard.js +160 -123
  36. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  37. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  38. package/dist-esm/plugin/billboardjs-plugin-stanford.js +9 -4
  39. package/dist-esm/plugin/billboardjs-plugin-tableview.js +16 -5
  40. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  41. package/package.json +21 -21
  42. package/src/ChartInternal/Axis/Axis.ts +2 -2
  43. package/src/ChartInternal/ChartInternal.ts +1 -1
  44. package/src/ChartInternal/internals/clip.ts +4 -2
  45. package/src/ChartInternal/internals/domain.ts +6 -2
  46. package/src/ChartInternal/internals/legend.ts +4 -4
  47. package/src/ChartInternal/internals/size.axis.ts +3 -2
  48. package/src/ChartInternal/internals/size.ts +91 -121
  49. package/src/ChartInternal/internals/tooltip.ts +27 -7
  50. package/src/ChartInternal/internals/transform.ts +1 -1
  51. package/src/Plugin/stanford/index.ts +10 -6
  52. package/src/Plugin/tableview/Options.ts +12 -1
  53. package/src/Plugin/tableview/index.ts +3 -2
  54. package/src/config/Options/axis/y2.ts +13 -0
  55. package/src/config/Options/common/main.ts +1 -0
  56. package/src/config/Options/common/tooltip.ts +25 -1
  57. package/types/options.d.ts +1 -0
  58. package/types/plugin/tableview/options.d.ts +5 -0
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.10.0-next.2
8
+ * @version 3.10.0-next.4
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.10.0-next.2
8
+ * @version 3.10.0-next.4
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -1859,6 +1859,7 @@ let Store = /*#__PURE__*/function () {
1859
1859
  size_height: undefined,
1860
1860
  /**
1861
1861
  * The padding of the chart element.
1862
+ * - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)"" wiki documentaion.
1862
1863
  * @name padding
1863
1864
  * @memberof Options
1864
1865
  * @type {object}
@@ -3475,6 +3476,7 @@ var tooltip_this = undefined;
3475
3476
  * @see [Demo: Tooltip Grouping](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipGrouping)
3476
3477
  * @see [Demo: Tooltip Format](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipFormat)
3477
3478
  * @see [Demo: Linked Tooltip](https://naver.github.io/billboard.js/demo/#Tooltip.LinkedTooltips)
3479
+ * @see [Demo: Tooltip Position](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipPosition)
3478
3480
  * @see [Demo: Tooltip Template](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipTemplate)
3479
3481
  * @example
3480
3482
  * tooltip: {
@@ -3498,8 +3500,31 @@ var tooltip_this = undefined;
3498
3500
  * // x: Current mouse event x position,
3499
3501
  * // y: Current mouse event y position,
3500
3502
  * // xAxis: Current x Axis position (the value is given for axis based chart type only)
3503
+ * // yAxis: Current y Axis position value or function(the value is given for axis based chart type only)
3501
3504
  * // }
3502
- * return {top: 0, left: 0}
3505
+ *
3506
+ * // yAxis will work differently per data lenghts
3507
+ * // - a) Single data: `yAxis` will return `number` value
3508
+ * // - b) Multiple data: `yAxis` will return a function with property value
3509
+ *
3510
+ * // a) Single data:
3511
+ * // Get y coordinate
3512
+ * pos.yAxis; // y axis coordinate value of current data point
3513
+ *
3514
+ * // b) Multiple data:
3515
+ * // Get y coordinate of value 500, where 'data1' scales(y or y2).
3516
+ * // When 'data.axes' option is used, data can bound to different axes.
3517
+ * // - when "data.axes={data1: 'y'}", wil return y value from y axis scale.
3518
+ * // - when "data.axes={data1: 'y2'}", wil return y value from y2 axis scale.
3519
+ * pos.yAxis(500, "data1"); // will return y coordinate value of data1
3520
+ *
3521
+ * pos.yAxis(500); // get y coordinate with value of 500, using y axis scale
3522
+ * pos.yAxis(500, null, "y2"); // get y coordinate with value of 500, using y2 axis scale
3523
+ *
3524
+ * return {
3525
+ * top: 0,
3526
+ * left: 0
3527
+ * }
3503
3528
  * },
3504
3529
  *
3505
3530
  * contents: function(d, defaultTitleFormat, defaultValueFormat, color) {
@@ -6584,13 +6609,19 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6584
6609
  var _$$$brush;
6585
6610
  x.domain(domain || sortValue($$.getXDomain(targets), !config.axis_x_inverted));
6586
6611
  org.xDomain = x.domain();
6587
- zoomEnabled && $$.zoom.updateScaleExtent();
6612
+
6613
+ // zoomEnabled && $$.zoom.updateScaleExtent();
6614
+
6588
6615
  subX.domain(x.domain());
6589
6616
  (_$$$brush = $$.brush) == null || _$$$brush.scale(subX);
6590
6617
  }
6591
6618
  if (withUpdateXDomain) {
6592
6619
  const domainValue = domain || !$$.brush || brushEmpty($$) ? org.xDomain : getBrushSelection($$).map(subX.invert);
6593
6620
  x.domain(domainValue);
6621
+ // zoomEnabled && $$.zoom.updateScaleExtent();
6622
+ }
6623
+
6624
+ if (withUpdateOrgXDomain || withUpdateXDomain) {
6594
6625
  zoomEnabled && $$.zoom.updateScaleExtent();
6595
6626
  }
6596
6627
 
@@ -6612,8 +6643,8 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6612
6643
  min = _zoomDomain[0],
6613
6644
  max = _zoomDomain[1];
6614
6645
  if (isInverted ? domain[0] >= min : domain[0] <= min) {
6615
- domain[0] = min;
6616
6646
  domain[1] = +domain[1] + (min - domain[0]);
6647
+ domain[0] = min;
6617
6648
  }
6618
6649
  if (isInverted ? domain[1] <= max : domain[1] >= max) {
6619
6650
  domain[0] = +domain[0] - (domain[1] - max);
@@ -6925,8 +6956,8 @@ function getLegendColor(id) {
6925
6956
  width = size.width,
6926
6957
  height = size.height,
6927
6958
  insetLegendPosition = {
6928
- top: isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : current.height - height - $$.getCurrentPaddingBottom() - config.legend_inset_y,
6929
- left: isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + .5 : current.width - width - $$.getCurrentPaddingRight() - config.legend_inset_x + .5
6959
+ top: isLegendTop ? $$.getCurrentPaddingByDirection("top") + config.legend_inset_y + 5.5 : current.height - height - $$.getCurrentPaddingByDirection("bottom") - config.legend_inset_y,
6960
+ left: isLegendLeft ? $$.getCurrentPaddingByDirection("left") + config.legend_inset_x + .5 : current.width - width - $$.getCurrentPaddingByDirection("right") - config.legend_inset_x + .5
6930
6961
  };
6931
6962
  $$.state.margin3 = {
6932
6963
  top: isLegendRight ? 0 : isLegendInset ? insetLegendPosition.top : current.height - height,
@@ -8584,88 +8615,6 @@ function getGroupedDataPointsFn(d) {
8584
8615
  h = config.size_height || $$.getParentHeight();
8585
8616
  return h > 0 ? h : 320 / ($$.hasType("gauge") && !config.gauge_fullCircle ? 2 : 1);
8586
8617
  },
8587
- getCurrentPaddingTop: function getCurrentPaddingTop() {
8588
- const $$ = this,
8589
- config = $$.config,
8590
- hasAxis = $$.state.hasAxis,
8591
- $el = $$.$el,
8592
- axesLen = hasAxis ? config.axis_y2_axes.length : 0;
8593
- let padding = isValue(config.padding_top) ? config.padding_top : 0;
8594
- if ($el.title && $el.title.node()) {
8595
- padding += $$.getTitlePadding();
8596
- }
8597
- if (axesLen && config.axis_rotated) {
8598
- padding += $$.getHorizontalAxisHeight("y2") * axesLen;
8599
- }
8600
- return padding;
8601
- },
8602
- getCurrentPaddingBottom: function getCurrentPaddingBottom() {
8603
- const $$ = this,
8604
- config = $$.config,
8605
- hasAxis = $$.state.hasAxis,
8606
- axisId = config.axis_rotated ? "y" : "x",
8607
- axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
8608
- padding = isValue(config.padding_bottom) ? config.padding_bottom : 0;
8609
- return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
8610
- },
8611
- getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) {
8612
- var _config$padding;
8613
- const $$ = this,
8614
- config = $$.config,
8615
- hasAxis = $$.state.hasAxis,
8616
- isRotated = config.axis_rotated,
8617
- isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit",
8618
- axisId = isRotated ? "x" : "y",
8619
- axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0;
8620
- let axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
8621
- if (!isFitPadding) {
8622
- axisWidth = ceil10(axisWidth);
8623
- }
8624
- let padding = config["axis_" + axisId + "_inner"] || !config["axis_" + axisId + "_show"] ? 0 : axisWidth;
8625
- if (isValue(config.padding_left)) {
8626
- padding = config.padding_left + (isFitPadding && isRotated ? axisWidth : 0);
8627
- } else if (hasAxis && isRotated) {
8628
- padding = !config.axis_x_show ? 1 : isFitPadding ? axisWidth : Math.max(axisWidth, 40);
8629
- }
8630
- if (hasAxis && (isFitPadding || config["axis_" + axisId + "_inner"]) && config["axis_" + axisId + "_label"].text) {
8631
- padding += $$.axis.getAxisLabelPosition("y").isOuter ? 20 : 0;
8632
- }
8633
- return padding + axisWidth * axesLen;
8634
- },
8635
- getCurrentPaddingRight: function getCurrentPaddingRight(withXAxisTickTextOverflow) {
8636
- var _config$padding2, _$$$axis;
8637
- if (withXAxisTickTextOverflow === void 0) {
8638
- withXAxisTickTextOverflow = !1;
8639
- }
8640
- const $$ = this,
8641
- config = $$.config,
8642
- hasAxis = $$.state.hasAxis,
8643
- isRotated = config.axis_rotated,
8644
- isFitPadding = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit",
8645
- defaultPadding = isFitPadding ? 2 : 10,
8646
- legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
8647
- axesLen = hasAxis ? config.axis_y2_axes.length : 0,
8648
- axisLabelWidth = (_$$$axis = $$.axis) != null && _$$$axis.getAxisLabelPosition("y2").isOuter ? 20 : 0,
8649
- xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0;
8650
- let axisWidth = hasAxis && !config.axis_y2_inner ? $$.getAxisWidthByAxisId("y2") : 1;
8651
- if (!isFitPadding) {
8652
- axisWidth = ceil10(axisWidth);
8653
- }
8654
- let padding = isRotated ? 0 : Math.max(axisWidth + legendWidthOnRight, xAxisTickTextOverflow);
8655
- if (isValue(config.padding_right)) {
8656
- // padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
8657
-
8658
- padding = config.padding_right + (isFitPadding && (isRotated || !config.axis_y2_show ? defaultPadding : padding)) + (hasAxis && !isFitPadding ? 1 : 0); // 1 is needed not to hide tick line
8659
- } else if ($$.axis && isRotated) {
8660
- padding = defaultPadding + legendWidthOnRight;
8661
- } else if ($$.axis && (!config.axis_y2_show || config.axis_y2_inner)) {
8662
- padding = Math.max((isFitPadding && !config.axis_y2_show ? 2 : 1) + legendWidthOnRight + axisLabelWidth, xAxisTickTextOverflow);
8663
- }
8664
- if (hasAxis && !isRotated && isFitPadding && config.axis_y2_show && !config.axis_y2_inner && config.axis_y2_label.text) {
8665
- padding += axisLabelWidth;
8666
- }
8667
- return padding + axisWidth * axesLen;
8668
- },
8669
8618
  /**
8670
8619
  * Get the parent rect element's size
8671
8620
  * @param {string} key property/attribute name
@@ -8718,7 +8667,7 @@ function getGroupedDataPointsFn(d) {
8718
8667
  },
8719
8668
  chartRect = $el.chart.node().getBoundingClientRect(),
8720
8669
  hasArc = $$.hasArcType(),
8721
- svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute));
8670
+ svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingByDirection("left", withoutRecompute));
8722
8671
  return svgLeft > 0 ? svgLeft : 0;
8723
8672
  },
8724
8673
  updateDimension: function updateDimension(withoutAxis) {
@@ -8762,13 +8711,78 @@ function getGroupedDataPointsFn(d) {
8762
8711
  clip.idSubchart && svg.select("#" + clip.idSubchart).select("rect").attr("width", width).attr("height", brushSize.height);
8763
8712
  }
8764
8713
  },
8714
+ /**
8715
+ * Get padding by the direction.
8716
+ * @param {string} type "top" | "bottom" | "left" | "right"
8717
+ * @param {boolean} [withoutRecompute=false] If set true, do not recompute the padding value.
8718
+ * @returns {number} padding value
8719
+ * @private
8720
+ */
8721
+ getCurrentPaddingByDirection: function getCurrentPaddingByDirection(type, withoutRecompute) {
8722
+ var _config$padding;
8723
+ if (withoutRecompute === void 0) {
8724
+ withoutRecompute = !1;
8725
+ }
8726
+ const $$ = this,
8727
+ config = $$.config,
8728
+ $el = $$.$el,
8729
+ hasAxis = $$.state.hasAxis,
8730
+ isRotated = config.axis_rotated,
8731
+ isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit",
8732
+ paddingOption = isNumber(config["padding_" + type]) ? config["padding_" + type] : undefined,
8733
+ axisId = hasAxis ? {
8734
+ top: isRotated ? "y2" : null,
8735
+ bottom: isRotated ? "y" : "x",
8736
+ left: isRotated ? "x" : "y",
8737
+ right: isRotated ? null : "y2"
8738
+ }[type] : null,
8739
+ isLeftRight = /^(left|right)$/.test(type),
8740
+ isAxisInner = axisId && config["axis_" + axisId + "_inner"],
8741
+ isAxisShow = axisId && config["axis_" + axisId + "_show"],
8742
+ axesLen = axisId ? config["axis_" + axisId + "_axes"].length : 0;
8743
+ let axisSize = axisId ? isLeftRight ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : $$.getHorizontalAxisHeight(axisId) : 0;
8744
+ let gap = 0;
8745
+ if (!isFitPadding && isLeftRight) {
8746
+ axisSize = ceil10(axisSize);
8747
+ }
8748
+ let padding = hasAxis && isLeftRight && (isAxisInner || isUndefined(paddingOption) && !isAxisShow) ? 0 : isFitPadding ? (isAxisShow ? axisSize : 0) + (paddingOption != null ? paddingOption : 0) : isUndefined(paddingOption) ? axisSize : paddingOption;
8749
+ if (isLeftRight && hasAxis) {
8750
+ if (axisId && (isFitPadding || isAxisInner) && config["axis_" + axisId + "_label"].text) {
8751
+ padding += $$.axis.getAxisLabelPosition(axisId).isOuter ? 20 : 0;
8752
+ }
8753
+ if (type === "right") {
8754
+ padding += isRotated ? !isFitPadding && isUndefined(paddingOption) ? 10 : 2 : !isAxisShow || isAxisInner ? isFitPadding ? 2 : 1 : 0;
8755
+ } else if (type === "left" && isRotated) {
8756
+ padding = !config.axis_x_show ? 1 : isFitPadding ? axisSize : Math.max(axisSize, 40);
8757
+ }
8758
+ } else {
8759
+ if (type === "top") {
8760
+ if ($el.title && $el.title.node()) {
8761
+ padding += $$.getTitlePadding();
8762
+ }
8763
+ gap = isRotated && !isAxisInner ? axesLen : 0;
8764
+ } else if (type === "bottom" && hasAxis && isRotated && !isAxisShow) {
8765
+ padding += 1;
8766
+ }
8767
+ }
8768
+ return padding + axisSize * axesLen - gap;
8769
+ },
8765
8770
  getCurrentPadding: function getCurrentPadding() {
8766
- const $$ = this;
8771
+ var _this = this;
8772
+ const $$ = this,
8773
+ _map = ["top", "bottom", "left", "right"].map(function (v) {
8774
+ _newArrowCheck(this, _this);
8775
+ return $$.getCurrentPaddingByDirection(v);
8776
+ }.bind(this)),
8777
+ top = _map[0],
8778
+ bottom = _map[1],
8779
+ left = _map[2],
8780
+ right = _map[3];
8767
8781
  return {
8768
- top: $$.getCurrentPaddingTop(),
8769
- bottom: $$.getCurrentPaddingBottom(),
8770
- left: $$.getCurrentPaddingLeft(),
8771
- right: $$.getCurrentPaddingRight()
8782
+ top: top,
8783
+ bottom: bottom,
8784
+ left: left,
8785
+ right: right
8772
8786
  };
8773
8787
  },
8774
8788
  /**
@@ -8779,14 +8793,14 @@ function getGroupedDataPointsFn(d) {
8779
8793
  * @private
8780
8794
  */
8781
8795
  getResettedPadding: function getResettedPadding(v) {
8782
- var _this = this;
8796
+ var _this2 = this;
8783
8797
  const $$ = this,
8784
8798
  config = $$.config,
8785
8799
  isNum = isNumber(v);
8786
8800
  let p = isNum ? 0 : {};
8787
8801
  if (config.padding === !1) {
8788
8802
  isNum || Object.keys(v).forEach(function (key) {
8789
- _newArrowCheck(this, _this);
8803
+ _newArrowCheck(this, _this2);
8790
8804
  // when data.lables=true, do not reset top padding
8791
8805
  p[key] = !isEmpty(config.data_labels) && config.data_labels !== !1 && key === "top" ? v[key] : 0;
8792
8806
  }.bind(this));
@@ -8801,14 +8815,14 @@ function getGroupedDataPointsFn(d) {
8801
8815
  * @private
8802
8816
  */
8803
8817
  updateSizes: function updateSizes(isInit) {
8804
- var _config$padding3;
8818
+ var _config$padding2;
8805
8819
  const $$ = this,
8806
8820
  config = $$.config,
8807
8821
  state = $$.state,
8808
8822
  legend = $$.$el.legend,
8809
8823
  isRotated = config.axis_rotated,
8810
8824
  isNonAxis = $$.hasArcType() || state.hasTreemap,
8811
- isFitPadding = ((_config$padding3 = config.padding) == null ? void 0 : _config$padding3.mode) === "fit";
8825
+ isFitPadding = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit";
8812
8826
  isInit || $$.setContainerSize();
8813
8827
  const currLegend = {
8814
8828
  width: legend ? $$.getLegendWidth() : 0,
@@ -8817,7 +8831,10 @@ function getGroupedDataPointsFn(d) {
8817
8831
  if (!isNonAxis && config.axis_x_show && config.axis_x_tick_autorotate) {
8818
8832
  $$.updateXAxisTickClip();
8819
8833
  }
8820
- const legendHeightForBottom = state.isLegendRight || state.isLegendInset ? 0 : currLegend.height,
8834
+ const legendSize = {
8835
+ right: config.legend_show && state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
8836
+ bottom: !config.legend_show || state.isLegendRight || state.isLegendInset ? 0 : currLegend.height
8837
+ },
8821
8838
  xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"),
8822
8839
  subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
8823
8840
  subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0,
@@ -8825,15 +8842,15 @@ function getGroupedDataPointsFn(d) {
8825
8842
  padding = $$.getCurrentPadding(); // when needle is shown with legend, it need some bottom space to not overlap with legend text
8826
8843
  // for main
8827
8844
  state.margin = !isNonAxis && isRotated ? {
8828
- top: $$.getHorizontalAxisHeight("y2") + padding.top,
8829
- right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
8830
- bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + padding.bottom,
8845
+ top: padding.top,
8846
+ right: isNonAxis ? 0 : padding.right + legendSize.right,
8847
+ bottom: legendSize.bottom + padding.bottom,
8831
8848
  left: subchartHeight + (isNonAxis ? 0 : padding.left)
8832
8849
  } : {
8833
8850
  top: (isFitPadding ? 0 : 4) + padding.top,
8834
8851
  // for top tick text
8835
- right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
8836
- bottom: gaugeHeight + xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
8852
+ right: isNonAxis ? 0 : padding.right + legendSize.right,
8853
+ bottom: gaugeHeight + subchartHeight + legendSize.bottom + padding.bottom,
8837
8854
  left: isNonAxis ? 0 : padding.left
8838
8855
  };
8839
8856
  state.margin = $$.getResettedPadding(state.margin);
@@ -8842,12 +8859,12 @@ function getGroupedDataPointsFn(d) {
8842
8859
  state.margin2 = isRotated ? {
8843
8860
  top: state.margin.top,
8844
8861
  right: NaN,
8845
- bottom: 20 + legendHeightForBottom,
8862
+ bottom: 20 + legendSize.bottom,
8846
8863
  left: $$.state.rotatedPadding.left
8847
8864
  } : {
8848
- top: state.current.height - subchartHeight - legendHeightForBottom,
8865
+ top: state.current.height - subchartHeight - legendSize.bottom,
8849
8866
  right: NaN,
8850
- bottom: subchartXAxisHeight + legendHeightForBottom,
8867
+ bottom: subchartXAxisHeight + legendSize.bottom,
8851
8868
  left: state.margin.left
8852
8869
  };
8853
8870
 
@@ -9797,24 +9814,47 @@ function getTextXPos(pos, width) {
9797
9814
  eventRect = _$$$$el.eventRect,
9798
9815
  tooltip = _$$$$el.tooltip,
9799
9816
  bindto = config.tooltip_contents.bindto,
9817
+ isRotated = config.axis_rotated,
9800
9818
  datum = tooltip == null ? void 0 : tooltip.datum();
9801
9819
  if (!bindto && datum) {
9802
9820
  var _config$tooltip_posit, _config$tooltip_posit2;
9803
- const _getPointer = getPointer(state.event, eventTarget != null ? eventTarget : eventRect == null ? void 0 : eventRect.node()),
9821
+ const data = dataToShow != null ? dataToShow : JSON.parse(datum.current),
9822
+ _getPointer = getPointer(state.event, eventTarget != null ? eventTarget : eventRect == null ? void 0 : eventRect.node()),
9804
9823
  x = _getPointer[0],
9805
9824
  y = _getPointer[1],
9806
9825
  currPos = {
9807
9826
  x: x,
9808
9827
  y: y
9809
- }; // get mouse event position
9810
- if (scale.x && datum && "x" in datum) {
9811
- currPos.xAxis = scale.x(datum.x);
9828
+ };
9829
+ // get mouse event position
9830
+
9831
+ if (state.hasAxis && scale.x && datum && "x" in datum) {
9832
+ const getYPos = function (value, id, axisId) {
9833
+ var _$$$axis2;
9834
+ if (value === void 0) {
9835
+ value = 0;
9836
+ }
9837
+ if (axisId === void 0) {
9838
+ axisId = "y";
9839
+ }
9840
+ _newArrowCheck(this, _this4);
9841
+ const scaleFn = scale[id ? (_$$$axis2 = $$.axis) == null ? void 0 : _$$$axis2.getId(id) : axisId];
9842
+ return scaleFn ? scaleFn(value) + (isRotated ? state.margin.left : state.margin.top) : 0;
9843
+ }.bind(this);
9844
+ currPos.xAxis = scale.x(datum.x) + (
9845
+ // add margin only when user specified tooltip.position function
9846
+ config.tooltip_position ? isRotated ? state.margin.top : state.margin.left : 0);
9847
+ if (data.length === 1) {
9848
+ currPos.yAxis = getYPos(data[0].value, data[0].id);
9849
+ } else {
9850
+ currPos.yAxis = getYPos;
9851
+ }
9812
9852
  }
9813
9853
  const _datum$width = datum.width,
9814
9854
  width = _datum$width === void 0 ? 0 : _datum$width,
9815
9855
  _datum$height = datum.height,
9816
9856
  height = _datum$height === void 0 ? 0 : _datum$height,
9817
- 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
9857
+ pos = (_config$tooltip_posit = (_config$tooltip_posit2 = config.tooltip_position) == null ? void 0 : _config$tooltip_posit2.bind($$.api)(data, width, height, eventRect == null ? void 0 : eventRect.node(), currPos)) != null ? _config$tooltip_posit : $$.getTooltipPosition.bind($$)(width, height, currPos); // Get tooltip position
9818
9858
  ["top", "left"].forEach(function (v) {
9819
9859
  _newArrowCheck(this, _this4);
9820
9860
  const value = pos[v];
@@ -9851,8 +9891,8 @@ function getTextXPos(pos, width) {
9851
9891
  hasTreemap = state.hasTreemap,
9852
9892
  isRotated = config.axis_rotated,
9853
9893
  svgLeft = $$.getSvgLeft(!0);
9854
- let chartRight = svgLeft + current.width - $$.getCurrentPaddingRight();
9855
- const chartLeft = $$.getCurrentPaddingLeft(!0),
9894
+ let chartRight = svgLeft + current.width - $$.getCurrentPaddingByDirection("right");
9895
+ const chartLeft = $$.getCurrentPaddingByDirection("left", !0),
9856
9896
  size = 20;
9857
9897
  let x = currPos.x,
9858
9898
  y = currPos.y;
@@ -10130,7 +10170,7 @@ function getTextXPos(pos, width) {
10130
10170
  y = isRotated ? state.height + padding : 0;
10131
10171
  } else if (target === "y2") {
10132
10172
  x = isRotated ? 0 : state.width + padding;
10133
- y = isRotated && padding ? 1 - padding : 0;
10173
+ y = isRotated ? 1 - padding : 0;
10134
10174
  } else if (target === "subX") {
10135
10175
  x = 0;
10136
10176
  y = isRotated ? 0 : state.height2;
@@ -10782,7 +10822,7 @@ let ChartInternal = /*#__PURE__*/function () {
10782
10822
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) {
10783
10823
  $el.defs = $el.svg.append("defs");
10784
10824
  if (hasAxis) {
10785
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
10825
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(function (v) {
10786
10826
  _newArrowCheck(this, _this3);
10787
10827
  $$.appendClip($el.defs, state.clip[v]);
10788
10828
  }.bind(this));
@@ -14453,7 +14493,7 @@ let Axis_Axis = /*#__PURE__*/function () {
14453
14493
  if (v === "x") {
14454
14494
  res = clip.pathXAxis;
14455
14495
  } else if (v === "y") {
14456
- // && config.axis_y_inner) {
14496
+ // || v === "y2") {
14457
14497
  res = clip.pathYAxis;
14458
14498
  }
14459
14499
  return res;
@@ -14918,7 +14958,7 @@ let Axis_Axis = /*#__PURE__*/function () {
14918
14958
  state = $$.state,
14919
14959
  xAxisTickRotate = $$.getAxisTickRotate("x");
14920
14960
  if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && !config.axis_x_tick_culling && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
14921
- const widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingLeft(),
14961
+ const widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingByDirection("left"),
14922
14962
  maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding),
14923
14963
  xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
14924
14964
  // for display inconsistencies between browsers
@@ -16064,11 +16104,13 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
16064
16104
 
16065
16105
  // less than 20 is not enough to show the axis label 'outer' without legend
16066
16106
 
16067
- node.attr("x", x).attr("y", -2).attr("width", w).attr("height", h);
16107
+ // -Math.max(15, margin.top);
16108
+
16109
+ node.attr("x", x).attr("y", -15).attr("width", w).attr("height", h);
16068
16110
  },
16069
16111
  /**
16070
16112
  * Set y Axis clipPath dimension
16071
- * @param {d3Selecton} node clipPath <rect> selection
16113
+ * @param {d3Selection} node clipPath <rect> selection
16072
16114
  * @private
16073
16115
  */
16074
16116
  setYAxisClipPath: function setYAxisClipPath(node) {
@@ -16731,7 +16773,7 @@ function smoothLines(el, type) {
16731
16773
  if (id === "x" && !config.axis_x_show) {
16732
16774
  return 8;
16733
16775
  }
16734
- if (id === "x" && config.axis_x_height) {
16776
+ if (id === "x" && isNumber(config.axis_x_height)) {
16735
16777
  return config.axis_x_height;
16736
16778
  }
16737
16779
  if (id === "y" && !config.axis_y_show) {
@@ -16807,7 +16849,7 @@ function smoothLines(el, type) {
16807
16849
  _$$$state = $$.state,
16808
16850
  axis = _$$$state.axis,
16809
16851
  current = _$$$state.current,
16810
- xAxisLength = current.width - $$.getCurrentPaddingLeft(!1) - $$.getCurrentPaddingRight(),
16852
+ xAxisLength = current.width - $$.getCurrentPaddingByDirection("left") - $$.getCurrentPaddingByDirection("right"),
16811
16853
  tickCountWithPadding = axis.x.tickCount + axis.x.padding.left + axis.x.padding.right,
16812
16854
  maxTickWidth = $$.axis.getMaxTickWidth("x"),
16813
16855
  tickLength = tickCountWithPadding ? xAxisLength / tickCountWithPadding : 0;
@@ -18138,6 +18180,18 @@ function smoothLines(el, type) {
18138
18180
  * y2 Axis config options
18139
18181
  */
18140
18182
  /* harmony default export */ var y2 = ({
18183
+ /**
18184
+ * Set clip-path attribute for y2 axis element
18185
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
18186
+ * @name axis․y2․clipPath
18187
+ * @memberof Options
18188
+ * @type {boolean}
18189
+ * @default true
18190
+ * @example
18191
+ * // don't set 'clip-path' attribute
18192
+ * clipPath: false
18193
+ */
18194
+ axis_y2_clipPath: !0,
18141
18195
  /**
18142
18196
  * Show or hide y2 axis.
18143
18197
  * - **NOTE**:
@@ -25453,7 +25507,7 @@ let _defaults = {};
25453
25507
 
25454
25508
  /**
25455
25509
  * @namespace bb
25456
- * @version 3.10.0-next.2
25510
+ * @version 3.10.0-next.4
25457
25511
  */
25458
25512
  const bb = {
25459
25513
  /**
@@ -25463,7 +25517,7 @@ const bb = {
25463
25517
  * bb.version; // "1.0.0"
25464
25518
  * @memberof bb
25465
25519
  */
25466
- version: "3.10.0-next.2",
25520
+ version: "3.10.0-next.4",
25467
25521
  /**
25468
25522
  * Generate chart
25469
25523
  * - **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.10.0-next.2
8
+ * @version 3.10.0-next.4
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 rect{fill:#4682b4;fill-opacity:.1}.bb-brush .extent,.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}