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
  */
@@ -132,7 +132,6 @@ function _assertThisInitialized(self) {
132
132
  if (self === void 0) {
133
133
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
134
134
  }
135
-
136
135
  return self;
137
136
  }
138
137
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
@@ -168,21 +167,16 @@ function _defineProperty(obj, key, value) {
168
167
  } else {
169
168
  obj[key] = value;
170
169
  }
171
-
172
170
  return obj;
173
171
  }
174
172
  ;// CONCATENATED MODULE: ./src/config/classes.ts
175
173
 
176
-
177
174
  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; }
178
-
179
175
  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; }
180
-
181
176
  /**
182
177
  * Copyright (c) 2017 ~ present NAVER Corp.
183
178
  * billboard.js project is licensed under the MIT license
184
179
  */
185
-
186
180
  /**
187
181
  * CSS class names definition
188
182
  * @private
@@ -340,56 +334,41 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
340
334
  var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
341
335
  ;// CONCATENATED MODULE: ./src/module/browser.ts
342
336
 
343
-
344
337
  var _this = undefined;
345
-
346
338
  /**
347
339
  * Copyright (c) 2017 ~ present NAVER Corp.
348
340
  * billboard.js project is licensed under the MIT license
349
341
  */
350
-
351
342
  /**
352
343
  * Window object
353
344
  * @private
354
345
  */
355
-
356
346
  /* eslint-disable no-new-func, no-undef */
357
347
 
358
-
359
348
  var win = function () {
360
349
  _newArrowCheck(this, _this);
361
-
362
350
  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;
363
351
  return root || Function("return this")();
364
352
  }.bind(undefined)();
365
353
  /* eslint-enable no-new-func, no-undef */
366
- // fallback for non-supported environments
367
-
368
354
 
355
+ // fallback for non-supported environments
369
356
  win.requestIdleCallback = win.requestIdleCallback || function (cb) {
370
357
  _newArrowCheck(this, _this);
371
-
372
358
  return setTimeout(cb, 1);
373
- }.bind(undefined); // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
374
-
375
-
359
+ }.bind(undefined);
360
+ // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
376
361
  win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
377
362
  _newArrowCheck(this, _this);
378
-
379
363
  return setTimeout(cb, 1);
380
364
  }.bind(undefined);
381
-
382
365
  var doc = win == null ? void 0 : win.document;
383
366
  ;// CONCATENATED MODULE: ./src/module/util.ts
384
367
 
385
368
 
386
-
387
369
  var util_this = undefined;
388
-
389
370
  function util_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; }
390
-
391
371
  function util_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? util_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : util_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
392
-
393
372
  /**
394
373
  * Copyright (c) 2017 ~ present NAVER Corp.
395
374
  * billboard.js project is licensed under the MIT license
@@ -399,83 +378,66 @@ function util_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
399
378
 
400
379
 
401
380
 
402
-
403
381
  var isValue = function (v) {
404
- _newArrowCheck(this, util_this);
405
-
406
- return v || v === 0;
407
- }.bind(undefined),
408
- isFunction = function (v) {
409
- _newArrowCheck(this, util_this);
410
-
411
- return typeof v === "function";
412
- }.bind(undefined),
413
- isString = function (v) {
414
- _newArrowCheck(this, util_this);
415
-
416
- return typeof v === "string";
417
- }.bind(undefined),
418
- isNumber = function (v) {
419
- _newArrowCheck(this, util_this);
420
-
421
- return typeof v === "number";
422
- }.bind(undefined),
423
- isUndefined = function (v) {
424
- _newArrowCheck(this, util_this);
425
-
426
- return typeof v === "undefined";
427
- }.bind(undefined),
428
- isDefined = function (v) {
429
- _newArrowCheck(this, util_this);
430
-
431
- return typeof v !== "undefined";
432
- }.bind(undefined),
433
- isboolean = function (v) {
434
- _newArrowCheck(this, util_this);
435
-
436
- return typeof v === "boolean";
437
- }.bind(undefined),
438
- ceil10 = function (v) {
439
- _newArrowCheck(this, util_this);
440
-
441
- return Math.ceil(v / 10) * 10;
442
- }.bind(undefined),
443
- asHalfPixel = function (n) {
444
- _newArrowCheck(this, util_this);
445
-
446
- return Math.ceil(n) + .5;
447
- }.bind(undefined),
448
- diffDomain = function (d) {
449
- _newArrowCheck(this, util_this);
450
-
451
- return d[1] - d[0];
452
- }.bind(undefined),
453
- isObjectType = function (v) {
454
- _newArrowCheck(this, util_this);
455
-
456
- return typeof v === "object";
457
- }.bind(undefined),
458
- isEmpty = function (o) {
459
- _newArrowCheck(this, util_this);
460
-
461
- return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
462
- }.bind(undefined),
463
- notEmpty = function (o) {
464
- _newArrowCheck(this, util_this);
465
-
466
- return !isEmpty(o);
467
- }.bind(undefined),
468
- isArray = function (arr) {
469
- _newArrowCheck(this, util_this);
470
-
471
- return Array.isArray(arr);
472
- }.bind(undefined),
473
- isObject = function (obj) {
474
- _newArrowCheck(this, util_this);
475
-
476
- return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
477
- }.bind(undefined);
478
-
382
+ _newArrowCheck(this, util_this);
383
+ return v || v === 0;
384
+ }.bind(undefined),
385
+ isFunction = function (v) {
386
+ _newArrowCheck(this, util_this);
387
+ return typeof v === "function";
388
+ }.bind(undefined),
389
+ isString = function (v) {
390
+ _newArrowCheck(this, util_this);
391
+ return typeof v === "string";
392
+ }.bind(undefined),
393
+ isNumber = function (v) {
394
+ _newArrowCheck(this, util_this);
395
+ return typeof v === "number";
396
+ }.bind(undefined),
397
+ isUndefined = function (v) {
398
+ _newArrowCheck(this, util_this);
399
+ return typeof v === "undefined";
400
+ }.bind(undefined),
401
+ isDefined = function (v) {
402
+ _newArrowCheck(this, util_this);
403
+ return typeof v !== "undefined";
404
+ }.bind(undefined),
405
+ isboolean = function (v) {
406
+ _newArrowCheck(this, util_this);
407
+ return typeof v === "boolean";
408
+ }.bind(undefined),
409
+ ceil10 = function (v) {
410
+ _newArrowCheck(this, util_this);
411
+ return Math.ceil(v / 10) * 10;
412
+ }.bind(undefined),
413
+ asHalfPixel = function (n) {
414
+ _newArrowCheck(this, util_this);
415
+ return Math.ceil(n) + .5;
416
+ }.bind(undefined),
417
+ diffDomain = function (d) {
418
+ _newArrowCheck(this, util_this);
419
+ return d[1] - d[0];
420
+ }.bind(undefined),
421
+ isObjectType = function (v) {
422
+ _newArrowCheck(this, util_this);
423
+ return typeof v === "object";
424
+ }.bind(undefined),
425
+ isEmpty = function (o) {
426
+ _newArrowCheck(this, util_this);
427
+ return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
428
+ }.bind(undefined),
429
+ notEmpty = function (o) {
430
+ _newArrowCheck(this, util_this);
431
+ return !isEmpty(o);
432
+ }.bind(undefined),
433
+ isArray = function (arr) {
434
+ _newArrowCheck(this, util_this);
435
+ return Array.isArray(arr);
436
+ }.bind(undefined),
437
+ isObject = function (obj) {
438
+ _newArrowCheck(this, util_this);
439
+ return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
440
+ }.bind(undefined);
479
441
  /**
480
442
  * Get specified key value from object
481
443
  * If default value is given, will return if given key value not found
@@ -488,6 +450,7 @@ var isValue = function (v) {
488
450
  function getOption(options, key, defaultValue) {
489
451
  return isDefined(options[key]) ? options[key] : defaultValue;
490
452
  }
453
+
491
454
  /**
492
455
  * Check if value exist in the given object
493
456
  * @param {object} dict Target object to be checked
@@ -495,19 +458,16 @@ function getOption(options, key, defaultValue) {
495
458
  * @returns {boolean}
496
459
  * @private
497
460
  */
498
-
499
-
500
461
  function hasValue(dict, value) {
501
462
  var _this2 = this,
502
- found = !1;
503
-
463
+ found = !1;
504
464
  Object.keys(dict).forEach(function (key) {
505
465
  _newArrowCheck(this, _this2);
506
-
507
466
  return dict[key] === value && (found = !0);
508
467
  }.bind(this));
509
468
  return found;
510
469
  }
470
+
511
471
  /**
512
472
  * Call function with arguments
513
473
  * @param {Function} fn Function to be called
@@ -516,40 +476,33 @@ function hasValue(dict, value) {
516
476
  * @returns {boolean} true: fn is function, false: fn is not function
517
477
  * @private
518
478
  */
519
-
520
-
521
479
  function callFn(fn, thisArg) {
522
480
  for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
523
481
  args[_key - 2] = arguments[_key];
524
482
  }
525
-
526
483
  isFn && fn.call.apply(fn, [thisArg].concat(args));
527
484
  return isFn;
528
485
  }
486
+
529
487
  /**
530
488
  * Call function after all transitions ends
531
489
  * @param {d3.transition} transition Transition
532
490
  * @param {Fucntion} cb Callback function
533
491
  * @private
534
492
  */
535
-
536
-
537
493
  function endall(transition, cb) {
538
494
  var _this3 = this,
539
- n = 0,
540
- end = function () {
541
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
542
- args[_key2] = arguments[_key2];
543
- }
544
-
545
- --n || cb.apply.apply(cb, [this].concat(args));
546
- };
547
-
495
+ n = 0,
496
+ end = function () {
497
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
498
+ args[_key2] = arguments[_key2];
499
+ }
500
+ --n || cb.apply.apply(cb, [this].concat(args));
501
+ };
548
502
  // if is transition selection
549
503
  if ("duration" in transition) {
550
504
  transition.each(function () {
551
505
  _newArrowCheck(this, _this3);
552
-
553
506
  return ++n;
554
507
  }.bind(this)).on("end", end);
555
508
  } else {
@@ -557,17 +510,17 @@ function endall(transition, cb) {
557
510
  transition.call(end);
558
511
  }
559
512
  }
513
+
560
514
  /**
561
515
  * Replace tag sign to html entity
562
516
  * @param {string} str Target string value
563
517
  * @returns {string}
564
518
  * @private
565
519
  */
566
-
567
-
568
520
  function sanitise(str) {
569
521
  return isString(str) ? str.replace(/</g, "&lt;").replace(/>/g, "&gt;") : str;
570
522
  }
523
+
571
524
  /**
572
525
  * Set text value. If there's multiline add nodes.
573
526
  * @param {d3Selection} node Text node
@@ -576,53 +529,43 @@ function sanitise(str) {
576
529
  * @param {boolean} toMiddle To be alingned vertically middle
577
530
  * @private
578
531
  */
579
-
580
-
581
532
  function setTextValue(node, text, dy, toMiddle) {
582
533
  var _this4 = this;
583
-
584
534
  if (dy === void 0) {
585
535
  dy = [-1, 1];
586
536
  }
587
-
588
537
  if (toMiddle === void 0) {
589
538
  toMiddle = !1;
590
539
  }
591
-
592
540
  if (!node || !isString(text)) {
593
541
  return;
594
542
  }
595
-
596
543
  if (text.indexOf("\n") === -1) {
597
544
  node.text(text);
598
545
  } else {
599
546
  var diff = [node.text(), text].map(function (v) {
600
547
  _newArrowCheck(this, _this4);
601
-
602
548
  return v.replace(/[\s\n]/g, "");
603
549
  }.bind(this));
604
-
605
550
  if (diff[0] !== diff[1]) {
606
551
  var multiline = text.split("\n"),
607
- len = toMiddle ? multiline.length - 1 : 1;
552
+ len = toMiddle ? multiline.length - 1 : 1;
608
553
  // reset possible text
609
554
  node.html("");
610
555
  multiline.forEach(function (v, i) {
611
556
  _newArrowCheck(this, _this4);
612
-
613
557
  node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
614
558
  }.bind(this));
615
559
  }
616
560
  }
617
561
  }
562
+
618
563
  /**
619
564
  * Substitution of SVGPathSeg API polyfill
620
565
  * @param {SVGGraphicsElement} path Target svg element
621
566
  * @returns {Array}
622
567
  * @private
623
568
  */
624
-
625
-
626
569
  function getRectSegList(path) {
627
570
  /*
628
571
  * seg1 ---------- seg2
@@ -632,45 +575,45 @@ function getRectSegList(path) {
632
575
  * seg0 ---------- seg3
633
576
  * */
634
577
  var _path$getBBox = path.getBBox(),
635
- x = _path$getBBox.x,
636
- y = _path$getBBox.y,
637
- width = _path$getBBox.width,
638
- height = _path$getBBox.height;
639
-
578
+ x = _path$getBBox.x,
579
+ y = _path$getBBox.y,
580
+ width = _path$getBBox.width,
581
+ height = _path$getBBox.height;
640
582
  return [{
641
583
  x: x,
642
584
  y: y + height
643
- }, // seg0
585
+ },
586
+ // seg0
644
587
  {
645
588
  x: x,
646
589
  y: y
647
- }, // seg1
590
+ },
591
+ // seg1
648
592
  {
649
593
  x: x + width,
650
594
  y: y
651
- }, // seg2
595
+ },
596
+ // seg2
652
597
  {
653
598
  x: x + width,
654
599
  y: y + height
655
600
  } // seg3
656
601
  ];
657
602
  }
603
+
658
604
  /**
659
605
  * Get svg bounding path box dimension
660
606
  * @param {SVGGraphicsElement} path Target svg element
661
607
  * @returns {object}
662
608
  * @private
663
609
  */
664
-
665
-
666
610
  function getPathBox(path) {
667
611
  var _path$getBoundingClie = path.getBoundingClientRect(),
668
- width = _path$getBoundingClie.width,
669
- height = _path$getBoundingClie.height,
670
- items = getRectSegList(path),
671
- x = items[0].x,
672
- y = Math.min(items[0].y, items[1].y);
673
-
612
+ width = _path$getBoundingClie.width,
613
+ height = _path$getBoundingClie.height,
614
+ items = getRectSegList(path),
615
+ x = items[0].x,
616
+ y = Math.min(items[0].y, items[1].y);
674
617
  return {
675
618
  x: x,
676
619
  y: y,
@@ -678,6 +621,7 @@ function getPathBox(path) {
678
621
  height: height
679
622
  };
680
623
  }
624
+
681
625
  /**
682
626
  * Get event's current position coordinates
683
627
  * @param {object} event Event object
@@ -685,43 +629,38 @@ function getPathBox(path) {
685
629
  * @returns {Array} [x, y] Coordinates x, y array
686
630
  * @private
687
631
  */
688
-
689
-
690
632
  function getPointer(event, element) {
691
633
  var _ref,
692
- touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
693
- pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
694
- _this5 = this;
695
-
634
+ touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
635
+ pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
636
+ _this5 = this;
696
637
  return pointer.map(function (v) {
697
638
  _newArrowCheck(this, _this5);
698
-
699
639
  return isNaN(v) ? 0 : v;
700
640
  }.bind(this));
701
641
  }
642
+
702
643
  /**
703
644
  * Return brush selection array
704
645
  * @param {object} ctx Current instance
705
646
  * @returns {d3.brushSelection}
706
647
  * @private
707
648
  */
708
-
709
-
710
649
  function getBrushSelection(ctx) {
711
650
  var event = ctx.event,
712
- $el = ctx.$el,
713
- main = $el.subchart.main || $el.main,
714
- selection;
715
-
651
+ $el = ctx.$el,
652
+ main = $el.subchart.main || $el.main,
653
+ selection;
716
654
  // check from event
717
655
  if (event && event.type === "brush") {
718
- selection = event.selection; // check from brush area selection
656
+ selection = event.selection;
657
+ // check from brush area selection
719
658
  } else if (main && (selection = main.select(".bb-brush").node())) {
720
659
  selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
721
660
  }
722
-
723
661
  return selection;
724
662
  }
663
+
725
664
  /**
726
665
  * Get boundingClientRect.
727
666
  * Cache the evaluated value once it was called.
@@ -729,12 +668,11 @@ function getBrushSelection(ctx) {
729
668
  * @returns {object}
730
669
  * @private
731
670
  */
732
-
733
-
734
671
  function getBoundingRect(node) {
735
672
  var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
736
673
  return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
737
674
  }
675
+
738
676
  /**
739
677
  * Retrun random number
740
678
  * @param {boolean} asStr Convert returned value as string
@@ -743,24 +681,20 @@ function getBoundingRect(node) {
743
681
  * @returns {number|string}
744
682
  * @private
745
683
  */
746
-
747
-
748
684
  function getRandom(asStr, min, max) {
749
685
  if (asStr === void 0) {
750
686
  asStr = !0;
751
687
  }
752
-
753
688
  if (min === void 0) {
754
689
  min = 0;
755
690
  }
756
-
757
691
  if (max === void 0) {
758
692
  max = 1e4;
759
693
  }
760
-
761
694
  var rand = Math.floor(Math.random() * (max - min) + min);
762
695
  return asStr ? rand + "" : rand;
763
696
  }
697
+
764
698
  /**
765
699
  * Find index based on binary search
766
700
  * @param {Array} arr Data array
@@ -771,87 +705,71 @@ function getRandom(asStr, min, max) {
771
705
  * @returns {number} Index number
772
706
  * @private
773
707
  */
774
-
775
-
776
708
  function findIndex(arr, v, start, end, isRotated) {
777
709
  if (start > end) {
778
710
  return -1;
779
711
  }
780
-
781
712
  var mid = Math.floor((start + end) / 2),
782
- _arr$mid = arr[mid],
783
- x = _arr$mid.x,
784
- _arr$mid$w = _arr$mid.w,
785
- w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
786
-
713
+ _arr$mid = arr[mid],
714
+ x = _arr$mid.x,
715
+ _arr$mid$w = _arr$mid.w,
716
+ w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
787
717
  if (isRotated) {
788
718
  x = arr[mid].y;
789
719
  w = arr[mid].h;
790
720
  }
791
-
792
721
  if (v >= x && v <= x + w) {
793
722
  return mid;
794
723
  }
795
-
796
724
  return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
797
725
  }
726
+
798
727
  /**
799
728
  * Check if brush is empty
800
729
  * @param {object} ctx Bursh context
801
730
  * @returns {boolean}
802
731
  * @private
803
732
  */
804
-
805
-
806
733
  function brushEmpty(ctx) {
807
734
  var selection = getBrushSelection(ctx);
808
-
809
735
  if (selection) {
810
736
  // brush selected area
811
737
  // two-dimensional: [[x0, y0], [x1, y1]]
812
738
  // one-dimensional: [x0, x1] or [y0, y1]
813
739
  return selection[0] === selection[1];
814
740
  }
815
-
816
741
  return !0;
817
742
  }
743
+
818
744
  /**
819
745
  * Deep copy object
820
746
  * @param {object} objectN Source object
821
747
  * @returns {object} Cloned object
822
748
  * @private
823
749
  */
824
-
825
-
826
750
  function deepClone() {
827
751
  for (var _this6 = this, clone = function (v) {
828
- _newArrowCheck(this, _this6);
829
-
830
- if (isObject(v) && v.constructor) {
831
- var r = new v.constructor();
832
-
833
- for (var k in v) {
834
- r[k] = clone(v[k]);
752
+ _newArrowCheck(this, _this6);
753
+ if (isObject(v) && v.constructor) {
754
+ var r = new v.constructor();
755
+ for (var k in v) {
756
+ r[k] = clone(v[k]);
757
+ }
758
+ return r;
835
759
  }
836
-
837
- return r;
838
- }
839
-
840
- return v;
841
- }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
760
+ return v;
761
+ }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
842
762
  objectN[_key3] = arguments[_key3];
843
763
  }
844
-
845
764
  return objectN.map(function (v) {
846
765
  _newArrowCheck(this, _this6);
847
-
848
766
  return clone(v);
849
767
  }.bind(this)).reduce(function (a, c) {
850
768
  _newArrowCheck(this, _this6);
851
-
852
769
  return util_objectSpread(util_objectSpread({}, a), c);
853
770
  }.bind(this));
854
771
  }
772
+
855
773
  /**
856
774
  * Extend target from source object
857
775
  * @param {object} target Target object
@@ -859,47 +777,39 @@ function deepClone() {
859
777
  * @returns {object}
860
778
  * @private
861
779
  */
862
-
863
-
864
780
  function extend(target, source) {
865
781
  var _this7 = this;
866
-
867
782
  if (target === void 0) {
868
783
  target = {};
869
784
  }
870
-
871
785
  if (isArray(source)) {
872
786
  source.forEach(function (v) {
873
787
  _newArrowCheck(this, _this7);
874
-
875
788
  return extend(target, v);
876
789
  }.bind(this));
877
- } // exclude name with only numbers
878
-
790
+ }
879
791
 
792
+ // exclude name with only numbers
880
793
  for (var p in source) {
881
794
  if (/^\d+$/.test(p) || p in target) {
882
795
  continue;
883
796
  }
884
-
885
797
  target[p] = source[p];
886
798
  }
887
-
888
799
  return target;
889
800
  }
801
+
890
802
  /**
891
803
  * Return first letter capitalized
892
804
  * @param {string} str Target string
893
805
  * @returns {string} capitalized string
894
806
  * @private
895
807
  */
896
-
897
-
898
808
  var capitalize = function (str) {
899
809
  _newArrowCheck(this, util_this);
900
-
901
810
  return str.charAt(0).toUpperCase() + str.slice(1);
902
811
  }.bind(undefined);
812
+
903
813
  /**
904
814
  * Camelize from kebob style string
905
815
  * @param {string} str Target string
@@ -907,34 +817,28 @@ var capitalize = function (str) {
907
817
  * @returns {string} camelized string
908
818
  * @private
909
819
  */
910
-
911
-
912
820
  function camelize(str, separator) {
913
821
  var _this8 = this;
914
-
915
822
  if (separator === void 0) {
916
823
  separator = "-";
917
824
  }
918
-
919
825
  return str.split(separator).map(function (v, i) {
920
826
  _newArrowCheck(this, _this8);
921
-
922
827
  return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
923
828
  }.bind(this)).join("");
924
829
  }
830
+
925
831
  /**
926
832
  * Convert to array
927
833
  * @param {object} v Target to be converted
928
834
  * @returns {Array}
929
835
  * @private
930
836
  */
931
-
932
-
933
837
  var toArray = function (v) {
934
838
  _newArrowCheck(this, util_this);
935
-
936
839
  return [].slice.call(v);
937
840
  }.bind(undefined);
841
+
938
842
  /**
939
843
  * Add CSS rules
940
844
  * @param {object} style Style object
@@ -943,36 +847,29 @@ var toArray = function (v) {
943
847
  * @returns {number} Newely added rule index
944
848
  * @private
945
849
  */
946
-
947
-
948
850
  function addCssRules(style, selector, prop) {
949
851
  var _this9 = this,
950
- rootSelctor = style.rootSelctor,
951
- sheet = style.sheet,
952
- getSelector = function (s) {
953
- _newArrowCheck(this, _this9);
954
-
955
- return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
956
- }.bind(this),
957
- rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
958
-
852
+ rootSelctor = style.rootSelctor,
853
+ sheet = style.sheet,
854
+ getSelector = function (s) {
855
+ _newArrowCheck(this, _this9);
856
+ return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
857
+ }.bind(this),
858
+ rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
959
859
  return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
960
860
  }
861
+
961
862
  /**
962
863
  * Get css rules for specified stylesheets
963
864
  * @param {Array} styleSheets The stylesheets to get the rules from
964
865
  * @returns {Array}
965
866
  * @private
966
867
  */
967
-
968
-
969
868
  function getCssRules(styleSheets) {
970
869
  var _this10 = this,
971
- rules = [];
972
-
870
+ rules = [];
973
871
  styleSheets.forEach(function (sheet) {
974
872
  _newArrowCheck(this, _this10);
975
-
976
873
  try {
977
874
  if (sheet.cssRules && sheet.cssRules.length) {
978
875
  rules = rules.concat(toArray(sheet.cssRules));
@@ -983,17 +880,16 @@ function getCssRules(styleSheets) {
983
880
  }.bind(this));
984
881
  return rules;
985
882
  }
883
+
986
884
  /**
987
885
  * Gets the SVGMatrix of an SVGGElement
988
886
  * @param {SVGElement} node Node element
989
887
  * @returns {SVGMatrix} matrix
990
888
  * @private
991
889
  */
992
-
993
-
994
890
  function getTranslation(node) {
995
891
  var transform = node ? node.transform : null,
996
- baseVal = transform && transform.baseVal;
892
+ baseVal = transform && transform.baseVal;
997
893
  return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
998
894
  a: 0,
999
895
  b: 0,
@@ -1003,46 +899,40 @@ function getTranslation(node) {
1003
899
  f: 0
1004
900
  };
1005
901
  }
902
+
1006
903
  /**
1007
904
  * Get unique value from array
1008
905
  * @param {Array} data Source data
1009
906
  * @returns {Array} Unique array value
1010
907
  * @private
1011
908
  */
1012
-
1013
-
1014
909
  function getUnique(data) {
1015
910
  var _this11 = this,
1016
- isDate = data[0] instanceof Date,
1017
- d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
1018
- _newArrowCheck(this, _this11);
1019
-
1020
- return self.indexOf(v) === i;
1021
- }.bind(this));
1022
-
911
+ isDate = data[0] instanceof Date,
912
+ d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
913
+ _newArrowCheck(this, _this11);
914
+ return self.indexOf(v) === i;
915
+ }.bind(this));
1023
916
  return isDate ? d.map(function (v) {
1024
917
  _newArrowCheck(this, _this11);
1025
-
1026
918
  return new Date(v);
1027
919
  }.bind(this)) : d;
1028
920
  }
921
+
1029
922
  /**
1030
923
  * Merge array
1031
924
  * @param {Array} arr Source array
1032
925
  * @returns {Array}
1033
926
  * @private
1034
927
  */
1035
-
1036
-
1037
928
  function mergeArray(arr) {
1038
929
  var _this12 = this;
1039
-
1040
930
  return arr && arr.length ? arr.reduce(function (p, c) {
1041
931
  _newArrowCheck(this, _this12);
1042
-
1043
932
  return p.concat(c);
1044
933
  }.bind(this)) : [];
1045
934
  }
935
+
1046
936
  /**
1047
937
  * Merge object returning new object
1048
938
  * @param {object} target Target object
@@ -1050,25 +940,18 @@ function mergeArray(arr) {
1050
940
  * @returns {object} merged target object
1051
941
  * @private
1052
942
  */
1053
-
1054
-
1055
943
  function mergeObj(target) {
1056
944
  for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
1057
945
  objectN[_key4 - 1] = arguments[_key4];
1058
946
  }
1059
-
1060
947
  if (!objectN.length || objectN.length === 1 && !objectN[0]) {
1061
948
  return target;
1062
949
  }
1063
-
1064
950
  var source = objectN.shift();
1065
-
1066
951
  if (isObject(target) && isObject(source)) {
1067
952
  Object.keys(source).forEach(function (key) {
1068
953
  _newArrowCheck(this, _this13);
1069
-
1070
954
  var value = source[key];
1071
-
1072
955
  if (isObject(value)) {
1073
956
  target[key] || (target[key] = {});
1074
957
  target[key] = mergeObj(target[key], value);
@@ -1077,9 +960,9 @@ function mergeObj(target) {
1077
960
  }
1078
961
  }.bind(this));
1079
962
  }
1080
-
1081
963
  return mergeObj.apply(void 0, [target].concat(objectN));
1082
964
  }
965
+
1083
966
  /**
1084
967
  * Sort value
1085
968
  * @param {Array} data value to be sorted
@@ -1087,45 +970,36 @@ function mergeObj(target) {
1087
970
  * @returns {number|string|Date} sorted date
1088
971
  * @private
1089
972
  */
1090
-
1091
-
1092
973
  function sortValue(data, isAsc) {
1093
974
  var _this14 = this;
1094
-
1095
975
  if (isAsc === void 0) {
1096
976
  isAsc = !0;
1097
977
  }
1098
-
1099
978
  var fn;
1100
-
1101
979
  if (data[0] instanceof Date) {
1102
980
  fn = isAsc ? function (a, b) {
1103
981
  _newArrowCheck(this, _this14);
1104
-
1105
982
  return a - b;
1106
983
  }.bind(this) : function (a, b) {
1107
984
  _newArrowCheck(this, _this14);
1108
-
1109
985
  return b - a;
1110
986
  }.bind(this);
1111
987
  } else {
1112
988
  if (isAsc && !data.every(isNaN)) {
1113
989
  fn = function (a, b) {
1114
990
  _newArrowCheck(this, _this14);
1115
-
1116
991
  return a - b;
1117
992
  }.bind(this);
1118
993
  } else if (!isAsc) {
1119
994
  fn = function (a, b) {
1120
995
  _newArrowCheck(this, _this14);
1121
-
1122
996
  return a > b && -1 || a < b && 1 || a === b && 0;
1123
997
  }.bind(this);
1124
998
  }
1125
999
  }
1126
-
1127
1000
  return data.concat().sort(fn);
1128
1001
  }
1002
+
1129
1003
  /**
1130
1004
  * Get min/max value
1131
1005
  * @param {string} type 'min' or 'max'
@@ -1133,16 +1007,12 @@ function sortValue(data, isAsc) {
1133
1007
  * @returns {number|Date|undefined}
1134
1008
  * @private
1135
1009
  */
1136
-
1137
-
1138
1010
  function getMinMax(type, data) {
1139
1011
  var _this15 = this,
1140
- res = data.filter(function (v) {
1141
- _newArrowCheck(this, _this15);
1142
-
1143
- return notEmpty(v);
1144
- }.bind(this));
1145
-
1012
+ res = data.filter(function (v) {
1013
+ _newArrowCheck(this, _this15);
1014
+ return notEmpty(v);
1015
+ }.bind(this));
1146
1016
  if (res.length) {
1147
1017
  if (isNumber(res[0])) {
1148
1018
  res = Math[type].apply(Math, res);
@@ -1152,9 +1022,9 @@ function getMinMax(type, data) {
1152
1022
  } else {
1153
1023
  res = undefined;
1154
1024
  }
1155
-
1156
1025
  return res;
1157
1026
  }
1027
+
1158
1028
  /**
1159
1029
  * Get range
1160
1030
  * @param {number} start Start number
@@ -1163,95 +1033,80 @@ function getMinMax(type, data) {
1163
1033
  * @returns {Array}
1164
1034
  * @private
1165
1035
  */
1166
-
1167
-
1168
1036
  var getRange = function (start, end, step) {
1169
- if (step === void 0) {
1170
- step = 1;
1171
- }
1172
-
1173
- _newArrowCheck(this, util_this);
1174
-
1175
- var res = [],
1176
- n = Math.max(0, Math.ceil((end - start) / step)) | 0;
1177
-
1178
- for (var i = start; i < n; i++) {
1179
- res.push(start + i * step);
1180
- }
1181
-
1182
- return res;
1183
- }.bind(undefined),
1184
- emulateEvent = {
1185
- mouse: function () {
1186
- var _this16 = this;
1187
-
1037
+ if (step === void 0) {
1038
+ step = 1;
1039
+ }
1188
1040
  _newArrowCheck(this, util_this);
1189
-
1190
- var getParams = function () {
1191
- _newArrowCheck(this, _this16);
1192
-
1193
- return {
1194
- bubbles: !1,
1195
- cancelable: !1,
1196
- screenX: 0,
1197
- screenY: 0,
1198
- clientX: 0,
1199
- clientY: 0
1200
- };
1201
- }.bind(this);
1202
-
1203
- try {
1204
- // eslint-disable-next-line no-new
1205
- new MouseEvent("t");
1206
- return function (el, eventType, params) {
1207
- if (params === void 0) {
1208
- params = getParams();
1209
- }
1210
-
1041
+ var res = [],
1042
+ n = Math.max(0, Math.ceil((end - start) / step)) | 0;
1043
+ for (var i = start; i < n; i++) {
1044
+ res.push(start + i * step);
1045
+ }
1046
+ return res;
1047
+ }.bind(undefined),
1048
+ emulateEvent = {
1049
+ mouse: function () {
1050
+ var _this16 = this;
1051
+ _newArrowCheck(this, util_this);
1052
+ var getParams = function () {
1211
1053
  _newArrowCheck(this, _this16);
1212
-
1213
- el.dispatchEvent(new MouseEvent(eventType, params));
1054
+ return {
1055
+ bubbles: !1,
1056
+ cancelable: !1,
1057
+ screenX: 0,
1058
+ screenY: 0,
1059
+ clientX: 0,
1060
+ clientY: 0
1061
+ };
1214
1062
  }.bind(this);
1215
- } catch (e) {
1216
- // Polyfills DOM4 MouseEvent
1217
- return function (el, eventType, params) {
1218
- if (params === void 0) {
1219
- params = getParams();
1220
- }
1221
-
1222
- _newArrowCheck(this, _this16);
1223
-
1224
- var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1225
-
1226
- mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
1227
- params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1228
- el.dispatchEvent(mouseEvent);
1229
- }.bind(this);
1230
- }
1231
- }.bind(undefined)(),
1232
- touch: function touch(el, eventType, params) {
1233
- _newArrowCheck(this, util_this);
1234
-
1235
- var touchObj = new Touch(mergeObj({
1236
- identifier: Date.now(),
1237
- target: el,
1238
- radiusX: 2.5,
1239
- radiusY: 2.5,
1240
- rotationAngle: 10,
1241
- force: .5
1242
- }, params));
1243
- el.dispatchEvent(new TouchEvent(eventType, {
1244
- cancelable: !0,
1245
- bubbles: !0,
1246
- shiftKey: !0,
1247
- touches: [touchObj],
1248
- targetTouches: [],
1249
- changedTouches: [touchObj]
1250
- }));
1251
- }.bind(undefined)
1252
- }; // emulate event
1253
-
1254
-
1063
+ try {
1064
+ // eslint-disable-next-line no-new
1065
+ new MouseEvent("t");
1066
+ return function (el, eventType, params) {
1067
+ if (params === void 0) {
1068
+ params = getParams();
1069
+ }
1070
+ _newArrowCheck(this, _this16);
1071
+ el.dispatchEvent(new MouseEvent(eventType, params));
1072
+ }.bind(this);
1073
+ } catch (e) {
1074
+ // Polyfills DOM4 MouseEvent
1075
+ return function (el, eventType, params) {
1076
+ if (params === void 0) {
1077
+ params = getParams();
1078
+ }
1079
+ _newArrowCheck(this, _this16);
1080
+ var mouseEvent = doc.createEvent("MouseEvent");
1081
+
1082
+ // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1083
+ mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
1084
+ // the event's mouse click count
1085
+ params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
1086
+ el.dispatchEvent(mouseEvent);
1087
+ }.bind(this);
1088
+ }
1089
+ }.bind(undefined)(),
1090
+ touch: function touch(el, eventType, params) {
1091
+ _newArrowCheck(this, util_this);
1092
+ var touchObj = new Touch(mergeObj({
1093
+ identifier: Date.now(),
1094
+ target: el,
1095
+ radiusX: 2.5,
1096
+ radiusY: 2.5,
1097
+ rotationAngle: 10,
1098
+ force: .5
1099
+ }, params));
1100
+ el.dispatchEvent(new TouchEvent(eventType, {
1101
+ cancelable: !0,
1102
+ bubbles: !0,
1103
+ shiftKey: !0,
1104
+ touches: [touchObj],
1105
+ targetTouches: [],
1106
+ changedTouches: [touchObj]
1107
+ }));
1108
+ }.bind(undefined)
1109
+ }; // emulate event
1255
1110
  /**
1256
1111
  * Process the template & return bound string
1257
1112
  * @param {string} tpl Template string
@@ -1261,13 +1116,12 @@ var getRange = function (start, end, step) {
1261
1116
  */
1262
1117
  function tplProcess(tpl, data) {
1263
1118
  var res = tpl;
1264
-
1265
1119
  for (var x in data) {
1266
1120
  res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
1267
1121
  }
1268
-
1269
1122
  return res;
1270
1123
  }
1124
+
1271
1125
  /**
1272
1126
  * Get parsed date value
1273
1127
  * (It must be called in 'ChartInternal' context)
@@ -1275,41 +1129,35 @@ function tplProcess(tpl, data) {
1275
1129
  * @returns {Date}
1276
1130
  * @private
1277
1131
  */
1278
-
1279
-
1280
1132
  function parseDate(date) {
1281
1133
  var parsedDate;
1282
-
1283
1134
  if (date instanceof Date) {
1284
1135
  parsedDate = date;
1285
1136
  } else if (isString(date)) {
1286
1137
  var _format$dataTime,
1287
- config = this.config,
1288
- format = this.format;
1289
-
1138
+ config = this.config,
1139
+ format = this.format;
1290
1140
  // if fails to parse, try by new Date()
1291
1141
  // https://github.com/naver/billboard.js/issues/1714
1292
1142
  parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
1293
1143
  } else if (isNumber(date) && !isNaN(date)) {
1294
1144
  parsedDate = new Date(+date);
1295
1145
  }
1296
-
1297
1146
  if (!parsedDate || isNaN(+parsedDate)) {
1298
1147
  console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
1299
1148
  }
1300
-
1301
1149
  return parsedDate;
1302
1150
  }
1151
+
1303
1152
  /**
1304
1153
  * Return if the current doc is visible or not
1305
1154
  * @returns {boolean}
1306
1155
  * @private
1307
1156
  */
1308
-
1309
-
1310
1157
  function isTabVisible() {
1311
1158
  return (doc == null ? void 0 : doc.hidden) === !1 || (doc == null ? void 0 : doc.visibilityState) === "visible";
1312
1159
  }
1160
+
1313
1161
  /**
1314
1162
  * Get the current input type
1315
1163
  * @param {boolean} mouse Config value: interaction.inputType.mouse
@@ -1317,19 +1165,18 @@ function isTabVisible() {
1317
1165
  * @returns {string} "mouse" | "touch" | null
1318
1166
  * @private
1319
1167
  */
1320
-
1321
-
1322
1168
  function convertInputType(mouse, touch) {
1323
1169
  var _this17 = this,
1324
- DocumentTouch = win.DocumentTouch,
1325
- matchMedia = win.matchMedia,
1326
- navigator = win.navigator,
1327
- hasTouch = !1;
1328
-
1170
+ DocumentTouch = win.DocumentTouch,
1171
+ matchMedia = win.matchMedia,
1172
+ navigator = win.navigator,
1173
+ hasTouch = !1;
1329
1174
  if (touch) {
1330
1175
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
1331
1176
  if (navigator && "maxTouchPoints" in navigator) {
1332
- hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1177
+ hasTouch = navigator.maxTouchPoints > 0;
1178
+
1179
+ // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1333
1180
  // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
1334
1181
  } else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
1335
1182
  hasTouch = !0;
@@ -1343,34 +1190,31 @@ function convertInputType(mouse, touch) {
1343
1190
  hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
1344
1191
  }
1345
1192
  }
1346
- } // 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
1193
+ }
1194
+
1195
+ // 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
1347
1196
  // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
1348
1197
  // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
1349
-
1350
-
1351
1198
  var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1352
1199
  _newArrowCheck(this, _this17);
1353
-
1354
1200
  return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1355
- }.bind(this)); // fallback to 'mouse' if no input type is detected.
1201
+ }.bind(this));
1356
1202
 
1203
+ // fallback to 'mouse' if no input type is detected.
1357
1204
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1358
1205
  }
1206
+
1359
1207
  /**
1360
1208
  * Run function until given condition function return true
1361
1209
  * @param {Function} fn Function to be executed when condition is true
1362
1210
  * @param {Function} conditionFn Condition function to check if condition is true
1363
1211
  * @private
1364
1212
  */
1365
-
1366
-
1367
1213
  function runUntil(fn, conditionFn) {
1368
1214
  var _this18 = this;
1369
-
1370
1215
  if (conditionFn() === !1) {
1371
1216
  win.requestAnimationFrame(function () {
1372
1217
  _newArrowCheck(this, _this18);
1373
-
1374
1218
  return runUntil(fn, conditionFn);
1375
1219
  }.bind(this));
1376
1220
  } else {
@@ -1379,13 +1223,11 @@ function runUntil(fn, conditionFn) {
1379
1223
  }
1380
1224
  ;// CONCATENATED MODULE: ./src/config/config.ts
1381
1225
 
1382
-
1383
1226
  /**
1384
1227
  * Copyright (c) 2017 ~ present NAVER Corp.
1385
1228
  * billboard.js project is licensed under the MIT license
1386
1229
  */
1387
1230
 
1388
-
1389
1231
  /**
1390
1232
  * Load configuration option
1391
1233
  * @param {object} config User's generation config value
@@ -1393,54 +1235,46 @@ function runUntil(fn, conditionFn) {
1393
1235
  */
1394
1236
  function loadConfig(config) {
1395
1237
  var _this = this,
1396
- thisConfig = this.config,
1397
- target,
1398
- keys,
1399
- read,
1400
- find = function () {
1401
- _newArrowCheck(this, _this);
1402
-
1403
- var key = keys.shift();
1404
-
1405
- if (key && target && isObjectType(target) && key in target) {
1406
- target = target[key];
1407
- return find();
1408
- } else if (!key) {
1409
- return target;
1410
- }
1411
-
1412
- return undefined;
1413
- }.bind(this);
1414
-
1238
+ thisConfig = this.config,
1239
+ target,
1240
+ keys,
1241
+ read,
1242
+ find = function () {
1243
+ _newArrowCheck(this, _this);
1244
+ var key = keys.shift();
1245
+ if (key && target && isObjectType(target) && key in target) {
1246
+ target = target[key];
1247
+ return find();
1248
+ } else if (!key) {
1249
+ return target;
1250
+ }
1251
+ return undefined;
1252
+ }.bind(this);
1415
1253
  Object.keys(thisConfig).forEach(function (key) {
1416
1254
  _newArrowCheck(this, _this);
1417
-
1418
1255
  target = config;
1419
1256
  keys = key.split("_");
1420
1257
  read = find();
1421
-
1422
1258
  if (isDefined(read)) {
1423
1259
  thisConfig[key] = read;
1424
1260
  }
1425
- }.bind(this)); // only should run in the ChartInternal context
1261
+ }.bind(this));
1426
1262
 
1263
+ // only should run in the ChartInternal context
1427
1264
  if (this.api) {
1428
1265
  this.state.orgConfig = config;
1429
1266
  }
1430
1267
  }
1431
1268
  ;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
1432
1269
 
1433
-
1434
1270
  /**
1435
1271
  * Copyright (c) 2017 ~ present NAVER Corp.
1436
1272
  * billboard.js project is licensed under the MIT license
1437
1273
  */
1438
-
1439
1274
  /**
1440
1275
  * Base class to generate billboard.js plugin
1441
1276
  * @class Plugin
1442
1277
  */
1443
-
1444
1278
  /**
1445
1279
  * Version info string for plugin
1446
1280
  * @name version
@@ -1460,69 +1294,57 @@ var Plugin = /*#__PURE__*/function () {
1460
1294
  if (options === void 0) {
1461
1295
  options = {};
1462
1296
  }
1463
-
1464
1297
  this.$$ = void 0;
1465
1298
  this.options = void 0;
1466
1299
  this.options = options;
1467
1300
  }
1301
+
1468
1302
  /**
1469
1303
  * Lifecycle hook for 'beforeInit' phase.
1470
1304
  * @private
1471
1305
  */
1472
-
1473
-
1474
1306
  var _proto = Plugin.prototype;
1475
-
1476
1307
  _proto.$beforeInit = function $beforeInit() {}
1308
+
1477
1309
  /**
1478
1310
  * Lifecycle hook for 'init' phase.
1479
1311
  * @private
1480
- */
1481
- ;
1482
-
1312
+ */;
1483
1313
  _proto.$init = function $init() {}
1314
+
1484
1315
  /**
1485
1316
  * Lifecycle hook for 'afterInit' phase.
1486
1317
  * @private
1487
- */
1488
- ;
1489
-
1318
+ */;
1490
1319
  _proto.$afterInit = function $afterInit() {}
1320
+
1491
1321
  /**
1492
1322
  * Lifecycle hook for 'redraw' phase.
1493
1323
  * @private
1494
- */
1495
- ;
1496
-
1324
+ */;
1497
1325
  _proto.$redraw = function $redraw() {}
1326
+
1498
1327
  /**
1499
1328
  * Lifecycle hook for 'willDestroy' phase.
1500
1329
  * @private
1501
- */
1502
- ;
1503
-
1330
+ */;
1504
1331
  _proto.$willDestroy = function $willDestroy() {
1505
1332
  var _this = this;
1506
-
1507
1333
  Object.keys(this).forEach(function (key) {
1508
1334
  _newArrowCheck(this, _this);
1509
-
1510
1335
  this[key] = null;
1511
1336
  delete this[key];
1512
1337
  }.bind(this));
1513
1338
  };
1514
-
1515
1339
  return Plugin;
1516
1340
  }();
1517
-
1518
- Plugin.version = "3.6.0";
1341
+ Plugin.version = "3.6.1";
1519
1342
 
1520
1343
  ;// CONCATENATED MODULE: ./src/Plugin/stanford/Options.ts
1521
1344
  /**
1522
1345
  * Copyright (c) 2017 ~ present NAVER Corp.
1523
1346
  * billboard.js project is licensed under the MIT license
1524
1347
  */
1525
-
1526
1348
  /**
1527
1349
  * Stanford diagram plugin option class
1528
1350
  * @class StanfordOptions
@@ -1545,7 +1367,6 @@ var Options = function () {
1545
1367
  * )
1546
1368
  */
1547
1369
  colors: undefined,
1548
-
1549
1370
  /**
1550
1371
  * Specify the key of epochs values in the data.
1551
1372
  * @name epochs
@@ -1556,7 +1377,6 @@ var Options = function () {
1556
1377
  * epochs: [ 1, 1, 2, 2, ... ]
1557
1378
  */
1558
1379
  epochs: [],
1559
-
1560
1380
  /**
1561
1381
  * Show additional lines anywhere on the chart.
1562
1382
  * - Each line object should consist with following options:
@@ -1578,7 +1398,6 @@ var Options = function () {
1578
1398
  * ]
1579
1399
  */
1580
1400
  lines: [],
1581
-
1582
1401
  /**
1583
1402
  * Set scale values
1584
1403
  * @name scale
@@ -1608,7 +1427,6 @@ var Options = function () {
1608
1427
  scale_max: undefined,
1609
1428
  scale_width: 20,
1610
1429
  scale_format: undefined,
1611
-
1612
1430
  /**
1613
1431
  * The padding for color scale element
1614
1432
  * @name padding
@@ -1631,7 +1449,6 @@ var Options = function () {
1631
1449
  padding_right: 0,
1632
1450
  padding_bottom: 0,
1633
1451
  padding_left: 0,
1634
-
1635
1452
  /**
1636
1453
  * Show additional regions anywhere on the chart.
1637
1454
  * - Each region object should consist with following options:
@@ -1667,13 +1484,11 @@ var Options = function () {
1667
1484
  };
1668
1485
  };
1669
1486
 
1670
-
1671
1487
  ;// CONCATENATED MODULE: ./src/Plugin/stanford/classes.ts
1672
1488
  /**
1673
1489
  * Copyright (c) 2017 ~ present NAVER Corp.
1674
1490
  * billboard.js project is licensed under the MIT license
1675
1491
  */
1676
-
1677
1492
  /**
1678
1493
  * CSS class names definition
1679
1494
  * @private
@@ -1693,6 +1508,7 @@ var Options = function () {
1693
1508
  * @ignore
1694
1509
  */
1695
1510
 
1511
+
1696
1512
  /**
1697
1513
  * Check if point is in region
1698
1514
  * @param {object} point Point
@@ -1700,28 +1516,26 @@ var Options = function () {
1700
1516
  * @returns {boolean}
1701
1517
  * @private
1702
1518
  */
1703
-
1704
1519
  function pointInRegion(point, region) {
1705
1520
  // thanks to: http://bl.ocks.org/bycoffe/5575904
1706
1521
  // ray-casting algorithm based on
1707
1522
  // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
1708
1523
  var x = point.x,
1709
- y = point.value,
1710
- inside = !1;
1711
-
1524
+ y = point.value,
1525
+ inside = !1;
1712
1526
  for (var i = 0, j = region.length - 1; i < region.length; j = i++) {
1713
1527
  var xi = region[i].x,
1714
- yi = region[i].y,
1715
- xj = region[j].x,
1716
- yj = region[j].y;
1717
-
1718
- if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) {
1528
+ yi = region[i].y,
1529
+ xj = region[j].x,
1530
+ yj = region[j].y,
1531
+ intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
1532
+ if (intersect) {
1719
1533
  inside = !inside;
1720
1534
  }
1721
1535
  }
1722
-
1723
1536
  return inside;
1724
1537
  }
1538
+
1725
1539
  /**
1726
1540
  * Compare epochs
1727
1541
  * @param {object} a Target
@@ -1729,65 +1543,55 @@ function pointInRegion(point, region) {
1729
1543
  * @returns {number}
1730
1544
  * @private
1731
1545
  */
1732
-
1733
-
1734
1546
  function compareEpochs(a, b) {
1735
1547
  if (a.epochs < b.epochs) {
1736
1548
  return -1;
1737
1549
  }
1738
-
1739
1550
  if (a.epochs > b.epochs) {
1740
1551
  return 1;
1741
1552
  }
1742
-
1743
1553
  return 0;
1744
1554
  }
1555
+
1745
1556
  /**
1746
1557
  * Get region area
1747
1558
  * @param {Array} points Points
1748
1559
  * @returns {number}
1749
1560
  * @private
1750
1561
  */
1751
-
1752
-
1753
1562
  function getRegionArea(points) {
1754
1563
  // thanks to: https://stackoverflow.com/questions/16282330/find-centerpoint-of-polygon-in-javascript
1755
1564
  var area = 0,
1756
- point1,
1757
- point2;
1758
-
1565
+ point1,
1566
+ point2;
1759
1567
  for (var i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
1760
1568
  point1 = points[i];
1761
1569
  point2 = points[j];
1762
1570
  area += point1.x * point2.y;
1763
1571
  area -= point1.y * point2.x;
1764
1572
  }
1765
-
1766
1573
  area /= 2;
1767
1574
  return area;
1768
1575
  }
1576
+
1769
1577
  /**
1770
1578
  * Get centroid
1771
1579
  * @param {Array} points Points
1772
1580
  * @returns {object}
1773
1581
  * @private
1774
1582
  */
1775
-
1776
-
1777
1583
  function getCentroid(points) {
1778
1584
  var area = getRegionArea(points),
1779
- x = 0,
1780
- y = 0,
1781
- f;
1782
-
1585
+ x = 0,
1586
+ y = 0,
1587
+ f;
1783
1588
  for (var i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
1784
1589
  var point1 = points[i],
1785
- point2 = points[j];
1590
+ point2 = points[j];
1786
1591
  f = point1.x * point2.y - point2.x * point1.y;
1787
1592
  x += (point1.x + point2.x) * f;
1788
1593
  y += (point1.y + point2.y) * f;
1789
1594
  }
1790
-
1791
1595
  f = area * 6;
1792
1596
  return {
1793
1597
  x: x / f,
@@ -1795,10 +1599,8 @@ function getCentroid(points) {
1795
1599
  };
1796
1600
  }
1797
1601
 
1798
-
1799
1602
  ;// CONCATENATED MODULE: ./src/Plugin/stanford/Elements.ts
1800
1603
 
1801
-
1802
1604
  /**
1803
1605
  * Copyright (c) 2017 ~ present NAVER Corp.
1804
1606
  * billboard.js project is licensed under the MIT license
@@ -1806,166 +1608,141 @@ function getCentroid(points) {
1806
1608
  // @ts-nocheck
1807
1609
 
1808
1610
 
1611
+
1809
1612
  /**
1810
1613
  * Stanford diagram plugin element class
1811
1614
  * @class ColorScale
1812
1615
  * @param {Stanford} owner Stanford instance
1813
1616
  * @private
1814
1617
  */
1815
-
1816
1618
  var Elements = /*#__PURE__*/function () {
1817
1619
  function Elements(owner) {
1818
1620
  this.owner = void 0;
1819
- this.owner = owner; // MEMO: Avoid blocking eventRect
1621
+ this.owner = owner;
1820
1622
 
1623
+ // MEMO: Avoid blocking eventRect
1821
1624
  var elements = owner.$$.$el.main.select(".bb-chart").append("g").attr("class", stanford_classes.stanfordElements);
1822
1625
  elements.append("g").attr("class", stanford_classes.stanfordLines);
1823
1626
  elements.append("g").attr("class", stanford_classes.stanfordRegions);
1824
1627
  }
1825
-
1826
1628
  var _proto = Elements.prototype;
1827
-
1828
1629
  _proto.updateStanfordLines = function updateStanfordLines(duration) {
1829
1630
  var _this = this,
1830
- $$ = this.owner.$$,
1831
- config = $$.config,
1832
- main = $$.$el.main,
1833
- isRotated = config.axis_rotated,
1834
- xvCustom = this.xvCustom.bind($$),
1835
- yvCustom = this.yvCustom.bind($$),
1836
- stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
1837
-
1631
+ $$ = this.owner.$$,
1632
+ config = $$.config,
1633
+ main = $$.$el.main,
1634
+ isRotated = config.axis_rotated,
1635
+ xvCustom = this.xvCustom.bind($$),
1636
+ yvCustom = this.yvCustom.bind($$),
1637
+ stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
1838
1638
  // exit
1839
- stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove(); // enter
1639
+ stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove();
1840
1640
 
1641
+ // enter
1841
1642
  var stanfordLineEnter = stanfordLine.enter().append("g");
1842
1643
  stanfordLineEnter.append("line").style("opacity", "0");
1843
1644
  stanfordLineEnter.merge(stanfordLine).attr("class", function (d) {
1844
1645
  _newArrowCheck(this, _this);
1845
-
1846
1646
  return stanford_classes.stanfordLine + (d.class ? " " + d.class : "");
1847
1647
  }.bind(this)).select("line").transition().duration(duration).attr("x1", function (d) {
1848
1648
  _newArrowCheck(this, _this);
1849
-
1850
1649
  return isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
1851
1650
  }.bind(this)).attr("x2", function (d) {
1852
1651
  _newArrowCheck(this, _this);
1853
-
1854
1652
  return isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2");
1855
1653
  }.bind(this)).attr("y1", function (d) {
1856
1654
  _newArrowCheck(this, _this);
1857
-
1858
1655
  return isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
1859
1656
  }.bind(this)).attr("y2", function (d) {
1860
1657
  _newArrowCheck(this, _this);
1861
-
1862
1658
  return isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2");
1863
1659
  }.bind(this)).transition().style("opacity", null);
1864
1660
  };
1865
-
1866
1661
  _proto.updateStanfordRegions = function updateStanfordRegions(duration) {
1867
1662
  var _this2 = this,
1868
- $$ = this.owner.$$,
1869
- config = $$.config,
1870
- main = $$.$el.main,
1871
- isRotated = config.axis_rotated,
1872
- xvCustom = this.xvCustom.bind($$),
1873
- yvCustom = this.yvCustom.bind($$),
1874
- countPointsInRegion = this.owner.countEpochsInRegion.bind($$),
1875
- stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
1876
-
1663
+ $$ = this.owner.$$,
1664
+ config = $$.config,
1665
+ main = $$.$el.main,
1666
+ isRotated = config.axis_rotated,
1667
+ xvCustom = this.xvCustom.bind($$),
1668
+ yvCustom = this.yvCustom.bind($$),
1669
+ countPointsInRegion = this.owner.countEpochsInRegion.bind($$),
1670
+ stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
1877
1671
  // exit
1878
- stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove(); // enter
1672
+ stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove();
1879
1673
 
1674
+ // enter
1880
1675
  var stanfordRegionEnter = stanfordRegion.enter().append("g");
1881
1676
  stanfordRegionEnter.append("polygon").style("opacity", "0");
1882
1677
  stanfordRegionEnter.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0");
1883
- stanfordRegion = stanfordRegionEnter.merge(stanfordRegion); // update
1678
+ stanfordRegion = stanfordRegionEnter.merge(stanfordRegion);
1884
1679
 
1680
+ // update
1885
1681
  stanfordRegion.attr("class", function (d) {
1886
1682
  _newArrowCheck(this, _this2);
1887
-
1888
1683
  return stanford_classes.stanfordRegion + (d.class ? " " + d.class : "");
1889
1684
  }.bind(this)).select("polygon").transition().duration(duration).attr("points", function (d) {
1890
1685
  var _this3 = this;
1891
-
1892
1686
  _newArrowCheck(this, _this2);
1893
-
1894
1687
  return d.points.map(function (value) {
1895
1688
  _newArrowCheck(this, _this3);
1896
-
1897
1689
  return [isRotated ? yvCustom(value, "y") : xvCustom(value, "x"), isRotated ? xvCustom(value, "x") : yvCustom(value, "y")].join(",");
1898
1690
  }.bind(this)).join(" ");
1899
1691
  }.bind(this)).transition().style("opacity", function (d) {
1900
1692
  _newArrowCheck(this, _this2);
1901
-
1902
1693
  return (d.opacity ? d.opacity : .2) + "";
1903
1694
  }.bind(this));
1904
1695
  stanfordRegion.select("text").transition().duration(duration).attr("x", function (d) {
1905
1696
  _newArrowCheck(this, _this2);
1906
-
1907
1697
  return isRotated ? yvCustom(getCentroid(d.points), "y") : xvCustom(getCentroid(d.points), "x");
1908
1698
  }.bind(this)).attr("y", function (d) {
1909
1699
  _newArrowCheck(this, _this2);
1910
-
1911
1700
  return isRotated ? xvCustom(getCentroid(d.points), "x") : yvCustom(getCentroid(d.points), "y");
1912
1701
  }.bind(this)).text(function (d) {
1913
1702
  _newArrowCheck(this, _this2);
1914
-
1915
1703
  if (d.text) {
1916
1704
  var _countPointsInRegion = countPointsInRegion(d.points),
1917
- value = _countPointsInRegion.value,
1918
- percentage = _countPointsInRegion.percentage;
1919
-
1705
+ value = _countPointsInRegion.value,
1706
+ percentage = _countPointsInRegion.percentage;
1920
1707
  return d.text(value, percentage);
1921
1708
  }
1922
-
1923
1709
  return "";
1924
1710
  }.bind(this)).attr("text-anchor", "middle").attr("dominant-baseline", "middle").transition().style("opacity", null);
1925
1711
  };
1926
-
1927
1712
  _proto.updateStanfordElements = function updateStanfordElements(duration) {
1928
1713
  if (duration === void 0) {
1929
1714
  duration = 0;
1930
1715
  }
1931
-
1932
1716
  this.updateStanfordLines(duration);
1933
1717
  this.updateStanfordRegions(duration);
1934
1718
  };
1935
-
1936
1719
  _proto.xvCustom = function xvCustom(d, xyValue) {
1937
1720
  var $$ = this,
1938
- axis = $$.axis,
1939
- config = $$.config,
1940
- value = xyValue ? d[xyValue] : $$.getBaseValue(d);
1941
-
1721
+ axis = $$.axis,
1722
+ config = $$.config,
1723
+ value = xyValue ? d[xyValue] : $$.getBaseValue(d);
1942
1724
  if (axis.isTimeSeries()) {
1943
1725
  value = parseDate.call($$, value);
1944
1726
  } else if (axis.isCategorized() && isString(value)) {
1945
1727
  value = config.axis_x_categories.indexOf(d.value);
1946
1728
  }
1947
-
1948
1729
  return Math.ceil($$.scale.x(value));
1949
1730
  };
1950
-
1951
1731
  _proto.yvCustom = function yvCustom(d, xyValue) {
1952
1732
  var $$ = this,
1953
- yScale = d.axis && d.axis === "y2" ? $$.scale.y2 : $$.scale.y,
1954
- value = xyValue ? d[xyValue] : $$.getBaseValue(d);
1733
+ yScale = d.axis && d.axis === "y2" ? $$.scale.y2 : $$.scale.y,
1734
+ value = xyValue ? d[xyValue] : $$.getBaseValue(d);
1955
1735
  return Math.ceil(yScale(value));
1956
1736
  };
1957
-
1958
1737
  return Elements;
1959
1738
  }();
1960
1739
 
1961
-
1962
1740
  // EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
1963
1741
  var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(8);
1964
1742
  // EXTERNAL MODULE: external {"commonjs":"d3-format","commonjs2":"d3-format","amd":"d3-format","root":"d3"}
1965
1743
  var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __webpack_require__(9);
1966
1744
  ;// CONCATENATED MODULE: ./src/Plugin/stanford/ColorScale.ts
1967
1745
 
1968
-
1969
1746
  /**
1970
1747
  * Copyright (c) 2017 ~ present NAVER Corp.
1971
1748
  * billboard.js project is licensed under the MIT license
@@ -1975,97 +1752,82 @@ var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __w
1975
1752
 
1976
1753
 
1977
1754
 
1755
+
1978
1756
  /**
1979
1757
  * Stanford diagram plugin color scale class
1980
1758
  * @class ColorScale
1981
1759
  * @param {Stanford} owner Stanford instance
1982
1760
  * @private
1983
1761
  */
1984
-
1985
1762
  var ColorScale = /*#__PURE__*/function () {
1986
1763
  function ColorScale(owner) {
1987
1764
  this.owner = void 0;
1988
1765
  this.colorScale = void 0;
1989
1766
  this.owner = owner;
1990
1767
  }
1991
-
1992
1768
  var _proto = ColorScale.prototype;
1993
-
1994
1769
  _proto.drawColorScale = function drawColorScale() {
1995
1770
  var _this = this,
1996
- _this$owner = this.owner,
1997
- $$ = _this$owner.$$,
1998
- config = _this$owner.config,
1999
- target = $$.data.targets[0],
2000
- height = $$.state.height - config.padding_bottom - config.padding_top,
2001
- barWidth = config.scale_width,
2002
- points = getRange(config.padding_bottom, height, 5),
2003
- inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
2004
-
1771
+ _this$owner = this.owner,
1772
+ $$ = _this$owner.$$,
1773
+ config = _this$owner.config,
1774
+ target = $$.data.targets[0],
1775
+ height = $$.state.height - config.padding_bottom - config.padding_top,
1776
+ barWidth = config.scale_width,
1777
+ points = getRange(config.padding_bottom, height, 5),
1778
+ inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
2005
1779
  if (this.colorScale) {
2006
1780
  this.colorScale.remove();
2007
1781
  }
2008
-
2009
1782
  this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale);
2010
1783
  this.colorScale.append("g").attr("transform", "translate(0, " + config.padding_top + ")").selectAll("bars").data(points).enter().append("rect").attr("y", function (d, i) {
2011
1784
  _newArrowCheck(this, _this);
2012
-
2013
1785
  return i * 5;
2014
1786
  }.bind(this)).attr("x", 0).attr("width", barWidth).attr("height", 5).attr("fill", function (d) {
2015
1787
  _newArrowCheck(this, _this);
2016
-
2017
1788
  return inverseScale(d);
2018
- }.bind(this)); // Legend Axis
1789
+ }.bind(this));
2019
1790
 
1791
+ // Legend Axis
2020
1792
  var axisScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLog)().domain([target.minEpochs, target.maxEpochs]).range([points[0] + config.padding_top + points[points.length - 1] + 5 - 1, points[0] + config.padding_top]),
2021
- legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
2022
- scaleFormat = config.scale_format;
2023
-
1793
+ legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
1794
+ scaleFormat = config.scale_format;
2024
1795
  if (scaleFormat === "pow10") {
2025
1796
  legendAxis.tickValues([1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7]);
2026
1797
  } else if (isFunction(scaleFormat)) {
2027
1798
  legendAxis.tickFormat(scaleFormat);
2028
1799
  } else {
2029
1800
  legendAxis.tickFormat((0,external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_.format)("d"));
2030
- } // Draw Axis
2031
-
1801
+ }
2032
1802
 
1803
+ // Draw Axis
2033
1804
  var axis = this.colorScale.append("g").attr("class", "legend axis").attr("transform", "translate(" + barWidth + ",0)").call(legendAxis);
2034
-
2035
1805
  if (scaleFormat === "pow10") {
2036
1806
  axis.selectAll(".tick text").text(null).filter(function (d) {
2037
1807
  _newArrowCheck(this, _this);
2038
-
2039
1808
  return d / Math.pow(10, Math.ceil(Math.log(d) / Math.LN10 - 1e-12)) === 1;
2040
1809
  }.bind(this)) // Power of Ten
2041
1810
  .text(10).append("tspan").attr("dy", "-.7em") // https://bl.ocks.org/mbostock/6738229
2042
1811
  .text(function (d) {
2043
1812
  _newArrowCheck(this, _this);
2044
-
2045
1813
  return Math.round(Math.log(d) / Math.LN10);
2046
1814
  }.bind(this));
2047
1815
  }
2048
-
2049
1816
  this.colorScale.attr("transform", "translate(" + ($$.state.current.width - this.xForColorScale()) + ", 0)");
2050
1817
  };
2051
-
2052
1818
  _proto.xForColorScale = function xForColorScale() {
2053
1819
  return this.owner.config.padding_right + this.colorScale.node().getBBox().width;
2054
1820
  };
2055
-
2056
1821
  _proto.getColorScalePadding = function getColorScalePadding() {
2057
1822
  return this.xForColorScale() + this.owner.config.padding_left + 20;
2058
1823
  };
2059
-
2060
1824
  return ColorScale;
2061
1825
  }();
2062
1826
 
2063
-
2064
1827
  ;// CONCATENATED MODULE: ./src/Plugin/stanford/index.ts
2065
1828
 
2066
1829
 
2067
1830
 
2068
-
2069
1831
  /**
2070
1832
  * Copyright (c) 2017 ~ present NAVER Corp.
2071
1833
  * billboard.js project is licensed under the MIT license
@@ -2081,6 +1843,7 @@ var ColorScale = /*#__PURE__*/function () {
2081
1843
 
2082
1844
 
2083
1845
 
1846
+
2084
1847
  /**
2085
1848
  * Stanford diagram plugin
2086
1849
  * - **NOTE:**
@@ -2166,60 +1929,43 @@ var ColorScale = /*#__PURE__*/function () {
2166
1929
  * ]
2167
1930
  * })
2168
1931
  */
2169
-
2170
1932
  var Stanford = /*#__PURE__*/function (_Plugin) {
2171
1933
  _inheritsLoose(Stanford, _Plugin);
2172
-
2173
1934
  function Stanford(options) {
2174
1935
  var _this = _Plugin.call(this, options) || this;
2175
-
2176
1936
  _this.config = void 0;
2177
1937
  _this.colorScale = void 0;
2178
1938
  _this.elements = void 0;
2179
1939
  _this.config = new Options();
2180
1940
  return _assertThisInitialized(_this) || _assertThisInitialized(_this);
2181
1941
  }
2182
-
2183
1942
  var _proto = Stanford.prototype;
2184
-
2185
1943
  _proto.$beforeInit = function $beforeInit() {
2186
1944
  var _this2 = this,
2187
- $$ = this.$$;
2188
-
1945
+ $$ = this.$$;
2189
1946
  // override on config values & methods
2190
1947
  $$.config.data_xSort = !1;
2191
-
2192
1948
  $$.isMultipleX = function () {
2193
1949
  _newArrowCheck(this, _this2);
2194
-
2195
1950
  return !0;
2196
1951
  }.bind(this);
2197
-
2198
1952
  $$.showGridFocus = function () {
2199
1953
  _newArrowCheck(this, _this2);
2200
1954
  }.bind(this);
2201
-
2202
1955
  $$.labelishData = function (d) {
2203
1956
  _newArrowCheck(this, _this2);
2204
-
2205
1957
  return d.values;
2206
1958
  }.bind(this);
2207
-
2208
1959
  $$.opacityForCircle = function () {
2209
1960
  _newArrowCheck(this, _this2);
2210
-
2211
1961
  return 1;
2212
1962
  }.bind(this);
2213
-
2214
1963
  var getCurrentPaddingRight = $$.getCurrentPaddingRight.bind($$);
2215
-
2216
1964
  $$.getCurrentPaddingRight = function () {
2217
1965
  _newArrowCheck(this, _this2);
2218
-
2219
1966
  return getCurrentPaddingRight() + (this.colorScale ? this.colorScale.getColorScalePadding() : 0);
2220
1967
  }.bind(this);
2221
1968
  };
2222
-
2223
1969
  _proto.$init = function $init() {
2224
1970
  var $$ = this.$$;
2225
1971
  loadConfig.call(this, this.options);
@@ -2232,31 +1978,23 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
2232
1978
  this.colorScale.drawColorScale();
2233
1979
  this.$redraw();
2234
1980
  };
2235
-
2236
1981
  _proto.$redraw = function $redraw(duration) {
2237
1982
  var _this$colorScale, _this$elements;
2238
-
2239
1983
  (_this$colorScale = this.colorScale) == null ? void 0 : _this$colorScale.drawColorScale();
2240
1984
  (_this$elements = this.elements) == null ? void 0 : _this$elements.updateStanfordElements(duration);
2241
1985
  };
2242
-
2243
1986
  _proto.getOptions = function getOptions() {
2244
1987
  return new Options();
2245
1988
  };
2246
-
2247
1989
  _proto.convertData = function convertData() {
2248
1990
  var _this3 = this,
2249
- data = this.$$.data.targets,
2250
- epochs = this.options.epochs;
2251
-
1991
+ data = this.$$.data.targets,
1992
+ epochs = this.options.epochs;
2252
1993
  data.forEach(function (d) {
2253
1994
  var _this4 = this;
2254
-
2255
1995
  _newArrowCheck(this, _this3);
2256
-
2257
1996
  d.values.forEach(function (v, i) {
2258
1997
  _newArrowCheck(this, _this4);
2259
-
2260
1998
  v.epochs = epochs[i];
2261
1999
  }.bind(this));
2262
2000
  d.minEpochs = undefined;
@@ -2265,42 +2003,36 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
2265
2003
  d.colorscale = undefined;
2266
2004
  }.bind(this));
2267
2005
  };
2268
-
2269
2006
  _proto.xvCustom = function xvCustom(d, xyValue) {
2270
2007
  var $$ = this,
2271
- axis = $$.axis,
2272
- config = $$.config,
2273
- value = xyValue ? d[xyValue] : $$.getBaseValue(d);
2274
-
2008
+ axis = $$.axis,
2009
+ config = $$.config,
2010
+ value = xyValue ? d[xyValue] : $$.getBaseValue(d);
2275
2011
  if (axis.isTimeSeries()) {
2276
2012
  value = parseDate.call($$, value);
2277
2013
  } else if (axis.isCategorized() && isString(value)) {
2278
2014
  value = config.axis_x_categories.indexOf(d.value);
2279
2015
  }
2280
-
2281
2016
  return Math.ceil($$.scale.x(value));
2282
2017
  };
2283
-
2284
2018
  _proto.yvCustom = function yvCustom(d, xyValue) {
2285
2019
  var $$ = this,
2286
- scale = $$.scale,
2287
- yScale = d.axis && d.axis === "y2" ? scale.y2 : scale.y,
2288
- value = xyValue ? d[xyValue] : $$.getBaseValue(d);
2020
+ scale = $$.scale,
2021
+ yScale = d.axis && d.axis === "y2" ? scale.y2 : scale.y,
2022
+ value = xyValue ? d[xyValue] : $$.getBaseValue(d);
2289
2023
  return Math.ceil(yScale(value));
2290
2024
  };
2291
-
2292
2025
  _proto.initStanfordData = function initStanfordData() {
2293
2026
  var _this5 = this,
2294
- config = this.config,
2295
- target = this.$$.data.targets[0];
2296
-
2027
+ config = this.config,
2028
+ target = this.$$.data.targets[0];
2297
2029
  // TODO STANFORD see if (data.js -> orderTargets)+ can be used instead
2298
2030
  // Make larger values appear on top
2299
- target.values.sort(compareEpochs); // Get array of epochs
2031
+ target.values.sort(compareEpochs);
2300
2032
 
2033
+ // Get array of epochs
2301
2034
  var epochs = target.values.map(function (a) {
2302
2035
  _newArrowCheck(this, _this5);
2303
-
2304
2036
  return a.epochs;
2305
2037
  }.bind(this));
2306
2038
  target.minEpochs = !isNaN(config.scale_min) ? config.scale_min : Math.min.apply(Math, epochs);
@@ -2308,68 +2040,56 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
2308
2040
  target.colors = isFunction(config.colors) ? config.colors : (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolateHslLong)((0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(250, 1, .5), (0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(0, 1, .5));
2309
2041
  target.colorscale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequentialLog)(target.colors).domain([target.minEpochs, target.maxEpochs]);
2310
2042
  };
2311
-
2312
2043
  _proto.getStanfordPointColor = function getStanfordPointColor(d) {
2313
2044
  var target = this.data.targets[0];
2314
2045
  return target.colorscale(d.epochs);
2315
2046
  };
2316
-
2317
2047
  _proto.setStanfordTooltip = function setStanfordTooltip() {
2318
2048
  var config = this.$$.config;
2319
-
2320
2049
  if (isEmpty(config.tooltip_contents)) {
2321
2050
  config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
2322
2051
  var _this6 = this,
2323
- data_x = config.data_x,
2324
- html = "<table class=\"" + $TOOLTIP.tooltip + "\"><tbody>";
2325
-
2052
+ data_x = config.data_x,
2053
+ html = "<table class=\"" + $TOOLTIP.tooltip + "\"><tbody>";
2326
2054
  d.forEach(function (v) {
2327
2055
  _newArrowCheck(this, _this6);
2328
-
2329
2056
  var _v$id = v.id,
2330
- id = _v$id === void 0 ? "" : _v$id,
2331
- _v$value = v.value,
2332
- value = _v$value === void 0 ? 0 : _v$value,
2333
- _v$epochs = v.epochs,
2334
- epochs = _v$epochs === void 0 ? 0 : _v$epochs,
2335
- _v$x = v.x,
2336
- x = _v$x === void 0 ? "" : _v$x;
2057
+ id = _v$id === void 0 ? "" : _v$id,
2058
+ _v$value = v.value,
2059
+ value = _v$value === void 0 ? 0 : _v$value,
2060
+ _v$epochs = v.epochs,
2061
+ epochs = _v$epochs === void 0 ? 0 : _v$epochs,
2062
+ _v$x = v.x,
2063
+ x = _v$x === void 0 ? "" : _v$x;
2337
2064
  html += "<tr>\n\t\t\t\t\t\t\t<th>" + (data_x || "") + "</th>\n\t\t\t\t\t\t\t<th class=\"value\">" + 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>" + v.id + "</th>\n\t\t\t\t\t\t\t<th class=\"value\">" + defaultValueFormat(value) + "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"" + $TOOLTIP.tooltipName + "-" + id + "\">\n\t\t\t\t\t\t\t<td class=\"name\"><span style=\"background-color:" + color(v) + "\"></span>Epochs</td>\n\t\t\t\t\t\t\t<td class=\"value\">" + defaultValueFormat(epochs) + "</td>\n\t\t\t\t\t\t</tr>";
2338
2065
  }.bind(this));
2339
2066
  return html + "</tbody></table>";
2340
2067
  };
2341
2068
  }
2342
2069
  };
2343
-
2344
2070
  _proto.countEpochsInRegion = function countEpochsInRegion(region) {
2345
2071
  var _this7 = this,
2346
- $$ = this,
2347
- target = $$.data.targets[0],
2348
- total = target.values.reduce(function (accumulator, currentValue) {
2349
- _newArrowCheck(this, _this7);
2350
-
2351
- return accumulator + +currentValue.epochs;
2352
- }.bind(this), 0),
2353
- value = target.values.reduce(function (accumulator, currentValue) {
2354
- _newArrowCheck(this, _this7);
2355
-
2356
- if (pointInRegion(currentValue, region)) {
2072
+ $$ = this,
2073
+ target = $$.data.targets[0],
2074
+ total = target.values.reduce(function (accumulator, currentValue) {
2075
+ _newArrowCheck(this, _this7);
2357
2076
  return accumulator + +currentValue.epochs;
2358
- }
2359
-
2360
- return accumulator;
2361
- }.bind(this), 0);
2362
-
2077
+ }.bind(this), 0),
2078
+ value = target.values.reduce(function (accumulator, currentValue) {
2079
+ _newArrowCheck(this, _this7);
2080
+ if (pointInRegion(currentValue, region)) {
2081
+ return accumulator + +currentValue.epochs;
2082
+ }
2083
+ return accumulator;
2084
+ }.bind(this), 0);
2363
2085
  return {
2364
2086
  value: value,
2365
2087
  percentage: value !== 0 ? +(value / total * 100).toFixed(1) : 0
2366
2088
  };
2367
2089
  };
2368
-
2369
2090
  return Stanford;
2370
2091
  }(Plugin);
2371
2092
 
2372
-
2373
2093
  }();
2374
2094
  __webpack_exports__ = __webpack_exports__["default"];
2375
2095
  /******/ return __webpack_exports__;