billboard.js 3.4.0 → 3.5.0-next.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 +11 -4
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +3901 -1451
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +8350 -5297
- 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 +377 -92
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +447 -109
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +341 -74
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +337 -75
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +4233 -3792
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +4635 -3889
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +4823 -3937
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +4594 -3866
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +4606 -3874
- 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 +796 -387
- 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 +40 -40
- 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 +55 -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/color.ts +59 -36
- package/src/ChartInternal/internals/grid.ts +5 -3
- 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/text.ts +118 -17
- package/src/ChartInternal/shape/area.ts +14 -7
- package/src/ChartInternal/shape/bar.ts +19 -10
- 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 +115 -1
- 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-next.2
|
|
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,11 +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
|
-
});
|
|
1204
|
-
|
|
1355
|
+
}.bind(this)); // fallback to 'mouse' if no input type is detected.
|
|
1356
|
+
|
|
1357
|
+
return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
|
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
|
+
}
|
|
1205
1448
|
}
|
|
1206
1449
|
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1450
|
+
|
|
1451
|
+
|
|
1207
1452
|
/**
|
|
1208
1453
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1209
1454
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1216,11 +1461,14 @@ function convertInputType(mouse, touch) {
|
|
|
1216
1461
|
* @private
|
|
1217
1462
|
*/
|
|
1218
1463
|
function loadConfig(config) {
|
|
1219
|
-
var
|
|
1464
|
+
var _this = this,
|
|
1465
|
+
thisConfig = this.config,
|
|
1220
1466
|
target,
|
|
1221
1467
|
keys,
|
|
1222
1468
|
read,
|
|
1223
1469
|
find = function () {
|
|
1470
|
+
_newArrowCheck(this, _this);
|
|
1471
|
+
|
|
1224
1472
|
var key = keys.shift();
|
|
1225
1473
|
|
|
1226
1474
|
if (key && target && isObjectType(target) && key in target) {
|
|
@@ -1231,9 +1479,11 @@ function loadConfig(config) {
|
|
|
1231
1479
|
}
|
|
1232
1480
|
|
|
1233
1481
|
return undefined;
|
|
1234
|
-
};
|
|
1482
|
+
}.bind(this);
|
|
1235
1483
|
|
|
1236
1484
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1485
|
+
_newArrowCheck(this, _this);
|
|
1486
|
+
|
|
1237
1487
|
target = config;
|
|
1238
1488
|
keys = key.split("_");
|
|
1239
1489
|
read = find();
|
|
@@ -1241,9 +1491,11 @@ function loadConfig(config) {
|
|
|
1241
1491
|
if (isDefined(read)) {
|
|
1242
1492
|
thisConfig[key] = read;
|
|
1243
1493
|
}
|
|
1244
|
-
});
|
|
1494
|
+
}.bind(this));
|
|
1245
1495
|
}
|
|
1246
1496
|
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
1497
|
+
|
|
1498
|
+
|
|
1247
1499
|
/**
|
|
1248
1500
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1249
1501
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1318,15 +1570,17 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
1318
1570
|
var _this = this;
|
|
1319
1571
|
|
|
1320
1572
|
Object.keys(this).forEach(function (key) {
|
|
1321
|
-
_this
|
|
1322
|
-
|
|
1323
|
-
|
|
1573
|
+
_newArrowCheck(this, _this);
|
|
1574
|
+
|
|
1575
|
+
this[key] = null;
|
|
1576
|
+
delete this[key];
|
|
1577
|
+
}.bind(this));
|
|
1324
1578
|
};
|
|
1325
1579
|
|
|
1326
1580
|
return Plugin;
|
|
1327
1581
|
}();
|
|
1328
1582
|
|
|
1329
|
-
Plugin.version = "3.
|
|
1583
|
+
Plugin.version = "3.5.0-next.2";
|
|
1330
1584
|
|
|
1331
1585
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/Options.ts
|
|
1332
1586
|
/**
|
|
@@ -1608,6 +1862,8 @@ function getCentroid(points) {
|
|
|
1608
1862
|
|
|
1609
1863
|
|
|
1610
1864
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/Elements.ts
|
|
1865
|
+
|
|
1866
|
+
|
|
1611
1867
|
/**
|
|
1612
1868
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1613
1869
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1635,33 +1891,46 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1635
1891
|
var _proto = Elements.prototype;
|
|
1636
1892
|
|
|
1637
1893
|
_proto.updateStanfordLines = function updateStanfordLines(duration) {
|
|
1638
|
-
var
|
|
1894
|
+
var _this = this,
|
|
1895
|
+
$$ = this.owner.$$,
|
|
1639
1896
|
config = $$.config,
|
|
1640
1897
|
main = $$.$el.main,
|
|
1641
1898
|
isRotated = config.axis_rotated,
|
|
1642
1899
|
xvCustom = this.xvCustom.bind($$),
|
|
1643
1900
|
yvCustom = this.yvCustom.bind($$),
|
|
1644
1901
|
stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
|
|
1902
|
+
|
|
1645
1903
|
// exit
|
|
1646
1904
|
stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove(); // enter
|
|
1647
1905
|
|
|
1648
1906
|
var stanfordLineEnter = stanfordLine.enter().append("g");
|
|
1649
1907
|
stanfordLineEnter.append("line").style("opacity", "0");
|
|
1650
1908
|
stanfordLineEnter.merge(stanfordLine).attr("class", function (d) {
|
|
1909
|
+
_newArrowCheck(this, _this);
|
|
1910
|
+
|
|
1651
1911
|
return stanford_classes.stanfordLine + (d.class ? " " + d.class : "");
|
|
1652
|
-
}).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
|
+
|
|
1653
1915
|
return isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
|
|
1654
|
-
}).attr("x2", function (d) {
|
|
1916
|
+
}.bind(this)).attr("x2", function (d) {
|
|
1917
|
+
_newArrowCheck(this, _this);
|
|
1918
|
+
|
|
1655
1919
|
return isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2");
|
|
1656
|
-
}).attr("y1", function (d) {
|
|
1920
|
+
}.bind(this)).attr("y1", function (d) {
|
|
1921
|
+
_newArrowCheck(this, _this);
|
|
1922
|
+
|
|
1657
1923
|
return isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
|
|
1658
|
-
}).attr("y2", function (d) {
|
|
1924
|
+
}.bind(this)).attr("y2", function (d) {
|
|
1925
|
+
_newArrowCheck(this, _this);
|
|
1926
|
+
|
|
1659
1927
|
return isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2");
|
|
1660
|
-
}).transition().style("opacity", null);
|
|
1928
|
+
}.bind(this)).transition().style("opacity", null);
|
|
1661
1929
|
};
|
|
1662
1930
|
|
|
1663
1931
|
_proto.updateStanfordRegions = function updateStanfordRegions(duration) {
|
|
1664
|
-
var
|
|
1932
|
+
var _this2 = this,
|
|
1933
|
+
$$ = this.owner.$$,
|
|
1665
1934
|
config = $$.config,
|
|
1666
1935
|
main = $$.$el.main,
|
|
1667
1936
|
isRotated = config.axis_rotated,
|
|
@@ -1669,6 +1938,7 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1669
1938
|
yvCustom = this.yvCustom.bind($$),
|
|
1670
1939
|
countPointsInRegion = this.owner.countEpochsInRegion.bind($$),
|
|
1671
1940
|
stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
|
|
1941
|
+
|
|
1672
1942
|
// exit
|
|
1673
1943
|
stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove(); // enter
|
|
1674
1944
|
|
|
@@ -1678,19 +1948,35 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1678
1948
|
stanfordRegion = stanfordRegionEnter.merge(stanfordRegion); // update
|
|
1679
1949
|
|
|
1680
1950
|
stanfordRegion.attr("class", function (d) {
|
|
1951
|
+
_newArrowCheck(this, _this2);
|
|
1952
|
+
|
|
1681
1953
|
return stanford_classes.stanfordRegion + (d.class ? " " + d.class : "");
|
|
1682
|
-
}).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
|
+
|
|
1683
1959
|
return d.points.map(function (value) {
|
|
1960
|
+
_newArrowCheck(this, _this3);
|
|
1961
|
+
|
|
1684
1962
|
return [isRotated ? yvCustom(value, "y") : xvCustom(value, "x"), isRotated ? xvCustom(value, "x") : yvCustom(value, "y")].join(",");
|
|
1685
|
-
}).join(" ");
|
|
1686
|
-
}).transition().style("opacity", function (d) {
|
|
1963
|
+
}.bind(this)).join(" ");
|
|
1964
|
+
}.bind(this)).transition().style("opacity", function (d) {
|
|
1965
|
+
_newArrowCheck(this, _this2);
|
|
1966
|
+
|
|
1687
1967
|
return (d.opacity ? d.opacity : .2) + "";
|
|
1688
|
-
});
|
|
1968
|
+
}.bind(this));
|
|
1689
1969
|
stanfordRegion.select("text").transition().duration(duration).attr("x", function (d) {
|
|
1970
|
+
_newArrowCheck(this, _this2);
|
|
1971
|
+
|
|
1690
1972
|
return isRotated ? yvCustom(getCentroid(d.points), "y") : xvCustom(getCentroid(d.points), "x");
|
|
1691
|
-
}).attr("y", function (d) {
|
|
1973
|
+
}.bind(this)).attr("y", function (d) {
|
|
1974
|
+
_newArrowCheck(this, _this2);
|
|
1975
|
+
|
|
1692
1976
|
return isRotated ? xvCustom(getCentroid(d.points), "x") : yvCustom(getCentroid(d.points), "y");
|
|
1693
|
-
}).text(function (d) {
|
|
1977
|
+
}.bind(this)).text(function (d) {
|
|
1978
|
+
_newArrowCheck(this, _this2);
|
|
1979
|
+
|
|
1694
1980
|
if (d.text) {
|
|
1695
1981
|
var _countPointsInRegion = countPointsInRegion(d.points),
|
|
1696
1982
|
value = _countPointsInRegion.value,
|
|
@@ -1700,7 +1986,7 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1700
1986
|
}
|
|
1701
1987
|
|
|
1702
1988
|
return "";
|
|
1703
|
-
}).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);
|
|
1704
1990
|
};
|
|
1705
1991
|
|
|
1706
1992
|
_proto.updateStanfordElements = function updateStanfordElements(duration) {
|
|
@@ -1743,6 +2029,8 @@ var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack
|
|
|
1743
2029
|
// EXTERNAL MODULE: external {"commonjs":"d3-format","commonjs2":"d3-format","amd":"d3-format","root":"d3"}
|
|
1744
2030
|
var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __webpack_require__(9);
|
|
1745
2031
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/ColorScale.ts
|
|
2032
|
+
|
|
2033
|
+
|
|
1746
2034
|
/**
|
|
1747
2035
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1748
2036
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1769,14 +2057,14 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1769
2057
|
var _proto = ColorScale.prototype;
|
|
1770
2058
|
|
|
1771
2059
|
_proto.drawColorScale = function drawColorScale() {
|
|
1772
|
-
var _this
|
|
2060
|
+
var _this = this,
|
|
2061
|
+
_this$owner = this.owner,
|
|
1773
2062
|
$$ = _this$owner.$$,
|
|
1774
2063
|
config = _this$owner.config,
|
|
1775
2064
|
target = $$.data.targets[0],
|
|
1776
2065
|
height = $$.state.height - config.padding_bottom - config.padding_top,
|
|
1777
2066
|
barWidth = config.scale_width,
|
|
1778
|
-
|
|
1779
|
-
points = getRange(config.padding_bottom, height, barHeight),
|
|
2067
|
+
points = getRange(config.padding_bottom, height, 5),
|
|
1780
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]]);
|
|
1781
2069
|
|
|
1782
2070
|
if (this.colorScale) {
|
|
@@ -1785,12 +2073,16 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1785
2073
|
|
|
1786
2074
|
this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale);
|
|
1787
2075
|
this.colorScale.append("g").attr("transform", "translate(0, " + config.padding_top + ")").selectAll("bars").data(points).enter().append("rect").attr("y", function (d, i) {
|
|
1788
|
-
|
|
1789
|
-
|
|
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
|
+
|
|
1790
2082
|
return inverseScale(d);
|
|
1791
|
-
}); // Legend Axis
|
|
2083
|
+
}.bind(this)); // Legend Axis
|
|
1792
2084
|
|
|
1793
|
-
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]),
|
|
1794
2086
|
legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
|
|
1795
2087
|
scaleFormat = config.scale_format;
|
|
1796
2088
|
|
|
@@ -1807,12 +2099,16 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1807
2099
|
|
|
1808
2100
|
if (scaleFormat === "pow10") {
|
|
1809
2101
|
axis.selectAll(".tick text").text(null).filter(function (d) {
|
|
2102
|
+
_newArrowCheck(this, _this);
|
|
2103
|
+
|
|
1810
2104
|
return d / Math.pow(10, Math.ceil(Math.log(d) / Math.LN10 - 1e-12)) === 1;
|
|
1811
|
-
}) // Power of Ten
|
|
2105
|
+
}.bind(this)) // Power of Ten
|
|
1812
2106
|
.text(10).append("tspan").attr("dy", "-.7em") // https://bl.ocks.org/mbostock/6738229
|
|
1813
2107
|
.text(function (d) {
|
|
2108
|
+
_newArrowCheck(this, _this);
|
|
2109
|
+
|
|
1814
2110
|
return Math.round(Math.log(d) / Math.LN10);
|
|
1815
|
-
});
|
|
2111
|
+
}.bind(this));
|
|
1816
2112
|
}
|
|
1817
2113
|
|
|
1818
2114
|
this.colorScale.attr("transform", "translate(" + ($$.state.current.width - this.xForColorScale()) + ", 0)");
|
|
@@ -1834,6 +2130,7 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1834
2130
|
|
|
1835
2131
|
|
|
1836
2132
|
|
|
2133
|
+
|
|
1837
2134
|
/**
|
|
1838
2135
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1839
2136
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1958,24 +2255,34 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1958
2255
|
$$.config.data_xSort = !1;
|
|
1959
2256
|
|
|
1960
2257
|
$$.isMultipleX = function () {
|
|
2258
|
+
_newArrowCheck(this, _this2);
|
|
2259
|
+
|
|
1961
2260
|
return !0;
|
|
1962
|
-
};
|
|
2261
|
+
}.bind(this);
|
|
1963
2262
|
|
|
1964
|
-
$$.showGridFocus = function () {
|
|
2263
|
+
$$.showGridFocus = function () {
|
|
2264
|
+
_newArrowCheck(this, _this2);
|
|
2265
|
+
}.bind(this);
|
|
1965
2266
|
|
|
1966
2267
|
$$.labelishData = function (d) {
|
|
2268
|
+
_newArrowCheck(this, _this2);
|
|
2269
|
+
|
|
1967
2270
|
return d.values;
|
|
1968
|
-
};
|
|
2271
|
+
}.bind(this);
|
|
1969
2272
|
|
|
1970
2273
|
$$.opacityForCircle = function () {
|
|
2274
|
+
_newArrowCheck(this, _this2);
|
|
2275
|
+
|
|
1971
2276
|
return 1;
|
|
1972
|
-
};
|
|
2277
|
+
}.bind(this);
|
|
1973
2278
|
|
|
1974
2279
|
var getCurrentPaddingRight = $$.getCurrentPaddingRight.bind($$);
|
|
1975
2280
|
|
|
1976
2281
|
$$.getCurrentPaddingRight = function () {
|
|
1977
|
-
|
|
1978
|
-
|
|
2282
|
+
_newArrowCheck(this, _this2);
|
|
2283
|
+
|
|
2284
|
+
return getCurrentPaddingRight() + (this.colorScale ? this.colorScale.getColorScalePadding() : 0);
|
|
2285
|
+
}.bind(this);
|
|
1979
2286
|
};
|
|
1980
2287
|
|
|
1981
2288
|
_proto.$init = function $init() {
|
|
@@ -2003,17 +2310,25 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2003
2310
|
};
|
|
2004
2311
|
|
|
2005
2312
|
_proto.convertData = function convertData() {
|
|
2006
|
-
var
|
|
2313
|
+
var _this3 = this,
|
|
2314
|
+
data = this.$$.data.targets,
|
|
2007
2315
|
epochs = this.options.epochs;
|
|
2316
|
+
|
|
2008
2317
|
data.forEach(function (d) {
|
|
2318
|
+
var _this4 = this;
|
|
2319
|
+
|
|
2320
|
+
_newArrowCheck(this, _this3);
|
|
2321
|
+
|
|
2009
2322
|
d.values.forEach(function (v, i) {
|
|
2323
|
+
_newArrowCheck(this, _this4);
|
|
2324
|
+
|
|
2010
2325
|
v.epochs = epochs[i];
|
|
2011
|
-
});
|
|
2326
|
+
}.bind(this));
|
|
2012
2327
|
d.minEpochs = undefined;
|
|
2013
2328
|
d.maxEpochs = undefined;
|
|
2014
2329
|
d.colors = undefined;
|
|
2015
2330
|
d.colorscale = undefined;
|
|
2016
|
-
});
|
|
2331
|
+
}.bind(this));
|
|
2017
2332
|
};
|
|
2018
2333
|
|
|
2019
2334
|
_proto.xvCustom = function xvCustom(d, xyValue) {
|
|
@@ -2040,15 +2355,19 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2040
2355
|
};
|
|
2041
2356
|
|
|
2042
2357
|
_proto.initStanfordData = function initStanfordData() {
|
|
2043
|
-
var
|
|
2358
|
+
var _this5 = this,
|
|
2359
|
+
config = this.config,
|
|
2044
2360
|
target = this.$$.data.targets[0];
|
|
2361
|
+
|
|
2045
2362
|
// TODO STANFORD see if (data.js -> orderTargets)+ can be used instead
|
|
2046
2363
|
// Make larger values appear on top
|
|
2047
2364
|
target.values.sort(compareEpochs); // Get array of epochs
|
|
2048
2365
|
|
|
2049
2366
|
var epochs = target.values.map(function (a) {
|
|
2367
|
+
_newArrowCheck(this, _this5);
|
|
2368
|
+
|
|
2050
2369
|
return a.epochs;
|
|
2051
|
-
});
|
|
2370
|
+
}.bind(this));
|
|
2052
2371
|
target.minEpochs = !isNaN(config.scale_min) ? config.scale_min : Math.min.apply(Math, epochs);
|
|
2053
2372
|
target.maxEpochs = !isNaN(config.scale_max) ? config.scale_max : Math.max.apply(Math, epochs);
|
|
2054
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));
|
|
@@ -2065,28 +2384,47 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2065
2384
|
|
|
2066
2385
|
if (isEmpty(config.tooltip_contents)) {
|
|
2067
2386
|
config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
|
|
2068
|
-
var
|
|
2387
|
+
var _this6 = this,
|
|
2388
|
+
data_x = config.data_x,
|
|
2389
|
+
html = "<table class=\"" + $TOOLTIP.tooltip + "\"><tbody>";
|
|
2390
|
+
|
|
2069
2391
|
d.forEach(function (v) {
|
|
2070
|
-
|
|
2071
|
-
|
|
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));
|
|
2072
2404
|
return html + "</tbody></table>";
|
|
2073
2405
|
};
|
|
2074
2406
|
}
|
|
2075
2407
|
};
|
|
2076
2408
|
|
|
2077
2409
|
_proto.countEpochsInRegion = function countEpochsInRegion(region) {
|
|
2078
|
-
var
|
|
2410
|
+
var _this7 = this,
|
|
2411
|
+
$$ = this,
|
|
2079
2412
|
target = $$.data.targets[0],
|
|
2080
2413
|
total = target.values.reduce(function (accumulator, currentValue) {
|
|
2414
|
+
_newArrowCheck(this, _this7);
|
|
2415
|
+
|
|
2081
2416
|
return accumulator + +currentValue.epochs;
|
|
2082
|
-
}, 0),
|
|
2417
|
+
}.bind(this), 0),
|
|
2083
2418
|
value = target.values.reduce(function (accumulator, currentValue) {
|
|
2419
|
+
_newArrowCheck(this, _this7);
|
|
2420
|
+
|
|
2084
2421
|
if (pointInRegion(currentValue, region)) {
|
|
2085
2422
|
return accumulator + +currentValue.epochs;
|
|
2086
2423
|
}
|
|
2087
2424
|
|
|
2088
2425
|
return accumulator;
|
|
2089
|
-
}, 0);
|
|
2426
|
+
}.bind(this), 0);
|
|
2427
|
+
|
|
2090
2428
|
return {
|
|
2091
2429
|
value: value,
|
|
2092
2430
|
percentage: value !== 0 ? +(value / total * 100).toFixed(1) : 0
|