billboard.js 3.4.1 → 3.5.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 (53) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +3283 -1110
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +7416 -4949
  6. package/dist/billboard.pkgd.min.js +3 -2
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +29 -13
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +259 -89
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +329 -106
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +223 -71
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +219 -72
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +3940 -3793
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +4219 -3882
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +4392 -3930
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +4187 -3868
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +4195 -3872
  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 +206 -41
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +47 -75
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +66 -85
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +50 -76
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +47 -75
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +47 -75
  34. package/package.json +34 -34
  35. package/src/Chart/api/data.ts +2 -2
  36. package/src/ChartInternal/Axis/AxisRenderer.ts +29 -3
  37. package/src/ChartInternal/ChartInternal.ts +8 -1
  38. package/src/ChartInternal/interactions/zoom.ts +17 -4
  39. package/src/ChartInternal/internals/color.ts +3 -2
  40. package/src/ChartInternal/internals/grid.ts +5 -3
  41. package/src/ChartInternal/internals/redraw.ts +5 -2
  42. package/src/ChartInternal/internals/scale.ts +3 -1
  43. package/src/ChartInternal/internals/size.axis.ts +5 -2
  44. package/src/ChartInternal/internals/text.ts +115 -15
  45. package/src/ChartInternal/shape/bar.ts +12 -5
  46. package/src/Plugin/sparkline/index.ts +22 -11
  47. package/src/Plugin/stanford/index.ts +10 -7
  48. package/src/config/Options/common/main.ts +15 -1
  49. package/src/config/Options/common/tooltip.ts +1 -1
  50. package/src/config/Options/data/data.ts +11 -3
  51. package/src/module/generator.ts +12 -5
  52. package/types/chart.d.ts +2 -2
  53. package/types/options.d.ts +21 -8
@@ -5,13 +5,13 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.4.1
8
+ * @version 3.5.0-next.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
12
12
  import { select } from 'd3-selection';
13
13
 
14
- /*! *****************************************************************************
14
+ /******************************************************************************
15
15
  Copyright (c) Microsoft Corporation.
16
16
 
17
17
  Permission to use, copy, modify, and/or distribute this software for any
@@ -57,12 +57,10 @@ function __extends(d, b) {
57
57
  * Copyright (c) 2017 ~ present NAVER Corp.
58
58
  * billboard.js project is licensed under the MIT license
59
59
  */
60
-
61
60
  /**
62
61
  * Base class to generate billboard.js plugin
63
62
  * @class Plugin
64
63
  */
65
-
66
64
  /**
67
65
  * Version info string for plugin
68
66
  * @name version
@@ -72,77 +70,51 @@ function __extends(d, b) {
72
70
  * @example
73
71
  * bb.plugin.stanford.version; // ex) 1.9.0
74
72
  */
75
- var Plugin = /*#__PURE__*/function () {
76
- /**
77
- * Version info string for plugin
78
- * @name version
79
- * @static
80
- * @memberof Plugin
81
- * @type {String}
82
- * @example
83
- * bb.plugin.stanford.version; // ex) 1.9.0
84
- */
85
-
86
- /**
87
- * Constructor
88
- * @param {Any} options config option object
89
- * @private
90
- */
91
- function Plugin(options) {
92
- if (options === void 0) {
93
- options = {};
73
+ var Plugin = /** @class */ (function () {
74
+ /**
75
+ * Constructor
76
+ * @param {Any} options config option object
77
+ * @private
78
+ */
79
+ function Plugin(options) {
80
+ if (options === void 0) { options = {}; }
81
+ this.options = options;
94
82
  }
95
- this.options = options;
96
- }
97
- /**
98
- * Lifecycle hook for 'beforeInit' phase.
99
- * @private
100
- */
101
-
102
-
103
- var _proto = Plugin.prototype;
104
-
105
- _proto.$beforeInit = function $beforeInit() {}
106
- /**
107
- * Lifecycle hook for 'init' phase.
108
- * @private
109
- */
110
- ;
111
-
112
- _proto.$init = function $init() {}
113
- /**
114
- * Lifecycle hook for 'afterInit' phase.
115
- * @private
116
- */
117
- ;
118
-
119
- _proto.$afterInit = function $afterInit() {}
120
- /**
121
- * Lifecycle hook for 'redraw' phase.
122
- * @private
123
- */
124
- ;
125
-
126
- _proto.$redraw = function $redraw() {}
127
- /**
128
- * Lifecycle hook for 'willDestroy' phase.
129
- * @private
130
- */
131
- ;
132
-
133
- _proto.$willDestroy = function $willDestroy() {
134
- var _this = this;
135
-
136
- Object.keys(this).forEach(function (key) {
137
- _this[key] = null;
138
- delete _this[key];
139
- });
140
- };
141
-
142
- return Plugin;
143
- }();
144
-
145
- Plugin.version = "#3.4.1#";
83
+ /**
84
+ * Lifecycle hook for 'beforeInit' phase.
85
+ * @private
86
+ */
87
+ Plugin.prototype.$beforeInit = function () { };
88
+ /**
89
+ * Lifecycle hook for 'init' phase.
90
+ * @private
91
+ */
92
+ Plugin.prototype.$init = function () { };
93
+ /**
94
+ * Lifecycle hook for 'afterInit' phase.
95
+ * @private
96
+ */
97
+ Plugin.prototype.$afterInit = function () { };
98
+ /**
99
+ * Lifecycle hook for 'redraw' phase.
100
+ * @private
101
+ */
102
+ Plugin.prototype.$redraw = function () { };
103
+ /**
104
+ * Lifecycle hook for 'willDestroy' phase.
105
+ * @private
106
+ */
107
+ Plugin.prototype.$willDestroy = function () {
108
+ var _this = this;
109
+ Object.keys(this).forEach(function (key) {
110
+ _this[key] = null;
111
+ delete _this[key];
112
+ });
113
+ };
114
+ Plugin.version = "3.5.0-next.1";
115
+ return Plugin;
116
+ }());
117
+ var Plugin$1 = Plugin;
146
118
 
147
119
  /**
148
120
  * Bubble compare diagram plugin.<br>
@@ -241,6 +213,6 @@ var BubbleCompare = /** @class */ (function (_super) {
241
213
  };
242
214
  BubbleCompare.version = "0.0.1";
243
215
  return BubbleCompare;
244
- }(Plugin));
216
+ }(Plugin$1));
245
217
 
246
218
  export { BubbleCompare as default };
@@ -5,11 +5,11 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.4.1
8
+ * @version 3.5.0-next.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
12
- /*! *****************************************************************************
12
+ /******************************************************************************
13
13
  Copyright (c) Microsoft Corporation.
14
14
 
15
15
  Permission to use, copy, modify, and/or distribute this software for any
@@ -232,12 +232,10 @@ _assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(
232
232
  * Copyright (c) 2017 ~ present NAVER Corp.
233
233
  * billboard.js project is licensed under the MIT license
234
234
  */
235
-
236
235
  /**
237
236
  * Base class to generate billboard.js plugin
238
237
  * @class Plugin
239
238
  */
240
-
241
239
  /**
242
240
  * Version info string for plugin
243
241
  * @name version
@@ -247,77 +245,51 @@ _assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(
247
245
  * @example
248
246
  * bb.plugin.stanford.version; // ex) 1.9.0
249
247
  */
250
- var Plugin = /*#__PURE__*/function () {
251
- /**
252
- * Version info string for plugin
253
- * @name version
254
- * @static
255
- * @memberof Plugin
256
- * @type {String}
257
- * @example
258
- * bb.plugin.stanford.version; // ex) 1.9.0
259
- */
260
-
261
- /**
262
- * Constructor
263
- * @param {Any} options config option object
264
- * @private
265
- */
266
- function Plugin(options) {
267
- if (options === void 0) {
268
- options = {};
248
+ var Plugin = /** @class */ (function () {
249
+ /**
250
+ * Constructor
251
+ * @param {Any} options config option object
252
+ * @private
253
+ */
254
+ function Plugin(options) {
255
+ if (options === void 0) { options = {}; }
256
+ this.options = options;
269
257
  }
270
- this.options = options;
271
- }
272
- /**
273
- * Lifecycle hook for 'beforeInit' phase.
274
- * @private
275
- */
276
-
277
-
278
- var _proto = Plugin.prototype;
279
-
280
- _proto.$beforeInit = function $beforeInit() {}
281
- /**
282
- * Lifecycle hook for 'init' phase.
283
- * @private
284
- */
285
- ;
286
-
287
- _proto.$init = function $init() {}
288
- /**
289
- * Lifecycle hook for 'afterInit' phase.
290
- * @private
291
- */
292
- ;
293
-
294
- _proto.$afterInit = function $afterInit() {}
295
- /**
296
- * Lifecycle hook for 'redraw' phase.
297
- * @private
298
- */
299
- ;
300
-
301
- _proto.$redraw = function $redraw() {}
302
- /**
303
- * Lifecycle hook for 'willDestroy' phase.
304
- * @private
305
- */
306
- ;
307
-
308
- _proto.$willDestroy = function $willDestroy() {
309
- var _this = this;
310
-
311
- Object.keys(this).forEach(function (key) {
312
- _this[key] = null;
313
- delete _this[key];
314
- });
315
- };
316
-
317
- return Plugin;
318
- }();
319
-
320
- Plugin.version = "#3.4.1#";
258
+ /**
259
+ * Lifecycle hook for 'beforeInit' phase.
260
+ * @private
261
+ */
262
+ Plugin.prototype.$beforeInit = function () { };
263
+ /**
264
+ * Lifecycle hook for 'init' phase.
265
+ * @private
266
+ */
267
+ Plugin.prototype.$init = function () { };
268
+ /**
269
+ * Lifecycle hook for 'afterInit' phase.
270
+ * @private
271
+ */
272
+ Plugin.prototype.$afterInit = function () { };
273
+ /**
274
+ * Lifecycle hook for 'redraw' phase.
275
+ * @private
276
+ */
277
+ Plugin.prototype.$redraw = function () { };
278
+ /**
279
+ * Lifecycle hook for 'willDestroy' phase.
280
+ * @private
281
+ */
282
+ Plugin.prototype.$willDestroy = function () {
283
+ var _this = this;
284
+ Object.keys(this).forEach(function (key) {
285
+ _this[key] = null;
286
+ delete _this[key];
287
+ });
288
+ };
289
+ Plugin.version = "3.5.0-next.1";
290
+ return Plugin;
291
+ }());
292
+ var Plugin$1 = Plugin;
321
293
 
322
294
  /**
323
295
  * Copyright (c) 2021 ~ present NAVER Corp.
@@ -589,13 +561,21 @@ var Sparkline = /** @class */ (function (_super) {
589
561
  config.legend_show = false;
590
562
  config.resize_auto = false;
591
563
  config.axis_x_show = false;
592
- config.axis_x_padding = {
593
- left: 15,
594
- right: 15,
595
- unit: "px"
596
- };
564
+ // set default axes padding
565
+ if (config.padding !== false) {
566
+ var hasOption = function (o) { return Object.keys(o || {}).length > 0; };
567
+ if (hasOption(config.axis_x_padding)) {
568
+ config.axis_x_padding = {
569
+ left: 15,
570
+ right: 15,
571
+ unit: "px"
572
+ };
573
+ }
574
+ if (hasOption(config.axis_y_padding)) {
575
+ config.axis_y_padding = 5;
576
+ }
577
+ }
597
578
  config.axis_y_show = false;
598
- config.axis_y_padding = 5;
599
579
  if (!config.tooltip_position) {
600
580
  config.tooltip_position = function (data, width, height) {
601
581
  var event = this.internal.state.event;
@@ -612,14 +592,14 @@ var Sparkline = /** @class */ (function (_super) {
612
592
  }
613
593
  };
614
594
  Sparkline.prototype.$init = function () {
615
- var $$ = this.$$;
616
- var $el = $$.$el;
595
+ var _a;
596
+ var $el = this.$$.$el;
617
597
  // make disable-ish main chart element
618
598
  $el.chart
619
599
  .style("width", "0")
620
600
  .style("height", "0")
621
601
  .style("pointer-events", "none");
622
- document.body.appendChild($el.tooltip.node());
602
+ ((_a = $el.tooltip) === null || _a === void 0 ? void 0 : _a.node()) && document.body.appendChild($el.tooltip.node());
623
603
  };
624
604
  Sparkline.prototype.$afterInit = function () {
625
605
  var $$ = this.$$;
@@ -636,7 +616,8 @@ var Sparkline = /** @class */ (function (_super) {
636
616
  Sparkline.prototype.bindEvents = function (bind) {
637
617
  var _this = this;
638
618
  if (bind === void 0) { bind = true; }
639
- if (this.$$.config.interaction_enabled) {
619
+ var config = this.$$.config;
620
+ if (config.interaction_enabled && config.tooltip_show) {
640
621
  var method_1 = "".concat(bind ? "add" : "remove", "EventListener");
641
622
  this.element
642
623
  .forEach(function (el) {
@@ -716,6 +697,6 @@ var Sparkline = /** @class */ (function (_super) {
716
697
  };
717
698
  Sparkline.version = "0.0.1";
718
699
  return Sparkline;
719
- }(Plugin));
700
+ }(Plugin$1));
720
701
 
721
702
  export { Sparkline as default };
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.4.1
8
+ * @version 3.5.0-next.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -15,7 +15,7 @@ import { scaleSequential, scaleLog, scaleSequentialLog } from 'd3-scale';
15
15
  import { axisRight } from 'd3-axis';
16
16
  import { format } from 'd3-format';
17
17
 
18
- /*! *****************************************************************************
18
+ /******************************************************************************
19
19
  Copyright (c) Microsoft Corporation.
20
20
 
21
21
  Permission to use, copy, modify, and/or distribute this software for any
@@ -435,12 +435,10 @@ function loadConfig(config) {
435
435
  * Copyright (c) 2017 ~ present NAVER Corp.
436
436
  * billboard.js project is licensed under the MIT license
437
437
  */
438
-
439
438
  /**
440
439
  * Base class to generate billboard.js plugin
441
440
  * @class Plugin
442
441
  */
443
-
444
442
  /**
445
443
  * Version info string for plugin
446
444
  * @name version
@@ -450,77 +448,51 @@ function loadConfig(config) {
450
448
  * @example
451
449
  * bb.plugin.stanford.version; // ex) 1.9.0
452
450
  */
453
- var Plugin = /*#__PURE__*/function () {
454
- /**
455
- * Version info string for plugin
456
- * @name version
457
- * @static
458
- * @memberof Plugin
459
- * @type {String}
460
- * @example
461
- * bb.plugin.stanford.version; // ex) 1.9.0
462
- */
463
-
464
- /**
465
- * Constructor
466
- * @param {Any} options config option object
467
- * @private
468
- */
469
- function Plugin(options) {
470
- if (options === void 0) {
471
- options = {};
451
+ var Plugin = /** @class */ (function () {
452
+ /**
453
+ * Constructor
454
+ * @param {Any} options config option object
455
+ * @private
456
+ */
457
+ function Plugin(options) {
458
+ if (options === void 0) { options = {}; }
459
+ this.options = options;
472
460
  }
473
- this.options = options;
474
- }
475
- /**
476
- * Lifecycle hook for 'beforeInit' phase.
477
- * @private
478
- */
479
-
480
-
481
- var _proto = Plugin.prototype;
482
-
483
- _proto.$beforeInit = function $beforeInit() {}
484
- /**
485
- * Lifecycle hook for 'init' phase.
486
- * @private
487
- */
488
- ;
489
-
490
- _proto.$init = function $init() {}
491
- /**
492
- * Lifecycle hook for 'afterInit' phase.
493
- * @private
494
- */
495
- ;
496
-
497
- _proto.$afterInit = function $afterInit() {}
498
- /**
499
- * Lifecycle hook for 'redraw' phase.
500
- * @private
501
- */
502
- ;
503
-
504
- _proto.$redraw = function $redraw() {}
505
- /**
506
- * Lifecycle hook for 'willDestroy' phase.
507
- * @private
508
- */
509
- ;
510
-
511
- _proto.$willDestroy = function $willDestroy() {
512
- var _this = this;
513
-
514
- Object.keys(this).forEach(function (key) {
515
- _this[key] = null;
516
- delete _this[key];
517
- });
518
- };
519
-
520
- return Plugin;
521
- }();
522
-
523
- Plugin.version = "#3.4.1#";
461
+ /**
462
+ * Lifecycle hook for 'beforeInit' phase.
463
+ * @private
464
+ */
465
+ Plugin.prototype.$beforeInit = function () { };
466
+ /**
467
+ * Lifecycle hook for 'init' phase.
468
+ * @private
469
+ */
470
+ Plugin.prototype.$init = function () { };
471
+ /**
472
+ * Lifecycle hook for 'afterInit' phase.
473
+ * @private
474
+ */
475
+ Plugin.prototype.$afterInit = function () { };
476
+ /**
477
+ * Lifecycle hook for 'redraw' phase.
478
+ * @private
479
+ */
480
+ Plugin.prototype.$redraw = function () { };
481
+ /**
482
+ * Lifecycle hook for 'willDestroy' phase.
483
+ * @private
484
+ */
485
+ Plugin.prototype.$willDestroy = function () {
486
+ var _this = this;
487
+ Object.keys(this).forEach(function (key) {
488
+ _this[key] = null;
489
+ delete _this[key];
490
+ });
491
+ };
492
+ Plugin.version = "3.5.0-next.1";
493
+ return Plugin;
494
+ }());
495
+ var Plugin$1 = Plugin;
524
496
 
525
497
  /**
526
498
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -1174,9 +1146,11 @@ var Stanford = /** @class */ (function (_super) {
1174
1146
  var config = this.$$.config;
1175
1147
  if (isEmpty(config.tooltip_contents)) {
1176
1148
  config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
1149
+ var data_x = config.data_x;
1177
1150
  var html = "<table class=\"".concat($TOOLTIP.tooltip, "\"><tbody>");
1178
1151
  d.forEach(function (v) {
1179
- html += "<tr>\n\t\t\t\t\t\t\t<th>".concat(defaultTitleFormat(config.data_x), "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultValueFormat(v.x), "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>").concat(defaultTitleFormat(v.id), "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultValueFormat(v.value), "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"").concat($TOOLTIP.tooltipName, "-").concat(v.id, "\">\n\t\t\t\t\t\t\t<td class=\"name\"><span style=\"background-color:").concat(color(v), "\"></span>").concat(defaultTitleFormat("Epochs"), "</td>\n\t\t\t\t\t\t\t<td class=\"value\">").concat(defaultValueFormat(v.epochs), "</td>\n\t\t\t\t\t\t</tr>");
1152
+ var _a = v.id, id = _a === void 0 ? "" : _a, _b = v.value, value = _b === void 0 ? 0 : _b, _c = v.epochs, epochs = _c === void 0 ? 0 : _c, _d = v.x, x = _d === void 0 ? "" : _d;
1153
+ html += "<tr>\n\t\t\t\t\t\t\t<th>".concat(data_x || "", "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultTitleFormat(x), "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>").concat(v.id, "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultValueFormat(value), "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"").concat($TOOLTIP.tooltipName, "-").concat(id, "\">\n\t\t\t\t\t\t\t<td class=\"name\"><span style=\"background-color:").concat(color(v), "\"></span>Epochs</td>\n\t\t\t\t\t\t\t<td class=\"value\">").concat(defaultValueFormat(epochs), "</td>\n\t\t\t\t\t\t</tr>");
1180
1154
  });
1181
1155
  return "".concat(html, "</tbody></table>");
1182
1156
  };
@@ -1200,6 +1174,6 @@ var Stanford = /** @class */ (function (_super) {
1200
1174
  };
1201
1175
  };
1202
1176
  return Stanford;
1203
- }(Plugin));
1177
+ }(Plugin$1));
1204
1178
 
1205
1179
  export { Stanford as default };