billboard.js 3.4.1 → 3.5.0
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 +4 -1
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +3942 -1467
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +8372 -5306
- package/dist/billboard.pkgd.min.js +3 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +29 -13
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +375 -91
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +445 -108
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +339 -73
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +335 -74
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +4236 -3792
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +4637 -3889
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +4804 -3931
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +4595 -3865
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +4607 -3873
- 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 +837 -403
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +47 -75
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +68 -86
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +52 -77
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +49 -76
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +49 -76
- package/package.json +39 -39
- package/src/Chart/api/chart.ts +4 -1
- package/src/Chart/api/data.ts +2 -2
- package/src/Chart/api/flow.ts +125 -115
- package/src/ChartInternal/Axis/AxisRenderer.ts +29 -3
- package/src/ChartInternal/ChartInternal.ts +46 -18
- package/src/ChartInternal/data/IData.ts +2 -2
- package/src/ChartInternal/data/convert.helper.ts +226 -0
- package/src/ChartInternal/data/convert.ts +43 -210
- package/src/ChartInternal/data/load.ts +5 -4
- package/src/ChartInternal/interactions/zoom.ts +17 -4
- package/src/ChartInternal/internals/class.ts +1 -1
- package/src/ChartInternal/internals/color.ts +41 -42
- package/src/ChartInternal/internals/grid.ts +5 -3
- package/src/ChartInternal/internals/legend.ts +21 -6
- package/src/ChartInternal/internals/redraw.ts +5 -2
- package/src/ChartInternal/internals/scale.ts +3 -1
- package/src/ChartInternal/internals/size.axis.ts +5 -2
- package/src/ChartInternal/internals/style.ts +54 -0
- package/src/ChartInternal/internals/text.ts +118 -18
- package/src/ChartInternal/shape/arc.ts +4 -3
- package/src/ChartInternal/shape/area.ts +14 -7
- package/src/ChartInternal/shape/bar.ts +22 -12
- package/src/ChartInternal/shape/line.ts +3 -2
- package/src/ChartInternal/shape/point.ts +15 -9
- package/src/ChartInternal/shape/polar.ts +1 -1
- package/src/Plugin/sparkline/index.ts +22 -11
- package/src/Plugin/stanford/index.ts +10 -7
- package/src/Plugin/textoverlap/index.ts +4 -1
- package/src/config/Options/Options.ts +2 -0
- package/src/config/Options/common/boost.ts +31 -0
- package/src/config/Options/common/main.ts +15 -1
- package/src/config/Options/common/tooltip.ts +1 -1
- package/src/config/Options/data/data.ts +11 -3
- package/src/config/Options/shape/area.ts +6 -1
- package/src/config/Store/State.ts +3 -0
- package/src/module/browser.ts +2 -1
- package/src/module/generator.ts +18 -16
- package/src/module/util.ts +113 -0
- package/types/chart.d.ts +2 -2
- package/types/options.d.ts +45 -8
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.5.0
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -121,6 +121,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
121
121
|
"default": function() { return /* binding */ Stanford; }
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
|
|
125
|
+
function _newArrowCheck(innerThis, boundThis) {
|
|
126
|
+
if (innerThis !== boundThis) {
|
|
127
|
+
throw new TypeError("Cannot instantiate an arrow function");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
124
130
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
125
131
|
function _assertThisInitialized(self) {
|
|
126
132
|
if (self === void 0) {
|
|
@@ -131,11 +137,10 @@ function _assertThisInitialized(self) {
|
|
|
131
137
|
}
|
|
132
138
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
133
139
|
function _setPrototypeOf(o, p) {
|
|
134
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
140
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
135
141
|
o.__proto__ = p;
|
|
136
142
|
return o;
|
|
137
143
|
};
|
|
138
|
-
|
|
139
144
|
return _setPrototypeOf(o, p);
|
|
140
145
|
}
|
|
141
146
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
@@ -334,6 +339,10 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
|
|
|
334
339
|
// EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
|
|
335
340
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
336
341
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
var _this = undefined;
|
|
345
|
+
|
|
337
346
|
/**
|
|
338
347
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
339
348
|
* billboard.js project is licensed under the MIT license
|
|
@@ -348,25 +357,35 @@ var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webp
|
|
|
348
357
|
|
|
349
358
|
|
|
350
359
|
var win = function () {
|
|
360
|
+
_newArrowCheck(this, _this);
|
|
361
|
+
|
|
351
362
|
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;
|
|
352
363
|
return root || Function("return this")();
|
|
353
|
-
}();
|
|
364
|
+
}.bind(undefined)();
|
|
354
365
|
/* eslint-enable no-new-func, no-undef */
|
|
355
366
|
// fallback for non-supported environments
|
|
356
367
|
|
|
357
368
|
|
|
358
369
|
win.requestIdleCallback = win.requestIdleCallback || function (cb) {
|
|
370
|
+
_newArrowCheck(this, _this);
|
|
371
|
+
|
|
359
372
|
return setTimeout(cb, 1);
|
|
360
|
-
};
|
|
373
|
+
}.bind(undefined); // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
|
|
361
374
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
375
|
+
|
|
376
|
+
win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
|
|
377
|
+
_newArrowCheck(this, _this);
|
|
378
|
+
|
|
379
|
+
return setTimeout(cb, 1);
|
|
380
|
+
}.bind(undefined);
|
|
365
381
|
|
|
366
382
|
var doc = win == null ? void 0 : win.document;
|
|
367
383
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
368
384
|
|
|
369
385
|
|
|
386
|
+
|
|
387
|
+
var util_this = undefined;
|
|
388
|
+
|
|
370
389
|
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; }
|
|
371
390
|
|
|
372
391
|
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; }
|
|
@@ -382,50 +401,80 @@ function util_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
|
|
|
382
401
|
|
|
383
402
|
|
|
384
403
|
var isValue = function (v) {
|
|
404
|
+
_newArrowCheck(this, util_this);
|
|
405
|
+
|
|
385
406
|
return v || v === 0;
|
|
386
|
-
},
|
|
407
|
+
}.bind(undefined),
|
|
387
408
|
isFunction = function (v) {
|
|
409
|
+
_newArrowCheck(this, util_this);
|
|
410
|
+
|
|
388
411
|
return typeof v === "function";
|
|
389
|
-
},
|
|
412
|
+
}.bind(undefined),
|
|
390
413
|
isString = function (v) {
|
|
414
|
+
_newArrowCheck(this, util_this);
|
|
415
|
+
|
|
391
416
|
return typeof v === "string";
|
|
392
|
-
},
|
|
417
|
+
}.bind(undefined),
|
|
393
418
|
isNumber = function (v) {
|
|
419
|
+
_newArrowCheck(this, util_this);
|
|
420
|
+
|
|
394
421
|
return typeof v === "number";
|
|
395
|
-
},
|
|
422
|
+
}.bind(undefined),
|
|
396
423
|
isUndefined = function (v) {
|
|
424
|
+
_newArrowCheck(this, util_this);
|
|
425
|
+
|
|
397
426
|
return typeof v === "undefined";
|
|
398
|
-
},
|
|
427
|
+
}.bind(undefined),
|
|
399
428
|
isDefined = function (v) {
|
|
429
|
+
_newArrowCheck(this, util_this);
|
|
430
|
+
|
|
400
431
|
return typeof v !== "undefined";
|
|
401
|
-
},
|
|
432
|
+
}.bind(undefined),
|
|
402
433
|
isboolean = function (v) {
|
|
434
|
+
_newArrowCheck(this, util_this);
|
|
435
|
+
|
|
403
436
|
return typeof v === "boolean";
|
|
404
|
-
},
|
|
437
|
+
}.bind(undefined),
|
|
405
438
|
ceil10 = function (v) {
|
|
439
|
+
_newArrowCheck(this, util_this);
|
|
440
|
+
|
|
406
441
|
return Math.ceil(v / 10) * 10;
|
|
407
|
-
},
|
|
442
|
+
}.bind(undefined),
|
|
408
443
|
asHalfPixel = function (n) {
|
|
444
|
+
_newArrowCheck(this, util_this);
|
|
445
|
+
|
|
409
446
|
return Math.ceil(n) + .5;
|
|
410
|
-
},
|
|
447
|
+
}.bind(undefined),
|
|
411
448
|
diffDomain = function (d) {
|
|
449
|
+
_newArrowCheck(this, util_this);
|
|
450
|
+
|
|
412
451
|
return d[1] - d[0];
|
|
413
|
-
},
|
|
452
|
+
}.bind(undefined),
|
|
414
453
|
isObjectType = function (v) {
|
|
454
|
+
_newArrowCheck(this, util_this);
|
|
455
|
+
|
|
415
456
|
return typeof v === "object";
|
|
416
|
-
},
|
|
457
|
+
}.bind(undefined),
|
|
417
458
|
isEmpty = function (o) {
|
|
459
|
+
_newArrowCheck(this, util_this);
|
|
460
|
+
|
|
418
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);
|
|
419
|
-
},
|
|
462
|
+
}.bind(undefined),
|
|
420
463
|
notEmpty = function (o) {
|
|
464
|
+
_newArrowCheck(this, util_this);
|
|
465
|
+
|
|
421
466
|
return !isEmpty(o);
|
|
422
|
-
},
|
|
467
|
+
}.bind(undefined),
|
|
423
468
|
isArray = function (arr) {
|
|
469
|
+
_newArrowCheck(this, util_this);
|
|
470
|
+
|
|
424
471
|
return Array.isArray(arr);
|
|
425
|
-
},
|
|
472
|
+
}.bind(undefined),
|
|
426
473
|
isObject = function (obj) {
|
|
474
|
+
_newArrowCheck(this, util_this);
|
|
475
|
+
|
|
427
476
|
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
428
|
-
};
|
|
477
|
+
}.bind(undefined);
|
|
429
478
|
|
|
430
479
|
/**
|
|
431
480
|
* Get specified key value from object
|
|
@@ -449,10 +498,14 @@ function getOption(options, key, defaultValue) {
|
|
|
449
498
|
|
|
450
499
|
|
|
451
500
|
function hasValue(dict, value) {
|
|
452
|
-
var
|
|
501
|
+
var _this2 = this,
|
|
502
|
+
found = !1;
|
|
503
|
+
|
|
453
504
|
Object.keys(dict).forEach(function (key) {
|
|
505
|
+
_newArrowCheck(this, _this2);
|
|
506
|
+
|
|
454
507
|
return dict[key] === value && (found = !0);
|
|
455
|
-
});
|
|
508
|
+
}.bind(this));
|
|
456
509
|
return found;
|
|
457
510
|
}
|
|
458
511
|
/**
|
|
@@ -482,7 +535,8 @@ function callFn(fn, thisArg) {
|
|
|
482
535
|
|
|
483
536
|
|
|
484
537
|
function endall(transition, cb) {
|
|
485
|
-
var
|
|
538
|
+
var _this3 = this,
|
|
539
|
+
n = 0,
|
|
486
540
|
end = function () {
|
|
487
541
|
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
488
542
|
args[_key2] = arguments[_key2];
|
|
@@ -494,8 +548,10 @@ function endall(transition, cb) {
|
|
|
494
548
|
// if is transition selection
|
|
495
549
|
if ("duration" in transition) {
|
|
496
550
|
transition.each(function () {
|
|
551
|
+
_newArrowCheck(this, _this3);
|
|
552
|
+
|
|
497
553
|
return ++n;
|
|
498
|
-
}).on("end", end);
|
|
554
|
+
}.bind(this)).on("end", end);
|
|
499
555
|
} else {
|
|
500
556
|
++n;
|
|
501
557
|
transition.call(end);
|
|
@@ -523,6 +579,8 @@ function sanitise(str) {
|
|
|
523
579
|
|
|
524
580
|
|
|
525
581
|
function setTextValue(node, text, dy, toMiddle) {
|
|
582
|
+
var _this4 = this;
|
|
583
|
+
|
|
526
584
|
if (dy === void 0) {
|
|
527
585
|
dy = [-1, 1];
|
|
528
586
|
}
|
|
@@ -539,8 +597,10 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
539
597
|
node.text(text);
|
|
540
598
|
} else {
|
|
541
599
|
var diff = [node.text(), text].map(function (v) {
|
|
600
|
+
_newArrowCheck(this, _this4);
|
|
601
|
+
|
|
542
602
|
return v.replace(/[\s\n]/g, "");
|
|
543
|
-
});
|
|
603
|
+
}.bind(this));
|
|
544
604
|
|
|
545
605
|
if (diff[0] !== diff[1]) {
|
|
546
606
|
var multiline = text.split("\n"),
|
|
@@ -548,8 +608,10 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
548
608
|
// reset possible text
|
|
549
609
|
node.html("");
|
|
550
610
|
multiline.forEach(function (v, i) {
|
|
611
|
+
_newArrowCheck(this, _this4);
|
|
612
|
+
|
|
551
613
|
node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
|
552
|
-
});
|
|
614
|
+
}.bind(this));
|
|
553
615
|
}
|
|
554
616
|
}
|
|
555
617
|
}
|
|
@@ -628,11 +690,14 @@ function getPathBox(path) {
|
|
|
628
690
|
function getPointer(event, element) {
|
|
629
691
|
var _ref,
|
|
630
692
|
touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
|
631
|
-
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element)
|
|
693
|
+
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
|
694
|
+
_this5 = this;
|
|
632
695
|
|
|
633
696
|
return pointer.map(function (v) {
|
|
697
|
+
_newArrowCheck(this, _this5);
|
|
698
|
+
|
|
634
699
|
return isNaN(v) ? 0 : v;
|
|
635
|
-
});
|
|
700
|
+
}.bind(this));
|
|
636
701
|
}
|
|
637
702
|
/**
|
|
638
703
|
* Return brush selection array
|
|
@@ -759,7 +824,9 @@ function brushEmpty(ctx) {
|
|
|
759
824
|
|
|
760
825
|
|
|
761
826
|
function deepClone() {
|
|
762
|
-
for (var clone = function (v) {
|
|
827
|
+
for (var _this6 = this, clone = function (v) {
|
|
828
|
+
_newArrowCheck(this, _this6);
|
|
829
|
+
|
|
763
830
|
if (isObject(v) && v.constructor) {
|
|
764
831
|
var r = new v.constructor();
|
|
765
832
|
|
|
@@ -771,15 +838,19 @@ function deepClone() {
|
|
|
771
838
|
}
|
|
772
839
|
|
|
773
840
|
return v;
|
|
774
|
-
}, _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
841
|
+
}.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
775
842
|
objectN[_key3] = arguments[_key3];
|
|
776
843
|
}
|
|
777
844
|
|
|
778
845
|
return objectN.map(function (v) {
|
|
846
|
+
_newArrowCheck(this, _this6);
|
|
847
|
+
|
|
779
848
|
return clone(v);
|
|
780
|
-
}).reduce(function (a, c) {
|
|
849
|
+
}.bind(this)).reduce(function (a, c) {
|
|
850
|
+
_newArrowCheck(this, _this6);
|
|
851
|
+
|
|
781
852
|
return util_objectSpread(util_objectSpread({}, a), c);
|
|
782
|
-
});
|
|
853
|
+
}.bind(this));
|
|
783
854
|
}
|
|
784
855
|
/**
|
|
785
856
|
* Extend target from source object
|
|
@@ -791,14 +862,18 @@ function deepClone() {
|
|
|
791
862
|
|
|
792
863
|
|
|
793
864
|
function extend(target, source) {
|
|
865
|
+
var _this7 = this;
|
|
866
|
+
|
|
794
867
|
if (target === void 0) {
|
|
795
868
|
target = {};
|
|
796
869
|
}
|
|
797
870
|
|
|
798
871
|
if (isArray(source)) {
|
|
799
872
|
source.forEach(function (v) {
|
|
873
|
+
_newArrowCheck(this, _this7);
|
|
874
|
+
|
|
800
875
|
return extend(target, v);
|
|
801
|
-
});
|
|
876
|
+
}.bind(this));
|
|
802
877
|
} // exclude name with only numbers
|
|
803
878
|
|
|
804
879
|
|
|
@@ -821,8 +896,10 @@ function extend(target, source) {
|
|
|
821
896
|
|
|
822
897
|
|
|
823
898
|
var capitalize = function (str) {
|
|
899
|
+
_newArrowCheck(this, util_this);
|
|
900
|
+
|
|
824
901
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
825
|
-
};
|
|
902
|
+
}.bind(undefined);
|
|
826
903
|
/**
|
|
827
904
|
* Camelize from kebob style string
|
|
828
905
|
* @param {string} str Target string
|
|
@@ -833,13 +910,17 @@ var capitalize = function (str) {
|
|
|
833
910
|
|
|
834
911
|
|
|
835
912
|
function camelize(str, separator) {
|
|
913
|
+
var _this8 = this;
|
|
914
|
+
|
|
836
915
|
if (separator === void 0) {
|
|
837
916
|
separator = "-";
|
|
838
917
|
}
|
|
839
918
|
|
|
840
919
|
return str.split(separator).map(function (v, i) {
|
|
920
|
+
_newArrowCheck(this, _this8);
|
|
921
|
+
|
|
841
922
|
return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
|
|
842
|
-
}).join("");
|
|
923
|
+
}.bind(this)).join("");
|
|
843
924
|
}
|
|
844
925
|
/**
|
|
845
926
|
* Convert to array
|
|
@@ -850,8 +931,33 @@ function camelize(str, separator) {
|
|
|
850
931
|
|
|
851
932
|
|
|
852
933
|
var toArray = function (v) {
|
|
934
|
+
_newArrowCheck(this, util_this);
|
|
935
|
+
|
|
853
936
|
return [].slice.call(v);
|
|
854
|
-
};
|
|
937
|
+
}.bind(undefined);
|
|
938
|
+
/**
|
|
939
|
+
* Add CSS rules
|
|
940
|
+
* @param {object} style Style object
|
|
941
|
+
* @param {string} selector Selector string
|
|
942
|
+
* @param {Array} prop Prps arrary
|
|
943
|
+
* @returns {number} Newely added rule index
|
|
944
|
+
* @private
|
|
945
|
+
*/
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
function addCssRules(style, selector, prop) {
|
|
949
|
+
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
|
+
|
|
959
|
+
return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
|
960
|
+
}
|
|
855
961
|
/**
|
|
856
962
|
* Get css rules for specified stylesheets
|
|
857
963
|
* @param {Array} styleSheets The stylesheets to get the rules from
|
|
@@ -861,8 +967,12 @@ var toArray = function (v) {
|
|
|
861
967
|
|
|
862
968
|
|
|
863
969
|
function getCssRules(styleSheets) {
|
|
864
|
-
var
|
|
970
|
+
var _this10 = this,
|
|
971
|
+
rules = [];
|
|
972
|
+
|
|
865
973
|
styleSheets.forEach(function (sheet) {
|
|
974
|
+
_newArrowCheck(this, _this10);
|
|
975
|
+
|
|
866
976
|
try {
|
|
867
977
|
if (sheet.cssRules && sheet.cssRules.length) {
|
|
868
978
|
rules = rules.concat(toArray(sheet.cssRules));
|
|
@@ -870,7 +980,7 @@ function getCssRules(styleSheets) {
|
|
|
870
980
|
} catch (e) {
|
|
871
981
|
console.error("Error while reading rules from " + sheet.href + ": " + e.toString());
|
|
872
982
|
}
|
|
873
|
-
});
|
|
983
|
+
}.bind(this));
|
|
874
984
|
return rules;
|
|
875
985
|
}
|
|
876
986
|
/**
|
|
@@ -902,13 +1012,19 @@ function getTranslation(node) {
|
|
|
902
1012
|
|
|
903
1013
|
|
|
904
1014
|
function getUnique(data) {
|
|
905
|
-
var
|
|
1015
|
+
var _this11 = this,
|
|
1016
|
+
isDate = data[0] instanceof Date,
|
|
906
1017
|
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
1018
|
+
_newArrowCheck(this, _this11);
|
|
1019
|
+
|
|
907
1020
|
return self.indexOf(v) === i;
|
|
908
|
-
});
|
|
1021
|
+
}.bind(this));
|
|
1022
|
+
|
|
909
1023
|
return isDate ? d.map(function (v) {
|
|
1024
|
+
_newArrowCheck(this, _this11);
|
|
1025
|
+
|
|
910
1026
|
return new Date(v);
|
|
911
|
-
}) : d;
|
|
1027
|
+
}.bind(this)) : d;
|
|
912
1028
|
}
|
|
913
1029
|
/**
|
|
914
1030
|
* Merge array
|
|
@@ -919,9 +1035,13 @@ function getUnique(data) {
|
|
|
919
1035
|
|
|
920
1036
|
|
|
921
1037
|
function mergeArray(arr) {
|
|
1038
|
+
var _this12 = this;
|
|
1039
|
+
|
|
922
1040
|
return arr && arr.length ? arr.reduce(function (p, c) {
|
|
1041
|
+
_newArrowCheck(this, _this12);
|
|
1042
|
+
|
|
923
1043
|
return p.concat(c);
|
|
924
|
-
}) : [];
|
|
1044
|
+
}.bind(this)) : [];
|
|
925
1045
|
}
|
|
926
1046
|
/**
|
|
927
1047
|
* Merge object returning new object
|
|
@@ -933,7 +1053,7 @@ function mergeArray(arr) {
|
|
|
933
1053
|
|
|
934
1054
|
|
|
935
1055
|
function mergeObj(target) {
|
|
936
|
-
for (var _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
1056
|
+
for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
937
1057
|
objectN[_key4 - 1] = arguments[_key4];
|
|
938
1058
|
}
|
|
939
1059
|
|
|
@@ -945,6 +1065,8 @@ function mergeObj(target) {
|
|
|
945
1065
|
|
|
946
1066
|
if (isObject(target) && isObject(source)) {
|
|
947
1067
|
Object.keys(source).forEach(function (key) {
|
|
1068
|
+
_newArrowCheck(this, _this13);
|
|
1069
|
+
|
|
948
1070
|
var value = source[key];
|
|
949
1071
|
|
|
950
1072
|
if (isObject(value)) {
|
|
@@ -953,7 +1075,7 @@ function mergeObj(target) {
|
|
|
953
1075
|
} else {
|
|
954
1076
|
target[key] = isArray(value) ? value.concat() : value;
|
|
955
1077
|
}
|
|
956
|
-
});
|
|
1078
|
+
}.bind(this));
|
|
957
1079
|
}
|
|
958
1080
|
|
|
959
1081
|
return mergeObj.apply(void 0, [target].concat(objectN));
|
|
@@ -968,6 +1090,8 @@ function mergeObj(target) {
|
|
|
968
1090
|
|
|
969
1091
|
|
|
970
1092
|
function sortValue(data, isAsc) {
|
|
1093
|
+
var _this14 = this;
|
|
1094
|
+
|
|
971
1095
|
if (isAsc === void 0) {
|
|
972
1096
|
isAsc = !0;
|
|
973
1097
|
}
|
|
@@ -976,19 +1100,27 @@ function sortValue(data, isAsc) {
|
|
|
976
1100
|
|
|
977
1101
|
if (data[0] instanceof Date) {
|
|
978
1102
|
fn = isAsc ? function (a, b) {
|
|
1103
|
+
_newArrowCheck(this, _this14);
|
|
1104
|
+
|
|
979
1105
|
return a - b;
|
|
980
|
-
} : function (a, b) {
|
|
1106
|
+
}.bind(this) : function (a, b) {
|
|
1107
|
+
_newArrowCheck(this, _this14);
|
|
1108
|
+
|
|
981
1109
|
return b - a;
|
|
982
|
-
};
|
|
1110
|
+
}.bind(this);
|
|
983
1111
|
} else {
|
|
984
1112
|
if (isAsc && !data.every(isNaN)) {
|
|
985
1113
|
fn = function (a, b) {
|
|
1114
|
+
_newArrowCheck(this, _this14);
|
|
1115
|
+
|
|
986
1116
|
return a - b;
|
|
987
|
-
};
|
|
1117
|
+
}.bind(this);
|
|
988
1118
|
} else if (!isAsc) {
|
|
989
1119
|
fn = function (a, b) {
|
|
1120
|
+
_newArrowCheck(this, _this14);
|
|
1121
|
+
|
|
990
1122
|
return a > b && -1 || a < b && 1 || a === b && 0;
|
|
991
|
-
};
|
|
1123
|
+
}.bind(this);
|
|
992
1124
|
}
|
|
993
1125
|
}
|
|
994
1126
|
|
|
@@ -1004,9 +1136,12 @@ function sortValue(data, isAsc) {
|
|
|
1004
1136
|
|
|
1005
1137
|
|
|
1006
1138
|
function getMinMax(type, data) {
|
|
1007
|
-
var
|
|
1139
|
+
var _this15 = this,
|
|
1140
|
+
res = data.filter(function (v) {
|
|
1141
|
+
_newArrowCheck(this, _this15);
|
|
1142
|
+
|
|
1008
1143
|
return notEmpty(v);
|
|
1009
|
-
});
|
|
1144
|
+
}.bind(this));
|
|
1010
1145
|
|
|
1011
1146
|
if (res.length) {
|
|
1012
1147
|
if (isNumber(res[0])) {
|
|
@@ -1035,6 +1170,8 @@ var getRange = function (start, end, step) {
|
|
|
1035
1170
|
step = 1;
|
|
1036
1171
|
}
|
|
1037
1172
|
|
|
1173
|
+
_newArrowCheck(this, util_this);
|
|
1174
|
+
|
|
1038
1175
|
var res = [],
|
|
1039
1176
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
1040
1177
|
|
|
@@ -1043,10 +1180,16 @@ var getRange = function (start, end, step) {
|
|
|
1043
1180
|
}
|
|
1044
1181
|
|
|
1045
1182
|
return res;
|
|
1046
|
-
},
|
|
1183
|
+
}.bind(undefined),
|
|
1047
1184
|
emulateEvent = {
|
|
1048
1185
|
mouse: function () {
|
|
1186
|
+
var _this16 = this;
|
|
1187
|
+
|
|
1188
|
+
_newArrowCheck(this, util_this);
|
|
1189
|
+
|
|
1049
1190
|
var getParams = function () {
|
|
1191
|
+
_newArrowCheck(this, _this16);
|
|
1192
|
+
|
|
1050
1193
|
return {
|
|
1051
1194
|
bubbles: !1,
|
|
1052
1195
|
cancelable: !1,
|
|
@@ -1055,7 +1198,7 @@ var getRange = function (start, end, step) {
|
|
|
1055
1198
|
clientX: 0,
|
|
1056
1199
|
clientY: 0
|
|
1057
1200
|
};
|
|
1058
|
-
};
|
|
1201
|
+
}.bind(this);
|
|
1059
1202
|
|
|
1060
1203
|
try {
|
|
1061
1204
|
// eslint-disable-next-line no-new
|
|
@@ -1065,8 +1208,10 @@ var getRange = function (start, end, step) {
|
|
|
1065
1208
|
params = getParams();
|
|
1066
1209
|
}
|
|
1067
1210
|
|
|
1211
|
+
_newArrowCheck(this, _this16);
|
|
1212
|
+
|
|
1068
1213
|
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
1069
|
-
};
|
|
1214
|
+
}.bind(this);
|
|
1070
1215
|
} catch (e) {
|
|
1071
1216
|
// Polyfills DOM4 MouseEvent
|
|
1072
1217
|
return function (el, eventType, params) {
|
|
@@ -1074,15 +1219,19 @@ var getRange = function (start, end, step) {
|
|
|
1074
1219
|
params = getParams();
|
|
1075
1220
|
}
|
|
1076
1221
|
|
|
1222
|
+
_newArrowCheck(this, _this16);
|
|
1223
|
+
|
|
1077
1224
|
var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
1078
1225
|
|
|
1079
1226
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
|
|
1080
1227
|
params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
|
|
1081
1228
|
el.dispatchEvent(mouseEvent);
|
|
1082
|
-
};
|
|
1229
|
+
}.bind(this);
|
|
1083
1230
|
}
|
|
1084
|
-
}(),
|
|
1231
|
+
}.bind(undefined)(),
|
|
1085
1232
|
touch: function touch(el, eventType, params) {
|
|
1233
|
+
_newArrowCheck(this, util_this);
|
|
1234
|
+
|
|
1086
1235
|
var touchObj = new Touch(mergeObj({
|
|
1087
1236
|
identifier: Date.now(),
|
|
1088
1237
|
target: el,
|
|
@@ -1099,7 +1248,7 @@ var getRange = function (start, end, step) {
|
|
|
1099
1248
|
targetTouches: [],
|
|
1100
1249
|
changedTouches: [touchObj]
|
|
1101
1250
|
}));
|
|
1102
|
-
}
|
|
1251
|
+
}.bind(undefined)
|
|
1103
1252
|
}; // emulate event
|
|
1104
1253
|
|
|
1105
1254
|
|
|
@@ -1171,7 +1320,8 @@ function isTabVisible() {
|
|
|
1171
1320
|
|
|
1172
1321
|
|
|
1173
1322
|
function convertInputType(mouse, touch) {
|
|
1174
|
-
var
|
|
1323
|
+
var _this17 = this,
|
|
1324
|
+
DocumentTouch = win.DocumentTouch,
|
|
1175
1325
|
matchMedia = win.matchMedia,
|
|
1176
1326
|
navigator = win.navigator,
|
|
1177
1327
|
hasTouch = !1;
|
|
@@ -1199,12 +1349,106 @@ function convertInputType(mouse, touch) {
|
|
|
1199
1349
|
|
|
1200
1350
|
|
|
1201
1351
|
var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1352
|
+
_newArrowCheck(this, _this17);
|
|
1353
|
+
|
|
1202
1354
|
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1203
|
-
}); // fallback to 'mouse' if no input type is detected.
|
|
1355
|
+
}.bind(this)); // fallback to 'mouse' if no input type is detected.
|
|
1204
1356
|
|
|
1205
1357
|
return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
|
1206
1358
|
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Create and run on Web Worker
|
|
1361
|
+
* @param {boolean} useWorker Use Web Worker
|
|
1362
|
+
* @param {Function} fn Function to be executed in worker
|
|
1363
|
+
* @param {Function} callback Callback function to receive result from worker
|
|
1364
|
+
* @param {Array} depsFn Dependency functions to run given function(fn).
|
|
1365
|
+
* @returns {object}
|
|
1366
|
+
* @example
|
|
1367
|
+
* const worker = runWorker(function(arg) {
|
|
1368
|
+
* // do some tasks...
|
|
1369
|
+
* console.log("param:", A(arg));
|
|
1370
|
+
*
|
|
1371
|
+
* return 1234;
|
|
1372
|
+
* }, function(data) {
|
|
1373
|
+
* // callback after worker is done
|
|
1374
|
+
* console.log("result:", data);
|
|
1375
|
+
* },
|
|
1376
|
+
* [function A(){}]
|
|
1377
|
+
* );
|
|
1378
|
+
*
|
|
1379
|
+
* worker(11111);
|
|
1380
|
+
* @private
|
|
1381
|
+
*/
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
function runWorker(useWorker, fn, callback, depsFn) {
|
|
1385
|
+
if (useWorker === void 0) {
|
|
1386
|
+
useWorker = !0;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
var runFn;
|
|
1390
|
+
|
|
1391
|
+
if (win.Worker && useWorker) {
|
|
1392
|
+
var _depsFn$map$join,
|
|
1393
|
+
blob = new Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fn.toString() + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
|
|
1394
|
+
type: "text/javascript"
|
|
1395
|
+
}),
|
|
1396
|
+
worker = new Worker(URL.createObjectURL(blob));
|
|
1397
|
+
|
|
1398
|
+
runFn = function () {
|
|
1399
|
+
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1400
|
+
args[_key5] = arguments[_key5];
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
// trigger worker
|
|
1404
|
+
worker.postMessage(args); // listen worker
|
|
1405
|
+
|
|
1406
|
+
worker.onmessage = function (e) {
|
|
1407
|
+
return callback(e.data);
|
|
1408
|
+
}; // handle error
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
worker.onerror = function (e) {
|
|
1412
|
+
console.error(e);
|
|
1413
|
+
}; // return new Promise((resolve, reject) => {
|
|
1414
|
+
// worker.onmessage = ({data}) => resolve(data);
|
|
1415
|
+
// worker.onerror = reject;
|
|
1416
|
+
// });
|
|
1417
|
+
|
|
1418
|
+
};
|
|
1419
|
+
} else {
|
|
1420
|
+
runFn = function () {
|
|
1421
|
+
var res = fn.apply(void 0, arguments);
|
|
1422
|
+
callback(res);
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
return runFn;
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Run function until given condition function return true
|
|
1430
|
+
* @param {Function} fn Function to be executed when condition is true
|
|
1431
|
+
* @param {Function} conditionFn Condition function to check if condition is true
|
|
1432
|
+
* @private
|
|
1433
|
+
*/
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
function runUntil(fn, conditionFn) {
|
|
1437
|
+
var _this18 = this;
|
|
1438
|
+
|
|
1439
|
+
if (conditionFn() === !1) {
|
|
1440
|
+
win.requestAnimationFrame(function () {
|
|
1441
|
+
_newArrowCheck(this, _this18);
|
|
1442
|
+
|
|
1443
|
+
return runUntil(fn, conditionFn);
|
|
1444
|
+
}.bind(this));
|
|
1445
|
+
} else {
|
|
1446
|
+
fn();
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1207
1449
|
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1450
|
+
|
|
1451
|
+
|
|
1208
1452
|
/**
|
|
1209
1453
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1210
1454
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1217,11 +1461,14 @@ function convertInputType(mouse, touch) {
|
|
|
1217
1461
|
* @private
|
|
1218
1462
|
*/
|
|
1219
1463
|
function loadConfig(config) {
|
|
1220
|
-
var
|
|
1464
|
+
var _this = this,
|
|
1465
|
+
thisConfig = this.config,
|
|
1221
1466
|
target,
|
|
1222
1467
|
keys,
|
|
1223
1468
|
read,
|
|
1224
1469
|
find = function () {
|
|
1470
|
+
_newArrowCheck(this, _this);
|
|
1471
|
+
|
|
1225
1472
|
var key = keys.shift();
|
|
1226
1473
|
|
|
1227
1474
|
if (key && target && isObjectType(target) && key in target) {
|
|
@@ -1232,9 +1479,11 @@ function loadConfig(config) {
|
|
|
1232
1479
|
}
|
|
1233
1480
|
|
|
1234
1481
|
return undefined;
|
|
1235
|
-
};
|
|
1482
|
+
}.bind(this);
|
|
1236
1483
|
|
|
1237
1484
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1485
|
+
_newArrowCheck(this, _this);
|
|
1486
|
+
|
|
1238
1487
|
target = config;
|
|
1239
1488
|
keys = key.split("_");
|
|
1240
1489
|
read = find();
|
|
@@ -1242,9 +1491,11 @@ function loadConfig(config) {
|
|
|
1242
1491
|
if (isDefined(read)) {
|
|
1243
1492
|
thisConfig[key] = read;
|
|
1244
1493
|
}
|
|
1245
|
-
});
|
|
1494
|
+
}.bind(this));
|
|
1246
1495
|
}
|
|
1247
1496
|
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
1497
|
+
|
|
1498
|
+
|
|
1248
1499
|
/**
|
|
1249
1500
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1250
1501
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1319,15 +1570,17 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
1319
1570
|
var _this = this;
|
|
1320
1571
|
|
|
1321
1572
|
Object.keys(this).forEach(function (key) {
|
|
1322
|
-
_this
|
|
1323
|
-
|
|
1324
|
-
|
|
1573
|
+
_newArrowCheck(this, _this);
|
|
1574
|
+
|
|
1575
|
+
this[key] = null;
|
|
1576
|
+
delete this[key];
|
|
1577
|
+
}.bind(this));
|
|
1325
1578
|
};
|
|
1326
1579
|
|
|
1327
1580
|
return Plugin;
|
|
1328
1581
|
}();
|
|
1329
1582
|
|
|
1330
|
-
Plugin.version = "3.
|
|
1583
|
+
Plugin.version = "3.5.0";
|
|
1331
1584
|
|
|
1332
1585
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/Options.ts
|
|
1333
1586
|
/**
|
|
@@ -1609,6 +1862,8 @@ function getCentroid(points) {
|
|
|
1609
1862
|
|
|
1610
1863
|
|
|
1611
1864
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/Elements.ts
|
|
1865
|
+
|
|
1866
|
+
|
|
1612
1867
|
/**
|
|
1613
1868
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1614
1869
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1636,33 +1891,46 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1636
1891
|
var _proto = Elements.prototype;
|
|
1637
1892
|
|
|
1638
1893
|
_proto.updateStanfordLines = function updateStanfordLines(duration) {
|
|
1639
|
-
var
|
|
1894
|
+
var _this = this,
|
|
1895
|
+
$$ = this.owner.$$,
|
|
1640
1896
|
config = $$.config,
|
|
1641
1897
|
main = $$.$el.main,
|
|
1642
1898
|
isRotated = config.axis_rotated,
|
|
1643
1899
|
xvCustom = this.xvCustom.bind($$),
|
|
1644
1900
|
yvCustom = this.yvCustom.bind($$),
|
|
1645
1901
|
stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
|
|
1902
|
+
|
|
1646
1903
|
// exit
|
|
1647
1904
|
stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove(); // enter
|
|
1648
1905
|
|
|
1649
1906
|
var stanfordLineEnter = stanfordLine.enter().append("g");
|
|
1650
1907
|
stanfordLineEnter.append("line").style("opacity", "0");
|
|
1651
1908
|
stanfordLineEnter.merge(stanfordLine).attr("class", function (d) {
|
|
1909
|
+
_newArrowCheck(this, _this);
|
|
1910
|
+
|
|
1652
1911
|
return stanford_classes.stanfordLine + (d.class ? " " + d.class : "");
|
|
1653
|
-
}).select("line").transition().duration(duration).attr("x1", function (d) {
|
|
1912
|
+
}.bind(this)).select("line").transition().duration(duration).attr("x1", function (d) {
|
|
1913
|
+
_newArrowCheck(this, _this);
|
|
1914
|
+
|
|
1654
1915
|
return isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
|
|
1655
|
-
}).attr("x2", function (d) {
|
|
1916
|
+
}.bind(this)).attr("x2", function (d) {
|
|
1917
|
+
_newArrowCheck(this, _this);
|
|
1918
|
+
|
|
1656
1919
|
return isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2");
|
|
1657
|
-
}).attr("y1", function (d) {
|
|
1920
|
+
}.bind(this)).attr("y1", function (d) {
|
|
1921
|
+
_newArrowCheck(this, _this);
|
|
1922
|
+
|
|
1658
1923
|
return isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
|
|
1659
|
-
}).attr("y2", function (d) {
|
|
1924
|
+
}.bind(this)).attr("y2", function (d) {
|
|
1925
|
+
_newArrowCheck(this, _this);
|
|
1926
|
+
|
|
1660
1927
|
return isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2");
|
|
1661
|
-
}).transition().style("opacity", null);
|
|
1928
|
+
}.bind(this)).transition().style("opacity", null);
|
|
1662
1929
|
};
|
|
1663
1930
|
|
|
1664
1931
|
_proto.updateStanfordRegions = function updateStanfordRegions(duration) {
|
|
1665
|
-
var
|
|
1932
|
+
var _this2 = this,
|
|
1933
|
+
$$ = this.owner.$$,
|
|
1666
1934
|
config = $$.config,
|
|
1667
1935
|
main = $$.$el.main,
|
|
1668
1936
|
isRotated = config.axis_rotated,
|
|
@@ -1670,6 +1938,7 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1670
1938
|
yvCustom = this.yvCustom.bind($$),
|
|
1671
1939
|
countPointsInRegion = this.owner.countEpochsInRegion.bind($$),
|
|
1672
1940
|
stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
|
|
1941
|
+
|
|
1673
1942
|
// exit
|
|
1674
1943
|
stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove(); // enter
|
|
1675
1944
|
|
|
@@ -1679,19 +1948,35 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1679
1948
|
stanfordRegion = stanfordRegionEnter.merge(stanfordRegion); // update
|
|
1680
1949
|
|
|
1681
1950
|
stanfordRegion.attr("class", function (d) {
|
|
1951
|
+
_newArrowCheck(this, _this2);
|
|
1952
|
+
|
|
1682
1953
|
return stanford_classes.stanfordRegion + (d.class ? " " + d.class : "");
|
|
1683
|
-
}).select("polygon").transition().duration(duration).attr("points", function (d) {
|
|
1954
|
+
}.bind(this)).select("polygon").transition().duration(duration).attr("points", function (d) {
|
|
1955
|
+
var _this3 = this;
|
|
1956
|
+
|
|
1957
|
+
_newArrowCheck(this, _this2);
|
|
1958
|
+
|
|
1684
1959
|
return d.points.map(function (value) {
|
|
1960
|
+
_newArrowCheck(this, _this3);
|
|
1961
|
+
|
|
1685
1962
|
return [isRotated ? yvCustom(value, "y") : xvCustom(value, "x"), isRotated ? xvCustom(value, "x") : yvCustom(value, "y")].join(",");
|
|
1686
|
-
}).join(" ");
|
|
1687
|
-
}).transition().style("opacity", function (d) {
|
|
1963
|
+
}.bind(this)).join(" ");
|
|
1964
|
+
}.bind(this)).transition().style("opacity", function (d) {
|
|
1965
|
+
_newArrowCheck(this, _this2);
|
|
1966
|
+
|
|
1688
1967
|
return (d.opacity ? d.opacity : .2) + "";
|
|
1689
|
-
});
|
|
1968
|
+
}.bind(this));
|
|
1690
1969
|
stanfordRegion.select("text").transition().duration(duration).attr("x", function (d) {
|
|
1970
|
+
_newArrowCheck(this, _this2);
|
|
1971
|
+
|
|
1691
1972
|
return isRotated ? yvCustom(getCentroid(d.points), "y") : xvCustom(getCentroid(d.points), "x");
|
|
1692
|
-
}).attr("y", function (d) {
|
|
1973
|
+
}.bind(this)).attr("y", function (d) {
|
|
1974
|
+
_newArrowCheck(this, _this2);
|
|
1975
|
+
|
|
1693
1976
|
return isRotated ? xvCustom(getCentroid(d.points), "x") : yvCustom(getCentroid(d.points), "y");
|
|
1694
|
-
}).text(function (d) {
|
|
1977
|
+
}.bind(this)).text(function (d) {
|
|
1978
|
+
_newArrowCheck(this, _this2);
|
|
1979
|
+
|
|
1695
1980
|
if (d.text) {
|
|
1696
1981
|
var _countPointsInRegion = countPointsInRegion(d.points),
|
|
1697
1982
|
value = _countPointsInRegion.value,
|
|
@@ -1701,7 +1986,7 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1701
1986
|
}
|
|
1702
1987
|
|
|
1703
1988
|
return "";
|
|
1704
|
-
}).attr("text-anchor", "middle").attr("dominant-baseline", "middle").transition().style("opacity", null);
|
|
1989
|
+
}.bind(this)).attr("text-anchor", "middle").attr("dominant-baseline", "middle").transition().style("opacity", null);
|
|
1705
1990
|
};
|
|
1706
1991
|
|
|
1707
1992
|
_proto.updateStanfordElements = function updateStanfordElements(duration) {
|
|
@@ -1744,6 +2029,8 @@ var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack
|
|
|
1744
2029
|
// EXTERNAL MODULE: external {"commonjs":"d3-format","commonjs2":"d3-format","amd":"d3-format","root":"d3"}
|
|
1745
2030
|
var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __webpack_require__(9);
|
|
1746
2031
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/ColorScale.ts
|
|
2032
|
+
|
|
2033
|
+
|
|
1747
2034
|
/**
|
|
1748
2035
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1749
2036
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1770,14 +2057,14 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1770
2057
|
var _proto = ColorScale.prototype;
|
|
1771
2058
|
|
|
1772
2059
|
_proto.drawColorScale = function drawColorScale() {
|
|
1773
|
-
var _this
|
|
2060
|
+
var _this = this,
|
|
2061
|
+
_this$owner = this.owner,
|
|
1774
2062
|
$$ = _this$owner.$$,
|
|
1775
2063
|
config = _this$owner.config,
|
|
1776
2064
|
target = $$.data.targets[0],
|
|
1777
2065
|
height = $$.state.height - config.padding_bottom - config.padding_top,
|
|
1778
2066
|
barWidth = config.scale_width,
|
|
1779
|
-
|
|
1780
|
-
points = getRange(config.padding_bottom, height, barHeight),
|
|
2067
|
+
points = getRange(config.padding_bottom, height, 5),
|
|
1781
2068
|
inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
|
|
1782
2069
|
|
|
1783
2070
|
if (this.colorScale) {
|
|
@@ -1786,12 +2073,16 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1786
2073
|
|
|
1787
2074
|
this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale);
|
|
1788
2075
|
this.colorScale.append("g").attr("transform", "translate(0, " + config.padding_top + ")").selectAll("bars").data(points).enter().append("rect").attr("y", function (d, i) {
|
|
1789
|
-
|
|
1790
|
-
|
|
2076
|
+
_newArrowCheck(this, _this);
|
|
2077
|
+
|
|
2078
|
+
return i * 5;
|
|
2079
|
+
}.bind(this)).attr("x", 0).attr("width", barWidth).attr("height", 5).attr("fill", function (d) {
|
|
2080
|
+
_newArrowCheck(this, _this);
|
|
2081
|
+
|
|
1791
2082
|
return inverseScale(d);
|
|
1792
|
-
}); // Legend Axis
|
|
2083
|
+
}.bind(this)); // Legend Axis
|
|
1793
2084
|
|
|
1794
|
-
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] +
|
|
2085
|
+
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]),
|
|
1795
2086
|
legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
|
|
1796
2087
|
scaleFormat = config.scale_format;
|
|
1797
2088
|
|
|
@@ -1808,12 +2099,16 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1808
2099
|
|
|
1809
2100
|
if (scaleFormat === "pow10") {
|
|
1810
2101
|
axis.selectAll(".tick text").text(null).filter(function (d) {
|
|
2102
|
+
_newArrowCheck(this, _this);
|
|
2103
|
+
|
|
1811
2104
|
return d / Math.pow(10, Math.ceil(Math.log(d) / Math.LN10 - 1e-12)) === 1;
|
|
1812
|
-
}) // Power of Ten
|
|
2105
|
+
}.bind(this)) // Power of Ten
|
|
1813
2106
|
.text(10).append("tspan").attr("dy", "-.7em") // https://bl.ocks.org/mbostock/6738229
|
|
1814
2107
|
.text(function (d) {
|
|
2108
|
+
_newArrowCheck(this, _this);
|
|
2109
|
+
|
|
1815
2110
|
return Math.round(Math.log(d) / Math.LN10);
|
|
1816
|
-
});
|
|
2111
|
+
}.bind(this));
|
|
1817
2112
|
}
|
|
1818
2113
|
|
|
1819
2114
|
this.colorScale.attr("transform", "translate(" + ($$.state.current.width - this.xForColorScale()) + ", 0)");
|
|
@@ -1835,6 +2130,7 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1835
2130
|
|
|
1836
2131
|
|
|
1837
2132
|
|
|
2133
|
+
|
|
1838
2134
|
/**
|
|
1839
2135
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1840
2136
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1959,24 +2255,34 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1959
2255
|
$$.config.data_xSort = !1;
|
|
1960
2256
|
|
|
1961
2257
|
$$.isMultipleX = function () {
|
|
2258
|
+
_newArrowCheck(this, _this2);
|
|
2259
|
+
|
|
1962
2260
|
return !0;
|
|
1963
|
-
};
|
|
2261
|
+
}.bind(this);
|
|
1964
2262
|
|
|
1965
|
-
$$.showGridFocus = function () {
|
|
2263
|
+
$$.showGridFocus = function () {
|
|
2264
|
+
_newArrowCheck(this, _this2);
|
|
2265
|
+
}.bind(this);
|
|
1966
2266
|
|
|
1967
2267
|
$$.labelishData = function (d) {
|
|
2268
|
+
_newArrowCheck(this, _this2);
|
|
2269
|
+
|
|
1968
2270
|
return d.values;
|
|
1969
|
-
};
|
|
2271
|
+
}.bind(this);
|
|
1970
2272
|
|
|
1971
2273
|
$$.opacityForCircle = function () {
|
|
2274
|
+
_newArrowCheck(this, _this2);
|
|
2275
|
+
|
|
1972
2276
|
return 1;
|
|
1973
|
-
};
|
|
2277
|
+
}.bind(this);
|
|
1974
2278
|
|
|
1975
2279
|
var getCurrentPaddingRight = $$.getCurrentPaddingRight.bind($$);
|
|
1976
2280
|
|
|
1977
2281
|
$$.getCurrentPaddingRight = function () {
|
|
1978
|
-
|
|
1979
|
-
|
|
2282
|
+
_newArrowCheck(this, _this2);
|
|
2283
|
+
|
|
2284
|
+
return getCurrentPaddingRight() + (this.colorScale ? this.colorScale.getColorScalePadding() : 0);
|
|
2285
|
+
}.bind(this);
|
|
1980
2286
|
};
|
|
1981
2287
|
|
|
1982
2288
|
_proto.$init = function $init() {
|
|
@@ -2004,17 +2310,25 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2004
2310
|
};
|
|
2005
2311
|
|
|
2006
2312
|
_proto.convertData = function convertData() {
|
|
2007
|
-
var
|
|
2313
|
+
var _this3 = this,
|
|
2314
|
+
data = this.$$.data.targets,
|
|
2008
2315
|
epochs = this.options.epochs;
|
|
2316
|
+
|
|
2009
2317
|
data.forEach(function (d) {
|
|
2318
|
+
var _this4 = this;
|
|
2319
|
+
|
|
2320
|
+
_newArrowCheck(this, _this3);
|
|
2321
|
+
|
|
2010
2322
|
d.values.forEach(function (v, i) {
|
|
2323
|
+
_newArrowCheck(this, _this4);
|
|
2324
|
+
|
|
2011
2325
|
v.epochs = epochs[i];
|
|
2012
|
-
});
|
|
2326
|
+
}.bind(this));
|
|
2013
2327
|
d.minEpochs = undefined;
|
|
2014
2328
|
d.maxEpochs = undefined;
|
|
2015
2329
|
d.colors = undefined;
|
|
2016
2330
|
d.colorscale = undefined;
|
|
2017
|
-
});
|
|
2331
|
+
}.bind(this));
|
|
2018
2332
|
};
|
|
2019
2333
|
|
|
2020
2334
|
_proto.xvCustom = function xvCustom(d, xyValue) {
|
|
@@ -2041,15 +2355,19 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2041
2355
|
};
|
|
2042
2356
|
|
|
2043
2357
|
_proto.initStanfordData = function initStanfordData() {
|
|
2044
|
-
var
|
|
2358
|
+
var _this5 = this,
|
|
2359
|
+
config = this.config,
|
|
2045
2360
|
target = this.$$.data.targets[0];
|
|
2361
|
+
|
|
2046
2362
|
// TODO STANFORD see if (data.js -> orderTargets)+ can be used instead
|
|
2047
2363
|
// Make larger values appear on top
|
|
2048
2364
|
target.values.sort(compareEpochs); // Get array of epochs
|
|
2049
2365
|
|
|
2050
2366
|
var epochs = target.values.map(function (a) {
|
|
2367
|
+
_newArrowCheck(this, _this5);
|
|
2368
|
+
|
|
2051
2369
|
return a.epochs;
|
|
2052
|
-
});
|
|
2370
|
+
}.bind(this));
|
|
2053
2371
|
target.minEpochs = !isNaN(config.scale_min) ? config.scale_min : Math.min.apply(Math, epochs);
|
|
2054
2372
|
target.maxEpochs = !isNaN(config.scale_max) ? config.scale_max : Math.max.apply(Math, epochs);
|
|
2055
2373
|
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));
|
|
@@ -2066,28 +2384,47 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2066
2384
|
|
|
2067
2385
|
if (isEmpty(config.tooltip_contents)) {
|
|
2068
2386
|
config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
|
|
2069
|
-
var
|
|
2387
|
+
var _this6 = this,
|
|
2388
|
+
data_x = config.data_x,
|
|
2389
|
+
html = "<table class=\"" + $TOOLTIP.tooltip + "\"><tbody>";
|
|
2390
|
+
|
|
2070
2391
|
d.forEach(function (v) {
|
|
2071
|
-
|
|
2072
|
-
|
|
2392
|
+
_newArrowCheck(this, _this6);
|
|
2393
|
+
|
|
2394
|
+
var _v$id = v.id,
|
|
2395
|
+
id = _v$id === void 0 ? "" : _v$id,
|
|
2396
|
+
_v$value = v.value,
|
|
2397
|
+
value = _v$value === void 0 ? 0 : _v$value,
|
|
2398
|
+
_v$epochs = v.epochs,
|
|
2399
|
+
epochs = _v$epochs === void 0 ? 0 : _v$epochs,
|
|
2400
|
+
_v$x = v.x,
|
|
2401
|
+
x = _v$x === void 0 ? "" : _v$x;
|
|
2402
|
+
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>";
|
|
2403
|
+
}.bind(this));
|
|
2073
2404
|
return html + "</tbody></table>";
|
|
2074
2405
|
};
|
|
2075
2406
|
}
|
|
2076
2407
|
};
|
|
2077
2408
|
|
|
2078
2409
|
_proto.countEpochsInRegion = function countEpochsInRegion(region) {
|
|
2079
|
-
var
|
|
2410
|
+
var _this7 = this,
|
|
2411
|
+
$$ = this,
|
|
2080
2412
|
target = $$.data.targets[0],
|
|
2081
2413
|
total = target.values.reduce(function (accumulator, currentValue) {
|
|
2414
|
+
_newArrowCheck(this, _this7);
|
|
2415
|
+
|
|
2082
2416
|
return accumulator + +currentValue.epochs;
|
|
2083
|
-
}, 0),
|
|
2417
|
+
}.bind(this), 0),
|
|
2084
2418
|
value = target.values.reduce(function (accumulator, currentValue) {
|
|
2419
|
+
_newArrowCheck(this, _this7);
|
|
2420
|
+
|
|
2085
2421
|
if (pointInRegion(currentValue, region)) {
|
|
2086
2422
|
return accumulator + +currentValue.epochs;
|
|
2087
2423
|
}
|
|
2088
2424
|
|
|
2089
2425
|
return accumulator;
|
|
2090
|
-
}, 0);
|
|
2426
|
+
}.bind(this), 0);
|
|
2427
|
+
|
|
2091
2428
|
return {
|
|
2092
2429
|
value: value,
|
|
2093
2430
|
percentage: value !== 0 ? +(value / total * 100).toFixed(1) : 0
|