billboard.js 3.10.0-next.5 → 3.10.0-next.6

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 (53) hide show
  1. package/README.md +4 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +49 -29
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +83 -55
  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 +2 -2
  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 +2 -2
  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.pkgd.js +36 -28
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +36 -28
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +36 -28
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +36 -28
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +36 -28
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  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 +306 -0
  37. package/dist/theme/modern.min.css +10 -0
  38. package/dist-esm/billboard.js +44 -27
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  44. package/package.json +12 -12
  45. package/src/ChartInternal/interactions/eventrect.ts +2 -1
  46. package/src/ChartInternal/interactions/interaction.ts +5 -2
  47. package/src/ChartInternal/interactions/zoom.ts +1 -2
  48. package/src/ChartInternal/internals/size.ts +19 -6
  49. package/src/ChartInternal/internals/tooltip.ts +13 -8
  50. package/src/ChartInternal/shape/point.ts +4 -2
  51. package/src/config/Options/axis/x.ts +1 -1
  52. package/src/config/Options/data/axis.ts +1 -1
  53. package/src/scss/theme/modern.scss +432 -0
package/README.md CHANGED
@@ -98,7 +98,6 @@ You can download the compressed files for production
98
98
  - https://naver.github.io/billboard.js/release/latest/dist/theme/datalab.css
99
99
  - https://naver.github.io/billboard.js/release/latest/dist/theme/datalab.min.css
100
100
 
101
-
102
101
  #### dark
103
102
  - https://naver.github.io/billboard.js/release/latest/dist/theme/dark.css
104
103
  - https://naver.github.io/billboard.js/release/latest/dist/theme/dark.min.css
@@ -111,6 +110,10 @@ You can download the compressed files for production
111
110
  - https://naver.github.io/billboard.js/release/latest/dist/theme/graph.css
112
111
  - https://naver.github.io/billboard.js/release/latest/dist/theme/graph.min.css
113
112
 
113
+ #### modern
114
+ - https://naver.github.io/billboard.js/release/latest/dist/theme/modern.css
115
+ - https://naver.github.io/billboard.js/release/latest/dist/theme/modern.min.css
116
+
114
117
  </details>
115
118
 
116
119
  ### Nightly version
@@ -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.5
8
+ * @version 3.10.0-next.6
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.5
8
+ * @version 3.10.0-next.6
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -5832,7 +5832,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5832
5832
  treemap = _$$$$el.treemap,
5833
5833
  element = (_ref = hasTreemap && eventReceiver.rect || hasRadar && radar.axes.select("." + $AXIS.axis + "-" + index + " text") || eventRect || ($$.getArcElementByIdOrIndex == null ? void 0 : $$.getArcElementByIdOrIndex(index))) == null ? void 0 : _ref.node();
5834
5834
  if (element) {
5835
- const isMultipleX = $$.isMultipleX();
5835
+ const isMultipleX = $$.isMultipleX(),
5836
+ isRotated = config.axis_rotated;
5836
5837
  let _element$getBoundingC = element.getBoundingClientRect(),
5837
5838
  width = _element$getBoundingC.width,
5838
5839
  left = _element$getBoundingC.left,
@@ -5849,8 +5850,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5849
5850
  top = 0;
5850
5851
  }
5851
5852
  }
5852
- const x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : width / 2),
5853
- y = top + (mouse ? mouse[1] : 0);
5853
+ const x = left + (mouse ? mouse[0] : 0) + (isMultipleX || isRotated ? 0 : width / 2),
5854
+ y = top + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0); // value 4, is to adjust coordinate value set from: scale.ts - updateScales(): $$.getResettedPadding(1)
5854
5855
  emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](hasTreemap ? treemap.node() : element, type, {
5855
5856
  screenX: x,
5856
5857
  screenY: y,
@@ -8659,15 +8660,26 @@ function getGroupedDataPointsFn(d) {
8659
8660
  const $$ = this,
8660
8661
  config = $$.config,
8661
8662
  $el = $$.$el,
8662
- hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner,
8663
- leftAxisClass = config.axis_rotated ? $AXIS.axisX : $AXIS.axisY,
8663
+ isRotated = config.axis_rotated,
8664
+ hasLeftAxisRect = isRotated || !isRotated && !config.axis_y_inner,
8665
+ leftAxisClass = isRotated ? $AXIS.axisX : $AXIS.axisY,
8664
8666
  leftAxis = $el.main.select("." + leftAxisClass).node(),
8665
- svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {
8667
+ leftLabel = config["axis_" + (isRotated ? "x" : "y") + "_label"];
8668
+ let labelWidth = 0;
8669
+
8670
+ // if axis label position set to inner, exclude from the value
8671
+ if (isString(leftLabel) || isString(leftLabel.text) || /^inner-/.test(leftLabel == null ? void 0 : leftLabel.position)) {
8672
+ const label = $el.main.select("." + leftAxisClass + "-label");
8673
+ if (!label.empty()) {
8674
+ labelWidth = label.node().getBoundingClientRect().left;
8675
+ }
8676
+ }
8677
+ const svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : {
8666
8678
  right: 0
8667
8679
  },
8668
- chartRect = $el.chart.node().getBoundingClientRect(),
8680
+ chartRectLeft = $el.chart.node().getBoundingClientRect().left + labelWidth,
8669
8681
  hasArc = $$.hasArcType(),
8670
- svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingByDirection("left", withoutRecompute));
8682
+ svgLeft = svgRect.right - chartRectLeft - (hasArc ? 0 : $$.getCurrentPaddingByDirection("left", withoutRecompute));
8671
8683
  return svgLeft > 0 ? svgLeft : 0;
8672
8684
  },
8673
8685
  updateDimension: function updateDimension(withoutAxis) {
@@ -8752,7 +8764,7 @@ function getGroupedDataPointsFn(d) {
8752
8764
  }
8753
8765
  if (type === "right") {
8754
8766
  padding += isRotated ? !isFitPadding && isUndefined(paddingOption) ? 10 : 2 : !isAxisShow || isAxisInner ? isFitPadding ? 2 : 1 : 0;
8755
- } else if (type === "left" && isRotated) {
8767
+ } else if (type === "left" && isRotated && isUndefined(paddingOption)) {
8756
8768
  padding = !config.axis_x_show ? 1 : isFitPadding ? axisSize : Math.max(axisSize, 40);
8757
8769
  }
8758
8770
  } else {
@@ -9890,34 +9902,38 @@ function getTextXPos(pos, width) {
9890
9902
  hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
9891
9903
  hasTreemap = state.hasTreemap,
9892
9904
  isRotated = config.axis_rotated,
9905
+ hasArcType = $$.hasArcType(),
9893
9906
  svgLeft = $$.getSvgLeft(!0);
9894
9907
  let chartRight = svgLeft + current.width - $$.getCurrentPaddingByDirection("right");
9895
- const chartLeft = $$.getCurrentPaddingByDirection("left", !0),
9896
- size = 20;
9908
+ const size = 20;
9897
9909
  let x = currPos.x,
9898
9910
  y = currPos.y;
9899
9911
 
9900
9912
  // Determine tooltip position
9901
- if ($$.hasArcType()) {
9913
+ if (hasArcType) {
9902
9914
  const raw = inputType === "touch" || $$.hasType("radar");
9903
9915
  if (!raw) {
9904
- y += hasGauge ? height : height / 2;
9905
9916
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
9917
+ y += hasGauge ? height : height / 2;
9906
9918
  }
9907
9919
  } else if (!hasTreemap) {
9920
+ const padding = {
9921
+ top: $$.getCurrentPaddingByDirection("top", !0),
9922
+ left: $$.getCurrentPaddingByDirection("left", !0)
9923
+ };
9908
9924
  if (isRotated) {
9909
- y = currPos.xAxis + size;
9910
- x += svgLeft;
9925
+ x += svgLeft + padding.left + size;
9926
+ y = padding.top + currPos.xAxis + size;
9911
9927
  chartRight -= svgLeft;
9912
9928
  } else {
9913
- y -= 5;
9914
- x = svgLeft + chartLeft + size + (scale.zoom ? x : currPos.xAxis);
9929
+ x = svgLeft + padding.left + size + (scale.zoom ? x : currPos.xAxis);
9930
+ y += padding.top - 5;
9915
9931
  }
9916
9932
  }
9917
9933
 
9918
9934
  // when tooltip left + tWidth > chart's width
9919
9935
  if (x + tWidth + 15 > chartRight) {
9920
- x -= isRotated ? tWidth - chartLeft : tWidth + (hasTreemap ? 0 : chartLeft);
9936
+ x -= tWidth + (hasTreemap || hasArcType ? 0 : isRotated ? 40 : 38);
9921
9937
  }
9922
9938
  if (y + tHeight > current.height) {
9923
9939
  const gap = hasTreemap ? 0 : 30;
@@ -15804,13 +15820,14 @@ let Axis_Axis = /*#__PURE__*/function () {
15804
15820
  return;
15805
15821
  }
15806
15822
  const mouse = getPointer(state.event, this),
15807
- closest = $$.findClosestFromTargets(targetsToShow, mouse);
15823
+ closest = $$.findClosestFromTargets(targetsToShow, mouse),
15824
+ sensitivity = config.point_sensitivity === "radius" ? closest.r : config.point_sensitivity;
15808
15825
  if (!closest) {
15809
15826
  return;
15810
15827
  }
15811
15828
 
15812
15829
  // select if selection enabled
15813
- if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) {
15830
+ if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < sensitivity) {
15814
15831
  $$.$el.main.selectAll("." + $SHAPE.shapes + $$.getTargetSelectorSuffix(closest.id)).selectAll("." + $SHAPE.shape + "-" + closest.index).each(function () {
15815
15832
  if (config.data_selection_grouped || $$.isWithinShape(this, closest)) {
15816
15833
  $$.toggleShape == null || $$.toggleShape(this, closest, closest.index);
@@ -16903,7 +16920,7 @@ function smoothLines(el, type) {
16903
16920
  * type: "timeseries"
16904
16921
  * }
16905
16922
  * }
16906
- * @see [D3's time specifier](https://github.com/d3/d3-time-format#locale_format)
16923
+ * @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
16907
16924
  */
16908
16925
  data_xFormat: "%Y-%m-%d",
16909
16926
  /**
@@ -17121,7 +17138,7 @@ function smoothLines(el, type) {
17121
17138
  * @memberof Options
17122
17139
  * @type {Function|string}
17123
17140
  * @default undefined
17124
- * @see [D3's time specifier](https://github.com/d3/d3-time-format#locale_format)
17141
+ * @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
17125
17142
  * @example
17126
17143
  * axis: {
17127
17144
  * x: {
@@ -21161,9 +21178,12 @@ const getTransitionName = function () {
21161
21178
  return $$.config.point_focus_only && !$$.hasType("bubble") && !$$.hasType("scatter") && !$$.hasArcType(null, ["radar"]);
21162
21179
  },
21163
21180
  isWithinCircle: function isWithinCircle(node, r) {
21164
- const mouse = getPointer(this.state.event, node),
21181
+ const config = this.config,
21182
+ state = this.state,
21183
+ mouse = getPointer(state.event, node),
21165
21184
  element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(node),
21166
- prefix = this.isCirclePoint(node) ? "c" : "";
21185
+ prefix = this.isCirclePoint(node) ? "c" : "",
21186
+ sensitivity = config.point_sensitivity === "radius" ? node.getAttribute("r") : config.point_sensitivity;
21167
21187
  let cx = +element.attr(prefix + "x"),
21168
21188
  cy = +element.attr(prefix + "y");
21169
21189
  // if node don't have cx/y or x/y attribute value
@@ -21174,7 +21194,7 @@ const getTransitionName = function () {
21174
21194
  cx = x;
21175
21195
  cy = y;
21176
21196
  }
21177
- return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity);
21197
+ return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || sensitivity);
21178
21198
  },
21179
21199
  /**
21180
21200
  * Get data point sensitivity radius
@@ -25055,7 +25075,7 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
25055
25075
  $$.$el.svg.on("wheel", function () {
25056
25076
  _newArrowCheck(this, _this3);
25057
25077
  }.bind(this));
25058
- eventRect.call(behaviour).on("dblclick.zoom", null);
25078
+ eventRect == null || eventRect.call(behaviour).on("dblclick.zoom", null);
25059
25079
  },
25060
25080
  /**
25061
25081
  * Initialize the drag behaviour used for zooming.
@@ -25508,7 +25528,7 @@ let _defaults = {};
25508
25528
 
25509
25529
  /**
25510
25530
  * @namespace bb
25511
- * @version 3.10.0-next.5
25531
+ * @version 3.10.0-next.6
25512
25532
  */
25513
25533
  const bb = {
25514
25534
  /**
@@ -25518,7 +25538,7 @@ const bb = {
25518
25538
  * bb.version; // "1.0.0"
25519
25539
  * @memberof bb
25520
25540
  */
25521
- version: "3.10.0-next.5",
25541
+ version: "3.10.0-next.6",
25522
25542
  /**
25523
25543
  * Generate chart
25524
25544
  * - **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.5
8
+ * @version 3.10.0-next.6
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}