billboard.js 3.6.0 → 3.6.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 (37) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +4511 -7069
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +7862 -11555
  6. package/dist/billboard.pkgd.min.js +2 -3
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +27 -62
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +303 -528
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +368 -648
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +305 -513
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +306 -500
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2055 -2248
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2826 -3485
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3080 -3996
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2829 -3471
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2970 -3817
  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 +30 -27
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -8
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -12
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -12
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -12
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -8
  34. package/package.json +23 -23
  35. package/src/ChartInternal/data/IData.ts +8 -2
  36. package/src/ChartInternal/interactions/interaction.ts +39 -26
  37. package/types/options.d.ts +7 -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.6.0
8
+ * @version 3.6.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -116,7 +116,6 @@ function _assertThisInitialized(self) {
116
116
  if (self === void 0) {
117
117
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
118
118
  }
119
-
120
119
  return self;
121
120
  }
122
121
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
@@ -150,7 +149,6 @@ function _defineProperty(obj, key, value) {
150
149
  } else {
151
150
  obj[key] = value;
152
151
  }
153
-
154
152
  return obj;
155
153
  }
156
154
  // EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
@@ -159,56 +157,41 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
159
157
  var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
160
158
  ;// CONCATENATED MODULE: ./src/module/browser.ts
161
159
 
162
-
163
160
  var _this = undefined;
164
-
165
161
  /**
166
162
  * Copyright (c) 2017 ~ present NAVER Corp.
167
163
  * billboard.js project is licensed under the MIT license
168
164
  */
169
-
170
165
  /**
171
166
  * Window object
172
167
  * @private
173
168
  */
174
-
175
169
  /* eslint-disable no-new-func, no-undef */
176
170
 
177
-
178
171
  var win = function () {
179
172
  _newArrowCheck(this, _this);
180
-
181
173
  var root = typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self;
182
174
  return root || Function("return this")();
183
175
  }.bind(undefined)();
184
176
  /* eslint-enable no-new-func, no-undef */
185
- // fallback for non-supported environments
186
-
187
177
 
178
+ // fallback for non-supported environments
188
179
  win.requestIdleCallback = win.requestIdleCallback || function (cb) {
189
180
  _newArrowCheck(this, _this);
190
-
191
181
  return setTimeout(cb, 1);
192
- }.bind(undefined); // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
193
-
194
-
182
+ }.bind(undefined);
183
+ // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
195
184
  win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
196
185
  _newArrowCheck(this, _this);
197
-
198
186
  return setTimeout(cb, 1);
199
187
  }.bind(undefined);
200
-
201
188
  var doc = win == null ? void 0 : win.document;
202
189
  ;// CONCATENATED MODULE: ./src/module/util.ts
203
190
 
204
191
 
205
-
206
192
  var util_this = undefined;
207
-
208
193
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
209
-
210
194
  function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
211
-
212
195
  /**
213
196
  * Copyright (c) 2017 ~ present NAVER Corp.
214
197
  * billboard.js project is licensed under the MIT license
@@ -218,83 +201,66 @@ function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i
218
201
 
219
202
 
220
203
 
221
-
222
204
  var isValue = function (v) {
223
- _newArrowCheck(this, util_this);
224
-
225
- return v || v === 0;
226
- }.bind(undefined),
227
- isFunction = function (v) {
228
- _newArrowCheck(this, util_this);
229
-
230
- return typeof v === "function";
231
- }.bind(undefined),
232
- isString = function (v) {
233
- _newArrowCheck(this, util_this);
234
-
235
- return typeof v === "string";
236
- }.bind(undefined),
237
- isNumber = function (v) {
238
- _newArrowCheck(this, util_this);
239
-
240
- return typeof v === "number";
241
- }.bind(undefined),
242
- isUndefined = function (v) {
243
- _newArrowCheck(this, util_this);
244
-
245
- return typeof v === "undefined";
246
- }.bind(undefined),
247
- isDefined = function (v) {
248
- _newArrowCheck(this, util_this);
249
-
250
- return typeof v !== "undefined";
251
- }.bind(undefined),
252
- isboolean = function (v) {
253
- _newArrowCheck(this, util_this);
254
-
255
- return typeof v === "boolean";
256
- }.bind(undefined),
257
- ceil10 = function (v) {
258
- _newArrowCheck(this, util_this);
259
-
260
- return Math.ceil(v / 10) * 10;
261
- }.bind(undefined),
262
- asHalfPixel = function (n) {
263
- _newArrowCheck(this, util_this);
264
-
265
- return Math.ceil(n) + .5;
266
- }.bind(undefined),
267
- diffDomain = function (d) {
268
- _newArrowCheck(this, util_this);
269
-
270
- return d[1] - d[0];
271
- }.bind(undefined),
272
- isObjectType = function (v) {
273
- _newArrowCheck(this, util_this);
274
-
275
- return typeof v === "object";
276
- }.bind(undefined),
277
- isEmpty = function (o) {
278
- _newArrowCheck(this, util_this);
279
-
280
- return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
281
- }.bind(undefined),
282
- notEmpty = function (o) {
283
- _newArrowCheck(this, util_this);
284
-
285
- return !isEmpty(o);
286
- }.bind(undefined),
287
- isArray = function (arr) {
288
- _newArrowCheck(this, util_this);
289
-
290
- return Array.isArray(arr);
291
- }.bind(undefined),
292
- isObject = function (obj) {
293
- _newArrowCheck(this, util_this);
294
-
295
- return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
296
- }.bind(undefined);
297
-
205
+ _newArrowCheck(this, util_this);
206
+ return v || v === 0;
207
+ }.bind(undefined),
208
+ isFunction = function (v) {
209
+ _newArrowCheck(this, util_this);
210
+ return typeof v === "function";
211
+ }.bind(undefined),
212
+ isString = function (v) {
213
+ _newArrowCheck(this, util_this);
214
+ return typeof v === "string";
215
+ }.bind(undefined),
216
+ isNumber = function (v) {
217
+ _newArrowCheck(this, util_this);
218
+ return typeof v === "number";
219
+ }.bind(undefined),
220
+ isUndefined = function (v) {
221
+ _newArrowCheck(this, util_this);
222
+ return typeof v === "undefined";
223
+ }.bind(undefined),
224
+ isDefined = function (v) {
225
+ _newArrowCheck(this, util_this);
226
+ return typeof v !== "undefined";
227
+ }.bind(undefined),
228
+ isboolean = function (v) {
229
+ _newArrowCheck(this, util_this);
230
+ return typeof v === "boolean";
231
+ }.bind(undefined),
232
+ ceil10 = function (v) {
233
+ _newArrowCheck(this, util_this);
234
+ return Math.ceil(v / 10) * 10;
235
+ }.bind(undefined),
236
+ asHalfPixel = function (n) {
237
+ _newArrowCheck(this, util_this);
238
+ return Math.ceil(n) + .5;
239
+ }.bind(undefined),
240
+ diffDomain = function (d) {
241
+ _newArrowCheck(this, util_this);
242
+ return d[1] - d[0];
243
+ }.bind(undefined),
244
+ isObjectType = function (v) {
245
+ _newArrowCheck(this, util_this);
246
+ return typeof v === "object";
247
+ }.bind(undefined),
248
+ isEmpty = function (o) {
249
+ _newArrowCheck(this, util_this);
250
+ return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
251
+ }.bind(undefined),
252
+ notEmpty = function (o) {
253
+ _newArrowCheck(this, util_this);
254
+ return !isEmpty(o);
255
+ }.bind(undefined),
256
+ isArray = function (arr) {
257
+ _newArrowCheck(this, util_this);
258
+ return Array.isArray(arr);
259
+ }.bind(undefined),
260
+ isObject = function (obj) {
261
+ _newArrowCheck(this, util_this);
262
+ return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
263
+ }.bind(undefined);
298
264
  /**
299
265
  * Get specified key value from object
300
266
  * If default value is given, will return if given key value not found
@@ -307,6 +273,7 @@ var isValue = function (v) {
307
273
  function getOption(options, key, defaultValue) {
308
274
  return isDefined(options[key]) ? options[key] : defaultValue;
309
275
  }
276
+
310
277
  /**
311
278
  * Check if value exist in the given object
312
279
  * @param {object} dict Target object to be checked
@@ -314,19 +281,16 @@ function getOption(options, key, defaultValue) {
314
281
  * @returns {boolean}
315
282
  * @private
316
283
  */
317
-
318
-
319
284
  function hasValue(dict, value) {
320
285
  var _this2 = this,
321
- found = !1;
322
-
286
+ found = !1;
323
287
  Object.keys(dict).forEach(function (key) {
324
288
  _newArrowCheck(this, _this2);
325
-
326
289
  return dict[key] === value && (found = !0);
327
290
  }.bind(this));
328
291
  return found;
329
292
  }
293
+
330
294
  /**
331
295
  * Call function with arguments
332
296
  * @param {Function} fn Function to be called
@@ -335,40 +299,33 @@ function hasValue(dict, value) {
335
299
  * @returns {boolean} true: fn is function, false: fn is not function
336
300
  * @private
337
301
  */
338
-
339
-
340
302
  function callFn(fn, thisArg) {
341
303
  for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
342
304
  args[_key - 2] = arguments[_key];
343
305
  }
344
-
345
306
  isFn && fn.call.apply(fn, [thisArg].concat(args));
346
307
  return isFn;
347
308
  }
309
+
348
310
  /**
349
311
  * Call function after all transitions ends
350
312
  * @param {d3.transition} transition Transition
351
313
  * @param {Fucntion} cb Callback function
352
314
  * @private
353
315
  */
354
-
355
-
356
316
  function endall(transition, cb) {
357
317
  var _this3 = this,
358
- n = 0,
359
- end = function () {
360
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
361
- args[_key2] = arguments[_key2];
362
- }
363
-
364
- --n || cb.apply.apply(cb, [this].concat(args));
365
- };
366
-
318
+ n = 0,
319
+ end = function () {
320
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
321
+ args[_key2] = arguments[_key2];
322
+ }
323
+ --n || cb.apply.apply(cb, [this].concat(args));
324
+ };
367
325
  // if is transition selection
368
326
  if ("duration" in transition) {
369
327
  transition.each(function () {
370
328
  _newArrowCheck(this, _this3);
371
-
372
329
  return ++n;
373
330
  }.bind(this)).on("end", end);
374
331
  } else {
@@ -376,17 +333,17 @@ function endall(transition, cb) {
376
333
  transition.call(end);
377
334
  }
378
335
  }
336
+
379
337
  /**
380
338
  * Replace tag sign to html entity
381
339
  * @param {string} str Target string value
382
340
  * @returns {string}
383
341
  * @private
384
342
  */
385
-
386
-
387
343
  function sanitise(str) {
388
344
  return isString(str) ? str.replace(/</g, "&lt;").replace(/>/g, "&gt;") : str;
389
345
  }
346
+
390
347
  /**
391
348
  * Set text value. If there's multiline add nodes.
392
349
  * @param {d3Selection} node Text node
@@ -395,53 +352,43 @@ function sanitise(str) {
395
352
  * @param {boolean} toMiddle To be alingned vertically middle
396
353
  * @private
397
354
  */
398
-
399
-
400
355
  function setTextValue(node, text, dy, toMiddle) {
401
356
  var _this4 = this;
402
-
403
357
  if (dy === void 0) {
404
358
  dy = [-1, 1];
405
359
  }
406
-
407
360
  if (toMiddle === void 0) {
408
361
  toMiddle = !1;
409
362
  }
410
-
411
363
  if (!node || !isString(text)) {
412
364
  return;
413
365
  }
414
-
415
366
  if (text.indexOf("\n") === -1) {
416
367
  node.text(text);
417
368
  } else {
418
369
  var diff = [node.text(), text].map(function (v) {
419
370
  _newArrowCheck(this, _this4);
420
-
421
371
  return v.replace(/[\s\n]/g, "");
422
372
  }.bind(this));
423
-
424
373
  if (diff[0] !== diff[1]) {
425
374
  var multiline = text.split("\n"),
426
- len = toMiddle ? multiline.length - 1 : 1;
375
+ len = toMiddle ? multiline.length - 1 : 1;
427
376
  // reset possible text
428
377
  node.html("");
429
378
  multiline.forEach(function (v, i) {
430
379
  _newArrowCheck(this, _this4);
431
-
432
380
  node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
433
381
  }.bind(this));
434
382
  }
435
383
  }
436
384
  }
385
+
437
386
  /**
438
387
  * Substitution of SVGPathSeg API polyfill
439
388
  * @param {SVGGraphicsElement} path Target svg element
440
389
  * @returns {Array}
441
390
  * @private
442
391
  */
443
-
444
-
445
392
  function getRectSegList(path) {
446
393
  /*
447
394
  * seg1 ---------- seg2
@@ -451,45 +398,45 @@ function getRectSegList(path) {
451
398
  * seg0 ---------- seg3
452
399
  * */
453
400
  var _path$getBBox = path.getBBox(),
454
- x = _path$getBBox.x,
455
- y = _path$getBBox.y,
456
- width = _path$getBBox.width,
457
- height = _path$getBBox.height;
458
-
401
+ x = _path$getBBox.x,
402
+ y = _path$getBBox.y,
403
+ width = _path$getBBox.width,
404
+ height = _path$getBBox.height;
459
405
  return [{
460
406
  x: x,
461
407
  y: y + height
462
- }, // seg0
408
+ },
409
+ // seg0
463
410
  {
464
411
  x: x,
465
412
  y: y
466
- }, // seg1
413
+ },
414
+ // seg1
467
415
  {
468
416
  x: x + width,
469
417
  y: y
470
- }, // seg2
418
+ },
419
+ // seg2
471
420
  {
472
421
  x: x + width,
473
422
  y: y + height
474
423
  } // seg3
475
424
  ];
476
425
  }
426
+
477
427
  /**
478
428
  * Get svg bounding path box dimension
479
429
  * @param {SVGGraphicsElement} path Target svg element
480
430
  * @returns {object}
481
431
  * @private
482
432
  */
483
-
484
-
485
433
  function getPathBox(path) {
486
434
  var _path$getBoundingClie = path.getBoundingClientRect(),
487
- width = _path$getBoundingClie.width,
488
- height = _path$getBoundingClie.height,
489
- items = getRectSegList(path),
490
- x = items[0].x,
491
- y = Math.min(items[0].y, items[1].y);
492
-
435
+ width = _path$getBoundingClie.width,
436
+ height = _path$getBoundingClie.height,
437
+ items = getRectSegList(path),
438
+ x = items[0].x,
439
+ y = Math.min(items[0].y, items[1].y);
493
440
  return {
494
441
  x: x,
495
442
  y: y,
@@ -497,6 +444,7 @@ function getPathBox(path) {
497
444
  height: height
498
445
  };
499
446
  }
447
+
500
448
  /**
501
449
  * Get event's current position coordinates
502
450
  * @param {object} event Event object
@@ -504,43 +452,38 @@ function getPathBox(path) {
504
452
  * @returns {Array} [x, y] Coordinates x, y array
505
453
  * @private
506
454
  */
507
-
508
-
509
455
  function getPointer(event, element) {
510
456
  var _ref,
511
- touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
512
- pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
513
- _this5 = this;
514
-
457
+ touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
458
+ pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
459
+ _this5 = this;
515
460
  return pointer.map(function (v) {
516
461
  _newArrowCheck(this, _this5);
517
-
518
462
  return isNaN(v) ? 0 : v;
519
463
  }.bind(this));
520
464
  }
465
+
521
466
  /**
522
467
  * Return brush selection array
523
468
  * @param {object} ctx Current instance
524
469
  * @returns {d3.brushSelection}
525
470
  * @private
526
471
  */
527
-
528
-
529
472
  function getBrushSelection(ctx) {
530
473
  var event = ctx.event,
531
- $el = ctx.$el,
532
- main = $el.subchart.main || $el.main,
533
- selection;
534
-
474
+ $el = ctx.$el,
475
+ main = $el.subchart.main || $el.main,
476
+ selection;
535
477
  // check from event
536
478
  if (event && event.type === "brush") {
537
- selection = event.selection; // check from brush area selection
479
+ selection = event.selection;
480
+ // check from brush area selection
538
481
  } else if (main && (selection = main.select(".bb-brush").node())) {
539
482
  selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
540
483
  }
541
-
542
484
  return selection;
543
485
  }
486
+
544
487
  /**
545
488
  * Get boundingClientRect.
546
489
  * Cache the evaluated value once it was called.
@@ -548,12 +491,11 @@ function getBrushSelection(ctx) {
548
491
  * @returns {object}
549
492
  * @private
550
493
  */
551
-
552
-
553
494
  function getBoundingRect(node) {
554
495
  var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
555
496
  return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
556
497
  }
498
+
557
499
  /**
558
500
  * Retrun random number
559
501
  * @param {boolean} asStr Convert returned value as string
@@ -562,24 +504,20 @@ function getBoundingRect(node) {
562
504
  * @returns {number|string}
563
505
  * @private
564
506
  */
565
-
566
-
567
507
  function getRandom(asStr, min, max) {
568
508
  if (asStr === void 0) {
569
509
  asStr = !0;
570
510
  }
571
-
572
511
  if (min === void 0) {
573
512
  min = 0;
574
513
  }
575
-
576
514
  if (max === void 0) {
577
515
  max = 1e4;
578
516
  }
579
-
580
517
  var rand = Math.floor(Math.random() * (max - min) + min);
581
518
  return asStr ? rand + "" : rand;
582
519
  }
520
+
583
521
  /**
584
522
  * Find index based on binary search
585
523
  * @param {Array} arr Data array
@@ -590,87 +528,71 @@ function getRandom(asStr, min, max) {
590
528
  * @returns {number} Index number
591
529
  * @private
592
530
  */
593
-
594
-
595
531
  function findIndex(arr, v, start, end, isRotated) {
596
532
  if (start > end) {
597
533
  return -1;
598
534
  }
599
-
600
535
  var mid = Math.floor((start + end) / 2),
601
- _arr$mid = arr[mid],
602
- x = _arr$mid.x,
603
- _arr$mid$w = _arr$mid.w,
604
- w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
605
-
536
+ _arr$mid = arr[mid],
537
+ x = _arr$mid.x,
538
+ _arr$mid$w = _arr$mid.w,
539
+ w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
606
540
  if (isRotated) {
607
541
  x = arr[mid].y;
608
542
  w = arr[mid].h;
609
543
  }
610
-
611
544
  if (v >= x && v <= x + w) {
612
545
  return mid;
613
546
  }
614
-
615
547
  return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
616
548
  }
549
+
617
550
  /**
618
551
  * Check if brush is empty
619
552
  * @param {object} ctx Bursh context
620
553
  * @returns {boolean}
621
554
  * @private
622
555
  */
623
-
624
-
625
556
  function brushEmpty(ctx) {
626
557
  var selection = getBrushSelection(ctx);
627
-
628
558
  if (selection) {
629
559
  // brush selected area
630
560
  // two-dimensional: [[x0, y0], [x1, y1]]
631
561
  // one-dimensional: [x0, x1] or [y0, y1]
632
562
  return selection[0] === selection[1];
633
563
  }
634
-
635
564
  return !0;
636
565
  }
566
+
637
567
  /**
638
568
  * Deep copy object
639
569
  * @param {object} objectN Source object
640
570
  * @returns {object} Cloned object
641
571
  * @private
642
572
  */
643
-
644
-
645
573
  function deepClone() {
646
574
  for (var _this6 = this, clone = function (v) {
647
- _newArrowCheck(this, _this6);
648
-
649
- if (isObject(v) && v.constructor) {
650
- var r = new v.constructor();
651
-
652
- for (var k in v) {
653
- r[k] = clone(v[k]);
575
+ _newArrowCheck(this, _this6);
576
+ if (isObject(v) && v.constructor) {
577
+ var r = new v.constructor();
578
+ for (var k in v) {
579
+ r[k] = clone(v[k]);
580
+ }
581
+ return r;
654
582
  }
655
-
656
- return r;
657
- }
658
-
659
- return v;
660
- }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
583
+ return v;
584
+ }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
661
585
  objectN[_key3] = arguments[_key3];
662
586
  }
663
-
664
587
  return objectN.map(function (v) {
665
588
  _newArrowCheck(this, _this6);
666
-
667
589
  return clone(v);
668
590
  }.bind(this)).reduce(function (a, c) {
669
591
  _newArrowCheck(this, _this6);
670
-
671
592
  return _objectSpread(_objectSpread({}, a), c);
672
593
  }.bind(this));
673
594
  }
595
+
674
596
  /**
675
597
  * Extend target from source object
676
598
  * @param {object} target Target object
@@ -678,47 +600,39 @@ function deepClone() {
678
600
  * @returns {object}
679
601
  * @private
680
602
  */
681
-
682
-
683
603
  function extend(target, source) {
684
604
  var _this7 = this;
685
-
686
605
  if (target === void 0) {
687
606
  target = {};
688
607
  }
689
-
690
608
  if (isArray(source)) {
691
609
  source.forEach(function (v) {
692
610
  _newArrowCheck(this, _this7);
693
-
694
611
  return extend(target, v);
695
612
  }.bind(this));
696
- } // exclude name with only numbers
697
-
613
+ }
698
614
 
615
+ // exclude name with only numbers
699
616
  for (var p in source) {
700
617
  if (/^\d+$/.test(p) || p in target) {
701
618
  continue;
702
619
  }
703
-
704
620
  target[p] = source[p];
705
621
  }
706
-
707
622
  return target;
708
623
  }
624
+
709
625
  /**
710
626
  * Return first letter capitalized
711
627
  * @param {string} str Target string
712
628
  * @returns {string} capitalized string
713
629
  * @private
714
630
  */
715
-
716
-
717
631
  var capitalize = function (str) {
718
632
  _newArrowCheck(this, util_this);
719
-
720
633
  return str.charAt(0).toUpperCase() + str.slice(1);
721
634
  }.bind(undefined);
635
+
722
636
  /**
723
637
  * Camelize from kebob style string
724
638
  * @param {string} str Target string
@@ -726,34 +640,28 @@ var capitalize = function (str) {
726
640
  * @returns {string} camelized string
727
641
  * @private
728
642
  */
729
-
730
-
731
643
  function camelize(str, separator) {
732
644
  var _this8 = this;
733
-
734
645
  if (separator === void 0) {
735
646
  separator = "-";
736
647
  }
737
-
738
648
  return str.split(separator).map(function (v, i) {
739
649
  _newArrowCheck(this, _this8);
740
-
741
650
  return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
742
651
  }.bind(this)).join("");
743
652
  }
653
+
744
654
  /**
745
655
  * Convert to array
746
656
  * @param {object} v Target to be converted
747
657
  * @returns {Array}
748
658
  * @private
749
659
  */
750
-
751
-
752
660
  var toArray = function (v) {
753
661
  _newArrowCheck(this, util_this);
754
-
755
662
  return [].slice.call(v);
756
663
  }.bind(undefined);
664
+
757
665
  /**
758
666
  * Add CSS rules
759
667
  * @param {object} style Style object
@@ -762,36 +670,29 @@ var toArray = function (v) {
762
670
  * @returns {number} Newely added rule index
763
671
  * @private
764
672
  */
765
-
766
-
767
673
  function addCssRules(style, selector, prop) {
768
674
  var _this9 = this,
769
- rootSelctor = style.rootSelctor,
770
- sheet = style.sheet,
771
- getSelector = function (s) {
772
- _newArrowCheck(this, _this9);
773
-
774
- return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
775
- }.bind(this),
776
- rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
777
-
675
+ rootSelctor = style.rootSelctor,
676
+ sheet = style.sheet,
677
+ getSelector = function (s) {
678
+ _newArrowCheck(this, _this9);
679
+ return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
680
+ }.bind(this),
681
+ rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
778
682
  return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
779
683
  }
684
+
780
685
  /**
781
686
  * Get css rules for specified stylesheets
782
687
  * @param {Array} styleSheets The stylesheets to get the rules from
783
688
  * @returns {Array}
784
689
  * @private
785
690
  */
786
-
787
-
788
691
  function getCssRules(styleSheets) {
789
692
  var _this10 = this,
790
- rules = [];
791
-
693
+ rules = [];
792
694
  styleSheets.forEach(function (sheet) {
793
695
  _newArrowCheck(this, _this10);
794
-
795
696
  try {
796
697
  if (sheet.cssRules && sheet.cssRules.length) {
797
698
  rules = rules.concat(toArray(sheet.cssRules));
@@ -802,17 +703,16 @@ function getCssRules(styleSheets) {
802
703
  }.bind(this));
803
704
  return rules;
804
705
  }
706
+
805
707
  /**
806
708
  * Gets the SVGMatrix of an SVGGElement
807
709
  * @param {SVGElement} node Node element
808
710
  * @returns {SVGMatrix} matrix
809
711
  * @private
810
712
  */
811
-
812
-
813
713
  function getTranslation(node) {
814
714
  var transform = node ? node.transform : null,
815
- baseVal = transform && transform.baseVal;
715
+ baseVal = transform && transform.baseVal;
816
716
  return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
817
717
  a: 0,
818
718
  b: 0,
@@ -822,46 +722,40 @@ function getTranslation(node) {
822
722
  f: 0
823
723
  };
824
724
  }
725
+
825
726
  /**
826
727
  * Get unique value from array
827
728
  * @param {Array} data Source data
828
729
  * @returns {Array} Unique array value
829
730
  * @private
830
731
  */
831
-
832
-
833
732
  function getUnique(data) {
834
733
  var _this11 = this,
835
- isDate = data[0] instanceof Date,
836
- d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
837
- _newArrowCheck(this, _this11);
838
-
839
- return self.indexOf(v) === i;
840
- }.bind(this));
841
-
734
+ isDate = data[0] instanceof Date,
735
+ d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
736
+ _newArrowCheck(this, _this11);
737
+ return self.indexOf(v) === i;
738
+ }.bind(this));
842
739
  return isDate ? d.map(function (v) {
843
740
  _newArrowCheck(this, _this11);
844
-
845
741
  return new Date(v);
846
742
  }.bind(this)) : d;
847
743
  }
744
+
848
745
  /**
849
746
  * Merge array
850
747
  * @param {Array} arr Source array
851
748
  * @returns {Array}
852
749
  * @private
853
750
  */
854
-
855
-
856
751
  function mergeArray(arr) {
857
752
  var _this12 = this;
858
-
859
753
  return arr && arr.length ? arr.reduce(function (p, c) {
860
754
  _newArrowCheck(this, _this12);
861
-
862
755
  return p.concat(c);
863
756
  }.bind(this)) : [];
864
757
  }
758
+
865
759
  /**
866
760
  * Merge object returning new object
867
761
  * @param {object} target Target object
@@ -869,25 +763,18 @@ function mergeArray(arr) {
869
763
  * @returns {object} merged target object
870
764
  * @private
871
765
  */
872
-
873
-
874
766
  function mergeObj(target) {
875
767
  for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
876
768
  objectN[_key4 - 1] = arguments[_key4];
877
769
  }
878
-
879
770
  if (!objectN.length || objectN.length === 1 && !objectN[0]) {
880
771
  return target;
881
772
  }
882
-
883
773
  var source = objectN.shift();
884
-
885
774
  if (isObject(target) && isObject(source)) {
886
775
  Object.keys(source).forEach(function (key) {
887
776
  _newArrowCheck(this, _this13);
888
-
889
777
  var value = source[key];
890
-
891
778
  if (isObject(value)) {
892
779
  target[key] || (target[key] = {});
893
780
  target[key] = mergeObj(target[key], value);
@@ -896,9 +783,9 @@ function mergeObj(target) {
896
783
  }
897
784
  }.bind(this));
898
785
  }
899
-
900
786
  return mergeObj.apply(void 0, [target].concat(objectN));
901
787
  }
788
+
902
789
  /**
903
790
  * Sort value
904
791
  * @param {Array} data value to be sorted
@@ -906,45 +793,36 @@ function mergeObj(target) {
906
793
  * @returns {number|string|Date} sorted date
907
794
  * @private
908
795
  */
909
-
910
-
911
796
  function sortValue(data, isAsc) {
912
797
  var _this14 = this;
913
-
914
798
  if (isAsc === void 0) {
915
799
  isAsc = !0;
916
800
  }
917
-
918
801
  var fn;
919
-
920
802
  if (data[0] instanceof Date) {
921
803
  fn = isAsc ? function (a, b) {
922
804
  _newArrowCheck(this, _this14);
923
-
924
805
  return a - b;
925
806
  }.bind(this) : function (a, b) {
926
807
  _newArrowCheck(this, _this14);
927
-
928
808
  return b - a;
929
809
  }.bind(this);
930
810
  } else {
931
811
  if (isAsc && !data.every(isNaN)) {
932
812
  fn = function (a, b) {
933
813
  _newArrowCheck(this, _this14);
934
-
935
814
  return a - b;
936
815
  }.bind(this);
937
816
  } else if (!isAsc) {
938
817
  fn = function (a, b) {
939
818
  _newArrowCheck(this, _this14);
940
-
941
819
  return a > b && -1 || a < b && 1 || a === b && 0;
942
820
  }.bind(this);
943
821
  }
944
822
  }
945
-
946
823
  return data.concat().sort(fn);
947
824
  }
825
+
948
826
  /**
949
827
  * Get min/max value
950
828
  * @param {string} type 'min' or 'max'
@@ -952,16 +830,12 @@ function sortValue(data, isAsc) {
952
830
  * @returns {number|Date|undefined}
953
831
  * @private
954
832
  */
955
-
956
-
957
833
  function getMinMax(type, data) {
958
834
  var _this15 = this,
959
- res = data.filter(function (v) {
960
- _newArrowCheck(this, _this15);
961
-
962
- return notEmpty(v);
963
- }.bind(this));
964
-
835
+ res = data.filter(function (v) {
836
+ _newArrowCheck(this, _this15);
837
+ return notEmpty(v);
838
+ }.bind(this));
965
839
  if (res.length) {
966
840
  if (isNumber(res[0])) {
967
841
  res = Math[type].apply(Math, res);
@@ -971,9 +845,9 @@ function getMinMax(type, data) {
971
845
  } else {
972
846
  res = undefined;
973
847
  }
974
-
975
848
  return res;
976
849
  }
850
+
977
851
  /**
978
852
  * Get range
979
853
  * @param {number} start Start number
@@ -982,95 +856,80 @@ function getMinMax(type, data) {
982
856
  * @returns {Array}
983
857
  * @private
984
858
  */
985
-
986
-
987
859
  var getRange = function (start, end, step) {
988
- if (step === void 0) {
989
- step = 1;
990
- }
991
-
992
- _newArrowCheck(this, util_this);
993
-
994
- var res = [],
995
- n = Math.max(0, Math.ceil((end - start) / step)) | 0;
996
-
997
- for (var i = start; i < n; i++) {
998
- res.push(start + i * step);
999
- }
1000
-
1001
- return res;
1002
- }.bind(undefined),
1003
- emulateEvent = {
1004
- mouse: function () {
1005
- var _this16 = this;
1006
-
860
+ if (step === void 0) {
861
+ step = 1;
862
+ }
1007
863
  _newArrowCheck(this, util_this);
1008
-
1009
- var getParams = function () {
1010
- _newArrowCheck(this, _this16);
1011
-
1012
- return {
1013
- bubbles: !1,
1014
- cancelable: !1,
1015
- screenX: 0,
1016
- screenY: 0,
1017
- clientX: 0,
1018
- clientY: 0
1019
- };
1020
- }.bind(this);
1021
-
1022
- try {
1023
- // eslint-disable-next-line no-new
1024
- new MouseEvent("t");
1025
- return function (el, eventType, params) {
1026
- if (params === void 0) {
1027
- params = getParams();
1028
- }
1029
-
1030
- _newArrowCheck(this, _this16);
1031
-
1032
- el.dispatchEvent(new MouseEvent(eventType, params));
1033
- }.bind(this);
1034
- } catch (e) {
1035
- // Polyfills DOM4 MouseEvent
1036
- return function (el, eventType, params) {
1037
- if (params === void 0) {
1038
- params = getParams();
1039
- }
1040
-
864
+ var res = [],
865
+ n = Math.max(0, Math.ceil((end - start) / step)) | 0;
866
+ for (var i = start; i < n; i++) {
867
+ res.push(start + i * step);
868
+ }
869
+ return res;
870
+ }.bind(undefined),
871
+ emulateEvent = {
872
+ mouse: function () {
873
+ var _this16 = this;
874
+ _newArrowCheck(this, util_this);
875
+ var getParams = function () {
1041
876
  _newArrowCheck(this, _this16);
1042
-
1043
- var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1044
-
1045
- mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
1046
- params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1047
- el.dispatchEvent(mouseEvent);
877
+ return {
878
+ bubbles: !1,
879
+ cancelable: !1,
880
+ screenX: 0,
881
+ screenY: 0,
882
+ clientX: 0,
883
+ clientY: 0
884
+ };
1048
885
  }.bind(this);
1049
- }
1050
- }.bind(undefined)(),
1051
- touch: function touch(el, eventType, params) {
1052
- _newArrowCheck(this, util_this);
1053
-
1054
- var touchObj = new Touch(mergeObj({
1055
- identifier: Date.now(),
1056
- target: el,
1057
- radiusX: 2.5,
1058
- radiusY: 2.5,
1059
- rotationAngle: 10,
1060
- force: .5
1061
- }, params));
1062
- el.dispatchEvent(new TouchEvent(eventType, {
1063
- cancelable: !0,
1064
- bubbles: !0,
1065
- shiftKey: !0,
1066
- touches: [touchObj],
1067
- targetTouches: [],
1068
- changedTouches: [touchObj]
1069
- }));
1070
- }.bind(undefined)
1071
- }; // emulate event
1072
-
1073
-
886
+ try {
887
+ // eslint-disable-next-line no-new
888
+ new MouseEvent("t");
889
+ return function (el, eventType, params) {
890
+ if (params === void 0) {
891
+ params = getParams();
892
+ }
893
+ _newArrowCheck(this, _this16);
894
+ el.dispatchEvent(new MouseEvent(eventType, params));
895
+ }.bind(this);
896
+ } catch (e) {
897
+ // Polyfills DOM4 MouseEvent
898
+ return function (el, eventType, params) {
899
+ if (params === void 0) {
900
+ params = getParams();
901
+ }
902
+ _newArrowCheck(this, _this16);
903
+ var mouseEvent = doc.createEvent("MouseEvent");
904
+
905
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
906
+ mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
907
+ // the event's mouse click count
908
+ params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
909
+ el.dispatchEvent(mouseEvent);
910
+ }.bind(this);
911
+ }
912
+ }.bind(undefined)(),
913
+ touch: function touch(el, eventType, params) {
914
+ _newArrowCheck(this, util_this);
915
+ var touchObj = new Touch(mergeObj({
916
+ identifier: Date.now(),
917
+ target: el,
918
+ radiusX: 2.5,
919
+ radiusY: 2.5,
920
+ rotationAngle: 10,
921
+ force: .5
922
+ }, params));
923
+ el.dispatchEvent(new TouchEvent(eventType, {
924
+ cancelable: !0,
925
+ bubbles: !0,
926
+ shiftKey: !0,
927
+ touches: [touchObj],
928
+ targetTouches: [],
929
+ changedTouches: [touchObj]
930
+ }));
931
+ }.bind(undefined)
932
+ }; // emulate event
1074
933
  /**
1075
934
  * Process the template & return bound string
1076
935
  * @param {string} tpl Template string
@@ -1080,13 +939,12 @@ var getRange = function (start, end, step) {
1080
939
  */
1081
940
  function tplProcess(tpl, data) {
1082
941
  var res = tpl;
1083
-
1084
942
  for (var x in data) {
1085
943
  res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
1086
944
  }
1087
-
1088
945
  return res;
1089
946
  }
947
+
1090
948
  /**
1091
949
  * Get parsed date value
1092
950
  * (It must be called in 'ChartInternal' context)
@@ -1094,41 +952,35 @@ function tplProcess(tpl, data) {
1094
952
  * @returns {Date}
1095
953
  * @private
1096
954
  */
1097
-
1098
-
1099
955
  function parseDate(date) {
1100
956
  var parsedDate;
1101
-
1102
957
  if (date instanceof Date) {
1103
958
  parsedDate = date;
1104
959
  } else if (isString(date)) {
1105
960
  var _format$dataTime,
1106
- config = this.config,
1107
- format = this.format;
1108
-
961
+ config = this.config,
962
+ format = this.format;
1109
963
  // if fails to parse, try by new Date()
1110
964
  // https://github.com/naver/billboard.js/issues/1714
1111
965
  parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
1112
966
  } else if (isNumber(date) && !isNaN(date)) {
1113
967
  parsedDate = new Date(+date);
1114
968
  }
1115
-
1116
969
  if (!parsedDate || isNaN(+parsedDate)) {
1117
970
  console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
1118
971
  }
1119
-
1120
972
  return parsedDate;
1121
973
  }
974
+
1122
975
  /**
1123
976
  * Return if the current doc is visible or not
1124
977
  * @returns {boolean}
1125
978
  * @private
1126
979
  */
1127
-
1128
-
1129
980
  function isTabVisible() {
1130
981
  return (doc == null ? void 0 : doc.hidden) === !1 || (doc == null ? void 0 : doc.visibilityState) === "visible";
1131
982
  }
983
+
1132
984
  /**
1133
985
  * Get the current input type
1134
986
  * @param {boolean} mouse Config value: interaction.inputType.mouse
@@ -1136,19 +988,18 @@ function isTabVisible() {
1136
988
  * @returns {string} "mouse" | "touch" | null
1137
989
  * @private
1138
990
  */
1139
-
1140
-
1141
991
  function convertInputType(mouse, touch) {
1142
992
  var _this17 = this,
1143
- DocumentTouch = win.DocumentTouch,
1144
- matchMedia = win.matchMedia,
1145
- navigator = win.navigator,
1146
- hasTouch = !1;
1147
-
993
+ DocumentTouch = win.DocumentTouch,
994
+ matchMedia = win.matchMedia,
995
+ navigator = win.navigator,
996
+ hasTouch = !1;
1148
997
  if (touch) {
1149
998
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
1150
999
  if (navigator && "maxTouchPoints" in navigator) {
1151
- hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1000
+ hasTouch = navigator.maxTouchPoints > 0;
1001
+
1002
+ // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1152
1003
  // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
1153
1004
  } else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
1154
1005
  hasTouch = !0;
@@ -1162,34 +1013,31 @@ function convertInputType(mouse, touch) {
1162
1013
  hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
1163
1014
  }
1164
1015
  }
1165
- } // Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
1016
+ }
1017
+
1018
+ // Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
1166
1019
  // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
1167
1020
  // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
1168
-
1169
-
1170
1021
  var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1171
1022
  _newArrowCheck(this, _this17);
1172
-
1173
1023
  return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1174
- }.bind(this)); // fallback to 'mouse' if no input type is detected.
1024
+ }.bind(this));
1175
1025
 
1026
+ // fallback to 'mouse' if no input type is detected.
1176
1027
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1177
1028
  }
1029
+
1178
1030
  /**
1179
1031
  * Run function until given condition function return true
1180
1032
  * @param {Function} fn Function to be executed when condition is true
1181
1033
  * @param {Function} conditionFn Condition function to check if condition is true
1182
1034
  * @private
1183
1035
  */
1184
-
1185
-
1186
1036
  function runUntil(fn, conditionFn) {
1187
1037
  var _this18 = this;
1188
-
1189
1038
  if (conditionFn() === !1) {
1190
1039
  win.requestAnimationFrame(function () {
1191
1040
  _newArrowCheck(this, _this18);
1192
-
1193
1041
  return runUntil(fn, conditionFn);
1194
1042
  }.bind(this));
1195
1043
  } else {
@@ -1198,13 +1046,11 @@ function runUntil(fn, conditionFn) {
1198
1046
  }
1199
1047
  ;// CONCATENATED MODULE: ./src/config/config.ts
1200
1048
 
1201
-
1202
1049
  /**
1203
1050
  * Copyright (c) 2017 ~ present NAVER Corp.
1204
1051
  * billboard.js project is licensed under the MIT license
1205
1052
  */
1206
1053
 
1207
-
1208
1054
  /**
1209
1055
  * Load configuration option
1210
1056
  * @param {object} config User's generation config value
@@ -1212,54 +1058,46 @@ function runUntil(fn, conditionFn) {
1212
1058
  */
1213
1059
  function loadConfig(config) {
1214
1060
  var _this = this,
1215
- thisConfig = this.config,
1216
- target,
1217
- keys,
1218
- read,
1219
- find = function () {
1220
- _newArrowCheck(this, _this);
1221
-
1222
- var key = keys.shift();
1223
-
1224
- if (key && target && isObjectType(target) && key in target) {
1225
- target = target[key];
1226
- return find();
1227
- } else if (!key) {
1228
- return target;
1229
- }
1230
-
1231
- return undefined;
1232
- }.bind(this);
1233
-
1061
+ thisConfig = this.config,
1062
+ target,
1063
+ keys,
1064
+ read,
1065
+ find = function () {
1066
+ _newArrowCheck(this, _this);
1067
+ var key = keys.shift();
1068
+ if (key && target && isObjectType(target) && key in target) {
1069
+ target = target[key];
1070
+ return find();
1071
+ } else if (!key) {
1072
+ return target;
1073
+ }
1074
+ return undefined;
1075
+ }.bind(this);
1234
1076
  Object.keys(thisConfig).forEach(function (key) {
1235
1077
  _newArrowCheck(this, _this);
1236
-
1237
1078
  target = config;
1238
1079
  keys = key.split("_");
1239
1080
  read = find();
1240
-
1241
1081
  if (isDefined(read)) {
1242
1082
  thisConfig[key] = read;
1243
1083
  }
1244
- }.bind(this)); // only should run in the ChartInternal context
1084
+ }.bind(this));
1245
1085
 
1086
+ // only should run in the ChartInternal context
1246
1087
  if (this.api) {
1247
1088
  this.state.orgConfig = config;
1248
1089
  }
1249
1090
  }
1250
1091
  ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
1251
1092
 
1252
-
1253
1093
  /**
1254
1094
  * Copyright (c) 2017 ~ present NAVER Corp.
1255
1095
  * billboard.js project is licensed under the MIT license
1256
1096
  */
1257
-
1258
1097
  /**
1259
1098
  * Base class to generate billboard.js plugin
1260
1099
  * @class Plugin
1261
1100
  */
1262
-
1263
1101
  /**
1264
1102
  * Version info string for plugin
1265
1103
  * @name version
@@ -1279,69 +1117,57 @@ var Plugin = /*#__PURE__*/function () {
1279
1117
  if (options === void 0) {
1280
1118
  options = {};
1281
1119
  }
1282
-
1283
1120
  this.$$ = void 0;
1284
1121
  this.options = void 0;
1285
1122
  this.options = options;
1286
1123
  }
1124
+
1287
1125
  /**
1288
1126
  * Lifecycle hook for 'beforeInit' phase.
1289
1127
  * @private
1290
1128
  */
1291
-
1292
-
1293
1129
  var _proto = Plugin.prototype;
1294
-
1295
1130
  _proto.$beforeInit = function $beforeInit() {}
1131
+
1296
1132
  /**
1297
1133
  * Lifecycle hook for 'init' phase.
1298
1134
  * @private
1299
- */
1300
- ;
1301
-
1135
+ */;
1302
1136
  _proto.$init = function $init() {}
1137
+
1303
1138
  /**
1304
1139
  * Lifecycle hook for 'afterInit' phase.
1305
1140
  * @private
1306
- */
1307
- ;
1308
-
1141
+ */;
1309
1142
  _proto.$afterInit = function $afterInit() {}
1143
+
1310
1144
  /**
1311
1145
  * Lifecycle hook for 'redraw' phase.
1312
1146
  * @private
1313
- */
1314
- ;
1315
-
1147
+ */;
1316
1148
  _proto.$redraw = function $redraw() {}
1149
+
1317
1150
  /**
1318
1151
  * Lifecycle hook for 'willDestroy' phase.
1319
1152
  * @private
1320
- */
1321
- ;
1322
-
1153
+ */;
1323
1154
  _proto.$willDestroy = function $willDestroy() {
1324
1155
  var _this = this;
1325
-
1326
1156
  Object.keys(this).forEach(function (key) {
1327
1157
  _newArrowCheck(this, _this);
1328
-
1329
1158
  this[key] = null;
1330
1159
  delete this[key];
1331
1160
  }.bind(this));
1332
1161
  };
1333
-
1334
1162
  return Plugin;
1335
1163
  }();
1336
-
1337
- Plugin.version = "3.6.0";
1164
+ Plugin.version = "3.6.1";
1338
1165
 
1339
1166
  ;// CONCATENATED MODULE: ./src/Plugin/textoverlap/Options.ts
1340
1167
  /**
1341
1168
  * Copyright (c) 2017 ~ present NAVER Corp.
1342
1169
  * billboard.js project is licensed under the MIT license
1343
1170
  */
1344
-
1345
1171
  /**
1346
1172
  * TextOverlap plugin option class
1347
1173
  * @class TextOverlapOptions
@@ -1364,7 +1190,6 @@ var Options = function () {
1364
1190
  * selector: ".bb-texts text"
1365
1191
  */
1366
1192
  selector: undefined,
1367
-
1368
1193
  /**
1369
1194
  * Extent of label overlap prevention.
1370
1195
  * @name extent
@@ -1375,7 +1200,6 @@ var Options = function () {
1375
1200
  * extent: 1
1376
1201
  */
1377
1202
  extent: 1,
1378
-
1379
1203
  /**
1380
1204
  * Minimum area needed to show a data label.
1381
1205
  * @name area
@@ -1389,12 +1213,10 @@ var Options = function () {
1389
1213
  };
1390
1214
  };
1391
1215
 
1392
-
1393
1216
  ;// CONCATENATED MODULE: ./src/Plugin/textoverlap/index.ts
1394
1217
 
1395
1218
 
1396
1219
 
1397
-
1398
1220
  /**
1399
1221
  * Copyright (c) 2017 ~ present NAVER Corp.
1400
1222
  * billboard.js project is licensed under the MIT license
@@ -1404,6 +1226,8 @@ var Options = function () {
1404
1226
 
1405
1227
 
1406
1228
 
1229
+
1230
+
1407
1231
  /**
1408
1232
  * TextOverlap plugin<br>
1409
1233
  * Prevents label overlap using [Voronoi layout](https://en.wikipedia.org/wiki/Voronoi_diagram).
@@ -1447,106 +1271,88 @@ var Options = function () {
1447
1271
  * ]
1448
1272
  * })
1449
1273
  */
1450
-
1451
1274
  var TextOverlap = /*#__PURE__*/function (_Plugin) {
1452
1275
  _inheritsLoose(TextOverlap, _Plugin);
1453
-
1454
1276
  function TextOverlap(options) {
1455
1277
  var _this = _Plugin.call(this, options) || this;
1456
-
1457
1278
  _this.config = void 0;
1458
1279
  _this.config = new Options();
1459
1280
  return _assertThisInitialized(_this) || _assertThisInitialized(_this);
1460
1281
  }
1461
-
1462
1282
  var _proto = TextOverlap.prototype;
1463
-
1464
1283
  _proto.$init = function $init() {
1465
1284
  loadConfig.call(this, this.options);
1466
1285
  };
1467
-
1468
1286
  _proto.$redraw = function $redraw() {
1469
1287
  var $el = this.$$.$el,
1470
- selector = this.config.selector,
1471
- text = selector ? $el.main.selectAll(selector) : $el.text;
1288
+ selector = this.config.selector,
1289
+ text = selector ? $el.main.selectAll(selector) : $el.text;
1472
1290
  text.empty() || this.preventLabelOverlap(text);
1473
1291
  }
1292
+
1474
1293
  /**
1475
1294
  * Generates the voronoi layout for data labels
1476
1295
  * @param {Array} points Indices values
1477
1296
  * @returns {object} Voronoi layout points and corresponding Data points
1478
1297
  * @private
1479
- */
1480
- ;
1481
-
1298
+ */;
1482
1299
  _proto.generateVoronoi = function generateVoronoi(points) {
1483
1300
  var _this2 = this,
1484
- $$ = this.$$,
1485
- scale = $$.scale,
1486
- _map = ["x", "y"].map(function (v) {
1487
- _newArrowCheck(this, _this2);
1488
-
1489
- return scale[v].domain();
1490
- }.bind(this)),
1491
- min = _map[0],
1492
- max = _map[1],
1493
- _ref = [max[0], min[1]];
1494
-
1301
+ $$ = this.$$,
1302
+ scale = $$.scale,
1303
+ _map = ["x", "y"].map(function (v) {
1304
+ _newArrowCheck(this, _this2);
1305
+ return scale[v].domain();
1306
+ }.bind(this)),
1307
+ min = _map[0],
1308
+ max = _map[1],
1309
+ _ref = [max[0], min[1]];
1495
1310
  min[1] = _ref[0];
1496
1311
  max[0] = _ref[1];
1497
1312
  return external_commonjs_d3_delaunay_commonjs2_d3_delaunay_amd_d3_delaunay_root_d3_.Delaunay.from(points).voronoi([].concat(min, max)); // bounds = [xmin, ymin, xmax, ymax], default value: [0, 0, 960, 500]
1498
1313
  }
1314
+
1499
1315
  /**
1500
1316
  * Set text label's position to preventg overlap.
1501
1317
  * @param {d3Selection} text target text selection
1502
1318
  * @private
1503
- */
1504
- ;
1505
-
1319
+ */;
1506
1320
  _proto.preventLabelOverlap = function preventLabelOverlap(text) {
1507
1321
  var _this3 = this,
1508
- _this$config = this.config,
1509
- extent = _this$config.extent,
1510
- area = _this$config.area,
1511
- points = text.data().map(function (v) {
1512
- _newArrowCheck(this, _this3);
1513
-
1514
- return [v.index, v.value];
1515
- }.bind(this)),
1516
- voronoi = this.generateVoronoi(points),
1517
- i = 0;
1518
-
1322
+ _this$config = this.config,
1323
+ extent = _this$config.extent,
1324
+ area = _this$config.area,
1325
+ points = text.data().map(function (v) {
1326
+ _newArrowCheck(this, _this3);
1327
+ return [v.index, v.value];
1328
+ }.bind(this)),
1329
+ voronoi = this.generateVoronoi(points),
1330
+ i = 0;
1519
1331
  text.each(function () {
1520
1332
  var cell = voronoi.cellPolygon(i);
1521
-
1522
1333
  if (cell && this) {
1523
1334
  var _points$i = points[i],
1524
- x = _points$i[0],
1525
- y = _points$i[1],
1526
- _d3PolygonCentroid = (0,external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_.polygonCentroid)(cell),
1527
- cx = _d3PolygonCentroid[0],
1528
- cy = _d3PolygonCentroid[1],
1529
- polygonArea = Math.abs((0,external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_.polygonArea)(cell)),
1530
- angle = Math.round(Math.atan2(cy - y, cx - x) / Math.PI * 2),
1531
- xTranslate = extent * (angle === 0 ? 1 : -1),
1532
- yTranslate = angle === -1 ? -extent : extent + 5,
1533
- txtAnchor = Math.abs(angle) === 1 ? "middle" : angle === 0 ? "start" : "end"; // @ts-ignore wrong type definiton for d3PolygonCentroid
1534
-
1535
-
1335
+ x = _points$i[0],
1336
+ y = _points$i[1],
1337
+ _d3PolygonCentroid = (0,external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_.polygonCentroid)(cell),
1338
+ cx = _d3PolygonCentroid[0],
1339
+ cy = _d3PolygonCentroid[1],
1340
+ polygonArea = Math.abs((0,external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_.polygonArea)(cell)),
1341
+ angle = Math.round(Math.atan2(cy - y, cx - x) / Math.PI * 2),
1342
+ xTranslate = extent * (angle === 0 ? 1 : -1),
1343
+ yTranslate = angle === -1 ? -extent : extent + 5,
1344
+ txtAnchor = Math.abs(angle) === 1 ? "middle" : angle === 0 ? "start" : "end"; // @ts-ignore wrong type definiton for d3PolygonCentroid
1536
1345
  this.style.display = polygonArea < area ? "none" : "";
1537
1346
  this.setAttribute("text-anchor", txtAnchor);
1538
1347
  this.setAttribute("dy", "0." + (angle === 1 ? 71 : 35) + "em");
1539
1348
  this.setAttribute("transform", "translate(" + xTranslate + ", " + yTranslate + ")");
1540
1349
  }
1541
-
1542
1350
  i++;
1543
1351
  });
1544
1352
  };
1545
-
1546
1353
  return TextOverlap;
1547
1354
  }(Plugin);
1548
1355
 
1549
-
1550
1356
  }();
1551
1357
  __webpack_exports__ = __webpack_exports__["default"];
1552
1358
  /******/ return __webpack_exports__;