billboard.js 3.14.1 → 3.14.3

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 (54) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +79 -41
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +9 -9
  5. package/dist/billboard.pkgd.js +79 -41
  6. package/dist/billboard.pkgd.min.js +9 -9
  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 +9 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +9 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +9 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -3
  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 +9 -3
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +9 -3
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +7 -7
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +9 -3
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +9 -3
  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/theme/modern.css +1 -1
  36. package/dist/theme/modern.min.css +1 -1
  37. package/dist-esm/billboard.js +460 -420
  38. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +4 -4
  39. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +88 -15
  40. package/dist-esm/plugin/billboardjs-plugin-stanford.js +86 -13
  41. package/dist-esm/plugin/billboardjs-plugin-tableview.js +83 -10
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +70 -7
  43. package/package.json +29 -29
  44. package/src/ChartInternal/Axis/Axis.ts +23 -0
  45. package/src/ChartInternal/data/data.ts +5 -4
  46. package/src/ChartInternal/interactions/interaction.ts +1 -1
  47. package/src/ChartInternal/interactions/subchart.ts +2 -25
  48. package/src/ChartInternal/interactions/zoom.ts +21 -0
  49. package/src/ChartInternal/internals/tooltip.ts +25 -15
  50. package/src/config/Options/axis/x.ts +2 -1
  51. package/src/config/Options/shape/gauge.ts +3 -2
  52. package/src/module/util.ts +10 -2
  53. package/types/axis.d.ts +2 -2
  54. package/types/options.shape.d.ts +3 -2
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.14.1
8
+ * @version 3.14.3
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.11
@@ -26117,9 +26117,15 @@ function getScrollPosition(node) {
26117
26117
  function getTransformCTM(node, x = 0, y = 0, inverse = true) {
26118
26118
  const point = new DOMPoint(x, y);
26119
26119
  const screen = node.getScreenCTM();
26120
- return point.matrixTransform(
26120
+ const res = point.matrixTransform(
26121
26121
  inverse ? screen == null ? void 0 : screen.inverse() : screen
26122
26122
  );
26123
+ if (inverse === false) {
26124
+ const rect = node.getBoundingClientRect();
26125
+ res.x -= rect.x;
26126
+ res.y -= rect.y;
26127
+ }
26128
+ return res;
26123
26129
  }
26124
26130
  function getTranslation(node) {
26125
26131
  const transform = node ? node.transform : null;
@@ -27895,11 +27901,13 @@ function getDataKeyForJson(keysParam, config) {
27895
27901
  const isRotated = config.axis_rotated;
27896
27902
  const scrollPos = getScrollPosition($el.chart.node());
27897
27903
  const e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event;
27898
- let point = isRotated ? e.clientY + scrollPos.y - rect.top : e.clientX + scrollPos.x - rect.left;
27904
+ let point = isRotated ? e.clientY + scrollPos.y : e.clientX + scrollPos.x;
27899
27905
  if (hasViewBox($el.svg)) {
27900
27906
  const pos = [point, 0];
27901
27907
  isRotated && pos.reverse();
27902
- point = getTransformCTM($el.svg.node(), ...pos)[isRotated ? "y" : "x"];
27908
+ point = getTransformCTM($el.eventRect.node(), ...pos)[isRotated ? "y" : "x"];
27909
+ } else {
27910
+ point -= isRotated ? rect.top : rect.left;
27903
27911
  }
27904
27912
  index = findIndex(
27905
27913
  coords,
@@ -28642,7 +28650,7 @@ function drag_defaultTouchable() {
28642
28650
  let x = left + (mouse ? mouse[0] : 0) + (isMultipleX || isRotated ? 0 : width / 2);
28643
28651
  let y = top + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0);
28644
28652
  if (hasViewBox(svg)) {
28645
- const ctm = getTransformCTM($$.$el.svg.node(), x, y, false);
28653
+ const ctm = getTransformCTM($$.$el.eventRect.node(), x, y, false);
28646
28654
  x = ctm.x;
28647
28655
  y = ctm.y;
28648
28656
  }
@@ -32665,32 +32673,44 @@ function getTextXPos(pos = "left", width) {
32665
32673
  });
32666
32674
  }
32667
32675
  },
32676
+ /**
32677
+ * Get tooltip position when svg has vieBox attribute
32678
+ * @param {number} tWidth Tooltip width value
32679
+ * @param {number} tHeight Tooltip height value
32680
+ * @param {object} currPos Current event position value from SVG coordinate
32681
+ * @returns {object} top, left value
32682
+ */
32668
32683
  getTooltipPositionViewBox(tWidth, tHeight, currPos) {
32669
32684
  var _a, _b;
32670
32685
  const $$ = this;
32671
- const { $el: { eventRect, main }, config, state } = $$;
32686
+ const { $el: { eventRect, svg }, config, state } = $$;
32672
32687
  const isRotated = config.axis_rotated;
32673
- const hasArcType = $$.hasArcType(void 0, ["radar"]) || state.hasFunnel || state.hasTreemap;
32674
- const target = (_b = (_a = state.hasRadar ? main : eventRect) == null ? void 0 : _a.node()) != null ? _b : state.event.target;
32675
- const size = 38;
32688
+ const hasArcType = $$.hasArcType() || state.hasFunnel || state.hasTreemap;
32689
+ const target = (_b = (_a = hasArcType ? svg : eventRect) == null ? void 0 : _a.node()) != null ? _b : state.event.target;
32676
32690
  let { x, y } = currPos;
32677
32691
  if (state.hasAxis) {
32678
32692
  x = isRotated ? x : currPos.xAxis;
32679
32693
  y = isRotated ? currPos.xAxis : y;
32680
32694
  }
32681
32695
  const ctm = getTransformCTM(target, x, y, false);
32696
+ const rect = target.getBoundingClientRect();
32697
+ const size = getTransformCTM(target, 20, 0, false).x;
32682
32698
  let top = ctm.y;
32683
- let left = ctm.x + size;
32699
+ let left = ctm.x + tWidth / 2 + size;
32684
32700
  if (hasArcType) {
32685
- top += tHeight;
32686
- left -= size;
32701
+ if (state.hasFunnel || state.hasTreemap || state.hasRadar) {
32702
+ left -= tWidth / 2 + size;
32703
+ top += tHeight;
32704
+ } else {
32705
+ top += rect.height / 2;
32706
+ left += rect.width / 2 - (tWidth - size);
32707
+ }
32687
32708
  }
32688
- const rect = (hasArcType ? main.node() : target).getBoundingClientRect();
32689
- if (left + tWidth > rect.right) {
32690
- left = rect.right - tWidth - size;
32709
+ if (left + tWidth > rect.width) {
32710
+ left = rect.width - tWidth - size;
32691
32711
  }
32692
- if (top + tHeight > rect.bottom) {
32693
- top -= tHeight + size;
32712
+ if (top + tHeight > rect.height) {
32713
+ top -= tHeight * 2;
32694
32714
  }
32695
32715
  return {
32696
32716
  top,
@@ -37271,7 +37291,7 @@ util_extend(zoom, {
37271
37291
  };
37272
37292
  $$.brush.scale = function(scale2) {
37273
37293
  const h = config.subchart_size_height;
37274
- let extent = $$.getExtent();
37294
+ let extent = $$.axis.getExtent();
37275
37295
  if (!extent && scale2.range) {
37276
37296
  extent = [[0, 0], [scale2.range()[1], h]];
37277
37297
  } else if (isArray(extent)) {
@@ -37452,25 +37472,6 @@ util_extend(zoom, {
37452
37472
  const subXAxis = (transitions == null ? void 0 : transitions.axisSubX) ? transitions.axisSubX : $T(subchart.main.select(`.${classes.axisX}`), withTransition);
37453
37473
  subchart.main.attr("transform", $$.getTranslate("context"));
37454
37474
  subXAxis.attr("transform", $$.getTranslate("subX"));
37455
- },
37456
- /**
37457
- * Get extent value
37458
- * @returns {Array} default extent
37459
- * @private
37460
- */
37461
- getExtent() {
37462
- const $$ = this;
37463
- const { config, scale } = $$;
37464
- let extent = config.axis_x_extent;
37465
- if (extent) {
37466
- if (isFunction(extent)) {
37467
- extent = extent.bind($$.api)($$.getXDomain($$.data.targets), scale.subX);
37468
- } else if ($$.axis.isTimeSeries() && extent.every(isNaN)) {
37469
- const fn = parseDate.bind($$);
37470
- extent = extent.map((v) => scale.subX(fn(v)));
37471
- }
37472
- }
37473
- return extent;
37474
37475
  }
37475
37476
  });
37476
37477
 
@@ -37712,12 +37713,14 @@ util_extend(zoom, {
37712
37713
  let start = 0;
37713
37714
  let end = 0;
37714
37715
  let zoomRect;
37716
+ let extent;
37715
37717
  const prop = {
37716
37718
  axis: isRotated ? "y" : "x",
37717
37719
  attr: isRotated ? "height" : "width",
37718
37720
  index: isRotated ? 1 : 0
37719
37721
  };
37720
37722
  $$.zoomBehaviour = drag().clickDistance(4).on("start", function(event) {
37723
+ extent = $$.scale.zoom ? null : $$.axis.getExtent();
37721
37724
  state.event = event;
37722
37725
  $$.setDragStatus(true);
37723
37726
  $$.unselectRect();
@@ -37725,11 +37728,25 @@ util_extend(zoom, {
37725
37728
  zoomRect = $$.$el.main.append("rect").attr("clip-path", state.clip.path).attr("class", $ZOOM.zoomBrush).attr("width", isRotated ? state.width : 0).attr("height", isRotated ? 0 : state.height);
37726
37729
  }
37727
37730
  start = getPointer(event, this)[prop.index];
37731
+ if (extent) {
37732
+ if (start < extent[0]) {
37733
+ start = extent[0];
37734
+ } else if (start > extent[1]) {
37735
+ start = extent[1];
37736
+ }
37737
+ }
37728
37738
  end = start;
37729
37739
  zoomRect.attr(prop.axis, start).attr(prop.attr, 0);
37730
37740
  $$.onZoomStart(event);
37731
37741
  }).on("drag", function(event) {
37732
37742
  end = getPointer(event, this)[prop.index];
37743
+ if (extent) {
37744
+ if (end > extent[1]) {
37745
+ end = extent[1];
37746
+ } else if (end < extent[0]) {
37747
+ end = extent[0];
37748
+ }
37749
+ }
37733
37750
  zoomRect.attr(prop.axis, Math.min(start, end)).attr(prop.attr, Math.abs(end - start));
37734
37751
  }).on("end", (event) => {
37735
37752
  const scale = $$.scale.zoom || $$.scale.x;
@@ -39756,6 +39773,25 @@ class Axis_Axis {
39756
39773
  }
39757
39774
  return type;
39758
39775
  }
39776
+ /**
39777
+ * Get extent value
39778
+ * @returns {Array} default extent
39779
+ * @private
39780
+ */
39781
+ getExtent() {
39782
+ const $$ = this.owner;
39783
+ const { config, scale } = $$;
39784
+ let extent = config.axis_x_extent;
39785
+ if (extent) {
39786
+ if (isFunction(extent)) {
39787
+ extent = extent.bind($$.api)($$.getXDomain($$.data.targets), scale.subX);
39788
+ } else if (this.isTimeSeries() && extent.every(isNaN)) {
39789
+ const fn = parseDate.bind($$);
39790
+ extent = extent.map((v) => scale.subX(fn(v)));
39791
+ }
39792
+ }
39793
+ return extent;
39794
+ }
39759
39795
  init() {
39760
39796
  const $$ = this.owner;
39761
39797
  const { config, $el: { main, axis }, state: { clip } } = $$;
@@ -42405,7 +42441,8 @@ function smoothLines(el, type) {
42405
42441
  */
42406
42442
  axis_x_height: void 0,
42407
42443
  /**
42408
- * Set default extent for subchart and zoom. This can be an array or function that returns an array.
42444
+ * Set extent for subchart and zoom(drag only). This can be an array or function that returns an array.
42445
+ * - **NOTE:** Specifying value, will limit the zoom scope selection within.
42409
42446
  * @name axis․x․extent
42410
42447
  * @memberof Options
42411
42448
  * @type {Array|Function}
@@ -48691,8 +48728,9 @@ ${percentValue}%`;
48691
48728
  * @property {number} [gauge.expand.rate=0.98] Set expand rate.
48692
48729
  * @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
48693
48730
  * @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
48694
- * - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
48695
- * - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
48731
+ * - **Note:** Only works for single data series.
48732
+ * - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
48733
+ * - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
48696
48734
  * @property {number} [gauge.min=0] Set min value of the gauge.
48697
48735
  * @property {number} [gauge.max=100] Set max value of the gauge.
48698
48736
  * @property {number} [gauge.startingAngle=-1 * Math.PI / 2] Set starting angle where data draws.
@@ -49195,7 +49233,7 @@ const bb = {
49195
49233
  * bb.version; // "1.0.0"
49196
49234
  * @memberof bb
49197
49235
  */
49198
- version: "3.14.1",
49236
+ version: "3.14.3",
49199
49237
  /**
49200
49238
  * Generate chart
49201
49239
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: