billboard.js 3.5.0 → 3.5.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 (67) hide show
  1. package/README.md +1 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +105 -73
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +134 -85
  7. package/dist/billboard.pkgd.min.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -71
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +2 -71
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +2 -71
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -71
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +31 -14
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +31 -83
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +31 -83
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +31 -83
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +31 -83
  23. package/dist/theme/datalab.css +1 -1
  24. package/dist/theme/datalab.min.css +1 -1
  25. package/dist/theme/graph.css +1 -1
  26. package/dist/theme/graph.min.css +1 -1
  27. package/dist/theme/insight.css +1 -1
  28. package/dist/theme/insight.min.css +1 -1
  29. package/dist-esm/billboard.js +97 -72
  30. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  34. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  35. package/package.json +10 -10
  36. package/src/Chart/api/data.ts +2 -2
  37. package/src/Chart/api/selection.ts +1 -1
  38. package/src/ChartInternal/Axis/AxisRenderer.ts +1 -1
  39. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  40. package/src/ChartInternal/ChartInternal.ts +1 -1
  41. package/src/ChartInternal/data/convert.ts +3 -2
  42. package/src/ChartInternal/data/data.ts +1 -1
  43. package/src/ChartInternal/interactions/drag.ts +1 -1
  44. package/src/ChartInternal/internals/color.ts +1 -1
  45. package/src/ChartInternal/internals/domain.ts +1 -1
  46. package/src/ChartInternal/internals/format.ts +1 -1
  47. package/src/ChartInternal/internals/region.ts +1 -1
  48. package/src/ChartInternal/internals/scale.ts +1 -1
  49. package/src/ChartInternal/internals/size.axis.ts +1 -1
  50. package/src/ChartInternal/internals/style.ts +2 -2
  51. package/src/ChartInternal/internals/text.ts +2 -2
  52. package/src/ChartInternal/internals/tooltip.ts +1 -1
  53. package/src/ChartInternal/shape/arc.ts +2 -2
  54. package/src/ChartInternal/shape/area.ts +3 -2
  55. package/src/ChartInternal/shape/bar.ts +2 -2
  56. package/src/ChartInternal/shape/point.ts +1 -1
  57. package/src/ChartInternal/shape/polar.ts +1 -1
  58. package/src/ChartInternal/shape/shape.ts +2 -2
  59. package/src/Plugin/sparkline/index.ts +1 -1
  60. package/src/Plugin/textoverlap/index.ts +1 -1
  61. package/src/config/Options/data/data.ts +1 -1
  62. package/src/config/Store/Element.ts +1 -1
  63. package/src/module/Cache.ts +1 -1
  64. package/src/module/generator.ts +1 -1
  65. package/src/module/util.ts +1 -74
  66. package/src/module/worker.ts +101 -0
  67. package/types/axis.d.ts +2 -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.5.0
8
+ * @version 3.5.1
9
9
  */
10
10
  import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
11
11
  import { pointer, select, namespaces, selectAll } from 'd3-selection';
@@ -825,74 +825,6 @@ function convertInputType(mouse, touch) {
825
825
  // fallback to 'mouse' if no input type is detected.
826
826
  return (hasMouse && "mouse") || (hasTouch && "touch") || "mouse";
827
827
  }
828
- /**
829
- * Create and run on Web Worker
830
- * @param {boolean} useWorker Use Web Worker
831
- * @param {Function} fn Function to be executed in worker
832
- * @param {Function} callback Callback function to receive result from worker
833
- * @param {Array} depsFn Dependency functions to run given function(fn).
834
- * @returns {object}
835
- * @example
836
- * const worker = runWorker(function(arg) {
837
- * // do some tasks...
838
- * console.log("param:", A(arg));
839
- *
840
- * return 1234;
841
- * }, function(data) {
842
- * // callback after worker is done
843
- * console.log("result:", data);
844
- * },
845
- * [function A(){}]
846
- * );
847
- *
848
- * worker(11111);
849
- * @private
850
- */
851
- function runWorker(useWorker, fn, callback, depsFn) {
852
- var _a;
853
- if (useWorker === void 0) { useWorker = true; }
854
- var runFn;
855
- if (win.Worker && useWorker) {
856
- // Web Worker body
857
- var blob = new Blob([
858
- "".concat((_a = depsFn === null || depsFn === void 0 ? void 0 : depsFn.map(String).join(";")) !== null && _a !== void 0 ? _a : "", "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (").concat(fn.toString(), ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};")
859
- ], {
860
- type: "text/javascript"
861
- });
862
- var worker_1 = new Worker(URL.createObjectURL(blob));
863
- runFn = function () {
864
- var args = [];
865
- for (var _i = 0; _i < arguments.length; _i++) {
866
- args[_i] = arguments[_i];
867
- }
868
- // trigger worker
869
- worker_1.postMessage(args);
870
- // listen worker
871
- worker_1.onmessage = function (e) {
872
- return callback(e.data);
873
- };
874
- // handle error
875
- worker_1.onerror = function (e) {
876
- console.error(e);
877
- };
878
- // return new Promise((resolve, reject) => {
879
- // worker.onmessage = ({data}) => resolve(data);
880
- // worker.onerror = reject;
881
- // });
882
- };
883
- }
884
- else {
885
- runFn = function () {
886
- var args = [];
887
- for (var _i = 0; _i < arguments.length; _i++) {
888
- args[_i] = arguments[_i];
889
- }
890
- var res = fn.apply(void 0, args);
891
- callback(res);
892
- };
893
- }
894
- return runFn;
895
- }
896
828
  /**
897
829
  * Run function until given condition function return true
898
830
  * @param {Function} fn Function to be executed when condition is true
@@ -3259,6 +3191,98 @@ function generateWait() {
3259
3191
  return f;
3260
3192
  }
3261
3193
 
3194
+ /**
3195
+ * Copyright (c) 2017 ~ present NAVER Corp.
3196
+ * billboard.js project is licensed under the MIT license
3197
+ */
3198
+ // Store blob in memory
3199
+ var blob = {};
3200
+ /**
3201
+ * Get Object URL
3202
+ * @param {Function} fn Function to be executed in worker
3203
+ * @param {Array} depsFn Dependency functions to run given function(fn).
3204
+ * @returns {string}
3205
+ * @private
3206
+ */
3207
+ function getObjectURL(fn, depsFn) {
3208
+ var _a;
3209
+ var fnString = fn.toString();
3210
+ var key = fnString.replace(/(function|[\s\W\n])/g, "").substring(0, 15);
3211
+ if (!(key in blob)) {
3212
+ // Web Worker body
3213
+ blob[key] = new win.Blob([
3214
+ "".concat((_a = depsFn === null || depsFn === void 0 ? void 0 : depsFn.map(String).join(";")) !== null && _a !== void 0 ? _a : "", "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (").concat(fnString, ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};")
3215
+ ], {
3216
+ type: "text/javascript"
3217
+ });
3218
+ }
3219
+ return win.URL.createObjectURL(blob[key]);
3220
+ }
3221
+ /**
3222
+ * Create and run on Web Worker
3223
+ * @param {boolean} useWorker Use Web Worker
3224
+ * @param {Function} fn Function to be executed in worker
3225
+ * @param {Function} callback Callback function to receive result from worker
3226
+ * @param {Array} depsFn Dependency functions to run given function(fn).
3227
+ * @returns {object}
3228
+ * @example
3229
+ * const worker = runWorker(function(arg) {
3230
+ * // do some tasks...
3231
+ * console.log("param:", A(arg));
3232
+ *
3233
+ * return 1234;
3234
+ * }, function(data) {
3235
+ * // callback after worker is done
3236
+ * console.log("result:", data);
3237
+ * },
3238
+ * [function A(){}]
3239
+ * );
3240
+ *
3241
+ * worker(11111);
3242
+ * @private
3243
+ */
3244
+ function runWorker(useWorker, fn, callback, depsFn) {
3245
+ if (useWorker === void 0) { useWorker = true; }
3246
+ var runFn;
3247
+ if (win.Worker && useWorker) {
3248
+ var src_1 = getObjectURL(fn, depsFn);
3249
+ var worker_1 = new win.Worker(src_1);
3250
+ runFn = function () {
3251
+ var args = [];
3252
+ for (var _i = 0; _i < arguments.length; _i++) {
3253
+ args[_i] = arguments[_i];
3254
+ }
3255
+ // trigger worker
3256
+ worker_1.postMessage(args);
3257
+ // listen worker
3258
+ worker_1.onmessage = function (e) {
3259
+ // release object URL from memory
3260
+ win.URL.revokeObjectURL(src_1);
3261
+ return callback(e.data);
3262
+ };
3263
+ // handle error
3264
+ worker_1.onerror = function (e) {
3265
+ console.error(e);
3266
+ };
3267
+ // return new Promise((resolve, reject) => {
3268
+ // worker.onmessage = ({data}) => resolve(data);
3269
+ // worker.onerror = reject;
3270
+ // });
3271
+ };
3272
+ }
3273
+ else {
3274
+ runFn = function () {
3275
+ var args = [];
3276
+ for (var _i = 0; _i < arguments.length; _i++) {
3277
+ args[_i] = arguments[_i];
3278
+ }
3279
+ var res = fn.apply(void 0, args);
3280
+ callback(res);
3281
+ };
3282
+ }
3283
+ return runFn;
3284
+ }
3285
+
3262
3286
  /**
3263
3287
  * Copyright (c) 2017 ~ present NAVER Corp.
3264
3288
  * billboard.js project is licensed under the MIT license
@@ -16756,9 +16780,10 @@ var shapeArea = {
16756
16780
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
16757
16781
  var offset = areaOffset(d, i) || y0; // offset is for stacked area chart
16758
16782
  var posX = x(d);
16783
+ var value = d.value;
16759
16784
  var posY = y(d);
16760
16785
  // fix posY not to overflow opposite quadrant
16761
- if (config.axis_rotated && ((d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY))) {
16786
+ if (config.axis_rotated && ((value > 0 && posY < y0) || (value < 0 && y0 < posY))) {
16762
16787
  posY = y0;
16763
16788
  }
16764
16789
  // 1 point that marks the area position
@@ -21172,7 +21197,7 @@ var zoomModule = function () {
21172
21197
  var defaults = {};
21173
21198
  /**
21174
21199
  * @namespace bb
21175
- * @version 3.5.0
21200
+ * @version 3.5.1
21176
21201
  */
21177
21202
  var bb = {
21178
21203
  /**
@@ -21182,7 +21207,7 @@ var bb = {
21182
21207
  * bb.version; // "1.0.0"
21183
21208
  * @memberof bb
21184
21209
  */
21185
- version: "3.5.0",
21210
+ version: "3.5.1",
21186
21211
  /**
21187
21212
  * Generate chart
21188
21213
  * - **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.5.0
8
+ * @version 3.5.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -111,7 +111,7 @@ var Plugin = /** @class */ (function () {
111
111
  delete _this[key];
112
112
  });
113
113
  };
114
- Plugin.version = "3.5.0";
114
+ Plugin.version = "3.5.1";
115
115
  return Plugin;
116
116
  }());
117
117
  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.5.0
8
+ * @version 3.5.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -286,7 +286,7 @@ var Plugin = /** @class */ (function () {
286
286
  delete _this[key];
287
287
  });
288
288
  };
289
- Plugin.version = "3.5.0";
289
+ Plugin.version = "3.5.1";
290
290
  return Plugin;
291
291
  }());
292
292
  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.5.0
8
+ * @version 3.5.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -490,7 +490,7 @@ var Plugin = /** @class */ (function () {
490
490
  delete _this[key];
491
491
  });
492
492
  };
493
- Plugin.version = "3.5.0";
493
+ Plugin.version = "3.5.1";
494
494
  return Plugin;
495
495
  }());
496
496
  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.5.0
8
+ * @version 3.5.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -134,7 +134,7 @@ var Plugin = /** @class */ (function () {
134
134
  delete _this[key];
135
135
  });
136
136
  };
137
- Plugin.version = "3.5.0";
137
+ Plugin.version = "3.5.1";
138
138
  return Plugin;
139
139
  }());
140
140
  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.5.0
8
+ * @version 3.5.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -266,7 +266,7 @@ var Plugin = /** @class */ (function () {
266
266
  delete _this[key];
267
267
  });
268
268
  };
269
- Plugin.version = "3.5.0";
269
+ Plugin.version = "3.5.1";
270
270
  return Plugin;
271
271
  }());
272
272
  var Plugin$1 = Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.5.0",
3
+ "version": "3.5.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",
@@ -103,7 +103,7 @@
103
103
  "@babel/preset-env": "^7.18.6",
104
104
  "@babel/preset-typescript": "^7.18.6",
105
105
  "@babel/runtime": "^7.18.6",
106
- "@commitlint/cli": "^15.0.0",
106
+ "@commitlint/cli": "15.0.0",
107
107
  "@commitlint/config-conventional": "^17.0.3",
108
108
  "@rollup/plugin-babel": "^5.3.1",
109
109
  "@rollup/plugin-node-resolve": "^13.2.1",
@@ -118,9 +118,9 @@
118
118
  "@types/chai": "^4.3.1",
119
119
  "@types/d3": "^7.4.0",
120
120
  "@types/mocha": "^9.1.1",
121
- "@types/sinon": "^10.0.11",
122
- "@typescript-eslint/eslint-plugin": "^5.30.0",
123
- "@typescript-eslint/parser": "^5.30.0",
121
+ "@types/sinon": "^10.0.12",
122
+ "@typescript-eslint/eslint-plugin": "^5.30.6",
123
+ "@typescript-eslint/parser": "^5.30.6",
124
124
  "babel-helper-modules": "^6.0.0",
125
125
  "babel-loader": "^8.2.5",
126
126
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -135,8 +135,8 @@
135
135
  "better-docs": "^2.7.2",
136
136
  "chai": "^4.3.4",
137
137
  "clean-webpack-plugin": "^4.0.0",
138
- "cloc": "^2.9.0",
139
- "core-js": "^3.23.3",
138
+ "cloc": "^2.10.0",
139
+ "core-js": "^3.23.4",
140
140
  "coveralls": "^3.1.1",
141
141
  "cross-env": "^7.0.3",
142
142
  "css-loader": "^6.7.1",
@@ -147,7 +147,7 @@
147
147
  "d3-polygon": "^3.0.1",
148
148
  "docdash": "^1.2.0",
149
149
  "dtslint": "^4.2.1",
150
- "eslint": "^8.18.0",
150
+ "eslint": "^8.19.0",
151
151
  "eslint-config-naver": "^2.1.0",
152
152
  "eslint-plugin-import": "^2.26.0",
153
153
  "eslint-plugin-jsdoc": "^39.3.3",
@@ -173,7 +173,7 @@
173
173
  "mocha": "^10.0.0",
174
174
  "node-sass": "^7.0.1",
175
175
  "regenerator-runtime": "^0.13.7",
176
- "rollup": "^2.75.7",
176
+ "rollup": "^2.76.0",
177
177
  "rollup-plugin-delete": "^2.0.0",
178
178
  "sass-loader": "^13.0.2",
179
179
  "semantic-release": "^19.0.3",
@@ -189,7 +189,7 @@
189
189
  "webpack-clean": "^1.2.5",
190
190
  "webpack-cli": "^4.10.0",
191
191
  "webpack-common-shake": "^2.1.0",
192
- "webpack-dev-server": "^4.9.2",
192
+ "webpack-dev-server": "^4.9.3",
193
193
  "webpack-merge": "^5.8.0",
194
194
  "webpackbar": "^5.0.2",
195
195
  "write-file-webpack-plugin": "^4.5.1"
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {DataItem} from "../../../types/types";
5
+ import type {DataItem} from "../../../types/types";
6
6
  import {extend, isUndefined, isArray} from "../../module/util";
7
- import {IDataRow} from "../../ChartInternal/data/IData";
7
+ import type {IDataRow} from "../../ChartInternal/data/IData";
8
8
 
9
9
  /**
10
10
  * Get data loaded in the chart.
@@ -5,7 +5,7 @@
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {isDefined} from "../../module/util";
7
7
  import {$AREA, $LINE, $SELECT, $SHAPE} from "../../config/classes";
8
- import {DataItem} from "../../../types/types";
8
+ import type {DataItem} from "../../../types/types";
9
9
 
10
10
  export default {
11
11
  /**
@@ -4,7 +4,7 @@
4
4
  * @ignore
5
5
  */
6
6
  import {select as d3Select} from "d3-selection";
7
- import {d3Selection} from "../../../types/types";
7
+ import type {d3Selection} from "../../../types/types";
8
8
  import Helper from "./AxisRendererHelper";
9
9
  import {isArray, toArray, isFunction, isString, isNumber} from "../../module/util";
10
10
 
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import {getScale} from "../internals/scale";
7
7
  import {isDefined, isNumber, isString} from "../../module/util";
8
- import {d3Selection} from "../../../types/types";
8
+ import type {d3Selection} from "../../../types/types";
9
9
 
10
10
  export default class AxisRendererHelper {
11
11
  private owner;
@@ -10,7 +10,7 @@ import {
10
10
  utcFormat as d3UtcFormat
11
11
  } from "d3-time-format";
12
12
  import {select as d3Select} from "d3-selection";
13
- import {d3Selection} from "../../types/types";
13
+ import type {d3Selection} from "../../types/types";
14
14
  import {checkModuleImport} from "../module/error";
15
15
  import {$COMMON, $CIRCLE, $TEXT} from "../config/classes";
16
16
  import Store from "../config/Store/Store";
@@ -2,9 +2,10 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {runWorker, isUndefined, isDefined, isObject, isValue, notEmpty, isArray} from "../../module/util";
5
+ import {isUndefined, isDefined, isObject, isValue, notEmpty, isArray} from "../../module/util";
6
+ import {runWorker} from "../../module/worker";
6
7
  import {columns, json, rows, url} from "./convert.helper";
7
- import {IData} from "../data/IData";
8
+ import type {IData} from "../data/IData";
8
9
 
9
10
  /**
10
11
  * Get data key for JSON
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {$BAR, $CANDLESTICK, $COMMON} from "../../config/classes";
6
6
  import {KEY} from "../../module/Cache";
7
- import {IData, IDataRow} from "./IData";
7
+ import type {IData, IDataRow} from "./IData";
8
8
  import {
9
9
  findIndex,
10
10
  getUnique,
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
- import {d3Selection} from "../../../types/types";
6
+ import type {d3Selection} from "../../../types/types";
7
7
  import {$BAR, $CIRCLE, $COMMON, $DRAG, $SELECT, $SHAPE} from "../../config/classes";
8
8
  import {getPathBox} from "../../module/util";
9
9
 
@@ -8,7 +8,7 @@ import {document} from "../../module/browser";
8
8
  import {$ARC, $COLOR, $SHAPE} from "../../config/classes";
9
9
  import {KEY} from "../../module/Cache";
10
10
  import {notEmpty, isFunction, isObject, isString} from "../../module/util";
11
- import {IArcData, IDataRow} from "../data/IData";
11
+ import type {IArcData, IDataRow} from "../data/IData";
12
12
  import {d3Selection} from "../../../types";
13
13
 
14
14
  /**
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {TYPE, TYPE_BY_CATEGORY} from "../../config/const";
6
- import {IData} from "../data/IData";
6
+ import type {IData} from "../data/IData";
7
7
  import {brushEmpty, getBrushSelection, getMinMax, isDefined, notEmpty, isValue, isObject, isNumber, diffDomain, parseDate, sortValue} from "../../module/util";
8
8
 
9
9
  export default {
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {isValue, isFunction, isObjectType} from "../../module/util";
6
- import {AxisType} from "../../../types/types";
6
+ import type {AxisType} from "../../../types/types";
7
7
 
8
8
  /**
9
9
  * Get formatted
@@ -5,7 +5,7 @@
5
5
  import {select as d3Select} from "d3-selection"; // selection
6
6
  import {$REGION} from "../../config/classes";
7
7
  import {isValue, parseDate} from "../../module/util";
8
- import {AxisType} from "../../../types/types";
8
+ import type {AxisType} from "../../../types/types";
9
9
 
10
10
  export default {
11
11
  initRegion() {
@@ -10,7 +10,7 @@ import {
10
10
  scaleSymlog as d3ScaleSymlog
11
11
  } from "d3-scale";
12
12
  import {isString, isValue, parseDate} from "../../module/util";
13
- import {IDataRow, IGridData} from "../data/IData";
13
+ import type {IDataRow, IGridData} from "../data/IData";
14
14
 
15
15
 
16
16
  /**
@@ -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 {AxisType} from "../../../types/types";
5
+ import type {AxisType} from "../../../types/types";
6
6
 
7
7
  export default {
8
8
  /**
@@ -3,8 +3,8 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {$SHAPE} from "../../config/classes";
6
- import {d3Selection} from "../../../types/types";
7
- import {IDataRow} from "../data/IData";
6
+ import type {d3Selection} from "../../../types/types";
7
+ import type {IDataRow} from "../data/IData";
8
8
  import {addCssRules, isFunction, isString} from "../../module/util";
9
9
 
10
10
  export default {
@@ -9,8 +9,8 @@ import {
9
9
  import {KEY} from "../../module/Cache";
10
10
  import {$COMMON, $TEXT} from "../../config/classes";
11
11
  import {capitalize, getBoundingRect, getRandom, isFunction, isNumber, isObject, isString, getTranslation, setTextValue} from "../../module/util";
12
- import {IDataRow, IArcData} from "../data/IData";
13
- import {AxisType} from "../../../types/types";
12
+ import type {IDataRow, IArcData} from "../data/IData";
13
+ import type {AxisType} from "../../../types/types";
14
14
 
15
15
  type Coord = {x: number, y: number};
16
16
  type Anchor = "start" | "middle" | "end";
@@ -5,7 +5,7 @@
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {document} from "../../module/browser";
7
7
  import {$ARC, $TOOLTIP} from "../../config/classes";
8
- import {IDataRow} from "../data/IData";
8
+ import type {IDataRow} from "../data/IData";
9
9
  import {getPointer, isFunction, isObject, isString, isValue, callFn, sanitise, tplProcess, isUndefined, parseDate} from "../../module/util";
10
10
 
11
11
  export default {
@@ -11,8 +11,8 @@ import {interpolate as d3Interpolate} from "d3-interpolate";
11
11
  import {document} from "../../module/browser";
12
12
  import {$ARC, $COMMON, $FOCUS, $GAUGE} from "../../config/classes";
13
13
  import {callFn, endall, isFunction, isNumber, isObject, isUndefined, setTextValue} from "../../module/util";
14
- import {d3Selection} from "../../../types/types";
15
- import {IArcData, IData} from "../data/IData";
14
+ import type {d3Selection} from "../../../types/types";
15
+ import type {IArcData, IData} from "../data/IData";
16
16
 
17
17
  export default {
18
18
  initPie(): void {
@@ -6,7 +6,7 @@ import {area as d3Area} from "d3-shape";
6
6
  import {select as d3Select} from "d3-selection";
7
7
  import {$AREA, $CIRCLE, $LINE} from "../../config/classes";
8
8
  import {getRandom, isFunction} from "../../module/util";
9
- import {IData, IDataRow} from "../data/IData";
9
+ import type {IData, IDataRow} from "../data/IData";
10
10
  import {d3Selection} from "../../../types";
11
11
 
12
12
  type Indices = {[key: string | "__max__"]: number};
@@ -202,11 +202,12 @@ export default {
202
202
  const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
203
203
  const offset = areaOffset(d, i) || y0; // offset is for stacked area chart
204
204
  const posX = x(d);
205
+ const value = d.value as number;
205
206
  let posY = y(d);
206
207
 
207
208
  // fix posY not to overflow opposite quadrant
208
209
  if (config.axis_rotated && (
209
- (d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY)
210
+ (value > 0 && posY < y0) || (value < 0 && y0 < posY)
210
211
  )) {
211
212
  posY = y0;
212
213
  }
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {DataRow} from "../../../types/types";
5
+ import type {DataRow} from "../../../types/types";
6
6
  import {$BAR, $COMMON} from "../../config/classes";
7
7
  import {getRandom, isNumber} from "../../module/util";
8
- import {IDataRow} from "../data/IData";
8
+ import type {IDataRow} from "../data/IData";
9
9
 
10
10
  type BarTypeDataRow = DataRow<number | number[]>;
11
11
 
@@ -6,7 +6,7 @@ import {
6
6
  namespaces as d3Namespaces,
7
7
  select as d3Select
8
8
  } from "d3-selection";
9
- import {d3Selection} from "../../../types/types";
9
+ import type {d3Selection} from "../../../types/types";
10
10
  import {$CIRCLE, $COMMON, $SELECT} from "../../config/classes";
11
11
  import {document} from "../../module/browser";
12
12
  import {getBoundingRect, getPointer, getRandom, isFunction, isObject, isObjectType, isUndefined, isValue, toArray, notEmpty} from "../../module/util";
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {$LEVEL} from "../../config/classes";
6
6
  import {getRange} from "../../module/util";
7
- import {IArcData, IData} from "../data/IData";
7
+ import type {IArcData, IData} from "../data/IData";
8
8
 
9
9
  /**
10
10
  * Get data max value
@@ -23,10 +23,10 @@ import {
23
23
  curveStep as d3CurveStep
24
24
  } from "d3-shape";
25
25
  import {select as d3Select} from "d3-selection";
26
- import {d3Selection} from "../../../types/types";
26
+ import type {d3Selection} from "../../../types/types";
27
27
  import CLASS from "../../config/classes";
28
28
  import {capitalize, getPointer, getRectSegList, getUnique, isObjectType, isNumber, isValue, isUndefined, notEmpty} from "../../module/util";
29
- import {IDataRow, IDataIndice, TIndices} from "../data/IData";
29
+ import type {IDataRow, IDataIndice, TIndices} from "../data/IData";
30
30
 
31
31
  export default {
32
32
  /**
@@ -5,7 +5,7 @@
5
5
  import {$COMMON} from "../../config/classes";
6
6
  import Plugin from "../Plugin";
7
7
  import Options from "./Options";
8
- import {IData} from "../../ChartInternal/data/IData";
8
+ import type {IData} from "../../ChartInternal/data/IData";
9
9
  import {loadConfig} from "../../config/config";
10
10
 
11
11
  /**