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

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 (49) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +62 -14
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +1100 -894
  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 +3 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  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 +1033 -879
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1035 -881
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1035 -881
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1036 -882
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1037 -883
  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 +55 -12
  36. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  37. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +5 -5
  38. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  39. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  41. package/package.json +27 -27
  42. package/src/ChartInternal/interactions/interaction.ts +1 -1
  43. package/src/ChartInternal/internals/selection.ts +1 -1
  44. package/src/ChartInternal/internals/text.ts +1 -1
  45. package/src/ChartInternal/internals/tooltip.ts +25 -5
  46. package/src/ChartInternal/shape/point.ts +2 -2
  47. package/src/Plugin/sparkline/index.ts +1 -1
  48. package/src/config/Options/common/tooltip.ts +25 -1
  49. package/types/options.d.ts +1 -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.3
8
+ * @version 3.10.0-next.5
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.3
8
+ * @version 3.10.0-next.5
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -3476,6 +3476,7 @@ var tooltip_this = undefined;
3476
3476
  * @see [Demo: Tooltip Grouping](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipGrouping)
3477
3477
  * @see [Demo: Tooltip Format](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipFormat)
3478
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)
3479
3480
  * @see [Demo: Tooltip Template](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipTemplate)
3480
3481
  * @example
3481
3482
  * tooltip: {
@@ -3499,8 +3500,31 @@ var tooltip_this = undefined;
3499
3500
  * // x: Current mouse event x position,
3500
3501
  * // y: Current mouse event y position,
3501
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)
3502
3504
  * // }
3503
- * 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
+ * }
3504
3528
  * },
3505
3529
  *
3506
3530
  * contents: function(d, defaultTitleFormat, defaultValueFormat, color) {
@@ -5740,7 +5764,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5740
5764
  $$.cache.add(KEY.setOverOut, last);
5741
5765
  } else {
5742
5766
  if (isOver) {
5743
- $$.isPointFocusOnly() && hasRadar ? $$.showCircleFocus($$.getAllValuesOnIndex(d, !0)) : $$.setExpand(d, null, !0);
5767
+ hasRadar && $$.isPointFocusOnly() ? $$.showCircleFocus($$.getAllValuesOnIndex(d, !0)) : $$.setExpand(d, null, !0);
5744
5768
  }
5745
5769
  $$.isMultipleX() || main.selectAll("." + $SHAPE.shape + "-" + d).each(function (d) {
5746
5770
  callback(d, this);
@@ -9103,7 +9127,7 @@ function getTextPos(d, type) {
9103
9127
  value = data.close;
9104
9128
  }
9105
9129
  }
9106
- value = $$.isTreemapType(d) ? $$.treemapDataLabelFormat(d)(node) : $$.dataLabelFormat(d.id)(value, d.id, i, texts);
9130
+ value = $$.isTreemapType(d) ? $$.treemapDataLabelFormat(d)(node) : $$.dataLabelFormat(d.id)(value, d.id, d.index, texts);
9107
9131
  if (isNumber(value)) {
9108
9132
  this.textContent = value;
9109
9133
  } else {
@@ -9790,24 +9814,47 @@ function getTextXPos(pos, width) {
9790
9814
  eventRect = _$$$$el.eventRect,
9791
9815
  tooltip = _$$$$el.tooltip,
9792
9816
  bindto = config.tooltip_contents.bindto,
9817
+ isRotated = config.axis_rotated,
9793
9818
  datum = tooltip == null ? void 0 : tooltip.datum();
9794
9819
  if (!bindto && datum) {
9795
9820
  var _config$tooltip_posit, _config$tooltip_posit2;
9796
- 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()),
9797
9823
  x = _getPointer[0],
9798
9824
  y = _getPointer[1],
9799
9825
  currPos = {
9800
9826
  x: x,
9801
9827
  y: y
9802
- }; // get mouse event position
9803
- if (scale.x && datum && "x" in datum) {
9804
- 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
+ }
9805
9852
  }
9806
9853
  const _datum$width = datum.width,
9807
9854
  width = _datum$width === void 0 ? 0 : _datum$width,
9808
9855
  _datum$height = datum.height,
9809
9856
  height = _datum$height === void 0 ? 0 : _datum$height,
9810
- 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
9811
9858
  ["top", "left"].forEach(function (v) {
9812
9859
  _newArrowCheck(this, _this4);
9813
9860
  const value = pos[v];
@@ -20847,7 +20894,8 @@ const getTransitionName = function () {
20847
20894
  const config = this.config;
20848
20895
  let opacity = config.point_opacity;
20849
20896
  if (isUndefined(opacity)) {
20850
- opacity = config.point_show && !this.isPointFocusOnly() ? null : "0";
20897
+ var _this$isPointFocusOnl;
20898
+ opacity = config.point_show && !((_this$isPointFocusOnl = this.isPointFocusOnly) != null && _this$isPointFocusOnl.call(this)) ? null : "0";
20851
20899
  opacity = isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0";
20852
20900
  }
20853
20901
  return opacity;
@@ -20984,7 +21032,7 @@ const getTransitionName = function () {
20984
21032
  transiting = _$$$state.transiting,
20985
21033
  $el = $$.$el;
20986
21034
  let circle = $el.circle;
20987
- if (transiting === !1 && $$.isPointFocusOnly() && circle) {
21035
+ if (transiting === !1 && circle && $$.isPointFocusOnly()) {
20988
21036
  const cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$),
20989
21037
  cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$),
20990
21038
  withTransition = toggling || isUndefined(d),
@@ -24370,7 +24418,7 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
24370
24418
  toggle = $$.getToggle(that, d).bind($$);
24371
24419
  let toggledShape;
24372
24420
  if (!config.data_selection_multiple) {
24373
- const focusOnly = $$.isPointFocusOnly();
24421
+ const focusOnly = $$.isPointFocusOnly == null ? void 0 : $$.isPointFocusOnly();
24374
24422
  let selector = "." + (focusOnly ? $SELECT.selectedCircles : $SHAPE.shapes);
24375
24423
  if (config.data_selection_grouped) {
24376
24424
  selector += $$.getTargetSelectorSuffix(d.id);
@@ -25460,7 +25508,7 @@ let _defaults = {};
25460
25508
 
25461
25509
  /**
25462
25510
  * @namespace bb
25463
- * @version 3.10.0-next.3
25511
+ * @version 3.10.0-next.5
25464
25512
  */
25465
25513
  const bb = {
25466
25514
  /**
@@ -25470,7 +25518,7 @@ const bb = {
25470
25518
  * bb.version; // "1.0.0"
25471
25519
  * @memberof bb
25472
25520
  */
25473
- version: "3.10.0-next.3",
25521
+ version: "3.10.0-next.5",
25474
25522
  /**
25475
25523
  * Generate chart
25476
25524
  * - **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.3
8
+ * @version 3.10.0-next.5
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}