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
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.4
@@ -26370,11 +26370,12 @@ function getDataKeyForJson(keysParam, config) {
26370
26370
  }.bind(this))).map(function (v) {
26371
26371
  _newArrowCheck(this, _this14);
26372
26372
  return v.value;
26373
- }.bind(this)).reduce(function (p, c) {
26373
+ }.bind(this));
26374
+ total = sum.length ? sum.reduce(function (p, c) {
26374
26375
  _newArrowCheck(this, _this14);
26375
26376
  return p + c;
26376
- }.bind(this));
26377
- $$.cache.add(cacheKey, total = sum);
26377
+ }.bind(this)) : 0;
26378
+ $$.cache.add(cacheKey, total);
26378
26379
  }
26379
26380
  if (subtractHidden) {
26380
26381
  total -= $$.getHiddenTotalDataSum();
@@ -27004,7 +27005,8 @@ function getDataKeyForJson(keysParam, config) {
27004
27005
  }.bind(this));
27005
27006
  }
27006
27007
  }
27007
- d.ratio = isNumber(d.value) && total ? d.value / total[d.index] : 0;
27008
+ var divisor = total[d.index];
27009
+ d.ratio = isNumber(d.value) && total && divisor ? d.value / divisor : 0;
27008
27010
  ratio = d.ratio;
27009
27011
  } else if (type === "radar") {
27010
27012
  ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio;
@@ -29666,14 +29668,14 @@ function getLegendColor(id) {
29666
29668
  $$.updateCircleY && ($$.circleY = $$.updateCircleY());
29667
29669
  }
29668
29670
 
29671
+ // Data empty label positioning and text.
29672
+ 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);
29673
+
29669
29674
  // update axis
29670
29675
  if (state.hasAxis) {
29671
29676
  // @TODO: Make 'init' state to be accessible everywhere not passing as argument.
29672
29677
  $$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
29673
29678
 
29674
- // Data empty label positioning and text.
29675
- 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);
29676
-
29677
29679
  // grid
29678
29680
  $$.hasGrid() && $$.updateGrid();
29679
29681
 
@@ -43962,6 +43964,7 @@ function getAttrTweenFn(fn) {
43962
43964
  state = $$.state,
43963
43965
  hasMultiArcGauge = $$.hasMultiArcGauge(),
43964
43966
  isFullCircle = config.gauge_fullCircle,
43967
+ showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 && !!config.data_empty_label_text,
43965
43968
  startAngle = $$.getStartAngle(),
43966
43969
  endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1,
43967
43970
  backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground);
@@ -43974,7 +43977,7 @@ function getAttrTweenFn(fn) {
43974
43977
  }.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) {
43975
43978
  var id = _ref2.id;
43976
43979
  _newArrowCheck(this, _this14);
43977
- if (state.hiddenTargetIds.indexOf(id) >= 0) {
43980
+ if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
43978
43981
  return "M 0 0";
43979
43982
  }
43980
43983
  var d = {
@@ -43989,7 +43992,7 @@ function getAttrTweenFn(fn) {
43989
43992
  }.bind(this));
43990
43993
  backgroundArc.exit().remove();
43991
43994
  } else {
43992
- backgroundArc.attr("d", function () {
43995
+ backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
43993
43996
  _newArrowCheck(this, _this14);
43994
43997
  var d = {
43995
43998
  data: [{
@@ -44593,7 +44596,9 @@ function point_y(p) {
44593
44596
  var points = getPoints(d, i),
44594
44597
  indexX = +isRotated,
44595
44598
  indexY = +!indexX,
44596
- isNegative = d.value < 0,
44599
+ isUnderZero = d.value < 0,
44600
+ isInverted = config["axis_" + $$.axis.getId(d.id) + "_inverted"],
44601
+ isNegative = !isInverted && isUnderZero || isInverted && !isUnderZero,
44597
44602
  pathRadius = ["", ""]; // switch points if axis is rotated, not applicable for sub chart
44598
44603
  var radius = 0;
44599
44604
  var isGrouped = $$.isGrouped(d.id),
@@ -44610,7 +44615,7 @@ function point_y(p) {
44610
44615
 
44611
44616
  // path string data shouldn't be containing new line chars
44612
44617
  // https://github.com/naver/billboard.js/issues/530
44613
- 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];
44618
+ 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];
44614
44619
  return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z";
44615
44620
  }.bind(this);
44616
44621
  },
@@ -50892,7 +50897,7 @@ var _defaults = {};
50892
50897
 
50893
50898
  /**
50894
50899
  * @namespace bb
50895
- * @version 3.7.2
50900
+ * @version 3.7.4
50896
50901
  */
50897
50902
  var bb = {
50898
50903
  /**
@@ -50902,7 +50907,7 @@ var bb = {
50902
50907
  * bb.version; // "1.0.0"
50903
50908
  * @memberof bb
50904
50909
  */
50905
- version: "3.7.2",
50910
+ version: "3.7.4",
50906
50911
  /**
50907
50912
  * Generate chart
50908
50913
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: