billboard.js 3.9.2 → 3.10.0-next.1

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 (91) hide show
  1. package/README.md +2 -2
  2. package/dist/billboard.css +2 -2
  3. package/dist/billboard.js +2705 -2529
  4. package/dist/billboard.min.css +2 -2
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +3516 -3329
  7. package/dist/billboard.pkgd.min.js +4 -4
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +15 -15
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +215 -196
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +244 -239
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +184 -164
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +170 -151
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/{billboardjs-plugin-bubblecompare.js → billboardjs-plugin-bubblecompare.pkgd.js} +667 -642
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +12 -0
  20. package/dist/plugin/pkgd/{billboardjs-plugin-sparkline.js → billboardjs-plugin-sparkline.pkgd.js} +864 -820
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +12 -0
  22. package/dist/plugin/pkgd/{billboardjs-plugin-stanford.js → billboardjs-plugin-stanford.pkgd.js} +929 -900
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -0
  24. package/dist/plugin/pkgd/{billboardjs-plugin-tableview.js → billboardjs-plugin-tableview.pkgd.js} +833 -788
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -0
  26. package/dist/plugin/pkgd/{billboardjs-plugin-textoverlap.js → billboardjs-plugin-textoverlap.pkgd.js} +932 -897
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +12 -0
  28. package/dist/theme/dark.css +5 -4
  29. package/dist/theme/dark.min.css +2 -2
  30. package/dist/theme/datalab.css +5 -4
  31. package/dist/theme/datalab.min.css +2 -2
  32. package/dist/theme/graph.css +5 -4
  33. package/dist/theme/graph.min.css +2 -2
  34. package/dist/theme/insight.css +5 -4
  35. package/dist/theme/insight.min.css +2 -2
  36. package/dist-esm/billboard.js +605 -468
  37. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
  38. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +13 -7
  39. package/dist-esm/plugin/billboardjs-plugin-stanford.js +21 -28
  40. package/dist-esm/plugin/billboardjs-plugin-tableview.js +17 -11
  41. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +13 -7
  42. package/package.json +31 -31
  43. package/src/Chart/api/axis.ts +4 -0
  44. package/src/Chart/api/category.ts +8 -4
  45. package/src/Chart/api/export.ts +1 -2
  46. package/src/Chart/api/subchart.ts +162 -89
  47. package/src/Chart/api/zoom.ts +69 -79
  48. package/src/ChartInternal/Axis/AxisRendererHelper.ts +0 -8
  49. package/src/ChartInternal/data/IData.ts +4 -1
  50. package/src/ChartInternal/data/convert.helper.ts +1 -15
  51. package/src/ChartInternal/data/data.ts +8 -2
  52. package/src/ChartInternal/interactions/eventrect.ts +0 -1
  53. package/src/ChartInternal/interactions/flow.ts +1 -7
  54. package/src/ChartInternal/interactions/interaction.ts +10 -4
  55. package/src/ChartInternal/interactions/subchart.ts +36 -30
  56. package/src/ChartInternal/interactions/zoom.ts +13 -3
  57. package/src/ChartInternal/internals/category.ts +2 -2
  58. package/src/ChartInternal/internals/clip.ts +4 -4
  59. package/src/ChartInternal/internals/domain.ts +46 -10
  60. package/src/ChartInternal/internals/grid.ts +57 -86
  61. package/src/ChartInternal/internals/redraw.ts +0 -5
  62. package/src/ChartInternal/internals/region.ts +35 -12
  63. package/src/ChartInternal/internals/text.ts +1 -26
  64. package/src/ChartInternal/internals/title.ts +10 -48
  65. package/src/ChartInternal/internals/tooltip.ts +47 -51
  66. package/src/ChartInternal/shape/arc.ts +16 -6
  67. package/src/ChartInternal/shape/candlestick.ts +2 -17
  68. package/src/ChartInternal/shape/shape.ts +50 -4
  69. package/src/ChartInternal/shape/treemap.ts +2 -2
  70. package/src/Plugin/bubblecompare/index.ts +1 -1
  71. package/src/Plugin/stanford/Elements.ts +10 -2
  72. package/src/Plugin/stanford/index.ts +1 -24
  73. package/src/Plugin/tableview/index.ts +2 -2
  74. package/src/config/Options/axis/x.ts +1 -0
  75. package/src/config/Options/common/main.ts +12 -2
  76. package/src/config/Options/common/tooltip.ts +10 -10
  77. package/src/config/Options/data/axis.ts +3 -1
  78. package/src/config/Options/data/data.ts +10 -2
  79. package/src/config/Store/State.ts +3 -0
  80. package/src/module/Cache.ts +7 -5
  81. package/src/module/browser.ts +34 -14
  82. package/src/module/util.ts +8 -4
  83. package/src/module/worker.ts +24 -13
  84. package/src/scss/billboard.scss +4 -2
  85. package/src/scss/theme/dark.scss +4 -2
  86. package/src/scss/theme/datalab.scss +4 -2
  87. package/src/scss/theme/graph.scss +4 -2
  88. package/src/scss/theme/insight.scss +4 -2
  89. package/types/chart.d.ts +11 -0
  90. package/types/options.d.ts +3 -3
  91. package/types/types.d.ts +15 -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.9.2
8
+ * @version 3.10.0-next.1
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.9.2";
107
+ Plugin.version = "3.10.0-next.1";
108
108
  return Plugin;
109
109
  }());
110
110
  var Plugin$1 = Plugin;
@@ -173,7 +173,7 @@ var BubbleCompare = /** @class */ (function (_super) {
173
173
  d.raise && select(d.node().parentNode.parentNode).raise();
174
174
  };
175
175
  BubbleCompare.prototype.changeCursorPoint = function () {
176
- this.$$.$el.svg.select(".bb-event-rect").style("cursor", "pointer");
176
+ this.$$.$el.eventRect.style("cursor", "pointer");
177
177
  };
178
178
  BubbleCompare.prototype.findClosest = function (values, pos) {
179
179
  var _this = this;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.9.2
8
+ * @version 3.10.0-next.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -279,7 +279,7 @@ var Plugin = /** @class */ (function () {
279
279
  delete _this[key];
280
280
  });
281
281
  };
282
- Plugin.version = "3.9.2";
282
+ Plugin.version = "3.10.0-next.1";
283
283
  return Plugin;
284
284
  }());
285
285
  var Plugin$1 = Plugin;
@@ -325,12 +325,18 @@ var Options$1 = Options;
325
325
  * @private
326
326
  */
327
327
  /* eslint-disable no-new-func, no-undef */
328
- var win = (function () {
329
- var root = (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
328
+ /**
329
+ * Get global object
330
+ * @returns {object} window object
331
+ * @private
332
+ */
333
+ function getGlobal() {
334
+ return (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
330
335
  (typeof global === "object" && global !== null && global.Object === Object && global) ||
331
- (typeof self === "object" && self !== null && self.Object === Object && self);
332
- return root || Function("return this")();
333
- })();
336
+ (typeof self === "object" && self !== null && self.Object === Object && self) ||
337
+ Function("return this")();
338
+ }
339
+ var win = getGlobal();
334
340
  var doc = win === null || win === void 0 ? void 0 : win.document;
335
341
 
336
342
  var isDefined = function (v) { return typeof v !== "undefined"; };
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.9.2
8
+ * @version 3.10.0-next.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -236,12 +236,18 @@ _assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(
236
236
  * @private
237
237
  */
238
238
  /* eslint-disable no-new-func, no-undef */
239
- var win = (function () {
240
- var root = (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
239
+ /**
240
+ * Get global object
241
+ * @returns {object} window object
242
+ * @private
243
+ */
244
+ function getGlobal() {
245
+ return (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
241
246
  (typeof global === "object" && global !== null && global.Object === Object && global) ||
242
- (typeof self === "object" && self !== null && self.Object === Object && self);
243
- return root || Function("return this")();
244
- })();
247
+ (typeof self === "object" && self !== null && self.Object === Object && self) ||
248
+ Function("return this")();
249
+ }
250
+ var win = getGlobal();
245
251
  var doc = win === null || win === void 0 ? void 0 : win.document;
246
252
 
247
253
  var isFunction = function (v) { return typeof v === "function"; };
@@ -487,7 +493,7 @@ var Plugin = /** @class */ (function () {
487
493
  delete _this[key];
488
494
  });
489
495
  };
490
- Plugin.version = "3.9.2";
496
+ Plugin.version = "3.10.0-next.1";
491
497
  return Plugin;
492
498
  }());
493
499
  var Plugin$1 = Plugin;
@@ -793,9 +799,15 @@ var Elements = /** @class */ (function () {
793
799
  .select("line")
794
800
  .transition()
795
801
  .duration(duration)
796
- .attr("x1", function (d) { return (isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1")); })
802
+ .attr("x1", function (d) {
803
+ var v = isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
804
+ return v;
805
+ })
797
806
  .attr("x2", function (d) { return (isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2")); })
798
- .attr("y1", function (d) { return (isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1")); })
807
+ .attr("y1", function (d) {
808
+ var v = isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
809
+ return v;
810
+ })
799
811
  .attr("y2", function (d) { return (isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2")); })
800
812
  .transition()
801
813
  .style("opacity", null);
@@ -1103,25 +1115,6 @@ var Stanford = /** @class */ (function (_super) {
1103
1115
  d.colorscale = undefined;
1104
1116
  });
1105
1117
  };
1106
- Stanford.prototype.xvCustom = function (d, xyValue) {
1107
- var $$ = this;
1108
- var axis = $$.axis, config = $$.config;
1109
- var value = xyValue ? d[xyValue] : $$.getBaseValue(d);
1110
- if (axis.isTimeSeries()) {
1111
- value = parseDate.call($$, value);
1112
- }
1113
- else if (axis.isCategorized() && isString(value)) {
1114
- value = config.axis_x_categories.indexOf(d.value);
1115
- }
1116
- return Math.ceil($$.scale.x(value));
1117
- };
1118
- Stanford.prototype.yvCustom = function (d, xyValue) {
1119
- var $$ = this;
1120
- var scale = $$.scale;
1121
- var yScale = d.axis && d.axis === "y2" ? scale.y2 : scale.y;
1122
- var value = xyValue ? d[xyValue] : $$.getBaseValue(d);
1123
- return Math.ceil(yScale(value));
1124
- };
1125
1118
  Stanford.prototype.initStanfordData = function () {
1126
1119
  var config = this.config;
1127
1120
  var target = this.$$.data.targets[0];
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.9.2
8
+ * @version 3.10.0-next.1
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.9.2";
124
+ Plugin.version = "3.10.0-next.1";
125
125
  return Plugin;
126
126
  }());
127
127
  var Plugin$1 = Plugin;
@@ -259,12 +259,18 @@ var tpl = {
259
259
  * @private
260
260
  */
261
261
  /* eslint-disable no-new-func, no-undef */
262
- var win = (function () {
263
- var root = (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
262
+ /**
263
+ * Get global object
264
+ * @returns {object} window object
265
+ * @private
266
+ */
267
+ function getGlobal() {
268
+ return (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
264
269
  (typeof global === "object" && global !== null && global.Object === Object && global) ||
265
- (typeof self === "object" && self !== null && self.Object === Object && self);
266
- return root || Function("return this")();
267
- })();
270
+ (typeof self === "object" && self !== null && self.Object === Object && self) ||
271
+ Function("return this")();
272
+ }
273
+ var win = getGlobal();
268
274
  var doc = win === null || win === void 0 ? void 0 : win.document;
269
275
 
270
276
  var isNumber = function (v) { return typeof v === "number"; };
@@ -522,7 +528,7 @@ var TableView = /** @class */ (function (_super) {
522
528
  (isNumber(d) ? d.toLocaleString() : "")
523
529
  }); }).join(""), "</tr>");
524
530
  });
525
- var rx = /<[^>]+><\/[^>]+>/g;
531
+ var rx = /(<\/?(script|img)[^>]*>|<[^>]+><\/[^>]+>)/ig;
526
532
  var r = tplProcess(tpl.body, _assign(_assign({}, config), { title: config.title || $$.config.title_text || "", thead: thead, tbody: tbody })).replace(rx, "");
527
533
  element.innerHTML = r;
528
534
  };
@@ -532,12 +538,12 @@ var TableView = /** @class */ (function (_super) {
532
538
  !doNotUpdate && this.generateTable();
533
539
  };
534
540
  TableView.prototype.$willDestroy = function () {
535
- var _a;
536
- this.element.parentNode.removeChild(this.element);
541
+ var _a, _b;
542
+ (_a = this.element.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
537
543
  // remove default css style when left one chart instance
538
544
  if (this.$$.charts.length === 1) {
539
545
  var s = document.getElementById(defaultStyle.id);
540
- (_a = s === null || s === void 0 ? void 0 : s.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(s);
546
+ (_b = s === null || s === void 0 ? void 0 : s.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(s);
541
547
  }
542
548
  };
543
549
  return TableView;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.9.2
8
+ * @version 3.10.0-next.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -65,12 +65,18 @@ function __spreadArray(to, from, pack) {
65
65
  * @private
66
66
  */
67
67
  /* eslint-disable no-new-func, no-undef */
68
- var win = (function () {
69
- var root = (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
68
+ /**
69
+ * Get global object
70
+ * @returns {object} window object
71
+ * @private
72
+ */
73
+ function getGlobal() {
74
+ return (typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis) ||
70
75
  (typeof global === "object" && global !== null && global.Object === Object && global) ||
71
- (typeof self === "object" && self !== null && self.Object === Object && self);
72
- return root || Function("return this")();
73
- })();
76
+ (typeof self === "object" && self !== null && self.Object === Object && self) ||
77
+ Function("return this")();
78
+ }
79
+ var win = getGlobal();
74
80
  var doc = win === null || win === void 0 ? void 0 : win.document;
75
81
 
76
82
  var isDefined = function (v) { return typeof v !== "undefined"; };
@@ -263,7 +269,7 @@ var Plugin = /** @class */ (function () {
263
269
  delete _this[key];
264
270
  });
265
271
  };
266
- Plugin.version = "3.9.2";
272
+ Plugin.version = "3.10.0-next.1";
267
273
  return Plugin;
268
274
  }());
269
275
  var Plugin$1 = Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.9.2",
3
+ "version": "3.10.0-next.1",
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",
@@ -33,7 +33,7 @@
33
33
  "build:theme": "cross-env NODE_ENV=theme webpack",
34
34
  "build:production:analyzer": "cross-env ANALYZER=true npm run build:production",
35
35
  "build:packaged:analyzer": "cross-env ANALYZER=true npm run build:packaged",
36
- "build:plugin": "cross-env NODE_ENV=plugin webpack && cross-env NODE_ENV=plugin MODE=min webpack && cross-env NODE_ENV=plugin MODE=pkgd webpack",
36
+ "build:plugin": "cross-env NODE_ENV=plugin webpack && cross-env NODE_ENV=plugin MODE=min webpack && cross-env NODE_ENV=plugin MODE=pkgd webpack && cross-env NODE_ENV=plugin MODE=pkgd-min webpack",
37
37
  "build:plugin:types": "node ./config/type.d-plugin.js",
38
38
  "release": "semantic-release",
39
39
  "lint": "npm run lint:types && eslint src --ext .ts",
@@ -85,8 +85,8 @@
85
85
  "license": "MIT",
86
86
  "readmeFilename": "README.md",
87
87
  "dependencies": {
88
- "@types/d3-selection": "^3.0.5",
89
- "@types/d3-transition": "^3.0.3",
88
+ "@types/d3-selection": "^3.0.6",
89
+ "@types/d3-transition": "^3.0.4",
90
90
  "d3-axis": "^3.0.0",
91
91
  "d3-brush": "^3.0.0",
92
92
  "d3-drag": "^3.0.0",
@@ -102,32 +102,32 @@
102
102
  "d3-zoom": "^3.0.0"
103
103
  },
104
104
  "devDependencies": {
105
- "@babel/core": "^7.22.9",
106
- "@babel/eslint-parser": "^7.22.9",
105
+ "@babel/core": "^7.22.11",
106
+ "@babel/eslint-parser": "^7.22.11",
107
107
  "@babel/plugin-proposal-class-properties": "^7.18.6",
108
108
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
109
- "@babel/plugin-transform-runtime": "^7.22.9",
110
- "@babel/preset-env": "^7.22.9",
111
- "@babel/preset-typescript": "^7.22.5",
112
- "@babel/runtime": "^7.22.6",
113
- "@commitlint/cli": "17.6.7",
114
- "@commitlint/config-conventional": "^17.6.7",
109
+ "@babel/plugin-transform-runtime": "^7.22.10",
110
+ "@babel/preset-env": "^7.22.10",
111
+ "@babel/preset-typescript": "^7.22.11",
112
+ "@babel/runtime": "^7.22.11",
113
+ "@commitlint/cli": "17.7.1",
114
+ "@commitlint/config-conventional": "^17.7.0",
115
115
  "@rollup/plugin-babel": "^6.0.3",
116
- "@rollup/plugin-node-resolve": "^15.0.2",
116
+ "@rollup/plugin-node-resolve": "^15.2.1",
117
117
  "@rollup/plugin-replace": "^5.0.2",
118
- "@rollup/plugin-typescript": "^11.1.2",
118
+ "@rollup/plugin-typescript": "^11.1.3",
119
119
  "@semantic-release/changelog": "^6.0.3",
120
- "@semantic-release/commit-analyzer": "^10.0.1",
120
+ "@semantic-release/commit-analyzer": "^10.0.4",
121
121
  "@semantic-release/exec": "^6.0.3",
122
122
  "@semantic-release/git": "^10.0.1",
123
- "@semantic-release/npm": "^10.0.4",
124
- "@semantic-release/release-notes-generator": "^11.0.4",
123
+ "@semantic-release/npm": "^10.0.5",
124
+ "@semantic-release/release-notes-generator": "^11.0.7",
125
125
  "@types/chai": "^4.3.5",
126
126
  "@types/d3": "^7.4.0",
127
127
  "@types/mocha": "^10.0.1",
128
- "@types/sinon": "^10.0.15",
129
- "@typescript-eslint/eslint-plugin": "^6.2.1",
130
- "@typescript-eslint/parser": "^6.2.1",
128
+ "@types/sinon": "^10.0.16",
129
+ "@typescript-eslint/eslint-plugin": "^6.5.0",
130
+ "@typescript-eslint/parser": "^6.5.0",
131
131
  "babel-helper-modules": "^6.0.0",
132
132
  "babel-loader": "^9.1.3",
133
133
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -140,10 +140,10 @@
140
140
  "babel-plugin-transform-merge-sibling-variables": "^6.9.5",
141
141
  "babel-plugin-transform-minify-booleans": "^6.9.4",
142
142
  "better-docs": "^2.7.2",
143
- "chai": "^4.3.7",
143
+ "chai": "^4.3.8",
144
144
  "clean-webpack-plugin": "^4.0.0",
145
145
  "cloc": "^2.11.0",
146
- "core-js": "^3.32.0",
146
+ "core-js": "^3.32.1",
147
147
  "coveralls": "^3.1.1",
148
148
  "cross-env": "^7.0.3",
149
149
  "css-loader": "^6.8.1",
@@ -154,10 +154,10 @@
154
154
  "d3-polygon": "^3.0.1",
155
155
  "docdash": "^2.0.1",
156
156
  "dtslint": "^4.2.1",
157
- "eslint": "^8.46.0",
157
+ "eslint": "^8.48.0",
158
158
  "eslint-config-naver": "^2.1.0",
159
- "eslint-plugin-import": "^2.28.0",
160
- "eslint-plugin-jsdoc": "^46.4.5",
159
+ "eslint-plugin-import": "^2.28.1",
160
+ "eslint-plugin-jsdoc": "^46.5.0",
161
161
  "eslint-webpack-plugin": "^4.0.1",
162
162
  "exports-loader": "^4.0.0",
163
163
  "hammer-simulator": "0.0.1",
@@ -175,24 +175,24 @@
175
175
  "karma-sinon": "^1.0.5",
176
176
  "karma-sourcemap-loader": "^0.4.0",
177
177
  "karma-webpack": "^5.0.0",
178
- "lint-staged": "^13.2.3",
178
+ "lint-staged": "^14.0.1",
179
179
  "lite-fixture": "^1.0.2",
180
180
  "mini-css-extract-plugin": "^2.7.6",
181
181
  "mocha": "^10.2.0",
182
182
  "node-sass": "^9.0.0",
183
- "regenerator-runtime": "^0.13.11",
184
- "rollup": "^3.27.0",
183
+ "regenerator-runtime": "^0.14.0",
184
+ "rollup": "^3.28.1",
185
185
  "rollup-plugin-delete": "^2.0.0",
186
186
  "sass-loader": "^13.3.2",
187
- "semantic-release": "^21.0.7",
187
+ "semantic-release": "^21.1.1",
188
188
  "simulant": "^0.2.2",
189
189
  "sinon": "^15.2.0",
190
190
  "string-replace-loader": "^3.1.0",
191
191
  "style-loader": "^3.3.3",
192
192
  "taffydb": "^2.7.3",
193
193
  "terser-webpack-plugin": "^5.3.9",
194
- "tslib": "^2.6.1",
195
- "typescript": "5.1.6",
194
+ "tslib": "^2.6.2",
195
+ "typescript": "5.2.2",
196
196
  "webpack": "^5.88.2",
197
197
  "webpack-bundle-analyzer": "^4.9.0",
198
198
  "webpack-clean": "^1.2.5",
@@ -77,6 +77,7 @@ function getMinMax($$, type: "min" | "max"): {x: number, y: number, y2: number}
77
77
  const axis = {
78
78
  /**
79
79
  * Get and set axis labels.
80
+ * - **NOTE:** Only applicable for chart types which has x and y axes.
80
81
  * @function axis․labels
81
82
  * @instance
82
83
  * @memberof Chart
@@ -126,6 +127,7 @@ const axis = {
126
127
 
127
128
  /**
128
129
  * Get and set axis min value.
130
+ * - **NOTE:** Only applicable for chart types which has x and y axes.
129
131
  * @function axis․min
130
132
  * @instance
131
133
  * @memberof Chart
@@ -163,6 +165,7 @@ const axis = {
163
165
 
164
166
  /**
165
167
  * Get and set axis max value.
168
+ * - **NOTE:** Only applicable for chart types which has x and y axes.
166
169
  * @function axis․max
167
170
  * @instance
168
171
  * @memberof Chart
@@ -200,6 +203,7 @@ const axis = {
200
203
 
201
204
  /**
202
205
  * Get and set axis min and max value.
206
+ * - **NOTE:** Only applicable for chart types which has x and y axes.
203
207
  * @function axis․range
204
208
  * @instance
205
209
  * @memberof Chart
@@ -2,6 +2,8 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
+ import {isEmpty} from "../../module/util";
6
+
5
7
  export default {
6
8
  /**
7
9
  * Set specified category name on category axis.
@@ -27,7 +29,7 @@ export default {
27
29
  },
28
30
 
29
31
  /**
30
- * Set category names on category axis.
32
+ * Set or get category names on category axis.
31
33
  * @function categories
32
34
  * @instance
33
35
  * @memberof Chart
@@ -38,12 +40,14 @@ export default {
38
40
  * "Category 1", "Category 2", ...
39
41
  * ]);
40
42
  */
41
- categories(categories: string[]): string[] {
43
+ categories(categories?: string[]): string[] {
42
44
  const $$ = this.internal;
43
45
  const {config} = $$;
44
46
 
45
- if (!arguments.length) {
46
- return config.axis_x_categories;
47
+ if (!categories || !Array.isArray(categories)) {
48
+ const cat = config.axis_x_categories;
49
+
50
+ return isEmpty(cat) ? Object.values($$.data.xs)[0] : cat;
47
51
  }
48
52
 
49
53
  config.axis_x_categories = categories;
@@ -87,8 +87,7 @@ function nodeToSvgDataUrl(node, option: TExportOption, orgSize: TSize) {
87
87
  <foreignObject width="100%" height="100%">
88
88
  ${styleXml}
89
89
  ${nodeXml.replace(/(url\()[^#]+/g, "$1")}
90
- </foreignObject></svg>`
91
- .replace("/\n/g", "%0A");
90
+ </foreignObject></svg>`;
92
91
 
93
92
  return `data:image/svg+xml;base64,${b64EncodeUnicode(dataStr)}`;
94
93
  }