billboard.js 3.6.0 → 3.6.2
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.
- package/README.md +13 -77
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +4531 -7081
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +7931 -11567
- package/dist/billboard.pkgd.min.js +2 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +27 -62
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +303 -528
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +368 -648
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +305 -513
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +306 -500
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2121 -2265
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2892 -3502
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3146 -4013
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2921 -3514
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3037 -3835
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist-esm/billboard.js +54 -38
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -8
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -8
- package/package.json +23 -23
- package/src/ChartInternal/data/IData.ts +8 -2
- package/src/ChartInternal/interactions/eventrect.ts +22 -13
- package/src/ChartInternal/interactions/interaction.ts +39 -26
- 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.
|
|
8
|
+
* @version 3.6.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -101,7 +101,6 @@ function _assertThisInitialized(self) {
|
|
|
101
101
|
if (self === void 0) {
|
|
102
102
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
103
103
|
}
|
|
104
|
-
|
|
105
104
|
return self;
|
|
106
105
|
}
|
|
107
106
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
@@ -131,21 +130,16 @@ function _defineProperty(obj, key, value) {
|
|
|
131
130
|
} else {
|
|
132
131
|
obj[key] = value;
|
|
133
132
|
}
|
|
134
|
-
|
|
135
133
|
return obj;
|
|
136
134
|
}
|
|
137
135
|
;// CONCATENATED MODULE: ./src/config/classes.ts
|
|
138
136
|
|
|
139
|
-
|
|
140
137
|
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; }
|
|
141
|
-
|
|
142
138
|
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; }
|
|
143
|
-
|
|
144
139
|
/**
|
|
145
140
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
146
141
|
* billboard.js project is licensed under the MIT license
|
|
147
142
|
*/
|
|
148
|
-
|
|
149
143
|
/**
|
|
150
144
|
* CSS class names definition
|
|
151
145
|
* @private
|
|
@@ -299,17 +293,14 @@ var $ZOOM = {
|
|
|
299
293
|
/* harmony default export */ var classes = (_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $ZOOM));
|
|
300
294
|
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
301
295
|
|
|
302
|
-
|
|
303
296
|
/**
|
|
304
297
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
305
298
|
* billboard.js project is licensed under the MIT license
|
|
306
299
|
*/
|
|
307
|
-
|
|
308
300
|
/**
|
|
309
301
|
* Base class to generate billboard.js plugin
|
|
310
302
|
* @class Plugin
|
|
311
303
|
*/
|
|
312
|
-
|
|
313
304
|
/**
|
|
314
305
|
* Version info string for plugin
|
|
315
306
|
* @name version
|
|
@@ -329,69 +320,57 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
329
320
|
if (options === void 0) {
|
|
330
321
|
options = {};
|
|
331
322
|
}
|
|
332
|
-
|
|
333
323
|
this.$$ = void 0;
|
|
334
324
|
this.options = void 0;
|
|
335
325
|
this.options = options;
|
|
336
326
|
}
|
|
327
|
+
|
|
337
328
|
/**
|
|
338
329
|
* Lifecycle hook for 'beforeInit' phase.
|
|
339
330
|
* @private
|
|
340
331
|
*/
|
|
341
|
-
|
|
342
|
-
|
|
343
332
|
var _proto = Plugin.prototype;
|
|
344
|
-
|
|
345
333
|
_proto.$beforeInit = function $beforeInit() {}
|
|
334
|
+
|
|
346
335
|
/**
|
|
347
336
|
* Lifecycle hook for 'init' phase.
|
|
348
337
|
* @private
|
|
349
|
-
|
|
350
|
-
;
|
|
351
|
-
|
|
338
|
+
*/;
|
|
352
339
|
_proto.$init = function $init() {}
|
|
340
|
+
|
|
353
341
|
/**
|
|
354
342
|
* Lifecycle hook for 'afterInit' phase.
|
|
355
343
|
* @private
|
|
356
|
-
|
|
357
|
-
;
|
|
358
|
-
|
|
344
|
+
*/;
|
|
359
345
|
_proto.$afterInit = function $afterInit() {}
|
|
346
|
+
|
|
360
347
|
/**
|
|
361
348
|
* Lifecycle hook for 'redraw' phase.
|
|
362
349
|
* @private
|
|
363
|
-
|
|
364
|
-
;
|
|
365
|
-
|
|
350
|
+
*/;
|
|
366
351
|
_proto.$redraw = function $redraw() {}
|
|
352
|
+
|
|
367
353
|
/**
|
|
368
354
|
* Lifecycle hook for 'willDestroy' phase.
|
|
369
355
|
* @private
|
|
370
|
-
|
|
371
|
-
;
|
|
372
|
-
|
|
356
|
+
*/;
|
|
373
357
|
_proto.$willDestroy = function $willDestroy() {
|
|
374
358
|
var _this = this;
|
|
375
|
-
|
|
376
359
|
Object.keys(this).forEach(function (key) {
|
|
377
360
|
_newArrowCheck(this, _this);
|
|
378
|
-
|
|
379
361
|
this[key] = null;
|
|
380
362
|
delete this[key];
|
|
381
363
|
}.bind(this));
|
|
382
364
|
};
|
|
383
|
-
|
|
384
365
|
return Plugin;
|
|
385
366
|
}();
|
|
386
|
-
|
|
387
|
-
Plugin.version = "3.6.0";
|
|
367
|
+
Plugin.version = "3.6.2";
|
|
388
368
|
|
|
389
369
|
;// CONCATENATED MODULE: ./src/Plugin/sparkline/Options.ts
|
|
390
370
|
/**
|
|
391
371
|
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
392
372
|
* billboard.js project is licensed under the MIT license
|
|
393
373
|
*/
|
|
394
|
-
|
|
395
374
|
/**
|
|
396
375
|
* Sparkline plugin option class
|
|
397
376
|
* @class SparklineOptions
|
|
@@ -416,63 +395,47 @@ var Options = function () {
|
|
|
416
395
|
};
|
|
417
396
|
};
|
|
418
397
|
|
|
419
|
-
|
|
420
398
|
// EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
|
|
421
399
|
var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
|
422
400
|
// EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
|
|
423
401
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
424
402
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
425
403
|
|
|
426
|
-
|
|
427
404
|
var _this = undefined;
|
|
428
|
-
|
|
429
405
|
/**
|
|
430
406
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
431
407
|
* billboard.js project is licensed under the MIT license
|
|
432
408
|
*/
|
|
433
|
-
|
|
434
409
|
/**
|
|
435
410
|
* Window object
|
|
436
411
|
* @private
|
|
437
412
|
*/
|
|
438
|
-
|
|
439
413
|
/* eslint-disable no-new-func, no-undef */
|
|
440
414
|
|
|
441
|
-
|
|
442
415
|
var win = function () {
|
|
443
416
|
_newArrowCheck(this, _this);
|
|
444
|
-
|
|
445
417
|
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;
|
|
446
418
|
return root || Function("return this")();
|
|
447
419
|
}.bind(undefined)();
|
|
448
420
|
/* eslint-enable no-new-func, no-undef */
|
|
449
|
-
// fallback for non-supported environments
|
|
450
|
-
|
|
451
421
|
|
|
422
|
+
// fallback for non-supported environments
|
|
452
423
|
win.requestIdleCallback = win.requestIdleCallback || function (cb) {
|
|
453
424
|
_newArrowCheck(this, _this);
|
|
454
|
-
|
|
455
425
|
return setTimeout(cb, 1);
|
|
456
|
-
}.bind(undefined);
|
|
457
|
-
|
|
458
|
-
|
|
426
|
+
}.bind(undefined);
|
|
427
|
+
// win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
|
|
459
428
|
win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
|
|
460
429
|
_newArrowCheck(this, _this);
|
|
461
|
-
|
|
462
430
|
return setTimeout(cb, 1);
|
|
463
431
|
}.bind(undefined);
|
|
464
|
-
|
|
465
432
|
var doc = win == null ? void 0 : win.document;
|
|
466
433
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
467
434
|
|
|
468
435
|
|
|
469
|
-
|
|
470
436
|
var util_this = undefined;
|
|
471
|
-
|
|
472
437
|
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; }
|
|
473
|
-
|
|
474
438
|
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; }
|
|
475
|
-
|
|
476
439
|
/**
|
|
477
440
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
478
441
|
* billboard.js project is licensed under the MIT license
|
|
@@ -482,83 +445,66 @@ function util_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
|
|
|
482
445
|
|
|
483
446
|
|
|
484
447
|
|
|
485
|
-
|
|
486
448
|
var isValue = function (v) {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}.bind(undefined),
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}.bind(undefined),
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}.bind(undefined)
|
|
546
|
-
notEmpty = function (o) {
|
|
547
|
-
_newArrowCheck(this, util_this);
|
|
548
|
-
|
|
549
|
-
return !isEmpty(o);
|
|
550
|
-
}.bind(undefined),
|
|
551
|
-
isArray = function (arr) {
|
|
552
|
-
_newArrowCheck(this, util_this);
|
|
553
|
-
|
|
554
|
-
return Array.isArray(arr);
|
|
555
|
-
}.bind(undefined),
|
|
556
|
-
isObject = function (obj) {
|
|
557
|
-
_newArrowCheck(this, util_this);
|
|
558
|
-
|
|
559
|
-
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
560
|
-
}.bind(undefined);
|
|
561
|
-
|
|
449
|
+
_newArrowCheck(this, util_this);
|
|
450
|
+
return v || v === 0;
|
|
451
|
+
}.bind(undefined),
|
|
452
|
+
isFunction = function (v) {
|
|
453
|
+
_newArrowCheck(this, util_this);
|
|
454
|
+
return typeof v === "function";
|
|
455
|
+
}.bind(undefined),
|
|
456
|
+
isString = function (v) {
|
|
457
|
+
_newArrowCheck(this, util_this);
|
|
458
|
+
return typeof v === "string";
|
|
459
|
+
}.bind(undefined),
|
|
460
|
+
isNumber = function (v) {
|
|
461
|
+
_newArrowCheck(this, util_this);
|
|
462
|
+
return typeof v === "number";
|
|
463
|
+
}.bind(undefined),
|
|
464
|
+
isUndefined = function (v) {
|
|
465
|
+
_newArrowCheck(this, util_this);
|
|
466
|
+
return typeof v === "undefined";
|
|
467
|
+
}.bind(undefined),
|
|
468
|
+
isDefined = function (v) {
|
|
469
|
+
_newArrowCheck(this, util_this);
|
|
470
|
+
return typeof v !== "undefined";
|
|
471
|
+
}.bind(undefined),
|
|
472
|
+
isboolean = function (v) {
|
|
473
|
+
_newArrowCheck(this, util_this);
|
|
474
|
+
return typeof v === "boolean";
|
|
475
|
+
}.bind(undefined),
|
|
476
|
+
ceil10 = function (v) {
|
|
477
|
+
_newArrowCheck(this, util_this);
|
|
478
|
+
return Math.ceil(v / 10) * 10;
|
|
479
|
+
}.bind(undefined),
|
|
480
|
+
asHalfPixel = function (n) {
|
|
481
|
+
_newArrowCheck(this, util_this);
|
|
482
|
+
return Math.ceil(n) + .5;
|
|
483
|
+
}.bind(undefined),
|
|
484
|
+
diffDomain = function (d) {
|
|
485
|
+
_newArrowCheck(this, util_this);
|
|
486
|
+
return d[1] - d[0];
|
|
487
|
+
}.bind(undefined),
|
|
488
|
+
isObjectType = function (v) {
|
|
489
|
+
_newArrowCheck(this, util_this);
|
|
490
|
+
return typeof v === "object";
|
|
491
|
+
}.bind(undefined),
|
|
492
|
+
isEmpty = function (o) {
|
|
493
|
+
_newArrowCheck(this, util_this);
|
|
494
|
+
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
495
|
+
}.bind(undefined),
|
|
496
|
+
notEmpty = function (o) {
|
|
497
|
+
_newArrowCheck(this, util_this);
|
|
498
|
+
return !isEmpty(o);
|
|
499
|
+
}.bind(undefined),
|
|
500
|
+
isArray = function (arr) {
|
|
501
|
+
_newArrowCheck(this, util_this);
|
|
502
|
+
return Array.isArray(arr);
|
|
503
|
+
}.bind(undefined),
|
|
504
|
+
isObject = function (obj) {
|
|
505
|
+
_newArrowCheck(this, util_this);
|
|
506
|
+
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
507
|
+
}.bind(undefined);
|
|
562
508
|
/**
|
|
563
509
|
* Get specified key value from object
|
|
564
510
|
* If default value is given, will return if given key value not found
|
|
@@ -571,6 +517,7 @@ var isValue = function (v) {
|
|
|
571
517
|
function getOption(options, key, defaultValue) {
|
|
572
518
|
return isDefined(options[key]) ? options[key] : defaultValue;
|
|
573
519
|
}
|
|
520
|
+
|
|
574
521
|
/**
|
|
575
522
|
* Check if value exist in the given object
|
|
576
523
|
* @param {object} dict Target object to be checked
|
|
@@ -578,19 +525,16 @@ function getOption(options, key, defaultValue) {
|
|
|
578
525
|
* @returns {boolean}
|
|
579
526
|
* @private
|
|
580
527
|
*/
|
|
581
|
-
|
|
582
|
-
|
|
583
528
|
function hasValue(dict, value) {
|
|
584
529
|
var _this2 = this,
|
|
585
|
-
|
|
586
|
-
|
|
530
|
+
found = !1;
|
|
587
531
|
Object.keys(dict).forEach(function (key) {
|
|
588
532
|
_newArrowCheck(this, _this2);
|
|
589
|
-
|
|
590
533
|
return dict[key] === value && (found = !0);
|
|
591
534
|
}.bind(this));
|
|
592
535
|
return found;
|
|
593
536
|
}
|
|
537
|
+
|
|
594
538
|
/**
|
|
595
539
|
* Call function with arguments
|
|
596
540
|
* @param {Function} fn Function to be called
|
|
@@ -599,40 +543,33 @@ function hasValue(dict, value) {
|
|
|
599
543
|
* @returns {boolean} true: fn is function, false: fn is not function
|
|
600
544
|
* @private
|
|
601
545
|
*/
|
|
602
|
-
|
|
603
|
-
|
|
604
546
|
function callFn(fn, thisArg) {
|
|
605
547
|
for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
606
548
|
args[_key - 2] = arguments[_key];
|
|
607
549
|
}
|
|
608
|
-
|
|
609
550
|
isFn && fn.call.apply(fn, [thisArg].concat(args));
|
|
610
551
|
return isFn;
|
|
611
552
|
}
|
|
553
|
+
|
|
612
554
|
/**
|
|
613
555
|
* Call function after all transitions ends
|
|
614
556
|
* @param {d3.transition} transition Transition
|
|
615
557
|
* @param {Fucntion} cb Callback function
|
|
616
558
|
* @private
|
|
617
559
|
*/
|
|
618
|
-
|
|
619
|
-
|
|
620
560
|
function endall(transition, cb) {
|
|
621
561
|
var _this3 = this,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
};
|
|
630
|
-
|
|
562
|
+
n = 0,
|
|
563
|
+
end = function () {
|
|
564
|
+
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
565
|
+
args[_key2] = arguments[_key2];
|
|
566
|
+
}
|
|
567
|
+
--n || cb.apply.apply(cb, [this].concat(args));
|
|
568
|
+
};
|
|
631
569
|
// if is transition selection
|
|
632
570
|
if ("duration" in transition) {
|
|
633
571
|
transition.each(function () {
|
|
634
572
|
_newArrowCheck(this, _this3);
|
|
635
|
-
|
|
636
573
|
return ++n;
|
|
637
574
|
}.bind(this)).on("end", end);
|
|
638
575
|
} else {
|
|
@@ -640,17 +577,17 @@ function endall(transition, cb) {
|
|
|
640
577
|
transition.call(end);
|
|
641
578
|
}
|
|
642
579
|
}
|
|
580
|
+
|
|
643
581
|
/**
|
|
644
582
|
* Replace tag sign to html entity
|
|
645
583
|
* @param {string} str Target string value
|
|
646
584
|
* @returns {string}
|
|
647
585
|
* @private
|
|
648
586
|
*/
|
|
649
|
-
|
|
650
|
-
|
|
651
587
|
function sanitise(str) {
|
|
652
588
|
return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
|
653
589
|
}
|
|
590
|
+
|
|
654
591
|
/**
|
|
655
592
|
* Set text value. If there's multiline add nodes.
|
|
656
593
|
* @param {d3Selection} node Text node
|
|
@@ -659,53 +596,43 @@ function sanitise(str) {
|
|
|
659
596
|
* @param {boolean} toMiddle To be alingned vertically middle
|
|
660
597
|
* @private
|
|
661
598
|
*/
|
|
662
|
-
|
|
663
|
-
|
|
664
599
|
function setTextValue(node, text, dy, toMiddle) {
|
|
665
600
|
var _this4 = this;
|
|
666
|
-
|
|
667
601
|
if (dy === void 0) {
|
|
668
602
|
dy = [-1, 1];
|
|
669
603
|
}
|
|
670
|
-
|
|
671
604
|
if (toMiddle === void 0) {
|
|
672
605
|
toMiddle = !1;
|
|
673
606
|
}
|
|
674
|
-
|
|
675
607
|
if (!node || !isString(text)) {
|
|
676
608
|
return;
|
|
677
609
|
}
|
|
678
|
-
|
|
679
610
|
if (text.indexOf("\n") === -1) {
|
|
680
611
|
node.text(text);
|
|
681
612
|
} else {
|
|
682
613
|
var diff = [node.text(), text].map(function (v) {
|
|
683
614
|
_newArrowCheck(this, _this4);
|
|
684
|
-
|
|
685
615
|
return v.replace(/[\s\n]/g, "");
|
|
686
616
|
}.bind(this));
|
|
687
|
-
|
|
688
617
|
if (diff[0] !== diff[1]) {
|
|
689
618
|
var multiline = text.split("\n"),
|
|
690
|
-
|
|
619
|
+
len = toMiddle ? multiline.length - 1 : 1;
|
|
691
620
|
// reset possible text
|
|
692
621
|
node.html("");
|
|
693
622
|
multiline.forEach(function (v, i) {
|
|
694
623
|
_newArrowCheck(this, _this4);
|
|
695
|
-
|
|
696
624
|
node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
|
697
625
|
}.bind(this));
|
|
698
626
|
}
|
|
699
627
|
}
|
|
700
628
|
}
|
|
629
|
+
|
|
701
630
|
/**
|
|
702
631
|
* Substitution of SVGPathSeg API polyfill
|
|
703
632
|
* @param {SVGGraphicsElement} path Target svg element
|
|
704
633
|
* @returns {Array}
|
|
705
634
|
* @private
|
|
706
635
|
*/
|
|
707
|
-
|
|
708
|
-
|
|
709
636
|
function getRectSegList(path) {
|
|
710
637
|
/*
|
|
711
638
|
* seg1 ---------- seg2
|
|
@@ -715,45 +642,45 @@ function getRectSegList(path) {
|
|
|
715
642
|
* seg0 ---------- seg3
|
|
716
643
|
* */
|
|
717
644
|
var _path$getBBox = path.getBBox(),
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
645
|
+
x = _path$getBBox.x,
|
|
646
|
+
y = _path$getBBox.y,
|
|
647
|
+
width = _path$getBBox.width,
|
|
648
|
+
height = _path$getBBox.height;
|
|
723
649
|
return [{
|
|
724
650
|
x: x,
|
|
725
651
|
y: y + height
|
|
726
|
-
},
|
|
652
|
+
},
|
|
653
|
+
// seg0
|
|
727
654
|
{
|
|
728
655
|
x: x,
|
|
729
656
|
y: y
|
|
730
|
-
},
|
|
657
|
+
},
|
|
658
|
+
// seg1
|
|
731
659
|
{
|
|
732
660
|
x: x + width,
|
|
733
661
|
y: y
|
|
734
|
-
},
|
|
662
|
+
},
|
|
663
|
+
// seg2
|
|
735
664
|
{
|
|
736
665
|
x: x + width,
|
|
737
666
|
y: y + height
|
|
738
667
|
} // seg3
|
|
739
668
|
];
|
|
740
669
|
}
|
|
670
|
+
|
|
741
671
|
/**
|
|
742
672
|
* Get svg bounding path box dimension
|
|
743
673
|
* @param {SVGGraphicsElement} path Target svg element
|
|
744
674
|
* @returns {object}
|
|
745
675
|
* @private
|
|
746
676
|
*/
|
|
747
|
-
|
|
748
|
-
|
|
749
677
|
function getPathBox(path) {
|
|
750
678
|
var _path$getBoundingClie = path.getBoundingClientRect(),
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
679
|
+
width = _path$getBoundingClie.width,
|
|
680
|
+
height = _path$getBoundingClie.height,
|
|
681
|
+
items = getRectSegList(path),
|
|
682
|
+
x = items[0].x,
|
|
683
|
+
y = Math.min(items[0].y, items[1].y);
|
|
757
684
|
return {
|
|
758
685
|
x: x,
|
|
759
686
|
y: y,
|
|
@@ -761,6 +688,7 @@ function getPathBox(path) {
|
|
|
761
688
|
height: height
|
|
762
689
|
};
|
|
763
690
|
}
|
|
691
|
+
|
|
764
692
|
/**
|
|
765
693
|
* Get event's current position coordinates
|
|
766
694
|
* @param {object} event Event object
|
|
@@ -768,43 +696,38 @@ function getPathBox(path) {
|
|
|
768
696
|
* @returns {Array} [x, y] Coordinates x, y array
|
|
769
697
|
* @private
|
|
770
698
|
*/
|
|
771
|
-
|
|
772
|
-
|
|
773
699
|
function getPointer(event, element) {
|
|
774
700
|
var _ref,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
701
|
+
touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
|
702
|
+
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
|
703
|
+
_this5 = this;
|
|
779
704
|
return pointer.map(function (v) {
|
|
780
705
|
_newArrowCheck(this, _this5);
|
|
781
|
-
|
|
782
706
|
return isNaN(v) ? 0 : v;
|
|
783
707
|
}.bind(this));
|
|
784
708
|
}
|
|
709
|
+
|
|
785
710
|
/**
|
|
786
711
|
* Return brush selection array
|
|
787
712
|
* @param {object} ctx Current instance
|
|
788
713
|
* @returns {d3.brushSelection}
|
|
789
714
|
* @private
|
|
790
715
|
*/
|
|
791
|
-
|
|
792
|
-
|
|
793
716
|
function getBrushSelection(ctx) {
|
|
794
717
|
var event = ctx.event,
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
718
|
+
$el = ctx.$el,
|
|
719
|
+
main = $el.subchart.main || $el.main,
|
|
720
|
+
selection;
|
|
799
721
|
// check from event
|
|
800
722
|
if (event && event.type === "brush") {
|
|
801
|
-
selection = event.selection;
|
|
723
|
+
selection = event.selection;
|
|
724
|
+
// check from brush area selection
|
|
802
725
|
} else if (main && (selection = main.select(".bb-brush").node())) {
|
|
803
726
|
selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
|
|
804
727
|
}
|
|
805
|
-
|
|
806
728
|
return selection;
|
|
807
729
|
}
|
|
730
|
+
|
|
808
731
|
/**
|
|
809
732
|
* Get boundingClientRect.
|
|
810
733
|
* Cache the evaluated value once it was called.
|
|
@@ -812,12 +735,11 @@ function getBrushSelection(ctx) {
|
|
|
812
735
|
* @returns {object}
|
|
813
736
|
* @private
|
|
814
737
|
*/
|
|
815
|
-
|
|
816
|
-
|
|
817
738
|
function getBoundingRect(node) {
|
|
818
739
|
var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
819
740
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
820
741
|
}
|
|
742
|
+
|
|
821
743
|
/**
|
|
822
744
|
* Retrun random number
|
|
823
745
|
* @param {boolean} asStr Convert returned value as string
|
|
@@ -826,24 +748,20 @@ function getBoundingRect(node) {
|
|
|
826
748
|
* @returns {number|string}
|
|
827
749
|
* @private
|
|
828
750
|
*/
|
|
829
|
-
|
|
830
|
-
|
|
831
751
|
function getRandom(asStr, min, max) {
|
|
832
752
|
if (asStr === void 0) {
|
|
833
753
|
asStr = !0;
|
|
834
754
|
}
|
|
835
|
-
|
|
836
755
|
if (min === void 0) {
|
|
837
756
|
min = 0;
|
|
838
757
|
}
|
|
839
|
-
|
|
840
758
|
if (max === void 0) {
|
|
841
759
|
max = 1e4;
|
|
842
760
|
}
|
|
843
|
-
|
|
844
761
|
var rand = Math.floor(Math.random() * (max - min) + min);
|
|
845
762
|
return asStr ? rand + "" : rand;
|
|
846
763
|
}
|
|
764
|
+
|
|
847
765
|
/**
|
|
848
766
|
* Find index based on binary search
|
|
849
767
|
* @param {Array} arr Data array
|
|
@@ -854,87 +772,71 @@ function getRandom(asStr, min, max) {
|
|
|
854
772
|
* @returns {number} Index number
|
|
855
773
|
* @private
|
|
856
774
|
*/
|
|
857
|
-
|
|
858
|
-
|
|
859
775
|
function findIndex(arr, v, start, end, isRotated) {
|
|
860
776
|
if (start > end) {
|
|
861
777
|
return -1;
|
|
862
778
|
}
|
|
863
|
-
|
|
864
779
|
var mid = Math.floor((start + end) / 2),
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
780
|
+
_arr$mid = arr[mid],
|
|
781
|
+
x = _arr$mid.x,
|
|
782
|
+
_arr$mid$w = _arr$mid.w,
|
|
783
|
+
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
870
784
|
if (isRotated) {
|
|
871
785
|
x = arr[mid].y;
|
|
872
786
|
w = arr[mid].h;
|
|
873
787
|
}
|
|
874
|
-
|
|
875
788
|
if (v >= x && v <= x + w) {
|
|
876
789
|
return mid;
|
|
877
790
|
}
|
|
878
|
-
|
|
879
791
|
return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
|
|
880
792
|
}
|
|
793
|
+
|
|
881
794
|
/**
|
|
882
795
|
* Check if brush is empty
|
|
883
796
|
* @param {object} ctx Bursh context
|
|
884
797
|
* @returns {boolean}
|
|
885
798
|
* @private
|
|
886
799
|
*/
|
|
887
|
-
|
|
888
|
-
|
|
889
800
|
function brushEmpty(ctx) {
|
|
890
801
|
var selection = getBrushSelection(ctx);
|
|
891
|
-
|
|
892
802
|
if (selection) {
|
|
893
803
|
// brush selected area
|
|
894
804
|
// two-dimensional: [[x0, y0], [x1, y1]]
|
|
895
805
|
// one-dimensional: [x0, x1] or [y0, y1]
|
|
896
806
|
return selection[0] === selection[1];
|
|
897
807
|
}
|
|
898
|
-
|
|
899
808
|
return !0;
|
|
900
809
|
}
|
|
810
|
+
|
|
901
811
|
/**
|
|
902
812
|
* Deep copy object
|
|
903
813
|
* @param {object} objectN Source object
|
|
904
814
|
* @returns {object} Cloned object
|
|
905
815
|
* @private
|
|
906
816
|
*/
|
|
907
|
-
|
|
908
|
-
|
|
909
817
|
function deepClone() {
|
|
910
818
|
for (var _this6 = this, clone = function (v) {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
r
|
|
819
|
+
_newArrowCheck(this, _this6);
|
|
820
|
+
if (isObject(v) && v.constructor) {
|
|
821
|
+
var r = new v.constructor();
|
|
822
|
+
for (var k in v) {
|
|
823
|
+
r[k] = clone(v[k]);
|
|
824
|
+
}
|
|
825
|
+
return r;
|
|
918
826
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
return v;
|
|
924
|
-
}.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
827
|
+
return v;
|
|
828
|
+
}.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
925
829
|
objectN[_key3] = arguments[_key3];
|
|
926
830
|
}
|
|
927
|
-
|
|
928
831
|
return objectN.map(function (v) {
|
|
929
832
|
_newArrowCheck(this, _this6);
|
|
930
|
-
|
|
931
833
|
return clone(v);
|
|
932
834
|
}.bind(this)).reduce(function (a, c) {
|
|
933
835
|
_newArrowCheck(this, _this6);
|
|
934
|
-
|
|
935
836
|
return util_objectSpread(util_objectSpread({}, a), c);
|
|
936
837
|
}.bind(this));
|
|
937
838
|
}
|
|
839
|
+
|
|
938
840
|
/**
|
|
939
841
|
* Extend target from source object
|
|
940
842
|
* @param {object} target Target object
|
|
@@ -942,47 +844,39 @@ function deepClone() {
|
|
|
942
844
|
* @returns {object}
|
|
943
845
|
* @private
|
|
944
846
|
*/
|
|
945
|
-
|
|
946
|
-
|
|
947
847
|
function extend(target, source) {
|
|
948
848
|
var _this7 = this;
|
|
949
|
-
|
|
950
849
|
if (target === void 0) {
|
|
951
850
|
target = {};
|
|
952
851
|
}
|
|
953
|
-
|
|
954
852
|
if (isArray(source)) {
|
|
955
853
|
source.forEach(function (v) {
|
|
956
854
|
_newArrowCheck(this, _this7);
|
|
957
|
-
|
|
958
855
|
return extend(target, v);
|
|
959
856
|
}.bind(this));
|
|
960
|
-
}
|
|
961
|
-
|
|
857
|
+
}
|
|
962
858
|
|
|
859
|
+
// exclude name with only numbers
|
|
963
860
|
for (var p in source) {
|
|
964
861
|
if (/^\d+$/.test(p) || p in target) {
|
|
965
862
|
continue;
|
|
966
863
|
}
|
|
967
|
-
|
|
968
864
|
target[p] = source[p];
|
|
969
865
|
}
|
|
970
|
-
|
|
971
866
|
return target;
|
|
972
867
|
}
|
|
868
|
+
|
|
973
869
|
/**
|
|
974
870
|
* Return first letter capitalized
|
|
975
871
|
* @param {string} str Target string
|
|
976
872
|
* @returns {string} capitalized string
|
|
977
873
|
* @private
|
|
978
874
|
*/
|
|
979
|
-
|
|
980
|
-
|
|
981
875
|
var capitalize = function (str) {
|
|
982
876
|
_newArrowCheck(this, util_this);
|
|
983
|
-
|
|
984
877
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
985
878
|
}.bind(undefined);
|
|
879
|
+
|
|
986
880
|
/**
|
|
987
881
|
* Camelize from kebob style string
|
|
988
882
|
* @param {string} str Target string
|
|
@@ -990,34 +884,28 @@ var capitalize = function (str) {
|
|
|
990
884
|
* @returns {string} camelized string
|
|
991
885
|
* @private
|
|
992
886
|
*/
|
|
993
|
-
|
|
994
|
-
|
|
995
887
|
function camelize(str, separator) {
|
|
996
888
|
var _this8 = this;
|
|
997
|
-
|
|
998
889
|
if (separator === void 0) {
|
|
999
890
|
separator = "-";
|
|
1000
891
|
}
|
|
1001
|
-
|
|
1002
892
|
return str.split(separator).map(function (v, i) {
|
|
1003
893
|
_newArrowCheck(this, _this8);
|
|
1004
|
-
|
|
1005
894
|
return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
|
|
1006
895
|
}.bind(this)).join("");
|
|
1007
896
|
}
|
|
897
|
+
|
|
1008
898
|
/**
|
|
1009
899
|
* Convert to array
|
|
1010
900
|
* @param {object} v Target to be converted
|
|
1011
901
|
* @returns {Array}
|
|
1012
902
|
* @private
|
|
1013
903
|
*/
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
904
|
var toArray = function (v) {
|
|
1017
905
|
_newArrowCheck(this, util_this);
|
|
1018
|
-
|
|
1019
906
|
return [].slice.call(v);
|
|
1020
907
|
}.bind(undefined);
|
|
908
|
+
|
|
1021
909
|
/**
|
|
1022
910
|
* Add CSS rules
|
|
1023
911
|
* @param {object} style Style object
|
|
@@ -1026,36 +914,29 @@ var toArray = function (v) {
|
|
|
1026
914
|
* @returns {number} Newely added rule index
|
|
1027
915
|
* @private
|
|
1028
916
|
*/
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
917
|
function addCssRules(style, selector, prop) {
|
|
1032
918
|
var _this9 = this,
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
|
1041
|
-
|
|
919
|
+
rootSelctor = style.rootSelctor,
|
|
920
|
+
sheet = style.sheet,
|
|
921
|
+
getSelector = function (s) {
|
|
922
|
+
_newArrowCheck(this, _this9);
|
|
923
|
+
return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
|
|
924
|
+
}.bind(this),
|
|
925
|
+
rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
|
1042
926
|
return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
|
1043
927
|
}
|
|
928
|
+
|
|
1044
929
|
/**
|
|
1045
930
|
* Get css rules for specified stylesheets
|
|
1046
931
|
* @param {Array} styleSheets The stylesheets to get the rules from
|
|
1047
932
|
* @returns {Array}
|
|
1048
933
|
* @private
|
|
1049
934
|
*/
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
935
|
function getCssRules(styleSheets) {
|
|
1053
936
|
var _this10 = this,
|
|
1054
|
-
|
|
1055
|
-
|
|
937
|
+
rules = [];
|
|
1056
938
|
styleSheets.forEach(function (sheet) {
|
|
1057
939
|
_newArrowCheck(this, _this10);
|
|
1058
|
-
|
|
1059
940
|
try {
|
|
1060
941
|
if (sheet.cssRules && sheet.cssRules.length) {
|
|
1061
942
|
rules = rules.concat(toArray(sheet.cssRules));
|
|
@@ -1066,17 +947,16 @@ function getCssRules(styleSheets) {
|
|
|
1066
947
|
}.bind(this));
|
|
1067
948
|
return rules;
|
|
1068
949
|
}
|
|
950
|
+
|
|
1069
951
|
/**
|
|
1070
952
|
* Gets the SVGMatrix of an SVGGElement
|
|
1071
953
|
* @param {SVGElement} node Node element
|
|
1072
954
|
* @returns {SVGMatrix} matrix
|
|
1073
955
|
* @private
|
|
1074
956
|
*/
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
957
|
function getTranslation(node) {
|
|
1078
958
|
var transform = node ? node.transform : null,
|
|
1079
|
-
|
|
959
|
+
baseVal = transform && transform.baseVal;
|
|
1080
960
|
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
1081
961
|
a: 0,
|
|
1082
962
|
b: 0,
|
|
@@ -1086,46 +966,40 @@ function getTranslation(node) {
|
|
|
1086
966
|
f: 0
|
|
1087
967
|
};
|
|
1088
968
|
}
|
|
969
|
+
|
|
1089
970
|
/**
|
|
1090
971
|
* Get unique value from array
|
|
1091
972
|
* @param {Array} data Source data
|
|
1092
973
|
* @returns {Array} Unique array value
|
|
1093
974
|
* @private
|
|
1094
975
|
*/
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
976
|
function getUnique(data) {
|
|
1098
977
|
var _this11 = this,
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
}.bind(this));
|
|
1105
|
-
|
|
978
|
+
isDate = data[0] instanceof Date,
|
|
979
|
+
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
980
|
+
_newArrowCheck(this, _this11);
|
|
981
|
+
return self.indexOf(v) === i;
|
|
982
|
+
}.bind(this));
|
|
1106
983
|
return isDate ? d.map(function (v) {
|
|
1107
984
|
_newArrowCheck(this, _this11);
|
|
1108
|
-
|
|
1109
985
|
return new Date(v);
|
|
1110
986
|
}.bind(this)) : d;
|
|
1111
987
|
}
|
|
988
|
+
|
|
1112
989
|
/**
|
|
1113
990
|
* Merge array
|
|
1114
991
|
* @param {Array} arr Source array
|
|
1115
992
|
* @returns {Array}
|
|
1116
993
|
* @private
|
|
1117
994
|
*/
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
995
|
function mergeArray(arr) {
|
|
1121
996
|
var _this12 = this;
|
|
1122
|
-
|
|
1123
997
|
return arr && arr.length ? arr.reduce(function (p, c) {
|
|
1124
998
|
_newArrowCheck(this, _this12);
|
|
1125
|
-
|
|
1126
999
|
return p.concat(c);
|
|
1127
1000
|
}.bind(this)) : [];
|
|
1128
1001
|
}
|
|
1002
|
+
|
|
1129
1003
|
/**
|
|
1130
1004
|
* Merge object returning new object
|
|
1131
1005
|
* @param {object} target Target object
|
|
@@ -1133,25 +1007,18 @@ function mergeArray(arr) {
|
|
|
1133
1007
|
* @returns {object} merged target object
|
|
1134
1008
|
* @private
|
|
1135
1009
|
*/
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
1010
|
function mergeObj(target) {
|
|
1139
1011
|
for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
1140
1012
|
objectN[_key4 - 1] = arguments[_key4];
|
|
1141
1013
|
}
|
|
1142
|
-
|
|
1143
1014
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
|
1144
1015
|
return target;
|
|
1145
1016
|
}
|
|
1146
|
-
|
|
1147
1017
|
var source = objectN.shift();
|
|
1148
|
-
|
|
1149
1018
|
if (isObject(target) && isObject(source)) {
|
|
1150
1019
|
Object.keys(source).forEach(function (key) {
|
|
1151
1020
|
_newArrowCheck(this, _this13);
|
|
1152
|
-
|
|
1153
1021
|
var value = source[key];
|
|
1154
|
-
|
|
1155
1022
|
if (isObject(value)) {
|
|
1156
1023
|
target[key] || (target[key] = {});
|
|
1157
1024
|
target[key] = mergeObj(target[key], value);
|
|
@@ -1160,9 +1027,9 @@ function mergeObj(target) {
|
|
|
1160
1027
|
}
|
|
1161
1028
|
}.bind(this));
|
|
1162
1029
|
}
|
|
1163
|
-
|
|
1164
1030
|
return mergeObj.apply(void 0, [target].concat(objectN));
|
|
1165
1031
|
}
|
|
1032
|
+
|
|
1166
1033
|
/**
|
|
1167
1034
|
* Sort value
|
|
1168
1035
|
* @param {Array} data value to be sorted
|
|
@@ -1170,45 +1037,36 @@ function mergeObj(target) {
|
|
|
1170
1037
|
* @returns {number|string|Date} sorted date
|
|
1171
1038
|
* @private
|
|
1172
1039
|
*/
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
1040
|
function sortValue(data, isAsc) {
|
|
1176
1041
|
var _this14 = this;
|
|
1177
|
-
|
|
1178
1042
|
if (isAsc === void 0) {
|
|
1179
1043
|
isAsc = !0;
|
|
1180
1044
|
}
|
|
1181
|
-
|
|
1182
1045
|
var fn;
|
|
1183
|
-
|
|
1184
1046
|
if (data[0] instanceof Date) {
|
|
1185
1047
|
fn = isAsc ? function (a, b) {
|
|
1186
1048
|
_newArrowCheck(this, _this14);
|
|
1187
|
-
|
|
1188
1049
|
return a - b;
|
|
1189
1050
|
}.bind(this) : function (a, b) {
|
|
1190
1051
|
_newArrowCheck(this, _this14);
|
|
1191
|
-
|
|
1192
1052
|
return b - a;
|
|
1193
1053
|
}.bind(this);
|
|
1194
1054
|
} else {
|
|
1195
1055
|
if (isAsc && !data.every(isNaN)) {
|
|
1196
1056
|
fn = function (a, b) {
|
|
1197
1057
|
_newArrowCheck(this, _this14);
|
|
1198
|
-
|
|
1199
1058
|
return a - b;
|
|
1200
1059
|
}.bind(this);
|
|
1201
1060
|
} else if (!isAsc) {
|
|
1202
1061
|
fn = function (a, b) {
|
|
1203
1062
|
_newArrowCheck(this, _this14);
|
|
1204
|
-
|
|
1205
1063
|
return a > b && -1 || a < b && 1 || a === b && 0;
|
|
1206
1064
|
}.bind(this);
|
|
1207
1065
|
}
|
|
1208
1066
|
}
|
|
1209
|
-
|
|
1210
1067
|
return data.concat().sort(fn);
|
|
1211
1068
|
}
|
|
1069
|
+
|
|
1212
1070
|
/**
|
|
1213
1071
|
* Get min/max value
|
|
1214
1072
|
* @param {string} type 'min' or 'max'
|
|
@@ -1216,16 +1074,12 @@ function sortValue(data, isAsc) {
|
|
|
1216
1074
|
* @returns {number|Date|undefined}
|
|
1217
1075
|
* @private
|
|
1218
1076
|
*/
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
1077
|
function getMinMax(type, data) {
|
|
1222
1078
|
var _this15 = this,
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
}.bind(this));
|
|
1228
|
-
|
|
1079
|
+
res = data.filter(function (v) {
|
|
1080
|
+
_newArrowCheck(this, _this15);
|
|
1081
|
+
return notEmpty(v);
|
|
1082
|
+
}.bind(this));
|
|
1229
1083
|
if (res.length) {
|
|
1230
1084
|
if (isNumber(res[0])) {
|
|
1231
1085
|
res = Math[type].apply(Math, res);
|
|
@@ -1235,9 +1089,9 @@ function getMinMax(type, data) {
|
|
|
1235
1089
|
} else {
|
|
1236
1090
|
res = undefined;
|
|
1237
1091
|
}
|
|
1238
|
-
|
|
1239
1092
|
return res;
|
|
1240
1093
|
}
|
|
1094
|
+
|
|
1241
1095
|
/**
|
|
1242
1096
|
* Get range
|
|
1243
1097
|
* @param {number} start Start number
|
|
@@ -1246,95 +1100,80 @@ function getMinMax(type, data) {
|
|
|
1246
1100
|
* @returns {Array}
|
|
1247
1101
|
* @private
|
|
1248
1102
|
*/
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
1103
|
var getRange = function (start, end, step) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
_newArrowCheck(this, util_this);
|
|
1257
|
-
|
|
1258
|
-
var res = [],
|
|
1259
|
-
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
1260
|
-
|
|
1261
|
-
for (var i = start; i < n; i++) {
|
|
1262
|
-
res.push(start + i * step);
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
return res;
|
|
1266
|
-
}.bind(undefined),
|
|
1267
|
-
emulateEvent = {
|
|
1268
|
-
mouse: function () {
|
|
1269
|
-
var _this16 = this;
|
|
1270
|
-
|
|
1104
|
+
if (step === void 0) {
|
|
1105
|
+
step = 1;
|
|
1106
|
+
}
|
|
1271
1107
|
_newArrowCheck(this, util_this);
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
}.bind(this);
|
|
1285
|
-
|
|
1286
|
-
try {
|
|
1287
|
-
// eslint-disable-next-line no-new
|
|
1288
|
-
new MouseEvent("t");
|
|
1289
|
-
return function (el, eventType, params) {
|
|
1290
|
-
if (params === void 0) {
|
|
1291
|
-
params = getParams();
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
_newArrowCheck(this, _this16);
|
|
1295
|
-
|
|
1296
|
-
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
1297
|
-
}.bind(this);
|
|
1298
|
-
} catch (e) {
|
|
1299
|
-
// Polyfills DOM4 MouseEvent
|
|
1300
|
-
return function (el, eventType, params) {
|
|
1301
|
-
if (params === void 0) {
|
|
1302
|
-
params = getParams();
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1108
|
+
var res = [],
|
|
1109
|
+
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
1110
|
+
for (var i = start; i < n; i++) {
|
|
1111
|
+
res.push(start + i * step);
|
|
1112
|
+
}
|
|
1113
|
+
return res;
|
|
1114
|
+
}.bind(undefined),
|
|
1115
|
+
emulateEvent = {
|
|
1116
|
+
mouse: function () {
|
|
1117
|
+
var _this16 = this;
|
|
1118
|
+
_newArrowCheck(this, util_this);
|
|
1119
|
+
var getParams = function () {
|
|
1305
1120
|
_newArrowCheck(this, _this16);
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1121
|
+
return {
|
|
1122
|
+
bubbles: !1,
|
|
1123
|
+
cancelable: !1,
|
|
1124
|
+
screenX: 0,
|
|
1125
|
+
screenY: 0,
|
|
1126
|
+
clientX: 0,
|
|
1127
|
+
clientY: 0
|
|
1128
|
+
};
|
|
1312
1129
|
}.bind(this);
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1130
|
+
try {
|
|
1131
|
+
// eslint-disable-next-line no-new
|
|
1132
|
+
new MouseEvent("t");
|
|
1133
|
+
return function (el, eventType, params) {
|
|
1134
|
+
if (params === void 0) {
|
|
1135
|
+
params = getParams();
|
|
1136
|
+
}
|
|
1137
|
+
_newArrowCheck(this, _this16);
|
|
1138
|
+
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
1139
|
+
}.bind(this);
|
|
1140
|
+
} catch (e) {
|
|
1141
|
+
// Polyfills DOM4 MouseEvent
|
|
1142
|
+
return function (el, eventType, params) {
|
|
1143
|
+
if (params === void 0) {
|
|
1144
|
+
params = getParams();
|
|
1145
|
+
}
|
|
1146
|
+
_newArrowCheck(this, _this16);
|
|
1147
|
+
var mouseEvent = doc.createEvent("MouseEvent");
|
|
1148
|
+
|
|
1149
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
1150
|
+
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
1151
|
+
// the event's mouse click count
|
|
1152
|
+
params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
|
|
1153
|
+
el.dispatchEvent(mouseEvent);
|
|
1154
|
+
}.bind(this);
|
|
1155
|
+
}
|
|
1156
|
+
}.bind(undefined)(),
|
|
1157
|
+
touch: function touch(el, eventType, params) {
|
|
1158
|
+
_newArrowCheck(this, util_this);
|
|
1159
|
+
var touchObj = new Touch(mergeObj({
|
|
1160
|
+
identifier: Date.now(),
|
|
1161
|
+
target: el,
|
|
1162
|
+
radiusX: 2.5,
|
|
1163
|
+
radiusY: 2.5,
|
|
1164
|
+
rotationAngle: 10,
|
|
1165
|
+
force: .5
|
|
1166
|
+
}, params));
|
|
1167
|
+
el.dispatchEvent(new TouchEvent(eventType, {
|
|
1168
|
+
cancelable: !0,
|
|
1169
|
+
bubbles: !0,
|
|
1170
|
+
shiftKey: !0,
|
|
1171
|
+
touches: [touchObj],
|
|
1172
|
+
targetTouches: [],
|
|
1173
|
+
changedTouches: [touchObj]
|
|
1174
|
+
}));
|
|
1175
|
+
}.bind(undefined)
|
|
1176
|
+
}; // emulate event
|
|
1338
1177
|
/**
|
|
1339
1178
|
* Process the template & return bound string
|
|
1340
1179
|
* @param {string} tpl Template string
|
|
@@ -1344,13 +1183,12 @@ var getRange = function (start, end, step) {
|
|
|
1344
1183
|
*/
|
|
1345
1184
|
function tplProcess(tpl, data) {
|
|
1346
1185
|
var res = tpl;
|
|
1347
|
-
|
|
1348
1186
|
for (var x in data) {
|
|
1349
1187
|
res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
|
1350
1188
|
}
|
|
1351
|
-
|
|
1352
1189
|
return res;
|
|
1353
1190
|
}
|
|
1191
|
+
|
|
1354
1192
|
/**
|
|
1355
1193
|
* Get parsed date value
|
|
1356
1194
|
* (It must be called in 'ChartInternal' context)
|
|
@@ -1358,41 +1196,35 @@ function tplProcess(tpl, data) {
|
|
|
1358
1196
|
* @returns {Date}
|
|
1359
1197
|
* @private
|
|
1360
1198
|
*/
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
1199
|
function parseDate(date) {
|
|
1364
1200
|
var parsedDate;
|
|
1365
|
-
|
|
1366
1201
|
if (date instanceof Date) {
|
|
1367
1202
|
parsedDate = date;
|
|
1368
1203
|
} else if (isString(date)) {
|
|
1369
1204
|
var _format$dataTime,
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1205
|
+
config = this.config,
|
|
1206
|
+
format = this.format;
|
|
1373
1207
|
// if fails to parse, try by new Date()
|
|
1374
1208
|
// https://github.com/naver/billboard.js/issues/1714
|
|
1375
1209
|
parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
|
1376
1210
|
} else if (isNumber(date) && !isNaN(date)) {
|
|
1377
1211
|
parsedDate = new Date(+date);
|
|
1378
1212
|
}
|
|
1379
|
-
|
|
1380
1213
|
if (!parsedDate || isNaN(+parsedDate)) {
|
|
1381
1214
|
console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
|
|
1382
1215
|
}
|
|
1383
|
-
|
|
1384
1216
|
return parsedDate;
|
|
1385
1217
|
}
|
|
1218
|
+
|
|
1386
1219
|
/**
|
|
1387
1220
|
* Return if the current doc is visible or not
|
|
1388
1221
|
* @returns {boolean}
|
|
1389
1222
|
* @private
|
|
1390
1223
|
*/
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
1224
|
function isTabVisible() {
|
|
1394
1225
|
return (doc == null ? void 0 : doc.hidden) === !1 || (doc == null ? void 0 : doc.visibilityState) === "visible";
|
|
1395
1226
|
}
|
|
1227
|
+
|
|
1396
1228
|
/**
|
|
1397
1229
|
* Get the current input type
|
|
1398
1230
|
* @param {boolean} mouse Config value: interaction.inputType.mouse
|
|
@@ -1400,19 +1232,18 @@ function isTabVisible() {
|
|
|
1400
1232
|
* @returns {string} "mouse" | "touch" | null
|
|
1401
1233
|
* @private
|
|
1402
1234
|
*/
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
1235
|
function convertInputType(mouse, touch) {
|
|
1406
1236
|
var _this17 = this,
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1237
|
+
DocumentTouch = win.DocumentTouch,
|
|
1238
|
+
matchMedia = win.matchMedia,
|
|
1239
|
+
navigator = win.navigator,
|
|
1240
|
+
hasTouch = !1;
|
|
1412
1241
|
if (touch) {
|
|
1413
1242
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1414
1243
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
1415
|
-
hasTouch = navigator.maxTouchPoints > 0;
|
|
1244
|
+
hasTouch = navigator.maxTouchPoints > 0;
|
|
1245
|
+
|
|
1246
|
+
// Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
1416
1247
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
1417
1248
|
} else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
|
|
1418
1249
|
hasTouch = !0;
|
|
@@ -1426,34 +1257,31 @@ function convertInputType(mouse, touch) {
|
|
|
1426
1257
|
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1427
1258
|
}
|
|
1428
1259
|
}
|
|
1429
|
-
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
// 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
|
|
1430
1263
|
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1431
1264
|
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
1265
|
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1435
1266
|
_newArrowCheck(this, _this17);
|
|
1436
|
-
|
|
1437
1267
|
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1438
|
-
}.bind(this));
|
|
1268
|
+
}.bind(this));
|
|
1439
1269
|
|
|
1270
|
+
// fallback to 'mouse' if no input type is detected.
|
|
1440
1271
|
return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
|
1441
1272
|
}
|
|
1273
|
+
|
|
1442
1274
|
/**
|
|
1443
1275
|
* Run function until given condition function return true
|
|
1444
1276
|
* @param {Function} fn Function to be executed when condition is true
|
|
1445
1277
|
* @param {Function} conditionFn Condition function to check if condition is true
|
|
1446
1278
|
* @private
|
|
1447
1279
|
*/
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
1280
|
function runUntil(fn, conditionFn) {
|
|
1451
1281
|
var _this18 = this;
|
|
1452
|
-
|
|
1453
1282
|
if (conditionFn() === !1) {
|
|
1454
1283
|
win.requestAnimationFrame(function () {
|
|
1455
1284
|
_newArrowCheck(this, _this18);
|
|
1456
|
-
|
|
1457
1285
|
return runUntil(fn, conditionFn);
|
|
1458
1286
|
}.bind(this));
|
|
1459
1287
|
} else {
|
|
@@ -1462,13 +1290,11 @@ function runUntil(fn, conditionFn) {
|
|
|
1462
1290
|
}
|
|
1463
1291
|
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1464
1292
|
|
|
1465
|
-
|
|
1466
1293
|
/**
|
|
1467
1294
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1468
1295
|
* billboard.js project is licensed under the MIT license
|
|
1469
1296
|
*/
|
|
1470
1297
|
|
|
1471
|
-
|
|
1472
1298
|
/**
|
|
1473
1299
|
* Load configuration option
|
|
1474
1300
|
* @param {object} config User's generation config value
|
|
@@ -1476,37 +1302,32 @@ function runUntil(fn, conditionFn) {
|
|
|
1476
1302
|
*/
|
|
1477
1303
|
function loadConfig(config) {
|
|
1478
1304
|
var _this = this,
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
return
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
return undefined;
|
|
1496
|
-
}.bind(this);
|
|
1497
|
-
|
|
1305
|
+
thisConfig = this.config,
|
|
1306
|
+
target,
|
|
1307
|
+
keys,
|
|
1308
|
+
read,
|
|
1309
|
+
find = function () {
|
|
1310
|
+
_newArrowCheck(this, _this);
|
|
1311
|
+
var key = keys.shift();
|
|
1312
|
+
if (key && target && isObjectType(target) && key in target) {
|
|
1313
|
+
target = target[key];
|
|
1314
|
+
return find();
|
|
1315
|
+
} else if (!key) {
|
|
1316
|
+
return target;
|
|
1317
|
+
}
|
|
1318
|
+
return undefined;
|
|
1319
|
+
}.bind(this);
|
|
1498
1320
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1499
1321
|
_newArrowCheck(this, _this);
|
|
1500
|
-
|
|
1501
1322
|
target = config;
|
|
1502
1323
|
keys = key.split("_");
|
|
1503
1324
|
read = find();
|
|
1504
|
-
|
|
1505
1325
|
if (isDefined(read)) {
|
|
1506
1326
|
thisConfig[key] = read;
|
|
1507
1327
|
}
|
|
1508
|
-
}.bind(this));
|
|
1328
|
+
}.bind(this));
|
|
1509
1329
|
|
|
1330
|
+
// only should run in the ChartInternal context
|
|
1510
1331
|
if (this.api) {
|
|
1511
1332
|
this.state.orgConfig = config;
|
|
1512
1333
|
}
|
|
@@ -1515,7 +1336,6 @@ function loadConfig(config) {
|
|
|
1515
1336
|
|
|
1516
1337
|
|
|
1517
1338
|
|
|
1518
|
-
|
|
1519
1339
|
/**
|
|
1520
1340
|
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
1521
1341
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1524,6 +1344,7 @@ function loadConfig(config) {
|
|
|
1524
1344
|
|
|
1525
1345
|
|
|
1526
1346
|
|
|
1347
|
+
|
|
1527
1348
|
/**
|
|
1528
1349
|
* Sparkline plugin.<br>
|
|
1529
1350
|
* Generates sparkline charts
|
|
@@ -1569,83 +1390,71 @@ function loadConfig(config) {
|
|
|
1569
1390
|
* ]
|
|
1570
1391
|
* })
|
|
1571
1392
|
*/
|
|
1572
|
-
|
|
1573
1393
|
var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
1574
1394
|
_inheritsLoose(Sparkline, _Plugin);
|
|
1575
|
-
|
|
1576
1395
|
function Sparkline(options) {
|
|
1577
1396
|
var _this = _Plugin.call(this, options) || this;
|
|
1578
|
-
|
|
1579
1397
|
_this.config = void 0;
|
|
1580
1398
|
_this.element = void 0;
|
|
1581
1399
|
_this.config = new Options();
|
|
1582
1400
|
return _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
|
1583
1401
|
}
|
|
1584
|
-
|
|
1585
1402
|
var _proto = Sparkline.prototype;
|
|
1586
|
-
|
|
1587
1403
|
_proto.$beforeInit = function $beforeInit() {
|
|
1588
1404
|
loadConfig.call(this, this.options);
|
|
1589
1405
|
this.validate();
|
|
1590
|
-
this.element = [].slice.call(document.querySelectorAll(this.config.selector));
|
|
1406
|
+
this.element = [].slice.call(document.querySelectorAll(this.config.selector));
|
|
1591
1407
|
|
|
1592
|
-
|
|
1408
|
+
// override internal methods
|
|
1409
|
+
this.overrideInternals();
|
|
1593
1410
|
|
|
1594
|
-
|
|
1411
|
+
// override options
|
|
1412
|
+
this.overrideOptions();
|
|
1595
1413
|
|
|
1414
|
+
// bind event handlers's context
|
|
1596
1415
|
this.overHandler = this.overHandler.bind(this);
|
|
1597
1416
|
this.moveHandler = this.moveHandler.bind(this);
|
|
1598
1417
|
this.outHandler = this.outHandler.bind(this);
|
|
1599
1418
|
};
|
|
1600
|
-
|
|
1601
1419
|
_proto.validate = function validate() {
|
|
1602
1420
|
var $$ = this.$$,
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1421
|
+
config = this.config,
|
|
1422
|
+
msg = "";
|
|
1606
1423
|
if (!config.selector || !document.querySelector(config.selector)) {
|
|
1607
1424
|
msg = "No holder elements found from given selector option.";
|
|
1608
1425
|
}
|
|
1609
|
-
|
|
1610
1426
|
if ($$.hasType("bubble") || $$.hasType("scatter") || $$.hasArcType($$.data.targets)) {
|
|
1611
1427
|
msg = "Contains non supported chart types.";
|
|
1612
1428
|
}
|
|
1613
|
-
|
|
1614
1429
|
if (msg) {
|
|
1615
1430
|
throw new Error("[Sparkline plugin] " + msg);
|
|
1616
1431
|
}
|
|
1617
1432
|
};
|
|
1618
|
-
|
|
1619
1433
|
_proto.overrideInternals = function overrideInternals() {
|
|
1620
1434
|
var $$ = this.$$,
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1435
|
+
getBarW = $$.getBarW,
|
|
1436
|
+
getIndices = $$.getIndices;
|
|
1624
1437
|
// override internal methods to positioning bars
|
|
1625
1438
|
$$.getIndices = function (indices, d, caller) {
|
|
1626
1439
|
return caller === "getShapeX" ? {} : getIndices.call(this, indices, d);
|
|
1627
1440
|
};
|
|
1628
|
-
|
|
1629
1441
|
$$.getBarW = function (type, axis) {
|
|
1630
1442
|
return getBarW.call(this, type, axis, 1);
|
|
1631
1443
|
};
|
|
1632
1444
|
};
|
|
1633
|
-
|
|
1634
1445
|
_proto.overrideOptions = function overrideOptions() {
|
|
1635
1446
|
var _this2 = this,
|
|
1636
|
-
|
|
1637
|
-
|
|
1447
|
+
config = this.$$.config;
|
|
1638
1448
|
config.legend_show = !1;
|
|
1639
1449
|
config.resize_auto = !1;
|
|
1640
|
-
config.axis_x_show = !1;
|
|
1450
|
+
config.axis_x_show = !1;
|
|
1641
1451
|
|
|
1452
|
+
// set default axes padding
|
|
1642
1453
|
if (config.padding !== !1) {
|
|
1643
1454
|
var hasOption = function (o) {
|
|
1644
1455
|
_newArrowCheck(this, _this2);
|
|
1645
|
-
|
|
1646
1456
|
return Object.keys(o || {}).length > 0;
|
|
1647
1457
|
}.bind(this);
|
|
1648
|
-
|
|
1649
1458
|
if (hasOption(config.axis_x_padding)) {
|
|
1650
1459
|
config.axis_x_padding = {
|
|
1651
1460
|
left: 15,
|
|
@@ -1653,28 +1462,22 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1653
1462
|
unit: "px"
|
|
1654
1463
|
};
|
|
1655
1464
|
}
|
|
1656
|
-
|
|
1657
1465
|
if (hasOption(config.axis_y_padding)) {
|
|
1658
1466
|
config.axis_y_padding = 5;
|
|
1659
1467
|
}
|
|
1660
1468
|
}
|
|
1661
|
-
|
|
1662
1469
|
config.axis_y_show = !1;
|
|
1663
|
-
|
|
1664
1470
|
if (!config.tooltip_position) {
|
|
1665
1471
|
config.tooltip_position = function (data, width, height) {
|
|
1666
1472
|
var event = this.internal.state.event,
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1473
|
+
top = event.pageY - height * 1.35,
|
|
1474
|
+
left = event.pageX - width / 2;
|
|
1670
1475
|
if (top < 0) {
|
|
1671
1476
|
top = 0;
|
|
1672
1477
|
}
|
|
1673
|
-
|
|
1674
1478
|
if (left < 0) {
|
|
1675
1479
|
left = 0;
|
|
1676
1480
|
}
|
|
1677
|
-
|
|
1678
1481
|
return {
|
|
1679
1482
|
top: top,
|
|
1680
1483
|
left: left
|
|
@@ -1682,42 +1485,34 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1682
1485
|
};
|
|
1683
1486
|
}
|
|
1684
1487
|
};
|
|
1685
|
-
|
|
1686
1488
|
_proto.$init = function $init() {
|
|
1687
1489
|
var _$el$tooltip,
|
|
1688
|
-
|
|
1689
|
-
|
|
1490
|
+
$el = this.$$.$el;
|
|
1690
1491
|
// make disable-ish main chart element
|
|
1691
1492
|
$el.chart.style("width", "0").style("height", "0").style("pointer-events", "none");
|
|
1692
1493
|
((_$el$tooltip = $el.tooltip) == null ? void 0 : _$el$tooltip.node()) && document.body.appendChild($el.tooltip.node());
|
|
1693
1494
|
};
|
|
1694
|
-
|
|
1695
1495
|
_proto.$afterInit = function $afterInit() {
|
|
1696
1496
|
var $$ = this.$$;
|
|
1697
1497
|
$$.$el.svg.attr("style", null).style("width", "0").style("height", "0");
|
|
1698
1498
|
this.bindEvents(!0);
|
|
1699
1499
|
}
|
|
1500
|
+
|
|
1700
1501
|
/**
|
|
1701
1502
|
* Bind tooltip event handlers for each sparkline elements.
|
|
1702
1503
|
* @param {boolean} bind or unbind
|
|
1703
1504
|
* @private
|
|
1704
|
-
|
|
1705
|
-
;
|
|
1706
|
-
|
|
1505
|
+
*/;
|
|
1707
1506
|
_proto.bindEvents = function bindEvents(bind) {
|
|
1708
1507
|
var _this3 = this;
|
|
1709
|
-
|
|
1710
1508
|
if (bind === void 0) {
|
|
1711
1509
|
bind = !0;
|
|
1712
1510
|
}
|
|
1713
|
-
|
|
1714
1511
|
var config = this.$$.config;
|
|
1715
|
-
|
|
1716
1512
|
if (config.interaction_enabled && config.tooltip_show) {
|
|
1717
1513
|
var method = (bind ? "add" : "remove") + "EventListener";
|
|
1718
1514
|
this.element.forEach(function (el) {
|
|
1719
1515
|
_newArrowCheck(this, _this3);
|
|
1720
|
-
|
|
1721
1516
|
var svg = el.querySelector("svg");
|
|
1722
1517
|
svg[method]("mouseover", this.overHandler);
|
|
1723
1518
|
svg[method]("mousemove", this.moveHandler);
|
|
@@ -1725,99 +1520,79 @@ var Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1725
1520
|
}.bind(this));
|
|
1726
1521
|
}
|
|
1727
1522
|
};
|
|
1728
|
-
|
|
1729
1523
|
_proto.overHandler = function overHandler(e) {
|
|
1730
1524
|
var $$ = this.$$,
|
|
1731
|
-
|
|
1525
|
+
eventReceiver = $$.state.eventReceiver;
|
|
1732
1526
|
eventReceiver.rect = e.target.getBoundingClientRect();
|
|
1733
1527
|
};
|
|
1734
|
-
|
|
1735
1528
|
_proto.moveHandler = function moveHandler(e) {
|
|
1736
1529
|
var _$$$api$data,
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1530
|
+
_data$values,
|
|
1531
|
+
$$ = this.$$,
|
|
1532
|
+
index = $$.getDataIndexFromEvent(e),
|
|
1533
|
+
data = (_$$$api$data = $$.api.data(e.target.__id)) == null ? void 0 : _$$$api$data[0],
|
|
1534
|
+
d = data == null ? void 0 : (_data$values = data.values) == null ? void 0 : _data$values[index];
|
|
1743
1535
|
if (d && !d.name) {
|
|
1744
1536
|
d.name = d.id;
|
|
1745
1537
|
}
|
|
1746
|
-
|
|
1747
1538
|
$$.state.event = e;
|
|
1748
1539
|
$$.setExpand(index, data.id, !0);
|
|
1749
1540
|
$$.showTooltip([d], e.target);
|
|
1750
1541
|
};
|
|
1751
|
-
|
|
1752
1542
|
_proto.outHandler = function outHandler(e) {
|
|
1753
1543
|
var $$ = this.$$;
|
|
1754
1544
|
$$.state.event = e;
|
|
1755
1545
|
$$.unexpandCircles();
|
|
1756
1546
|
$$.hideTooltip();
|
|
1757
1547
|
};
|
|
1758
|
-
|
|
1759
1548
|
_proto.$redraw = function $redraw() {
|
|
1760
1549
|
var _$el$chart$html$match,
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1550
|
+
$$ = this.$$,
|
|
1551
|
+
$el = $$.$el,
|
|
1552
|
+
el = this.element,
|
|
1553
|
+
data = $$.api.data(),
|
|
1554
|
+
svgWrapper = (_$el$chart$html$match = $el.chart.html().match(/<svg[^>]*>/)) == null ? void 0 : _$el$chart$html$match[0],
|
|
1555
|
+
_this4 = this;
|
|
1768
1556
|
// append sparkline holder if is less than the data length
|
|
1769
1557
|
if (el.length < data.length) {
|
|
1770
1558
|
var chart = $el.chart.node();
|
|
1771
|
-
|
|
1772
1559
|
for (var i = data.length - el.length; i > 0; i--) {
|
|
1773
1560
|
chart.parentNode.insertBefore(el[0].cloneNode(), chart.nextSibling);
|
|
1774
1561
|
}
|
|
1775
|
-
|
|
1776
1562
|
this.element = document.querySelectorAll(this.config.selector);
|
|
1777
1563
|
el = this.element;
|
|
1778
1564
|
}
|
|
1779
|
-
|
|
1780
1565
|
data.map(function (v) {
|
|
1781
1566
|
_newArrowCheck(this, _this4);
|
|
1782
|
-
|
|
1783
1567
|
return v.id;
|
|
1784
1568
|
}.bind(this)).forEach(function (id, i) {
|
|
1785
1569
|
_newArrowCheck(this, _this4);
|
|
1786
|
-
|
|
1787
1570
|
var selector = "." + $COMMON.target + "-" + id,
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1571
|
+
shape = $el.main.selectAll(selector),
|
|
1572
|
+
svg = el[i].querySelector("svg");
|
|
1791
1573
|
if (!svg) {
|
|
1792
1574
|
el[i].innerHTML = svgWrapper + "</svg>";
|
|
1793
1575
|
svg = el[i].querySelector("svg");
|
|
1794
1576
|
svg.__id = id;
|
|
1795
1577
|
}
|
|
1796
|
-
|
|
1797
1578
|
if (!svg.querySelector(selector)) {
|
|
1798
1579
|
shape.style("opacity", null);
|
|
1799
1580
|
}
|
|
1800
|
-
|
|
1801
1581
|
shape.style("fill", "none").style("opacity", null);
|
|
1802
1582
|
svg.innerHTML = "";
|
|
1803
1583
|
svg.appendChild(shape.node());
|
|
1804
1584
|
}.bind(this));
|
|
1805
1585
|
};
|
|
1806
|
-
|
|
1807
1586
|
_proto.$willDestroy = function $willDestroy() {
|
|
1808
1587
|
var _this5 = this;
|
|
1809
|
-
|
|
1810
1588
|
this.bindEvents(!1);
|
|
1811
1589
|
this.element.forEach(function (el) {
|
|
1812
1590
|
_newArrowCheck(this, _this5);
|
|
1813
|
-
|
|
1814
1591
|
el.innerHTML = "";
|
|
1815
1592
|
}.bind(this));
|
|
1816
1593
|
};
|
|
1817
|
-
|
|
1818
1594
|
return Sparkline;
|
|
1819
1595
|
}(Plugin);
|
|
1820
|
-
|
|
1821
1596
|
Sparkline.version = "0.0.1";
|
|
1822
1597
|
|
|
1823
1598
|
}();
|