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
package/README.md CHANGED
@@ -115,7 +115,7 @@ There're two ways to install from `nightly` branch directly.
115
115
  // Specify on 'package.json' file
116
116
  "dependencies": {
117
117
  ...
118
- "billboard.js": "git://github.com/naver/billboard.js.git#nightly"
118
+ "billboard.js": "naver/billboard.js#nightly"
119
119
  },
120
120
  ```
121
121
 
@@ -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
  /*-- Chart --*/
11
11
  .bb svg {
package/dist/billboard.js CHANGED
@@ -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
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -1310,75 +1310,6 @@ function convertInputType(mouse, touch) {
1310
1310
 
1311
1311
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1312
1312
  }
1313
- /**
1314
- * Create and run on Web Worker
1315
- * @param {boolean} useWorker Use Web Worker
1316
- * @param {Function} fn Function to be executed in worker
1317
- * @param {Function} callback Callback function to receive result from worker
1318
- * @param {Array} depsFn Dependency functions to run given function(fn).
1319
- * @returns {object}
1320
- * @example
1321
- * const worker = runWorker(function(arg) {
1322
- * // do some tasks...
1323
- * console.log("param:", A(arg));
1324
- *
1325
- * return 1234;
1326
- * }, function(data) {
1327
- * // callback after worker is done
1328
- * console.log("result:", data);
1329
- * },
1330
- * [function A(){}]
1331
- * );
1332
- *
1333
- * worker(11111);
1334
- * @private
1335
- */
1336
-
1337
-
1338
- function runWorker(useWorker, fn, callback, depsFn) {
1339
- if (useWorker === void 0) {
1340
- useWorker = !0;
1341
- }
1342
-
1343
- var runFn;
1344
-
1345
- if (win.Worker && useWorker) {
1346
- var _depsFn$map$join,
1347
- blob = new Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fn.toString() + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
1348
- type: "text/javascript"
1349
- }),
1350
- worker = new Worker(URL.createObjectURL(blob));
1351
-
1352
- runFn = function () {
1353
- for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1354
- args[_key5] = arguments[_key5];
1355
- }
1356
-
1357
- // trigger worker
1358
- worker.postMessage(args); // listen worker
1359
-
1360
- worker.onmessage = function (e) {
1361
- return callback(e.data);
1362
- }; // handle error
1363
-
1364
-
1365
- worker.onerror = function (e) {
1366
- console.error(e);
1367
- }; // return new Promise((resolve, reject) => {
1368
- // worker.onmessage = ({data}) => resolve(data);
1369
- // worker.onerror = reject;
1370
- // });
1371
-
1372
- };
1373
- } else {
1374
- runFn = function () {
1375
- var res = fn.apply(void 0, arguments);
1376
- callback(res);
1377
- };
1378
- }
1379
-
1380
- return runFn;
1381
- }
1382
1313
  /**
1383
1314
  * Run function until given condition function return true
1384
1315
  * @param {Function} fn Function to be executed when condition is true
@@ -4044,6 +3975,105 @@ function generateWait() {
4044
3975
 
4045
3976
  return f;
4046
3977
  }
3978
+ ;// CONCATENATED MODULE: ./src/module/worker.ts
3979
+ /**
3980
+ * Copyright (c) 2017 ~ present NAVER Corp.
3981
+ * billboard.js project is licensed under the MIT license
3982
+ */
3983
+ // Store blob in memory
3984
+
3985
+ var blob = {};
3986
+ /**
3987
+ * Get Object URL
3988
+ * @param {Function} fn Function to be executed in worker
3989
+ * @param {Array} depsFn Dependency functions to run given function(fn).
3990
+ * @returns {string}
3991
+ * @private
3992
+ */
3993
+
3994
+ function getObjectURL(fn, depsFn) {
3995
+ var fnString = fn.toString(),
3996
+ key = fnString.replace(/(function|[\s\W\n])/g, "").substring(0, 15);
3997
+
3998
+ if (!(key in blob)) {
3999
+ var _depsFn$map$join;
4000
+
4001
+ // Web Worker body
4002
+ blob[key] = new win.Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fnString + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
4003
+ type: "text/javascript"
4004
+ });
4005
+ }
4006
+
4007
+ return win.URL.createObjectURL(blob[key]);
4008
+ }
4009
+ /**
4010
+ * Create and run on Web Worker
4011
+ * @param {boolean} useWorker Use Web Worker
4012
+ * @param {Function} fn Function to be executed in worker
4013
+ * @param {Function} callback Callback function to receive result from worker
4014
+ * @param {Array} depsFn Dependency functions to run given function(fn).
4015
+ * @returns {object}
4016
+ * @example
4017
+ * const worker = runWorker(function(arg) {
4018
+ * // do some tasks...
4019
+ * console.log("param:", A(arg));
4020
+ *
4021
+ * return 1234;
4022
+ * }, function(data) {
4023
+ * // callback after worker is done
4024
+ * console.log("result:", data);
4025
+ * },
4026
+ * [function A(){}]
4027
+ * );
4028
+ *
4029
+ * worker(11111);
4030
+ * @private
4031
+ */
4032
+
4033
+
4034
+ function runWorker(useWorker, fn, callback, depsFn) {
4035
+ if (useWorker === void 0) {
4036
+ useWorker = !0;
4037
+ }
4038
+
4039
+ var runFn;
4040
+
4041
+ if (win.Worker && useWorker) {
4042
+ var src = getObjectURL(fn, depsFn),
4043
+ worker = new win.Worker(src);
4044
+
4045
+ runFn = function () {
4046
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
4047
+ args[_key] = arguments[_key];
4048
+ }
4049
+
4050
+ // trigger worker
4051
+ worker.postMessage(args); // listen worker
4052
+
4053
+ worker.onmessage = function (e) {
4054
+ // release object URL from memory
4055
+ win.URL.revokeObjectURL(src);
4056
+ return callback(e.data);
4057
+ }; // handle error
4058
+
4059
+
4060
+ worker.onerror = function (e) {
4061
+ console.error(e);
4062
+ }; // return new Promise((resolve, reject) => {
4063
+ // worker.onmessage = ({data}) => resolve(data);
4064
+ // worker.onerror = reject;
4065
+ // });
4066
+
4067
+ };
4068
+ } else {
4069
+ runFn = function () {
4070
+ var res = fn.apply(void 0, arguments);
4071
+ callback(res);
4072
+ };
4073
+ }
4074
+
4075
+ return runFn;
4076
+ }
4047
4077
  // EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"}
4048
4078
  var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_require__(5);
4049
4079
  ;// CONCATENATED MODULE: ./src/ChartInternal/data/convert.helper.ts
@@ -4272,6 +4302,7 @@ function tsv(tsv) {
4272
4302
 
4273
4303
 
4274
4304
 
4305
+
4275
4306
  /**
4276
4307
  * Get data key for JSON
4277
4308
  * @param {string|object} keysParam Key params
@@ -20449,10 +20480,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20449
20480
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
20450
20481
  offset = areaOffset(d, i) || y0,
20451
20482
  posX = x(d),
20483
+ value = d.value,
20452
20484
  posY = y(d);
20453
20485
 
20454
20486
  // fix posY not to overflow opposite quadrant
20455
- if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) {
20487
+ if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
20456
20488
  posY = y0;
20457
20489
  } // 1 point that marks the area position
20458
20490
 
@@ -25904,7 +25936,7 @@ var _defaults = {},
25904
25936
  * bb.version; // "1.0.0"
25905
25937
  * @memberof bb
25906
25938
  */
25907
- version: "3.5.0",
25939
+ version: "3.5.1",
25908
25940
 
25909
25941
  /**
25910
25942
  * Generate chart
@@ -26039,7 +26071,7 @@ var _defaults = {},
26039
26071
  };
26040
26072
  /**
26041
26073
  * @namespace bb
26042
- * @version 3.5.0
26074
+ * @version 3.5.1
26043
26075
  */
26044
26076
  ;// CONCATENATED MODULE: ./src/index.ts
26045
26077
 
@@ -5,5 +5,5 @@
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
  */.bb svg{-webkit-tap-highlight-color:rgba(0,0,0,0);font:10px sans-serif}.bb line,.bb path{fill:none;stroke:#000}.bb .bb-button,.bb text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-bars path,.bb-event-rect,.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid,.bb-ygrid-focus{shape-rendering:crispEdges}.bb-chart-arc .bb-gauge-value{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-axis{shape-rendering:crispEdges}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:grey;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-circles.bb-focused,.bb-target.bb-focused{opacity:1}.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step,.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step{stroke-width:2px}.bb-circles.bb-defocused,.bb-target.bb-defocused{opacity:.3!important}.bb-circles.bb-defocused .text-overlapping,.bb-target.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-brush .extent,.bb-region,.bb-zoom-brush{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{fill:#fff;stroke:#d3d3d3;stroke-width:1;opacity:.75}.bb-title{font:14px sans-serif}.bb-tooltip-container{user-select:none;z-index:10}.bb-tooltip{background-color:#fff;border-collapse:collapse;border-spacing:0;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777;empty-cells:show;opacity:.9}.bb-tooltip tr{border:1px solid #ccc}.bb-tooltip th{background-color:#aaa;color:#fff;font-size:14px;padding:2px 5px;text-align:left}.bb-tooltip td{background-color:#fff;border-left:1px dotted #999;font-size:13px;padding:3px 6px}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;height:10px;margin-right:6px;width:10px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{cursor:default;font-size:1.15em}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;right:10px;top:10px}.bb-button .bb-zoom-reset{background-color:#fff;border:1px solid #ccc;border-radius:5px;cursor:pointer;font-size:11px;padding:5px}