billboard.js 3.7.2 → 3.7.4

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 (40) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +19 -14
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +19 -14
  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 +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2 -2
  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 +23 -18
  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 +11 -11
  35. package/src/ChartInternal/data/data.ts +8 -5
  36. package/src/ChartInternal/internals/redraw.ts +7 -7
  37. package/src/ChartInternal/shape/arc.ts +4 -2
  38. package/src/ChartInternal/shape/bar.ts +5 -2
  39. package/types/chart.d.ts +3 -13
  40. 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.2
8
+ * @version 3.7.4
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.2
8
+ * @version 3.7.4
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -4618,11 +4618,12 @@ function getDataKeyForJson(keysParam, config) {
4618
4618
  }.bind(this))).map(function (v) {
4619
4619
  _newArrowCheck(this, _this14);
4620
4620
  return v.value;
4621
- }.bind(this)).reduce(function (p, c) {
4621
+ }.bind(this));
4622
+ total = sum.length ? sum.reduce(function (p, c) {
4622
4623
  _newArrowCheck(this, _this14);
4623
4624
  return p + c;
4624
- }.bind(this));
4625
- $$.cache.add(cacheKey, total = sum);
4625
+ }.bind(this)) : 0;
4626
+ $$.cache.add(cacheKey, total);
4626
4627
  }
4627
4628
  if (subtractHidden) {
4628
4629
  total -= $$.getHiddenTotalDataSum();
@@ -5252,7 +5253,8 @@ function getDataKeyForJson(keysParam, config) {
5252
5253
  }.bind(this));
5253
5254
  }
5254
5255
  }
5255
- d.ratio = isNumber(d.value) && total ? d.value / total[d.index] : 0;
5256
+ var divisor = total[d.index];
5257
+ d.ratio = isNumber(d.value) && total && divisor ? d.value / divisor : 0;
5256
5258
  ratio = d.ratio;
5257
5259
  } else if (type === "radar") {
5258
5260
  ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio;
@@ -7381,14 +7383,14 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
7381
7383
  $$.updateCircleY && ($$.circleY = $$.updateCircleY());
7382
7384
  }
7383
7385
 
7386
+ // Data empty label positioning and text.
7387
+ config.data_empty_label_text && main.select("text." + $TEXT.text + "." + $COMMON.empty).attr("x", state.width / 2).attr("y", state.height / 2).text(config.data_empty_label_text).style("display", targetsToShow.length ? "none" : null);
7388
+
7384
7389
  // update axis
7385
7390
  if (state.hasAxis) {
7386
7391
  // @TODO: Make 'init' state to be accessible everywhere not passing as argument.
7387
7392
  $$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
7388
7393
 
7389
- // Data empty label positioning and text.
7390
- config.data_empty_label_text && main.select("text." + $TEXT.text + "." + $COMMON.empty).attr("x", state.width / 2).attr("y", state.height / 2).text(config.data_empty_label_text).style("display", targetsToShow.length ? "none" : null);
7391
-
7392
7394
  // grid
7393
7395
  $$.hasGrid() && $$.updateGrid();
7394
7396
 
@@ -18825,6 +18827,7 @@ function getAttrTweenFn(fn) {
18825
18827
  state = $$.state,
18826
18828
  hasMultiArcGauge = $$.hasMultiArcGauge(),
18827
18829
  isFullCircle = config.gauge_fullCircle,
18830
+ showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 && !!config.data_empty_label_text,
18828
18831
  startAngle = $$.getStartAngle(),
18829
18832
  endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1,
18830
18833
  backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground);
@@ -18837,7 +18840,7 @@ function getAttrTweenFn(fn) {
18837
18840
  }.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) {
18838
18841
  var id = _ref2.id;
18839
18842
  _newArrowCheck(this, _this14);
18840
- if (state.hiddenTargetIds.indexOf(id) >= 0) {
18843
+ if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
18841
18844
  return "M 0 0";
18842
18845
  }
18843
18846
  var d = {
@@ -18852,7 +18855,7 @@ function getAttrTweenFn(fn) {
18852
18855
  }.bind(this));
18853
18856
  backgroundArc.exit().remove();
18854
18857
  } else {
18855
- backgroundArc.attr("d", function () {
18858
+ backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
18856
18859
  _newArrowCheck(this, _this14);
18857
18860
  var d = {
18858
18861
  data: [{
@@ -19311,7 +19314,9 @@ function getAttrTweenFn(fn) {
19311
19314
  var points = getPoints(d, i),
19312
19315
  indexX = +isRotated,
19313
19316
  indexY = +!indexX,
19314
- isNegative = d.value < 0,
19317
+ isUnderZero = d.value < 0,
19318
+ isInverted = config["axis_" + $$.axis.getId(d.id) + "_inverted"],
19319
+ isNegative = !isInverted && isUnderZero || isInverted && !isUnderZero,
19315
19320
  pathRadius = ["", ""]; // switch points if axis is rotated, not applicable for sub chart
19316
19321
  var radius = 0;
19317
19322
  var isGrouped = $$.isGrouped(d.id),
@@ -19328,7 +19333,7 @@ function getAttrTweenFn(fn) {
19328
19333
 
19329
19334
  // path string data shouldn't be containing new line chars
19330
19335
  // https://github.com/naver/billboard.js/issues/530
19331
- 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];
19336
+ 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];
19332
19337
  return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z";
19333
19338
  }.bind(this);
19334
19339
  },
@@ -24501,7 +24506,7 @@ var _defaults = {};
24501
24506
 
24502
24507
  /**
24503
24508
  * @namespace bb
24504
- * @version 3.7.2
24509
+ * @version 3.7.4
24505
24510
  */
24506
24511
  var bb = {
24507
24512
  /**
@@ -24511,7 +24516,7 @@ var bb = {
24511
24516
  * bb.version; // "1.0.0"
24512
24517
  * @memberof bb
24513
24518
  */
24514
- version: "3.7.2",
24519
+ version: "3.7.4",
24515
24520
  /**
24516
24521
  * Generate chart
24517
24522
  * - **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.2
8
+ * @version 3.7.4
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}