billboard.js 3.6.1 → 3.6.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/README.md +13 -77
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +30 -24
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +172 -102
  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 -2
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +144 -80
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +145 -81
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +146 -82
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +146 -82
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +146 -82
  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 +33 -21
  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 +1 -1
  36. package/src/ChartInternal/Axis/AxisRendererHelper.ts +4 -2
  37. package/src/ChartInternal/interactions/eventrect.ts +22 -13
  38. package/src/ChartInternal/interactions/interaction.ts +6 -7
package/README.md CHANGED
@@ -18,6 +18,7 @@ billboard.js is a re-usable, easy interface JavaScript chart library, based on [
18
18
  - [Examples](https://naver.github.io/billboard.js/demo/)
19
19
  - [Roadmap](https://github.com/naver/billboard.js/wiki/Roadmap)
20
20
  - [Contribution Guide](CONTRIBUTING.md)
21
+ - [Development Guide](DEVELOPMENT.md)
21
22
  - [Comparison table with other libraries](https://github.com/naver/billboard.js/wiki/Comparison-table)
22
23
  - [Migration guide from C3.js](https://github.com/naver/billboard.js/wiki/How-to-migrate-from-C3.js%3F)
23
24
  - [Third Party Applications](https://github.com/naver/billboard.js/wiki/Third-party-applications)
@@ -33,11 +34,6 @@ billboard.js is a re-usable, easy interface JavaScript chart library, based on [
33
34
  - v3 updates:
34
35
  - [billboard.js 3.0 release: D3.js v6 support & new candlestick type!](https://netil.medium.com/billboard-js-3-0-release-d3-js-v6-support-new-candlestick-type-9bd74af6a753)
35
36
 
36
- ## Playground
37
- Play with the diverse options generating on the fly!
38
- - https://naver.github.io/billboard.js/playground/ (obsolete)
39
- - https://beta.observablehq.com/@idris-maps/billboard-js-playground (by [@idris-maps](https://github.com/idris-maps))
40
-
41
37
  ## Questions?
42
38
  If you have any questions, checkout the previous posts or create a new one at:
43
39
  - [Stack Overflow: billboard.js tagged posts](https://stackoverflow.com/questions/tagged/billboard.js)
@@ -50,6 +46,9 @@ If you have any questions, checkout the previous posts or create a new one at:
50
46
 
51
47
  Download dist files from the repo directly or install it via npm.
52
48
 
49
+ <details>
50
+ <summary>Dist file list from the repo. (click to expand)</summary>
51
+
53
52
  ### For development (Uncompressed)
54
53
 
55
54
  You can download the uncompressed files for development
@@ -85,10 +84,16 @@ You can download the compressed files for production
85
84
  - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.pkgd.js
86
85
  - https://naver.github.io/billboard.js/release/[VERSION]/dist/billboard.pkgd.min.js
87
86
 
87
+ </details>
88
+
88
89
  ### Themes
89
90
  > If you want apply themes, simply load one of the theme css file provided instead of the default css file.
90
91
  > - [Screenshot Preview](https://github.com/naver/billboard.js/wiki/Themes)
91
92
 
93
+
94
+ <details>
95
+ <summary>Dist theme file list from the repo. (click to expand)</summary>
96
+
92
97
  #### datalab
93
98
  - https://naver.github.io/billboard.js/release/latest/dist/theme/datalab.css
94
99
  - https://naver.github.io/billboard.js/release/latest/dist/theme/datalab.min.css
@@ -102,6 +107,8 @@ You can download the compressed files for production
102
107
  - https://naver.github.io/billboard.js/release/latest/dist/theme/graph.css
103
108
  - https://naver.github.io/billboard.js/release/latest/dist/theme/graph.min.css
104
109
 
110
+ </details>
111
+
105
112
  ### Nightly version
106
113
 
107
114
  Nightly version is the latest build from the master branch.
@@ -192,6 +199,7 @@ Load billboard.js after D3.js.
192
199
  ```
193
200
 
194
201
  or use importing ESM.
202
+ > 📌 Also check: [How to load as ESM directly from the browser?](https://github.com/naver/billboard.js/wiki/How-to-load-as-ESM-directly-from-the-browser%3F)
195
203
 
196
204
  ```js
197
205
  // 1) import billboard.js
@@ -244,78 +252,6 @@ var chart = bb.generate({
244
252
  chart.load( ... );
245
253
  ```
246
254
 
247
- ## How to start developing billboard.js?
248
-
249
- For anyone interested in developing billboard.js, follow the instructions below.
250
- > Required Node.js version: `10.10.0+`
251
-
252
- ### Development Environment
253
-
254
- #### 1. Clone the repository
255
-
256
- Clone the billboard.js repository and install the dependency modules.
257
-
258
- ```bash
259
- # Create a folder and move.
260
- $ mkdir billboard.js && cd billboard.js
261
-
262
- # Clone the repository.
263
- $ git clone https://github.com/naver/billboard.js.git
264
- ```
265
-
266
- #### 2. Install dependencies
267
- `npm` and `Yarn` are supported.
268
-
269
- ```
270
- # Install the dependency modules.
271
- $ npm install
272
-
273
- # or
274
- $ yarn
275
- ```
276
-
277
- #### 3. Build
278
-
279
- Use npm script to build billboard.js
280
-
281
- ```bash
282
- # Run webpack-dev-server for development
283
- $ npm start
284
-
285
- # Build
286
- $ npm run build
287
-
288
- # Generate jsdoc
289
- $ npm run jsdoc
290
- ```
291
-
292
- Two folders will be created after the build is completed.
293
-
294
- - **dist** folder: Includes the **billboard.js** and **billboard.min.js** files.
295
- - **doc** folder: Includes API documentation. The home page for the documentation is **doc/index.html**.
296
-
297
- ### Linting
298
-
299
- To maintain the same code style and quality, we adopted [ESLint](https://eslint.org/). The [rules](https://github.com/naver/eslint-config-naver/tree/master/rules) are based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript) with some modifications.
300
- Setup your editor for check or run the below command for linting.
301
-
302
- ```bash
303
- $ npm run lint
304
- ```
305
-
306
- ### Test
307
-
308
- Once you created a branch and finished the development, you must perform a test with `npm test` command before the push to a remote repository.
309
-
310
- ```bash
311
- $ npm test
312
- ```
313
- Running the `npm test` command will start [Mocha](https://mochajs.org/) tests via [Karma-runner](https://karma-runner.github.io/).
314
-
315
- ## Bug Report
316
-
317
- If you find a bug, please report to us by posting [issues](https://github.com/naver/billboard.js/issues) on GitHub.
318
-
319
255
  ## License
320
256
  billboard.js is released under the [MIT license](https://github.com/naver/billboard.js/blob/master/LICENSE).
321
257
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.1
8
+ * @version 3.6.3
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.6.1
8
+ * @version 3.6.3
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -5396,12 +5396,10 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5396
5396
  return;
5397
5397
  }
5398
5398
  }
5399
- var shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).each(function () {
5400
- (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($COMMON.EXPANDED, !0);
5401
- if (isSelectionEnabled) {
5402
- eventRect.style("cursor", isSelectionGrouped ? "pointer" : null);
5403
- }
5404
- }).filter(function (d) {
5399
+
5400
+ // remove possible previous focused state
5401
+ main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1);
5402
+ var shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).classed($COMMON.EXPANDED, !0).style("cursor", isSelectable ? "pointer" : null).filter(function (d) {
5405
5403
  return $$.isWithinShape(this, d);
5406
5404
  });
5407
5405
  if (shapeAtIndex.empty() && !isTooltipGrouped) {
@@ -13017,7 +13015,7 @@ var AxisRendererHelper = /*#__PURE__*/function () {
13017
13015
  _newArrowCheck(this, _this2);
13018
13016
  selection.attr("transform", function (d) {
13019
13017
  _newArrowCheck(this, _this3);
13020
- return fn(Math.ceil(scale(d)));
13018
+ return isValue(d) ? fn(Math.ceil(scale(d))) : null;
13021
13019
  }.bind(this));
13022
13020
  }.bind(this);
13023
13021
  };
@@ -14637,30 +14635,38 @@ var Axis_Axis = /*#__PURE__*/function () {
14637
14635
  var _this4 = this;
14638
14636
  _newArrowCheck(this, _this3);
14639
14637
  var x = getPrevNextX(d),
14640
- xDomain = xScale.domain();
14638
+ xDomain = xScale.domain(),
14639
+ val;
14641
14640
  // if there this is a single data point make the eventRect full width (or height)
14642
14641
  if (x.prev === null && x.next === null) {
14643
- return isRotated ? state.height : state.width;
14642
+ val = isRotated ? state.height : state.width;
14643
+ } else if (x.prev === null) {
14644
+ val = (xScale(x.next) + xScale(d.x)) / 2;
14645
+ } else if (x.next === null) {
14646
+ val = xScale(xDomain[1]) - (xScale(x.prev) + xScale(d.x)) / 2;
14647
+ } else {
14648
+ Object.keys(x).forEach(function (key, i) {
14649
+ var _x$key;
14650
+ _newArrowCheck(this, _this4);
14651
+ x[key] = (_x$key = x[key]) != null ? _x$key : xDomain[i];
14652
+ }.bind(this));
14653
+ val = Math.max(0, (xScale(x.next) - xScale(x.prev)) / 2);
14644
14654
  }
14645
- Object.keys(x).forEach(function (key, i) {
14646
- var _x$key;
14647
- _newArrowCheck(this, _this4);
14648
- x[key] = (_x$key = x[key]) != null ? _x$key : xDomain[i];
14649
- }.bind(this));
14650
- return Math.max(0, (xScale(x.next) - xScale(x.prev)) / 2);
14655
+ return val;
14651
14656
  }.bind(this);
14652
14657
  rectX = function (d) {
14653
14658
  _newArrowCheck(this, _this3);
14654
14659
  var x = getPrevNextX(d),
14655
- thisX = d.x;
14660
+ val;
14656
14661
  // if there this is a single data point position the eventRect at 0
14657
14662
  if (x.prev === null && x.next === null) {
14658
- return 0;
14659
- }
14660
- if (x.prev === null) {
14661
- x.prev = xScale.domain()[0];
14663
+ val = 0;
14664
+ } else if (x.prev === null) {
14665
+ val = xScale(xScale.domain()[0]);
14666
+ } else {
14667
+ val = (xScale(d.x) + xScale(x.prev)) / 2;
14662
14668
  }
14663
- return (xScale(thisX) + xScale(x.prev)) / 2;
14669
+ return val;
14664
14670
  }.bind(this);
14665
14671
  }
14666
14672
  x = isRotated ? 0 : rectX;
@@ -23624,7 +23630,7 @@ var _defaults = {},
23624
23630
  * bb.version; // "1.0.0"
23625
23631
  * @memberof bb
23626
23632
  */
23627
- version: "3.6.1",
23633
+ version: "3.6.3",
23628
23634
  /**
23629
23635
  * Generate chart
23630
23636
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -23754,7 +23760,7 @@ var _defaults = {},
23754
23760
  };
23755
23761
  /**
23756
23762
  * @namespace bb
23757
- * @version 3.6.1
23763
+ * @version 3.6.3
23758
23764
  */
23759
23765
  ;// CONCATENATED MODULE: ./src/index.ts
23760
23766
 
@@ -5,5 +5,5 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.1
8
+ * @version 3.6.3
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}