billboard.js 3.7.2 → 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 (38) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +9 -6
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +9 -6
  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 +10 -7
  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 +8 -8
  35. package/src/ChartInternal/data/data.ts +4 -2
  36. package/src/ChartInternal/shape/bar.ts +5 -2
  37. package/types/chart.d.ts +3 -13
  38. 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.3
9
9
  */
10
10
  import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
11
11
  import { pointer, select, namespaces, selectAll } from 'd3-selection';
@@ -4437,8 +4437,9 @@ var data$1 = {
4437
4437
  total = total.map(function (v, i) { return v - hiddenSum_1[i]; });
4438
4438
  }
4439
4439
  }
4440
- d.ratio = isNumber(d.value) && total ?
4441
- d.value / total[d.index] : 0;
4440
+ var divisor = total[d.index];
4441
+ d.ratio = isNumber(d.value) && total && divisor ?
4442
+ d.value / divisor : 0;
4442
4443
  ratio = d.ratio;
4443
4444
  }
4444
4445
  else if (type === "radar") {
@@ -17464,7 +17465,9 @@ var shapeBar = {
17464
17465
  // switch points if axis is rotated, not applicable for sub chart
17465
17466
  var indexX = +isRotated;
17466
17467
  var indexY = +!indexX;
17467
- var isNegative = d.value < 0;
17468
+ var isUnderZero = d.value < 0;
17469
+ var isInverted = config["axis_".concat($$.axis.getId(d.id), "_inverted")];
17470
+ var isNegative = (!isInverted && isUnderZero) || (isInverted && !isUnderZero);
17468
17471
  var pathRadius = ["", ""];
17469
17472
  var radius = 0;
17470
17473
  var isGrouped = $$.isGrouped(d.id);
@@ -17482,7 +17485,7 @@ var shapeBar = {
17482
17485
  // path string data shouldn't be containing new line chars
17483
17486
  // https://github.com/naver/billboard.js/issues/530
17484
17487
  var path = isRotated ?
17485
- "H".concat(points[1][indexX] - radius, " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) :
17488
+ "H".concat(points[1][indexX] + (isNegative ? radius : -radius), " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) :
17486
17489
  "V".concat(points[1][indexY] + (isNegative ? -radius : radius), " ").concat(pathRadius[0], "H").concat(points[2][indexX] - radius, " ").concat(pathRadius[1], "V").concat(points[3][indexY]);
17487
17490
  return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z");
17488
17491
  };
@@ -22111,7 +22114,7 @@ var zoomModule = function () {
22111
22114
  var defaults = {};
22112
22115
  /**
22113
22116
  * @namespace bb
22114
- * @version 3.7.2
22117
+ * @version 3.7.3
22115
22118
  */
22116
22119
  var bb = {
22117
22120
  /**
@@ -22121,7 +22124,7 @@ var bb = {
22121
22124
  * bb.version; // "1.0.0"
22122
22125
  * @memberof bb
22123
22126
  */
22124
- version: "3.7.2",
22127
+ version: "3.7.3",
22125
22128
  /**
22126
22129
  * Generate chart
22127
22130
  * - **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.2
8
+ * @version 3.7.3
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.2";
107
+ Plugin.version = "3.7.3";
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.2
8
+ * @version 3.7.3
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.2";
281
+ Plugin.version = "3.7.3";
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.2
8
+ * @version 3.7.3
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.2";
489
+ Plugin.version = "3.7.3";
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.2
8
+ * @version 3.7.3
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.2";
124
+ Plugin.version = "3.7.3";
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.2
8
+ * @version 3.7.3
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.2";
266
+ Plugin.version = "3.7.3";
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.2",
3
+ "version": "3.7.3",
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",
@@ -108,7 +108,7 @@
108
108
  "@babel/plugin-transform-runtime": "^7.19.1",
109
109
  "@babel/preset-env": "^7.20.2",
110
110
  "@babel/preset-typescript": "^7.18.6",
111
- "@babel/runtime": "^7.20.7",
111
+ "@babel/runtime": "^7.20.13",
112
112
  "@commitlint/cli": "17.4.2",
113
113
  "@commitlint/config-conventional": "^17.4.2",
114
114
  "@rollup/plugin-babel": "^6.0.3",
@@ -125,8 +125,8 @@
125
125
  "@types/d3": "^7.4.0",
126
126
  "@types/mocha": "^10.0.1",
127
127
  "@types/sinon": "^10.0.13",
128
- "@typescript-eslint/eslint-plugin": "^5.48.2",
129
- "@typescript-eslint/parser": "^5.48.2",
128
+ "@typescript-eslint/eslint-plugin": "^5.49.0",
129
+ "@typescript-eslint/parser": "^5.49.0",
130
130
  "babel-helper-modules": "^6.0.0",
131
131
  "babel-loader": "^9.1.2",
132
132
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -142,7 +142,7 @@
142
142
  "chai": "^4.3.7",
143
143
  "clean-webpack-plugin": "^4.0.0",
144
144
  "cloc": "^2.11.0",
145
- "core-js": "^3.27.1",
145
+ "core-js": "^3.27.2",
146
146
  "coveralls": "^3.1.1",
147
147
  "cross-env": "^7.0.3",
148
148
  "css-loader": "^6.7.3",
@@ -156,7 +156,7 @@
156
156
  "eslint": "^8.32.0",
157
157
  "eslint-config-naver": "^2.1.0",
158
158
  "eslint-plugin-import": "^2.27.5",
159
- "eslint-plugin-jsdoc": "^39.6.4",
159
+ "eslint-plugin-jsdoc": "^39.6.8",
160
160
  "eslint-webpack-plugin": "^3.2.0",
161
161
  "exports-loader": "^4.0.0",
162
162
  "hammer-simulator": "0.0.1",
@@ -180,10 +180,10 @@
180
180
  "mocha": "^10.2.0",
181
181
  "node-sass": "^8.0.0",
182
182
  "regenerator-runtime": "^0.13.11",
183
- "rollup": "^3.10.0",
183
+ "rollup": "^3.10.1",
184
184
  "rollup-plugin-delete": "^2.0.0",
185
185
  "sass-loader": "^13.2.0",
186
- "semantic-release": "^20.0.2",
186
+ "semantic-release": "^20.0.4",
187
187
  "simulant": "^0.2.2",
188
188
  "sinon": "^15.0.1",
189
189
  "string-replace-loader": "^3.1.0",
@@ -946,8 +946,10 @@ export default {
946
946
  }
947
947
  }
948
948
 
949
- d.ratio = isNumber(d.value) && total ?
950
- d.value / total[d.index] : 0;
949
+ const divisor = total[d.index];
950
+
951
+ d.ratio = isNumber(d.value) && total && divisor ?
952
+ d.value / divisor : 0;
951
953
 
952
954
  ratio = d.ratio;
953
955
  } else if (type === "radar") {
@@ -172,7 +172,10 @@ export default {
172
172
  const indexX = +isRotated;
173
173
  const indexY = +!indexX;
174
174
 
175
- const isNegative = d.value as number < 0;
175
+ const isUnderZero = d.value as number < 0;
176
+ const isInverted = config[`axis_${$$.axis.getId(d.id)}_inverted`];
177
+ const isNegative = (!isInverted && isUnderZero) || (isInverted && !isUnderZero);
178
+
176
179
  const pathRadius = ["", ""];
177
180
  let radius = 0;
178
181
 
@@ -197,7 +200,7 @@ export default {
197
200
  // path string data shouldn't be containing new line chars
198
201
  // https://github.com/naver/billboard.js/issues/530
199
202
  const path = isRotated ?
200
- `H${points[1][indexX] - radius} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` :
203
+ `H${points[1][indexX] + (isNegative ? radius : -radius)} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` :
201
204
  `V${points[1][indexY] + (isNegative ? -radius : radius)} ${pathRadius[0]}H${points[2][indexX] - radius} ${pathRadius[1]}V${points[3][indexY]}`;
202
205
 
203
206
  return `M${points[0][indexX]},${points[0][indexY]}${path}z`;
package/types/chart.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {Data} from "./options";
5
+ import {Data, RegionOptions} from "./options";
6
6
  import {ArrayOrString, d3Selection, DataArray, DataItem, PrimitiveArray, TargetIds} from "./types";
7
7
 
8
8
  export interface Chart {
@@ -102,23 +102,13 @@ export interface Chart {
102
102
  * Update regions.
103
103
  * @param regions Regions will be replaced with this argument. The format of this argument is the same as regions.
104
104
  */
105
- (regions: Array<{
106
- axis: "x" | "y" | "y2",
107
- start?: number | Date,
108
- end?: number | Date,
109
- class?: string
110
- }>): void;
105
+ (regions: RegionOptions[]): void;
111
106
 
112
107
  /**
113
108
  * Add new region. This API adds new region instead of replacing like regions.
114
109
  * @param grids New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
115
110
  */
116
- add<T = {
117
- axis: "x" | "y" | "y2",
118
- start?: number | Date,
119
- end?: number | Date,
120
- class?: string
121
- }>(regions: T | T[]): void;
111
+ add(regions: RegionOptions | RegionOptions[]): void;
122
112
 
123
113
  /**
124
114
  * Remove regions. This API removes regions.
@@ -383,7 +383,7 @@ export interface ChartOptions {
383
383
  }
384
384
 
385
385
  export interface RegionOptions {
386
- axis?: string;
386
+ axis?: "x" | "y" | "y2";
387
387
  start?: string | number | Date;
388
388
  end?: string | number | Date;
389
389
  class?: string;