billboard.js 3.7.3 → 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 (37) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +13 -11
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +13 -11
  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 +16 -14
  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 +7 -7
  35. package/src/ChartInternal/data/data.ts +4 -3
  36. package/src/ChartInternal/internals/redraw.ts +7 -7
  37. package/src/ChartInternal/shape/arc.ts +4 -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.7.3
8
+ * @version 3.7.4
9
9
  */
10
10
  import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
11
11
  import { pointer, select, namespaces, selectAll } from 'd3-selection';
@@ -3945,9 +3945,9 @@ var data$1 = {
3945
3945
  var total = $$.cache.get(cacheKey);
3946
3946
  if (!isNumber(total)) {
3947
3947
  var sum = mergeArray($$.data.targets.map(function (t) { return t.values; }))
3948
- .map(function (v) { return v.value; })
3949
- .reduce(function (p, c) { return p + c; });
3950
- $$.cache.add(cacheKey, total = sum);
3948
+ .map(function (v) { return v.value; });
3949
+ total = sum.length ? sum.reduce(function (p, c) { return p + c; }) : 0;
3950
+ $$.cache.add(cacheKey, total);
3951
3951
  }
3952
3952
  if (subtractHidden) {
3953
3953
  total -= $$.getHiddenTotalDataSum();
@@ -6350,16 +6350,16 @@ var redraw = {
6350
6350
  if (!treemap && (!$$.hasArcType() || state.hasRadar)) {
6351
6351
  $$.updateCircleY && ($$.circleY = $$.updateCircleY());
6352
6352
  }
6353
+ // Data empty label positioning and text.
6354
+ config.data_empty_label_text && main.select("text.".concat($TEXT.text, ".").concat($COMMON.empty))
6355
+ .attr("x", state.width / 2)
6356
+ .attr("y", state.height / 2)
6357
+ .text(config.data_empty_label_text)
6358
+ .style("display", targetsToShow.length ? "none" : null);
6353
6359
  // update axis
6354
6360
  if (state.hasAxis) {
6355
6361
  // @TODO: Make 'init' state to be accessible everywhere not passing as argument.
6356
6362
  $$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
6357
- // Data empty label positioning and text.
6358
- config.data_empty_label_text && main.select("text.".concat($TEXT.text, ".").concat($COMMON.empty))
6359
- .attr("x", state.width / 2)
6360
- .attr("y", state.height / 2)
6361
- .text(config.data_empty_label_text)
6362
- .style("display", targetsToShow.length ? "none" : null);
6363
6363
  // grid
6364
6364
  $$.hasGrid() && $$.updateGrid();
6365
6365
  // rect for regions
@@ -17004,6 +17004,8 @@ var shapeArc = {
17004
17004
  var config = $$.config, state = $$.state;
17005
17005
  var hasMultiArcGauge = $$.hasMultiArcGauge();
17006
17006
  var isFullCircle = config.gauge_fullCircle;
17007
+ var showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 &&
17008
+ !!config.data_empty_label_text;
17007
17009
  var startAngle = $$.getStartAngle();
17008
17010
  var endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
17009
17011
  var backgroundArc = $$.$el.arcs.select("".concat(hasMultiArcGauge ? "g" : "", ".").concat($ARC.chartArcsBackground));
@@ -17019,7 +17021,7 @@ var shapeArc = {
17019
17021
  .style("fill", (config.gauge_background) || null)
17020
17022
  .attr("d", function (_a) {
17021
17023
  var id = _a.id;
17022
- if (state.hiddenTargetIds.indexOf(id) >= 0) {
17024
+ if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
17023
17025
  return "M 0 0";
17024
17026
  }
17025
17027
  var d = {
@@ -17033,7 +17035,7 @@ var shapeArc = {
17033
17035
  backgroundArc.exit().remove();
17034
17036
  }
17035
17037
  else {
17036
- backgroundArc.attr("d", function () {
17038
+ backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
17037
17039
  var d = {
17038
17040
  data: [{ value: config.gauge_max }],
17039
17041
  startAngle: startAngle,
@@ -22114,7 +22116,7 @@ var zoomModule = function () {
22114
22116
  var defaults = {};
22115
22117
  /**
22116
22118
  * @namespace bb
22117
- * @version 3.7.3
22119
+ * @version 3.7.4
22118
22120
  */
22119
22121
  var bb = {
22120
22122
  /**
@@ -22124,7 +22126,7 @@ var bb = {
22124
22126
  * bb.version; // "1.0.0"
22125
22127
  * @memberof bb
22126
22128
  */
22127
- version: "3.7.3",
22129
+ version: "3.7.4",
22128
22130
  /**
22129
22131
  * Generate chart
22130
22132
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -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.3
8
+ * @version 3.7.4
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -104,7 +104,7 @@ var Plugin = /** @class */ (function () {
104
104
  delete _this[key];
105
105
  });
106
106
  };
107
- Plugin.version = "3.7.3";
107
+ Plugin.version = "3.7.4";
108
108
  return Plugin;
109
109
  }());
110
110
  var Plugin$1 = Plugin;
@@ -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.3
8
+ * @version 3.7.4
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -278,7 +278,7 @@ var Plugin = /** @class */ (function () {
278
278
  delete _this[key];
279
279
  });
280
280
  };
281
- Plugin.version = "3.7.3";
281
+ Plugin.version = "3.7.4";
282
282
  return Plugin;
283
283
  }());
284
284
  var Plugin$1 = Plugin;
@@ -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.3
8
+ * @version 3.7.4
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -486,7 +486,7 @@ var Plugin = /** @class */ (function () {
486
486
  delete _this[key];
487
487
  });
488
488
  };
489
- Plugin.version = "3.7.3";
489
+ Plugin.version = "3.7.4";
490
490
  return Plugin;
491
491
  }());
492
492
  var Plugin$1 = Plugin;
@@ -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.3
8
+ * @version 3.7.4
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -121,7 +121,7 @@ var Plugin = /** @class */ (function () {
121
121
  delete _this[key];
122
122
  });
123
123
  };
124
- Plugin.version = "3.7.3";
124
+ Plugin.version = "3.7.4";
125
125
  return Plugin;
126
126
  }());
127
127
  var Plugin$1 = Plugin;
@@ -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.3
8
+ * @version 3.7.4
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -263,7 +263,7 @@ var Plugin = /** @class */ (function () {
263
263
  delete _this[key];
264
264
  });
265
265
  };
266
- Plugin.version = "3.7.3";
266
+ Plugin.version = "3.7.4";
267
267
  return Plugin;
268
268
  }());
269
269
  var Plugin$1 = Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.7.3",
3
+ "version": "3.7.4",
4
4
  "description": "Re-usable easy interface JavaScript chart library, based on D3 v4+",
5
5
  "homepage": "https://naver.github.io/billboard.js/",
6
6
  "main": "dist/billboard.js",
@@ -153,10 +153,10 @@
153
153
  "d3-polygon": "^3.0.1",
154
154
  "docdash": "^2.0.1",
155
155
  "dtslint": "^4.2.1",
156
- "eslint": "^8.32.0",
156
+ "eslint": "^8.33.0",
157
157
  "eslint-config-naver": "^2.1.0",
158
158
  "eslint-plugin-import": "^2.27.5",
159
- "eslint-plugin-jsdoc": "^39.6.8",
159
+ "eslint-plugin-jsdoc": "^39.7.4",
160
160
  "eslint-webpack-plugin": "^3.2.0",
161
161
  "exports-loader": "^4.0.0",
162
162
  "hammer-simulator": "0.0.1",
@@ -180,18 +180,18 @@
180
180
  "mocha": "^10.2.0",
181
181
  "node-sass": "^8.0.0",
182
182
  "regenerator-runtime": "^0.13.11",
183
- "rollup": "^3.10.1",
183
+ "rollup": "^3.12.0",
184
184
  "rollup-plugin-delete": "^2.0.0",
185
185
  "sass-loader": "^13.2.0",
186
- "semantic-release": "^20.0.4",
186
+ "semantic-release": "^20.1.0",
187
187
  "simulant": "^0.2.2",
188
188
  "sinon": "^15.0.1",
189
189
  "string-replace-loader": "^3.1.0",
190
190
  "style-loader": "^3.3.1",
191
191
  "taffydb": "^2.7.3",
192
192
  "terser-webpack-plugin": "^5.3.6",
193
- "tslib": "^2.4.1",
194
- "typescript": "4.9.4",
193
+ "tslib": "^2.5.0",
194
+ "typescript": "4.9.5",
195
195
  "webpack": "^5.75.0",
196
196
  "webpack-bundle-analyzer": "^4.7.0",
197
197
  "webpack-clean": "^1.2.5",
@@ -343,10 +343,11 @@ export default {
343
343
 
344
344
  if (!isNumber(total)) {
345
345
  const sum = mergeArray($$.data.targets.map(t => t.values))
346
- .map(v => v.value)
347
- .reduce((p, c) => p + c);
346
+ .map(v => v.value);
347
+
348
+ total = sum.length ? sum.reduce((p, c) => p + c) : 0;
348
349
 
349
- $$.cache.add(cacheKey, total = sum);
350
+ $$.cache.add(cacheKey, total);
350
351
  }
351
352
 
352
353
  if (subtractHidden) {
@@ -40,18 +40,18 @@ export default {
40
40
  $$.updateCircleY && ($$.circleY = $$.updateCircleY());
41
41
  }
42
42
 
43
+ // Data empty label positioning and text.
44
+ config.data_empty_label_text && main.select(`text.${$TEXT.text}.${$COMMON.empty}`)
45
+ .attr("x", state.width / 2)
46
+ .attr("y", state.height / 2)
47
+ .text(config.data_empty_label_text)
48
+ .style("display", targetsToShow.length ? "none" : null);
49
+
43
50
  // update axis
44
51
  if (state.hasAxis) {
45
52
  // @TODO: Make 'init' state to be accessible everywhere not passing as argument.
46
53
  $$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
47
54
 
48
- // Data empty label positioning and text.
49
- config.data_empty_label_text && main.select(`text.${$TEXT.text}.${$COMMON.empty}`)
50
- .attr("x", state.width / 2)
51
- .attr("y", state.height / 2)
52
- .text(config.data_empty_label_text)
53
- .style("display", targetsToShow.length ? "none" : null);
54
-
55
55
  // grid
56
56
  $$.hasGrid() && $$.updateGrid();
57
57
 
@@ -758,6 +758,8 @@ export default {
758
758
  const {config, state} = $$;
759
759
  const hasMultiArcGauge = $$.hasMultiArcGauge();
760
760
  const isFullCircle = config.gauge_fullCircle;
761
+ const showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 &&
762
+ !!config.data_empty_label_text;
761
763
 
762
764
  const startAngle = $$.getStartAngle();
763
765
  const endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
@@ -779,7 +781,7 @@ export default {
779
781
  .merge(backgroundArc)
780
782
  .style("fill", (config.gauge_background) || null)
781
783
  .attr("d", ({id}) => {
782
- if (state.hiddenTargetIds.indexOf(id) >= 0) {
784
+ if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
783
785
  return "M 0 0";
784
786
  }
785
787
 
@@ -795,7 +797,7 @@ export default {
795
797
 
796
798
  backgroundArc.exit().remove();
797
799
  } else {
798
- backgroundArc.attr("d", () => {
800
+ backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : () => {
799
801
  const d = {
800
802
  data: [{value: config.gauge_max}],
801
803
  startAngle,