billboard.js 3.11.0 → 3.11.1

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 (48) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +52 -28
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +48 -22
  6. package/dist/billboard.pkgd.min.js +4 -2
  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 +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 +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 +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2 -2
  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/theme/modern.css +1 -1
  36. package/dist/theme/modern.min.css +1 -1
  37. package/dist-esm/billboard.js +32 -14
  38. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  39. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  43. package/package.json +16 -14
  44. package/src/ChartInternal/Axis/AxisRenderer.ts +2 -1
  45. package/src/ChartInternal/interactions/zoom.ts +9 -3
  46. package/src/ChartInternal/internals/title.ts +2 -2
  47. package/src/ChartInternal/internals/tooltip.ts +1 -1
  48. package/src/ChartInternal/shape/shape.ts +18 -6
@@ -5,9 +5,11 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.11.0
8
+ * @version 3.11.1
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
+ * - @types/d3-selection ^3.0.0
12
+ * - @types/d3-transition ^3.0.0
11
13
  * - d3-axis ^3.0.0
12
14
  * - d3-brush ^3.0.0
13
15
  * - d3-drag ^3.0.0
@@ -34754,29 +34756,43 @@ function getGroupedDataPointsFn(d) {
34754
34756
  return points ? points(d, i)[0][1] : $$.getYScaleById(id)($$.getBaseValue(d));
34755
34757
  },
34756
34758
  getBarW: function getBarW(type, axis, targetsNum) {
34757
- var _this11 = this;
34759
+ var _config$data_groups,
34760
+ _config$axis_x_min,
34761
+ _config$axis_x_max,
34762
+ _this11 = this;
34758
34763
  const $$ = this,
34759
34764
  config = $$.config,
34760
34765
  org = $$.org,
34761
34766
  scale = $$.scale,
34762
34767
  maxDataCount = $$.getMaxDataCount(),
34763
- isGrouped = type === "bar" && config.data_groups.length,
34768
+ isGrouped = type === "bar" && ((_config$data_groups = config.data_groups) == null ? void 0 : _config$data_groups.length),
34764
34769
  configName = type + "_width",
34765
- tickInterval = scale.zoom && !$$.axis.isCategorized() ? org.xDomain.map(function (v) {
34770
+ _$$$getZoomTransform = $$.getZoomTransform(),
34771
+ k = _$$$getZoomTransform.k,
34772
+ xMinMax = [(_config$axis_x_min = config.axis_x_min) != null ? _config$axis_x_min : org.xDomain[0], (_config$axis_x_max = config.axis_x_max) != null ? _config$axis_x_max : org.xDomain[1]].map($$.axis.isTimeSeries() ? parseDate.bind($$) : Number);
34773
+ let tickInterval = axis.tickInterval(maxDataCount);
34774
+ if (scale.zoom && !$$.axis.isCategorized() && k > 1) {
34775
+ const isSameMinMax = xMinMax.every(function (v, i) {
34776
+ _newArrowCheck(this, _this11);
34777
+ return v === org.xDomain[i];
34778
+ }.bind(this));
34779
+ tickInterval = org.xDomain.map(function (v, i) {
34766
34780
  _newArrowCheck(this, _this11);
34767
- return scale.zoom(v);
34781
+ const value = isSameMinMax ? v : v - Math.abs(xMinMax[i]);
34782
+ return scale.zoom(value);
34768
34783
  }.bind(this)).reduce(function (a, c) {
34769
34784
  _newArrowCheck(this, _this11);
34770
34785
  return Math.abs(a) + c;
34771
- }.bind(this)) / maxDataCount : axis.tickInterval(maxDataCount),
34772
- getWidth = function (id) {
34773
- _newArrowCheck(this, _this11);
34774
- const width = id ? config[configName][id] : config[configName],
34775
- ratio = id ? width.ratio : config[configName + "_ratio"],
34776
- max = id ? width.max : config[configName + "_max"],
34777
- w = isNumber(width) ? width : targetsNum ? tickInterval * ratio / targetsNum : 0;
34778
- return max && w > max ? max : w;
34779
- }.bind(this);
34786
+ }.bind(this)) / maxDataCount;
34787
+ }
34788
+ const getWidth = function (id) {
34789
+ _newArrowCheck(this, _this11);
34790
+ const width = id ? config[configName][id] : config[configName],
34791
+ ratio = id ? width.ratio : config[configName + "_ratio"],
34792
+ max = id ? width.max : config[configName + "_max"],
34793
+ w = isNumber(width) ? width : targetsNum ? tickInterval * ratio / targetsNum : 0;
34794
+ return max && w > max ? max : w;
34795
+ }.bind(this);
34780
34796
  let result = getWidth();
34781
34797
  if (!isGrouped && isObjectType(config[configName])) {
34782
34798
  result = {
@@ -35883,9 +35899,9 @@ function getTextXPos(pos, width) {
35883
35899
  */
35884
35900
  getTitlePadding: function getTitlePadding() {
35885
35901
  const $$ = this,
35886
- $el = $$.$el,
35902
+ title = $$.$el.title,
35887
35903
  config = $$.config;
35888
- return (config.title_padding.top || 0) + $$.getTextRect($el.title, $TEXT.title).height + (config.title_padding.bottom || 0);
35904
+ return (config.title_padding.top || 0) + (title ? $$.getTextRect(title, $TEXT.title).height : 0) + (config.title_padding.bottom || 0);
35889
35905
  }
35890
35906
  });
35891
35907
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/tooltip.ts
@@ -36239,8 +36255,9 @@ function getTextXPos(pos, width) {
36239
36255
  y += 15;
36240
36256
  } else if (hasArcType) {
36241
36257
  if (!(inputType === "touch")) {
36258
+ var _$$$getTitlePadding;
36242
36259
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
36243
- y += hasGauge ? height : height / 2 + tHeight;
36260
+ y += (hasGauge ? height : height / 2 + tHeight) + ((_$$$getTitlePadding = $$.getTitlePadding == null ? void 0 : $$.getTitlePadding()) != null ? _$$$getTitlePadding : 0);
36244
36261
  }
36245
36262
  } else if (hasTreemap) {
36246
36263
  y += tHeight;
@@ -40827,14 +40844,16 @@ let AxisRenderer = /*#__PURE__*/function () {
40827
40844
  if (this.params.isCategory) {
40828
40845
  interval = tickOffset * 2;
40829
40846
  } else {
40830
- const length = this.g.select("path.domain").node().getTotalLength() - outerTickSize * 2;
40847
+ var _this$params$owner$sc;
40848
+ const scale = (_this$params$owner$sc = this.params.owner.scale.zoom) != null ? _this$params$owner$sc : this.helper.scale,
40849
+ length = this.g.select("path.domain").node().getTotalLength() - outerTickSize * 2;
40831
40850
  interval = length / (size || this.g.selectAll("line").size());
40832
40851
 
40833
40852
  // get the interval by its values
40834
40853
  const intervalByValue = tickValues ? tickValues.map(function (v, i, arr) {
40835
40854
  _newArrowCheck(this, _this5);
40836
40855
  const next = i + 1;
40837
- return next < arr.length ? this.helper.scale(arr[next]) - this.helper.scale(v) : null;
40856
+ return next < arr.length ? scale(arr[next]) - scale(v) : null;
40838
40857
  }.bind(this)).filter(Boolean) : [];
40839
40858
  interval = Math.min.apply(Math, intervalByValue.concat([interval]));
40840
40859
  }
@@ -53484,9 +53503,9 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
53484
53503
  if (config.zoom_type === "drag" && e && startEvent.clientX === e.clientX && startEvent.clientY === e.clientY) {
53485
53504
  return;
53486
53505
  }
53506
+ state.zooming = !1;
53487
53507
  $$.redrawEventRect();
53488
53508
  $$.updateZoom();
53489
- state.zooming = !1;
53490
53509
 
53491
53510
  // do not call event cb when is .unzoom() is called
53492
53511
  !isUnZoom && (e || state.dragging) && callFn(config.zoom_onzoomend, $$.api, (_$$$state$domain2 = $$.state.domain) != null ? _$$$state$domain2 : $$.zoom.getDomain());
@@ -53623,6 +53642,13 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
53623
53642
  $el.zoomResetBtn.style("display", null);
53624
53643
  }
53625
53644
  }
53645
+ },
53646
+ getZoomTransform: function getZoomTransform() {
53647
+ const $$ = this,
53648
+ eventRect = $$.$el.eventRect;
53649
+ return eventRect != null && eventRect.node() ? transform_transform(eventRect.node()) : {
53650
+ k: 1
53651
+ };
53626
53652
  }
53627
53653
  });
53628
53654
  ;// CONCATENATED MODULE: ./src/config/Options/data/selection.ts
@@ -54003,7 +54029,7 @@ let _defaults = {};
54003
54029
 
54004
54030
  /**
54005
54031
  * @namespace bb
54006
- * @version 3.11.0
54032
+ * @version 3.11.1
54007
54033
  */
54008
54034
  const bb = {
54009
54035
  /**
@@ -54013,7 +54039,7 @@ const bb = {
54013
54039
  * bb.version; // "1.0.0"
54014
54040
  * @memberof bb
54015
54041
  */
54016
- version: "3.11.0",
54042
+ version: "3.11.1",
54017
54043
  /**
54018
54044
  * Generate chart
54019
54045
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: