billboard.js 3.7.1 → 3.7.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 (44) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +39 -24
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +1247 -1193
  6. package/dist/billboard.pkgd.min.js +2 -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.js +1159 -1130
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1160 -1131
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1204 -1165
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1161 -1132
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1161 -1132
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +38 -24
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  34. package/package.json +13 -13
  35. package/src/Chart/api/data.ts +2 -2
  36. package/src/Chart/api/grid.x.ts +2 -2
  37. package/src/Chart/api/grid.y.ts +4 -2
  38. package/src/Chart/api/regions.ts +2 -2
  39. package/src/Chart/api/tooltip.ts +2 -2
  40. package/src/ChartInternal/data/data.ts +4 -2
  41. package/src/ChartInternal/internals/text.ts +14 -4
  42. package/src/ChartInternal/shape/bar.ts +9 -4
  43. package/types/chart.d.ts +4 -4
  44. package/types/options.d.ts +1 -1
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.7.1
8
+ * @version 3.7.3
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.7.1
8
+ * @version 3.7.3
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -5252,7 +5252,8 @@ function getDataKeyForJson(keysParam, config) {
5252
5252
  }.bind(this));
5253
5253
  }
5254
5254
  }
5255
- d.ratio = isNumber(d.value) && total ? d.value / total[d.index] : 0;
5255
+ var divisor = total[d.index];
5256
+ d.ratio = isNumber(d.value) && total && divisor ? d.value / divisor : 0;
5256
5257
  ratio = d.ratio;
5257
5258
  } else if (type === "radar") {
5258
5259
  ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio;
@@ -8799,14 +8800,17 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
8799
8800
  $el = $$.$el,
8800
8801
  $T = $$.$T,
8801
8802
  config = $$.config,
8803
+ axis = $$.axis,
8802
8804
  classText = $$.getClass("text", "index"),
8803
8805
  labelsCentered = config.data_labels.centered,
8804
8806
  text = $el.main.selectAll("." + $TEXT.texts).selectAll("." + $TEXT.text).data($$.labelishData.bind($$));
8805
8807
  $T(text.exit()).style("fill-opacity", "0").remove();
8806
8808
  $el.text = text.enter().append("text").merge(text).attr("class", classText).attr("text-anchor", function (d) {
8807
8809
  _newArrowCheck(this, _this2);
8810
+ var isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"];
8811
+
8808
8812
  // when value is negative or
8809
- var isEndAnchor = d.value < 0;
8813
+ var isEndAnchor = isInverted ? d.value > 0 : d.value < 0;
8810
8814
  if ($$.isCandlestickType(d)) {
8811
8815
  var data = $$.getCandlestickData(d);
8812
8816
  isEndAnchor = !(data != null && data._isUp);
@@ -9047,8 +9051,15 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9047
9051
  xPos += config.data_labels.centered ? 0 : 5;
9048
9052
  } else {
9049
9053
  if (isRotated) {
9050
- var padding = $$.isBarType(d) ? 4 : 6;
9051
- xPos = points[2][1] + padding * (d.value < 0 ? -1 : 1);
9054
+ var isInverted = config["axis_" + $$.axis.getId(d.id) + "_inverted"],
9055
+ padding = $$.isBarType(d) ? 4 : 6,
9056
+ value = d.value;
9057
+ xPos = points[2][1];
9058
+ if (isInverted) {
9059
+ xPos -= padding * (value > 0 ? 1 : -1);
9060
+ } else {
9061
+ xPos += padding * (value < 0 ? -1 : 1);
9062
+ }
9052
9063
  } else {
9053
9064
  xPos = $$.hasType("bar") ? (points[2][0] + points[0][0]) / 2 : xPos;
9054
9065
  }
@@ -11145,7 +11156,7 @@ function loadConfig(config) {
11145
11156
  * // Get all data
11146
11157
  * chart.data();
11147
11158
  */
11148
- function api_data_data(targetIds) {
11159
+ var api_data_data = function (targetIds) {
11149
11160
  var _this = this,
11150
11161
  targets = this.internal.data.targets;
11151
11162
  if (!isUndefined(targetIds)) {
@@ -11160,7 +11171,7 @@ function api_data_data(targetIds) {
11160
11171
  }.bind(this));
11161
11172
  }
11162
11173
  return targets;
11163
- }
11174
+ };
11164
11175
  extend(api_data_data, {
11165
11176
  /**
11166
11177
  * Get data shown in the chart.
@@ -12324,9 +12335,9 @@ var tooltip_tooltip = {
12324
12335
  // reset last touch point index
12325
12336
  inputType === "touch" && $$.callOverOutForTouch();
12326
12337
  $$.hideTooltip(!0);
12327
- $$.hideGridFocus();
12338
+ $$.hideGridFocus == null ? void 0 : $$.hideGridFocus();
12328
12339
  $$.unexpandCircles == null ? void 0 : $$.unexpandCircles();
12329
- $$.expandBarTypeShapes(!1);
12340
+ $$.expandBarTypeShapes == null ? void 0 : $$.expandBarTypeShapes(!1);
12330
12341
  }
12331
12342
  };
12332
12343
  /* harmony default export */ var api_tooltip = ({
@@ -12749,7 +12760,7 @@ var axis = {
12749
12760
  * ]);
12750
12761
  * // --> Returns: [{value: 1, text: "Label 1"}, {value: 4, text: "Label 4"}]
12751
12762
  */
12752
- function xgrids(grids) {
12763
+ var xgrids = function (grids) {
12753
12764
  var $$ = this.internal,
12754
12765
  config = $$.config;
12755
12766
  if (!grids) {
@@ -12758,7 +12769,7 @@ function xgrids(grids) {
12758
12769
  config.grid_x_lines = grids;
12759
12770
  $$.redrawWithoutRescale();
12760
12771
  return config.grid_x_lines;
12761
- }
12772
+ };
12762
12773
  extend(xgrids, {
12763
12774
  /**
12764
12775
  * Add x grid lines.<br>
@@ -12832,7 +12843,7 @@ extend(xgrids, {
12832
12843
  * ]);
12833
12844
  * // --> Returns: [{value: 100, text: "Label 1"}, {value: 400, text: "Label 4"}]
12834
12845
  */
12835
- function ygrids(grids) {
12846
+ var ygrids = function (grids) {
12836
12847
  var $$ = this.internal,
12837
12848
  config = $$.config;
12838
12849
  if (!grids) {
@@ -12841,7 +12852,7 @@ function ygrids(grids) {
12841
12852
  config.grid_y_lines = grids;
12842
12853
  $$.redrawWithoutRescale();
12843
12854
  return config.grid_y_lines;
12844
- }
12855
+ };
12845
12856
  extend(ygrids, {
12846
12857
  /**
12847
12858
  * Add y grid lines.<br>
@@ -12948,16 +12959,16 @@ extend(ygrids, {
12948
12959
  * {axis: "y", end: 50, class: "regionY"}
12949
12960
  * ]);
12950
12961
  */
12951
- function regions(regions) {
12962
+ var regions = function (_regions) {
12952
12963
  var $$ = this.internal,
12953
12964
  config = $$.config;
12954
- if (!regions) {
12965
+ if (!_regions) {
12955
12966
  return config.regions;
12956
12967
  }
12957
- config.regions = regions;
12968
+ config.regions = _regions;
12958
12969
  $$.redrawWithoutRescale();
12959
- return regions;
12960
- }
12970
+ return _regions;
12971
+ };
12961
12972
  extend(regions, {
12962
12973
  /**
12963
12974
  * Add new region.<br><br>
@@ -19301,7 +19312,9 @@ function getAttrTweenFn(fn) {
19301
19312
  var points = getPoints(d, i),
19302
19313
  indexX = +isRotated,
19303
19314
  indexY = +!indexX,
19304
- isNegative = d.value < 0,
19315
+ isUnderZero = d.value < 0,
19316
+ isInverted = config["axis_" + $$.axis.getId(d.id) + "_inverted"],
19317
+ isNegative = !isInverted && isUnderZero || isInverted && !isUnderZero,
19305
19318
  pathRadius = ["", ""]; // switch points if axis is rotated, not applicable for sub chart
19306
19319
  var radius = 0;
19307
19320
  var isGrouped = $$.isGrouped(d.id),
@@ -19318,7 +19331,7 @@ function getAttrTweenFn(fn) {
19318
19331
 
19319
19332
  // path string data shouldn't be containing new line chars
19320
19333
  // https://github.com/naver/billboard.js/issues/530
19321
- var path = isRotated ? "H" + (points[1][indexX] - radius) + " " + pathRadius[0] + "V" + (points[2][indexY] - radius) + " " + pathRadius[1] + "H" + points[3][indexX] : "V" + (points[1][indexY] + (isNegative ? -radius : radius)) + " " + pathRadius[0] + "H" + (points[2][indexX] - radius) + " " + pathRadius[1] + "V" + points[3][indexY];
19334
+ var path = isRotated ? "H" + (points[1][indexX] + (isNegative ? radius : -radius)) + " " + pathRadius[0] + "V" + (points[2][indexY] - radius) + " " + pathRadius[1] + "H" + points[3][indexX] : "V" + (points[1][indexY] + (isNegative ? -radius : radius)) + " " + pathRadius[0] + "H" + (points[2][indexX] - radius) + " " + pathRadius[1] + "V" + points[3][indexY];
19322
19335
  return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z";
19323
19336
  }.bind(this);
19324
19337
  },
@@ -19389,15 +19402,17 @@ function getAttrTweenFn(fn) {
19389
19402
  yScale = $$.getYScaleById.bind($$);
19390
19403
  return function (d, i) {
19391
19404
  _newArrowCheck(this, _this7);
19392
- var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
19405
+ var id = d.id,
19406
+ y0 = yScale.call($$, id, isSub)($$.getShapeYMin(id)),
19393
19407
  offset = barOffset(d, i) || y0,
19394
19408
  width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
19409
+ isInverted = config["axis_" + $$.axis.getId(id) + "_inverted"],
19395
19410
  value = d.value,
19396
19411
  posX = barX(d);
19397
19412
  var posY = barY(d);
19398
19413
 
19399
19414
  // fix posY not to overflow opposite quadrant
19400
- if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
19415
+ if (config.axis_rotated && !isInverted && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
19401
19416
  posY = y0;
19402
19417
  }
19403
19418
  if (!$$.isBarRangeType(d)) {
@@ -24489,7 +24504,7 @@ var _defaults = {};
24489
24504
 
24490
24505
  /**
24491
24506
  * @namespace bb
24492
- * @version 3.7.1
24507
+ * @version 3.7.3
24493
24508
  */
24494
24509
  var bb = {
24495
24510
  /**
@@ -24499,7 +24514,7 @@ var bb = {
24499
24514
  * bb.version; // "1.0.0"
24500
24515
  * @memberof bb
24501
24516
  */
24502
- version: "3.7.1",
24517
+ version: "3.7.3",
24503
24518
  /**
24504
24519
  * Generate chart
24505
24520
  * - **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.7.1
8
+ * @version 3.7.3
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-bars path,.bb-event-rect,.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid,.bb-ygrid-focus{shape-rendering:crispEdges}.bb-chart-arc .bb-gauge-value{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{fill:#4682b4}.bb-brush .extent,.bb-region,.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;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777;empty-cells:show;opacity:.9}.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}