billboard.js 2.2.5 → 2.2.7
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/CHANGELOG.md +14 -0
- package/dist/billboard.css +1 -1
- package/dist/billboard.esm.js +384 -387
- package/dist/billboard.js +3008 -3656
- package/dist/billboard.js.map +1 -0
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +17963 -14767
- package/dist/billboard.pkgd.min.js +2 -2
- package/dist/package.json +1 -0
- package/dist/plugin/billboardjs-plugin-bubblecompare.esm.js +14 -21
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +30 -45
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.esm.js +31 -39
- package/dist/plugin/billboardjs-plugin-stanford.js +281 -345
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.esm.js +20 -28
- package/dist/plugin/billboardjs-plugin-textoverlap.js +243 -291
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- 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/package.json +16 -16
- package/src/ChartInternal/data/data.ts +3 -2
- package/src/ChartInternal/internals/redraw.ts +7 -6
- package/src/ChartInternal/internals/tooltip.ts +9 -9
- package/src/ChartInternal/shape/arc.ts +4 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 2.2.
|
|
8
|
+
* @version 2.2.7
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -74,8 +74,9 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
|
|
|
74
74
|
/******/ // The require function
|
|
75
75
|
/******/ function __webpack_require__(moduleId) {
|
|
76
76
|
/******/ // Check if module is in cache
|
|
77
|
-
/******/
|
|
78
|
-
/******/
|
|
77
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
78
|
+
/******/ if (cachedModule !== undefined) {
|
|
79
|
+
/******/ return cachedModule.exports;
|
|
79
80
|
/******/ }
|
|
80
81
|
/******/ // Create a new module (and put it into the cache)
|
|
81
82
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
@@ -124,16 +125,14 @@ function _assertThisInitialized(self) {
|
|
|
124
125
|
if (self === void 0) {
|
|
125
126
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
126
127
|
}
|
|
127
|
-
|
|
128
128
|
return self;
|
|
129
129
|
}
|
|
130
130
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
131
131
|
function _setPrototypeOf(o, p) {
|
|
132
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
132
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
133
133
|
o.__proto__ = p;
|
|
134
134
|
return o;
|
|
135
135
|
};
|
|
136
|
-
|
|
137
136
|
return _setPrototypeOf(o, p);
|
|
138
137
|
}
|
|
139
138
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
@@ -154,7 +153,6 @@ var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webp
|
|
|
154
153
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
155
154
|
* billboard.js project is licensed under the MIT license
|
|
156
155
|
*/
|
|
157
|
-
|
|
158
156
|
/**
|
|
159
157
|
* CSS class names definition
|
|
160
158
|
* @private
|
|
@@ -258,8 +256,39 @@ var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webp
|
|
|
258
256
|
INCLUDED: "_included_",
|
|
259
257
|
TextOverlapping: "text-overlapping"
|
|
260
258
|
});
|
|
259
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
260
|
+
function _typeof(obj) {
|
|
261
|
+
"@babel/helpers - typeof";
|
|
262
|
+
|
|
263
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
264
|
+
return typeof obj;
|
|
265
|
+
} : function (obj) {
|
|
266
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
267
|
+
}, _typeof(obj);
|
|
268
|
+
}
|
|
269
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
270
|
+
|
|
271
|
+
function _toPrimitive(input, hint) {
|
|
272
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
273
|
+
var prim = input[Symbol.toPrimitive];
|
|
274
|
+
if (prim !== undefined) {
|
|
275
|
+
var res = prim.call(input, hint || "default");
|
|
276
|
+
if (_typeof(res) !== "object") return res;
|
|
277
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
278
|
+
}
|
|
279
|
+
return (hint === "string" ? String : Number)(input);
|
|
280
|
+
}
|
|
281
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
function _toPropertyKey(arg) {
|
|
285
|
+
var key = _toPrimitive(arg, "string");
|
|
286
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
287
|
+
}
|
|
261
288
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
289
|
+
|
|
262
290
|
function _defineProperty(obj, key, value) {
|
|
291
|
+
key = _toPropertyKey(key);
|
|
263
292
|
if (key in obj) {
|
|
264
293
|
Object.defineProperty(obj, key, {
|
|
265
294
|
value: value,
|
|
@@ -270,7 +299,6 @@ function _defineProperty(obj, key, value) {
|
|
|
270
299
|
} else {
|
|
271
300
|
obj[key] = value;
|
|
272
301
|
}
|
|
273
|
-
|
|
274
302
|
return obj;
|
|
275
303
|
}
|
|
276
304
|
// EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
|
|
@@ -282,28 +310,22 @@ var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webp
|
|
|
282
310
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
283
311
|
* billboard.js project is licensed under the MIT license
|
|
284
312
|
*/
|
|
285
|
-
|
|
286
313
|
/**
|
|
287
314
|
* Window object
|
|
288
315
|
* @private
|
|
289
316
|
*/
|
|
290
|
-
|
|
291
317
|
/* eslint-disable no-new-func, no-undef */
|
|
292
318
|
|
|
293
|
-
|
|
294
319
|
var win = function () {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}(),
|
|
298
|
-
|
|
320
|
+
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;
|
|
321
|
+
return root || Function("return this")();
|
|
322
|
+
}(),
|
|
323
|
+
doc = win && win.document;
|
|
299
324
|
/* eslint-enable no-new-func, no-undef */
|
|
300
325
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
301
326
|
|
|
302
|
-
|
|
303
327
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
304
|
-
|
|
305
|
-
function _objectSpread(target) { for (var source, i = 1; i < arguments.length; i++) source = arguments[i] == null ? {} : arguments[i], i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); return target; }
|
|
306
|
-
|
|
328
|
+
function _objectSpread(target) { for (var source, i = 1; i < arguments.length; i++) source = null == arguments[i] ? {} : arguments[i], i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); return target; }
|
|
307
329
|
/**
|
|
308
330
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
309
331
|
* billboard.js project is licensed under the MIT license
|
|
@@ -314,53 +336,51 @@ function _objectSpread(target) { for (var source, i = 1; i < arguments.length; i
|
|
|
314
336
|
|
|
315
337
|
|
|
316
338
|
|
|
317
|
-
|
|
318
339
|
var isValue = function (v) {
|
|
319
|
-
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
},
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
},
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
},
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
};
|
|
363
|
-
|
|
340
|
+
return v || v === 0;
|
|
341
|
+
},
|
|
342
|
+
isFunction = function (v) {
|
|
343
|
+
return typeof v === "function";
|
|
344
|
+
},
|
|
345
|
+
isString = function (v) {
|
|
346
|
+
return typeof v === "string";
|
|
347
|
+
},
|
|
348
|
+
isNumber = function (v) {
|
|
349
|
+
return typeof v === "number";
|
|
350
|
+
},
|
|
351
|
+
isUndefined = function (v) {
|
|
352
|
+
return typeof v === "undefined";
|
|
353
|
+
},
|
|
354
|
+
isDefined = function (v) {
|
|
355
|
+
return typeof v !== "undefined";
|
|
356
|
+
},
|
|
357
|
+
isboolean = function (v) {
|
|
358
|
+
return typeof v === "boolean";
|
|
359
|
+
},
|
|
360
|
+
ceil10 = function (v) {
|
|
361
|
+
return Math.ceil(v / 10) * 10;
|
|
362
|
+
},
|
|
363
|
+
asHalfPixel = function (n) {
|
|
364
|
+
return Math.ceil(n) + .5;
|
|
365
|
+
},
|
|
366
|
+
diffDomain = function (d) {
|
|
367
|
+
return d[1] - d[0];
|
|
368
|
+
},
|
|
369
|
+
isObjectType = function (v) {
|
|
370
|
+
return typeof v === "object";
|
|
371
|
+
},
|
|
372
|
+
isEmpty = function (o) {
|
|
373
|
+
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
374
|
+
},
|
|
375
|
+
notEmpty = function (o) {
|
|
376
|
+
return !isEmpty(o);
|
|
377
|
+
},
|
|
378
|
+
isArray = function (arr) {
|
|
379
|
+
return Array.isArray(arr);
|
|
380
|
+
},
|
|
381
|
+
isObject = function (obj) {
|
|
382
|
+
return obj && !obj.nodeType && isObjectType(obj) && !isArray(obj);
|
|
383
|
+
};
|
|
364
384
|
/**
|
|
365
385
|
* Get specified key value from object
|
|
366
386
|
* If default value is given, will return if given key value not found
|
|
@@ -373,6 +393,7 @@ var isValue = function (v) {
|
|
|
373
393
|
function getOption(options, key, defaultValue) {
|
|
374
394
|
return isDefined(options[key]) ? options[key] : defaultValue;
|
|
375
395
|
}
|
|
396
|
+
|
|
376
397
|
/**
|
|
377
398
|
* Check if value exist in the given object
|
|
378
399
|
* @param {object} dict Target object to be checked
|
|
@@ -380,14 +401,13 @@ function getOption(options, key, defaultValue) {
|
|
|
380
401
|
* @returns {boolean}
|
|
381
402
|
* @private
|
|
382
403
|
*/
|
|
383
|
-
|
|
384
|
-
|
|
385
404
|
function hasValue(dict, value) {
|
|
386
405
|
var found = !1;
|
|
387
406
|
return Object.keys(dict).forEach(function (key) {
|
|
388
407
|
return dict[key] === value && (found = !0);
|
|
389
408
|
}), found;
|
|
390
409
|
}
|
|
410
|
+
|
|
391
411
|
/**
|
|
392
412
|
* Call function with arguments
|
|
393
413
|
* @param {Function} fn Function to be called
|
|
@@ -395,42 +415,37 @@ function hasValue(dict, value) {
|
|
|
395
415
|
* @returns {boolean} true: fn is function, false: fn is not function
|
|
396
416
|
* @private
|
|
397
417
|
*/
|
|
398
|
-
|
|
399
|
-
|
|
400
418
|
function callFn(fn) {
|
|
401
419
|
for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
|
|
402
|
-
|
|
403
420
|
return isFn && fn.call.apply(fn, args), isFn;
|
|
404
421
|
}
|
|
422
|
+
|
|
405
423
|
/**
|
|
406
424
|
* Call function after all transitions ends
|
|
407
425
|
* @param {d3.transition} transition Transition
|
|
408
426
|
* @param {Fucntion} cb Callback function
|
|
409
427
|
* @private
|
|
410
428
|
*/
|
|
411
|
-
|
|
412
|
-
|
|
413
429
|
function endall(transition, cb) {
|
|
414
430
|
var n = 0;
|
|
415
431
|
transition.each(function () {
|
|
416
432
|
return ++n;
|
|
417
433
|
}).on("end", function () {
|
|
418
434
|
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
|
|
419
|
-
|
|
420
435
|
--n || cb.apply.apply(cb, [this].concat(args));
|
|
421
436
|
});
|
|
422
437
|
}
|
|
438
|
+
|
|
423
439
|
/**
|
|
424
440
|
* Replace tag sign to html entity
|
|
425
441
|
* @param {string} str Target string value
|
|
426
442
|
* @returns {string}
|
|
427
443
|
* @private
|
|
428
444
|
*/
|
|
429
|
-
|
|
430
|
-
|
|
431
445
|
function sanitise(str) {
|
|
432
446
|
return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
|
433
447
|
}
|
|
448
|
+
|
|
434
449
|
/**
|
|
435
450
|
* Set text value. If there's multiline add nodes.
|
|
436
451
|
* @param {d3Selection} node Text node
|
|
@@ -439,31 +454,27 @@ function sanitise(str) {
|
|
|
439
454
|
* @param {boolean} toMiddle To be alingned vertically middle
|
|
440
455
|
* @private
|
|
441
456
|
*/
|
|
442
|
-
|
|
443
|
-
|
|
444
457
|
function setTextValue(node, text, dy, toMiddle) {
|
|
445
458
|
if (dy === void 0 && (dy = [-1, 1]), toMiddle === void 0 && (toMiddle = !1), node && isString(text)) if (text.indexOf("\n") === -1) node.text(text);else {
|
|
446
459
|
var diff = [node.text(), text].map(function (v) {
|
|
447
460
|
return v.replace(/[\s\n]/g, "");
|
|
448
461
|
});
|
|
449
|
-
|
|
450
462
|
if (diff[0] !== diff[1]) {
|
|
451
463
|
var multiline = text.split("\n"),
|
|
452
|
-
|
|
464
|
+
len = toMiddle ? multiline.length - 1 : 1;
|
|
453
465
|
node.html(""), multiline.forEach(function (v, i) {
|
|
454
466
|
node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
|
455
467
|
});
|
|
456
468
|
}
|
|
457
469
|
}
|
|
458
470
|
}
|
|
471
|
+
|
|
459
472
|
/**
|
|
460
473
|
* Substitution of SVGPathSeg API polyfill
|
|
461
474
|
* @param {SVGGraphicsElement} path Target svg element
|
|
462
475
|
* @returns {Array}
|
|
463
476
|
* @private
|
|
464
477
|
*/
|
|
465
|
-
|
|
466
|
-
|
|
467
478
|
function getRectSegList(path) {
|
|
468
479
|
/*
|
|
469
480
|
* seg1 ---------- seg2
|
|
@@ -473,45 +484,45 @@ function getRectSegList(path) {
|
|
|
473
484
|
* seg0 ---------- seg3
|
|
474
485
|
* */
|
|
475
486
|
var _path$getBBox = path.getBBox(),
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
487
|
+
x = _path$getBBox.x,
|
|
488
|
+
y = _path$getBBox.y,
|
|
489
|
+
width = _path$getBBox.width,
|
|
490
|
+
height = _path$getBBox.height;
|
|
481
491
|
return [{
|
|
482
492
|
x: x,
|
|
483
493
|
y: y + height
|
|
484
|
-
},
|
|
494
|
+
},
|
|
495
|
+
// seg0
|
|
485
496
|
{
|
|
486
497
|
x: x,
|
|
487
498
|
y: y
|
|
488
|
-
},
|
|
499
|
+
},
|
|
500
|
+
// seg1
|
|
489
501
|
{
|
|
490
502
|
x: x + width,
|
|
491
503
|
y: y
|
|
492
|
-
},
|
|
504
|
+
},
|
|
505
|
+
// seg2
|
|
493
506
|
{
|
|
494
507
|
x: x + width,
|
|
495
508
|
y: y + height
|
|
496
509
|
} // seg3
|
|
497
510
|
];
|
|
498
511
|
}
|
|
512
|
+
|
|
499
513
|
/**
|
|
500
514
|
* Get svg bounding path box dimension
|
|
501
515
|
* @param {SVGGraphicsElement} path Target svg element
|
|
502
516
|
* @returns {object}
|
|
503
517
|
* @private
|
|
504
518
|
*/
|
|
505
|
-
|
|
506
|
-
|
|
507
519
|
function getPathBox(path) {
|
|
508
520
|
var _path$getBoundingClie = path.getBoundingClientRect(),
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
521
|
+
width = _path$getBoundingClie.width,
|
|
522
|
+
height = _path$getBoundingClie.height,
|
|
523
|
+
items = getRectSegList(path),
|
|
524
|
+
x = items[0].x,
|
|
525
|
+
y = Math.min(items[0].y, items[1].y);
|
|
515
526
|
return {
|
|
516
527
|
x: x,
|
|
517
528
|
y: y,
|
|
@@ -519,6 +530,7 @@ function getPathBox(path) {
|
|
|
519
530
|
height: height
|
|
520
531
|
};
|
|
521
532
|
}
|
|
533
|
+
|
|
522
534
|
/**
|
|
523
535
|
* Return brush selection array
|
|
524
536
|
* @param {object} {} Selection object
|
|
@@ -526,15 +538,14 @@ function getPathBox(path) {
|
|
|
526
538
|
* @returns {d3.brushSelection}
|
|
527
539
|
* @private
|
|
528
540
|
*/
|
|
529
|
-
|
|
530
|
-
|
|
531
541
|
function getBrushSelection(_ref) {
|
|
532
542
|
var selection,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
543
|
+
$el = _ref.$el,
|
|
544
|
+
event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.event,
|
|
545
|
+
main = $el.subchart.main || $el.main;
|
|
536
546
|
return event && event.type === "brush" ? selection = event.selection : main && (selection = main.select("." + classes.brush).node()) && (selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection)), selection;
|
|
537
547
|
}
|
|
548
|
+
|
|
538
549
|
/**
|
|
539
550
|
* Get boundingClientRect.
|
|
540
551
|
* Cache the evaluated value once it was called.
|
|
@@ -542,25 +553,23 @@ function getBrushSelection(_ref) {
|
|
|
542
553
|
* @returns {object}
|
|
543
554
|
* @private
|
|
544
555
|
*/
|
|
545
|
-
|
|
546
|
-
|
|
547
556
|
function getBoundingRect(node) {
|
|
548
557
|
var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
549
558
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
550
559
|
}
|
|
560
|
+
|
|
551
561
|
/**
|
|
552
562
|
* Retrun random number
|
|
553
563
|
* @param {boolean} asStr Convert returned value as string
|
|
554
564
|
* @returns {number|string}
|
|
555
565
|
* @private
|
|
556
566
|
*/
|
|
557
|
-
|
|
558
|
-
|
|
559
567
|
function getRandom(asStr) {
|
|
560
568
|
asStr === void 0 && (asStr = !0);
|
|
561
569
|
var rand = Math.random();
|
|
562
570
|
return asStr ? rand + "" : rand;
|
|
563
571
|
}
|
|
572
|
+
|
|
564
573
|
/**
|
|
565
574
|
* Find index based on binary search
|
|
566
575
|
* @param {Array} arr Data array
|
|
@@ -571,64 +580,50 @@ function getRandom(asStr) {
|
|
|
571
580
|
* @returns {number} Index number
|
|
572
581
|
* @private
|
|
573
582
|
*/
|
|
574
|
-
|
|
575
|
-
|
|
576
583
|
function findIndex(arr, v, start, end, isRotated) {
|
|
577
584
|
if (start > end) return -1;
|
|
578
585
|
var mid = Math.floor((start + end) / 2),
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
586
|
+
_arr$mid = arr[mid],
|
|
587
|
+
x = _arr$mid.x,
|
|
588
|
+
_arr$mid$w = _arr$mid.w,
|
|
589
|
+
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
583
590
|
return isRotated && (x = arr[mid].y, w = arr[mid].h), v >= x && v <= x + w ? mid : v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
|
|
584
591
|
}
|
|
592
|
+
|
|
585
593
|
/**
|
|
586
594
|
* Check if brush is empty
|
|
587
595
|
* @param {object} ctx Bursh context
|
|
588
596
|
* @returns {boolean}
|
|
589
597
|
* @private
|
|
590
598
|
*/
|
|
591
|
-
|
|
592
|
-
|
|
593
599
|
function brushEmpty(ctx) {
|
|
594
600
|
var selection = getBrushSelection(ctx);
|
|
595
601
|
return !selection || selection[0] === selection[1];
|
|
596
602
|
}
|
|
603
|
+
|
|
597
604
|
/**
|
|
598
605
|
* Deep copy object
|
|
599
606
|
* @param {object} objectN Source object
|
|
600
607
|
* @returns {object} Cloned object
|
|
601
608
|
* @private
|
|
602
609
|
*/
|
|
603
|
-
|
|
604
|
-
|
|
605
610
|
function deepClone() {
|
|
606
|
-
|
|
607
|
-
function clone() {
|
|
608
|
-
return _clone.apply(this, arguments);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
return clone.toString = function () {
|
|
612
|
-
return _clone.toString();
|
|
613
|
-
}, clone;
|
|
614
|
-
}(function (v) {
|
|
611
|
+
var clone = function (v) {
|
|
615
612
|
if (isObject(v) && v.constructor) {
|
|
616
613
|
var r = new v.constructor();
|
|
617
|
-
|
|
618
614
|
for (var k in v) r[k] = clone(v[k]);
|
|
619
|
-
|
|
620
615
|
return r;
|
|
621
616
|
}
|
|
622
|
-
|
|
623
617
|
return v;
|
|
624
|
-
}
|
|
625
|
-
|
|
618
|
+
};
|
|
619
|
+
for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) objectN[_key3] = arguments[_key3];
|
|
626
620
|
return objectN.map(function (v) {
|
|
627
621
|
return clone(v);
|
|
628
622
|
}).reduce(function (a, c) {
|
|
629
623
|
return _objectSpread(_objectSpread({}, a), c);
|
|
630
624
|
});
|
|
631
625
|
}
|
|
626
|
+
|
|
632
627
|
/**
|
|
633
628
|
* Extend target from source object
|
|
634
629
|
* @param {object} target Target object
|
|
@@ -636,38 +631,32 @@ function deepClone() {
|
|
|
636
631
|
* @returns {object}
|
|
637
632
|
* @private
|
|
638
633
|
*/
|
|
639
|
-
|
|
640
|
-
|
|
641
634
|
function extend(target, source) {
|
|
642
635
|
// exclude name with only numbers
|
|
643
636
|
for (var p in target === void 0 && (target = {}), isArray(source) && source.forEach(function (v) {
|
|
644
637
|
return extend(target, v);
|
|
645
638
|
}), source) /^\d+$/.test(p) || p in target || (target[p] = source[p]);
|
|
646
|
-
|
|
647
639
|
return target;
|
|
648
640
|
}
|
|
641
|
+
|
|
649
642
|
/**
|
|
650
643
|
* Return first letter capitalized
|
|
651
644
|
* @param {string} str Target string
|
|
652
645
|
* @returns {string} capitalized string
|
|
653
646
|
* @private
|
|
654
647
|
*/
|
|
655
|
-
|
|
656
|
-
|
|
657
648
|
var capitalize = function (str) {
|
|
658
|
-
|
|
659
|
-
},
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
};
|
|
649
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
650
|
+
},
|
|
651
|
+
toArray = function (v) {
|
|
652
|
+
return [].slice.call(v);
|
|
653
|
+
};
|
|
663
654
|
/**
|
|
664
655
|
* Convert to array
|
|
665
656
|
* @param {object} v Target to be converted
|
|
666
657
|
* @returns {Array}
|
|
667
658
|
* @private
|
|
668
659
|
*/
|
|
669
|
-
|
|
670
|
-
|
|
671
660
|
/**
|
|
672
661
|
* Get css rules for specified stylesheets
|
|
673
662
|
* @param {Array} styleSheets The stylesheets to get the rules from
|
|
@@ -684,17 +673,16 @@ function getCssRules(styleSheets) {
|
|
|
684
673
|
}
|
|
685
674
|
}), rules;
|
|
686
675
|
}
|
|
676
|
+
|
|
687
677
|
/**
|
|
688
678
|
* Gets the SVGMatrix of an SVGGElement
|
|
689
679
|
* @param {SVGElement} node Node element
|
|
690
680
|
* @returns {SVGMatrix} matrix
|
|
691
681
|
* @private
|
|
692
682
|
*/
|
|
693
|
-
|
|
694
|
-
|
|
695
683
|
var getTranslation = function (node) {
|
|
696
684
|
var transform = node ? node.transform : null,
|
|
697
|
-
|
|
685
|
+
baseVal = transform && transform.baseVal;
|
|
698
686
|
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
699
687
|
a: 0,
|
|
700
688
|
b: 0,
|
|
@@ -704,36 +692,35 @@ var getTranslation = function (node) {
|
|
|
704
692
|
f: 0
|
|
705
693
|
};
|
|
706
694
|
};
|
|
695
|
+
|
|
707
696
|
/**
|
|
708
697
|
* Get unique value from array
|
|
709
698
|
* @param {Array} data Source data
|
|
710
699
|
* @returns {Array} Unique array value
|
|
711
700
|
* @private
|
|
712
701
|
*/
|
|
713
|
-
|
|
714
|
-
|
|
715
702
|
function getUnique(data) {
|
|
716
703
|
var isDate = data[0] instanceof Date,
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
704
|
+
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
705
|
+
return self.indexOf(v) === i;
|
|
706
|
+
});
|
|
720
707
|
return isDate ? d.map(function (v) {
|
|
721
708
|
return new Date(v);
|
|
722
709
|
}) : d;
|
|
723
710
|
}
|
|
711
|
+
|
|
724
712
|
/**
|
|
725
713
|
* Merge array
|
|
726
714
|
* @param {Array} arr Source array
|
|
727
715
|
* @returns {Array}
|
|
728
716
|
* @private
|
|
729
717
|
*/
|
|
730
|
-
|
|
731
|
-
|
|
732
718
|
function mergeArray(arr) {
|
|
733
719
|
return arr && arr.length ? arr.reduce(function (p, c) {
|
|
734
720
|
return p.concat(c);
|
|
735
721
|
}) : [];
|
|
736
722
|
}
|
|
723
|
+
|
|
737
724
|
/**
|
|
738
725
|
* Merge object returning new object
|
|
739
726
|
* @param {object} target Target object
|
|
@@ -741,11 +728,8 @@ function mergeArray(arr) {
|
|
|
741
728
|
* @returns {object} merged target object
|
|
742
729
|
* @private
|
|
743
730
|
*/
|
|
744
|
-
|
|
745
|
-
|
|
746
731
|
function mergeObj(target) {
|
|
747
732
|
for (var _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) objectN[_key4 - 1] = arguments[_key4];
|
|
748
|
-
|
|
749
733
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
|
|
750
734
|
var source = objectN.shift();
|
|
751
735
|
return isObject(target) && isObject(source) && Object.keys(source).forEach(function (key) {
|
|
@@ -753,6 +737,7 @@ function mergeObj(target) {
|
|
|
753
737
|
isObject(value) ? (!target[key] && (target[key] = {}), target[key] = mergeObj(target[key], value)) : target[key] = isArray(value) ? value.concat() : value;
|
|
754
738
|
}), mergeObj.apply(void 0, [target].concat(objectN));
|
|
755
739
|
}
|
|
740
|
+
|
|
756
741
|
/**
|
|
757
742
|
* Sort value
|
|
758
743
|
* @param {Array} data value to be sorted
|
|
@@ -760,8 +745,6 @@ function mergeObj(target) {
|
|
|
760
745
|
* @returns {number|string|Date} sorted date
|
|
761
746
|
* @private
|
|
762
747
|
*/
|
|
763
|
-
|
|
764
|
-
|
|
765
748
|
function sortValue(data, isAsc) {
|
|
766
749
|
isAsc === void 0 && (isAsc = !0);
|
|
767
750
|
var fn;
|
|
@@ -775,6 +758,7 @@ function sortValue(data, isAsc) {
|
|
|
775
758
|
return a > b && -1 || a < b && 1 || a === b && 0;
|
|
776
759
|
}), data.concat().sort(fn);
|
|
777
760
|
}
|
|
761
|
+
|
|
778
762
|
/**
|
|
779
763
|
* Get min/max value
|
|
780
764
|
* @param {string} type 'min' or 'max'
|
|
@@ -782,14 +766,13 @@ function sortValue(data, isAsc) {
|
|
|
782
766
|
* @returns {number|Date|undefined}
|
|
783
767
|
* @private
|
|
784
768
|
*/
|
|
785
|
-
|
|
786
|
-
|
|
787
769
|
function getMinMax(type, data) {
|
|
788
770
|
var res = data.filter(function (v) {
|
|
789
771
|
return notEmpty(v);
|
|
790
772
|
});
|
|
791
773
|
return res.length ? isNumber(res[0]) ? res = Math[type].apply(Math, res) : res[0] instanceof Date && (res = sortValue(res, type === "min")[0]) : res = undefined, res;
|
|
792
774
|
}
|
|
775
|
+
|
|
793
776
|
/**
|
|
794
777
|
* Get range
|
|
795
778
|
* @param {number} start Start number
|
|
@@ -798,66 +781,61 @@ function getMinMax(type, data) {
|
|
|
798
781
|
* @returns {Array}
|
|
799
782
|
* @private
|
|
800
783
|
*/
|
|
801
|
-
|
|
802
|
-
|
|
803
784
|
var getRange = function (start, end, step) {
|
|
804
|
-
|
|
805
|
-
|
|
785
|
+
step === void 0 && (step = 1);
|
|
786
|
+
var res = [],
|
|
806
787
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
clientY: 0
|
|
822
|
-
};
|
|
823
|
-
};
|
|
824
|
-
|
|
825
|
-
try {
|
|
826
|
-
return new MouseEvent("t"), function (el, eventType, params) {
|
|
827
|
-
params === void 0 && (params = getParams()), el.dispatchEvent(new MouseEvent(eventType, params));
|
|
828
|
-
};
|
|
829
|
-
} catch (e) {
|
|
830
|
-
// Polyfills DOM4 MouseEvent
|
|
831
|
-
return function (el, eventType, params) {
|
|
832
|
-
params === void 0 && (params = getParams());
|
|
833
|
-
var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
834
|
-
|
|
835
|
-
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
|
|
836
|
-
params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
|
788
|
+
for (var i = start; i < n; i++) res.push(start + i * step);
|
|
789
|
+
return res;
|
|
790
|
+
},
|
|
791
|
+
emulateEvent = {
|
|
792
|
+
mouse: function () {
|
|
793
|
+
var getParams = function () {
|
|
794
|
+
return {
|
|
795
|
+
bubbles: !1,
|
|
796
|
+
cancelable: !1,
|
|
797
|
+
screenX: 0,
|
|
798
|
+
screenY: 0,
|
|
799
|
+
clientX: 0,
|
|
800
|
+
clientY: 0
|
|
801
|
+
};
|
|
837
802
|
};
|
|
803
|
+
try {
|
|
804
|
+
return new MouseEvent("t"), function (el, eventType, params) {
|
|
805
|
+
params === void 0 && (params = getParams()), el.dispatchEvent(new MouseEvent(eventType, params));
|
|
806
|
+
};
|
|
807
|
+
} catch (e) {
|
|
808
|
+
// Polyfills DOM4 MouseEvent
|
|
809
|
+
return function (el, eventType, params) {
|
|
810
|
+
params === void 0 && (params = getParams());
|
|
811
|
+
var mouseEvent = doc.createEvent("MouseEvent");
|
|
812
|
+
|
|
813
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
814
|
+
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
815
|
+
// the event's mouse click count
|
|
816
|
+
params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
}(),
|
|
820
|
+
touch: function touch(el, eventType, params) {
|
|
821
|
+
var touchObj = new Touch(mergeObj({
|
|
822
|
+
identifier: Date.now(),
|
|
823
|
+
target: el,
|
|
824
|
+
radiusX: 2.5,
|
|
825
|
+
radiusY: 2.5,
|
|
826
|
+
rotationAngle: 10,
|
|
827
|
+
force: .5
|
|
828
|
+
}, params));
|
|
829
|
+
el.dispatchEvent(new TouchEvent(eventType, {
|
|
830
|
+
cancelable: !0,
|
|
831
|
+
bubbles: !0,
|
|
832
|
+
shiftKey: !0,
|
|
833
|
+
touches: [touchObj],
|
|
834
|
+
targetTouches: [],
|
|
835
|
+
changedTouches: [touchObj]
|
|
836
|
+
}));
|
|
838
837
|
}
|
|
839
|
-
}
|
|
840
|
-
touch: function touch(el, eventType, params) {
|
|
841
|
-
var touchObj = new Touch(mergeObj({
|
|
842
|
-
identifier: Date.now(),
|
|
843
|
-
target: el,
|
|
844
|
-
radiusX: 2.5,
|
|
845
|
-
radiusY: 2.5,
|
|
846
|
-
rotationAngle: 10,
|
|
847
|
-
force: .5
|
|
848
|
-
}, params));
|
|
849
|
-
el.dispatchEvent(new TouchEvent(eventType, {
|
|
850
|
-
cancelable: !0,
|
|
851
|
-
bubbles: !0,
|
|
852
|
-
shiftKey: !0,
|
|
853
|
-
touches: [touchObj],
|
|
854
|
-
targetTouches: [],
|
|
855
|
-
changedTouches: [touchObj]
|
|
856
|
-
}));
|
|
857
|
-
}
|
|
858
|
-
}; // emulate event
|
|
859
|
-
|
|
860
|
-
|
|
838
|
+
}; // emulate event
|
|
861
839
|
/**
|
|
862
840
|
* Process the template & return bound string
|
|
863
841
|
* @param {string} tpl Template string
|
|
@@ -867,11 +845,10 @@ var getRange = function (start, end, step) {
|
|
|
867
845
|
*/
|
|
868
846
|
function tplProcess(tpl, data) {
|
|
869
847
|
var res = tpl;
|
|
870
|
-
|
|
871
848
|
for (var x in data) res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
|
872
|
-
|
|
873
849
|
return res;
|
|
874
850
|
}
|
|
851
|
+
|
|
875
852
|
/**
|
|
876
853
|
* Get parsed date value
|
|
877
854
|
* (It must be called in 'ChartInternal' context)
|
|
@@ -879,27 +856,25 @@ function tplProcess(tpl, data) {
|
|
|
879
856
|
* @returns {Date}
|
|
880
857
|
* @private
|
|
881
858
|
*/
|
|
882
|
-
|
|
883
|
-
|
|
884
859
|
function parseDate(date) {
|
|
885
860
|
var parsedDate;
|
|
886
861
|
if (date instanceof Date) parsedDate = date;else if (isString(date)) {
|
|
887
862
|
var config = this.config,
|
|
888
|
-
|
|
863
|
+
format = this.format;
|
|
889
864
|
parsedDate = format.dataTime(config.data_xFormat)(date);
|
|
890
865
|
} else isNumber(date) && !isNaN(date) && (parsedDate = new Date(+date));
|
|
891
866
|
return (!parsedDate || isNaN(+parsedDate)) && console && console.error && console.error("Failed to parse x '" + date + "' to Date object"), parsedDate;
|
|
892
867
|
}
|
|
868
|
+
|
|
893
869
|
/**
|
|
894
870
|
* Return if the current doc is visible or not
|
|
895
871
|
* @returns {boolean}
|
|
896
872
|
* @private
|
|
897
873
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
874
|
function isTabVisible() {
|
|
901
875
|
return !doc.hidden;
|
|
902
876
|
}
|
|
877
|
+
|
|
903
878
|
/**
|
|
904
879
|
* Get the current input type
|
|
905
880
|
* @param {boolean} mouse Config value: interaction.inputType.mouse
|
|
@@ -907,20 +882,17 @@ function isTabVisible() {
|
|
|
907
882
|
* @returns {string} "mouse" | "touch" | null
|
|
908
883
|
* @private
|
|
909
884
|
*/
|
|
910
|
-
|
|
911
|
-
|
|
912
885
|
function convertInputType(mouse, touch) {
|
|
913
|
-
var isMobile = !1;
|
|
886
|
+
var isMobile = !1;
|
|
914
887
|
|
|
888
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#Mobile_Tablet_or_Desktop
|
|
915
889
|
if (/Mobi/.test(win.navigator.userAgent) && touch) {
|
|
916
890
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
917
891
|
var hasTouchPoints = win.navigator && "maxTouchPoints" in win.navigator && win.navigator.maxTouchPoints > 0,
|
|
918
|
-
|
|
892
|
+
hasTouch = "ontouchmove" in win || win.DocumentTouch && doc instanceof win.DocumentTouch; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
919
893
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
920
|
-
|
|
921
894
|
isMobile = hasTouchPoints || hasTouch;
|
|
922
895
|
}
|
|
923
|
-
|
|
924
896
|
var hasMouse = !(!mouse || isMobile) && "onmouseover" in win;
|
|
925
897
|
return hasMouse && "mouse" || isMobile && "touch" || null;
|
|
926
898
|
}
|
|
@@ -930,22 +902,18 @@ function convertInputType(mouse, touch) {
|
|
|
930
902
|
* billboard.js project is licensed under the MIT license
|
|
931
903
|
*/
|
|
932
904
|
|
|
933
|
-
|
|
934
905
|
/**
|
|
935
906
|
* Load configuration option
|
|
936
907
|
* @param {object} config User's generation config value
|
|
937
908
|
* @private
|
|
938
909
|
*/
|
|
939
910
|
function loadConfig(config) {
|
|
940
|
-
var
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
thisConfig = this.config,
|
|
944
|
-
find = function () {
|
|
911
|
+
var thisConfig = this.config;
|
|
912
|
+
var target, keys, read;
|
|
913
|
+
var find = function () {
|
|
945
914
|
var key = keys.shift();
|
|
946
915
|
return key && target && isObjectType(target) && key in target ? (target = target[key], find()) : key ? undefined : target;
|
|
947
916
|
};
|
|
948
|
-
|
|
949
917
|
Object.keys(thisConfig).forEach(function (key) {
|
|
950
918
|
target = config, keys = key.split("_"), read = find(), isDefined(read) && (thisConfig[key] = read);
|
|
951
919
|
});
|
|
@@ -955,12 +923,10 @@ function loadConfig(config) {
|
|
|
955
923
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
956
924
|
* billboard.js project is licensed under the MIT license
|
|
957
925
|
*/
|
|
958
|
-
|
|
959
926
|
/**
|
|
960
927
|
* Base class to generate billboard.js plugin
|
|
961
928
|
* @class Plugin
|
|
962
929
|
*/
|
|
963
|
-
|
|
964
930
|
/**
|
|
965
931
|
* Version info string for plugin
|
|
966
932
|
* @name version
|
|
@@ -979,50 +945,46 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
979
945
|
function Plugin(options) {
|
|
980
946
|
options === void 0 && (options = {}), this.$$ = void 0, this.options = void 0, this.options = options;
|
|
981
947
|
}
|
|
948
|
+
|
|
982
949
|
/**
|
|
983
950
|
* Lifecycle hook for 'beforeInit' phase.
|
|
984
951
|
* @private
|
|
985
952
|
*/
|
|
986
|
-
|
|
987
|
-
|
|
988
953
|
var _proto = Plugin.prototype;
|
|
989
954
|
return _proto.$beforeInit = function $beforeInit() {}
|
|
955
|
+
|
|
990
956
|
/**
|
|
991
957
|
* Lifecycle hook for 'init' phase.
|
|
992
958
|
* @private
|
|
993
|
-
|
|
994
|
-
|
|
959
|
+
*/, _proto.$init = function $init() {}
|
|
960
|
+
|
|
995
961
|
/**
|
|
996
962
|
* Lifecycle hook for 'afterInit' phase.
|
|
997
963
|
* @private
|
|
998
|
-
|
|
999
|
-
|
|
964
|
+
*/, _proto.$afterInit = function $afterInit() {}
|
|
965
|
+
|
|
1000
966
|
/**
|
|
1001
967
|
* Lifecycle hook for 'redraw' phase.
|
|
1002
968
|
* @private
|
|
1003
|
-
|
|
1004
|
-
|
|
969
|
+
*/, _proto.$redraw = function $redraw() {}
|
|
970
|
+
|
|
1005
971
|
/**
|
|
1006
972
|
* Lifecycle hook for 'willDestroy' phase.
|
|
1007
973
|
* @private
|
|
1008
|
-
|
|
1009
|
-
, _proto.$willDestroy = function $willDestroy() {
|
|
974
|
+
*/, _proto.$willDestroy = function $willDestroy() {
|
|
1010
975
|
var _this = this;
|
|
1011
|
-
|
|
1012
976
|
Object.keys(this).forEach(function (key) {
|
|
1013
977
|
_this[key] = null, delete _this[key];
|
|
1014
978
|
});
|
|
1015
979
|
}, Plugin;
|
|
1016
980
|
}();
|
|
1017
|
-
|
|
1018
|
-
Plugin.version = "2.2.4";
|
|
981
|
+
Plugin.version = "2.2.7";
|
|
1019
982
|
|
|
1020
983
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/Options.ts
|
|
1021
984
|
/**
|
|
1022
985
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1023
986
|
* billboard.js project is licensed under the MIT license
|
|
1024
987
|
*/
|
|
1025
|
-
|
|
1026
988
|
/**
|
|
1027
989
|
* Stanford diagram plugin option class
|
|
1028
990
|
* @class StanfordOptions
|
|
@@ -1045,7 +1007,6 @@ var Options = function () {
|
|
|
1045
1007
|
* )
|
|
1046
1008
|
*/
|
|
1047
1009
|
colors: undefined,
|
|
1048
|
-
|
|
1049
1010
|
/**
|
|
1050
1011
|
* Specify the key of epochs values in the data.
|
|
1051
1012
|
* @name epochs
|
|
@@ -1056,7 +1017,6 @@ var Options = function () {
|
|
|
1056
1017
|
* epochs: [ 1, 1, 2, 2, ... ]
|
|
1057
1018
|
*/
|
|
1058
1019
|
epochs: [],
|
|
1059
|
-
|
|
1060
1020
|
/**
|
|
1061
1021
|
* Show additional lines anywhere on the chart.
|
|
1062
1022
|
* - Each line object should consist with following options:
|
|
@@ -1078,7 +1038,6 @@ var Options = function () {
|
|
|
1078
1038
|
* ]
|
|
1079
1039
|
*/
|
|
1080
1040
|
lines: [],
|
|
1081
|
-
|
|
1082
1041
|
/**
|
|
1083
1042
|
* Set scale values
|
|
1084
1043
|
* @name scale
|
|
@@ -1108,7 +1067,6 @@ var Options = function () {
|
|
|
1108
1067
|
scale_max: undefined,
|
|
1109
1068
|
scale_width: 20,
|
|
1110
1069
|
scale_format: undefined,
|
|
1111
|
-
|
|
1112
1070
|
/**
|
|
1113
1071
|
* The padding for color scale element
|
|
1114
1072
|
* @name padding
|
|
@@ -1131,7 +1089,6 @@ var Options = function () {
|
|
|
1131
1089
|
padding_right: 0,
|
|
1132
1090
|
padding_bottom: 0,
|
|
1133
1091
|
padding_left: 0,
|
|
1134
|
-
|
|
1135
1092
|
/**
|
|
1136
1093
|
* Show additional regions anywhere on the chart.
|
|
1137
1094
|
* - Each region object should consist with following options:
|
|
@@ -1167,13 +1124,11 @@ var Options = function () {
|
|
|
1167
1124
|
};
|
|
1168
1125
|
};
|
|
1169
1126
|
|
|
1170
|
-
|
|
1171
1127
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/classes.ts
|
|
1172
1128
|
/**
|
|
1173
1129
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1174
1130
|
* billboard.js project is licensed under the MIT license
|
|
1175
1131
|
*/
|
|
1176
|
-
|
|
1177
1132
|
/**
|
|
1178
1133
|
* CSS class names definition
|
|
1179
1134
|
* @private
|
|
@@ -1193,6 +1148,8 @@ var Options = function () {
|
|
|
1193
1148
|
* @ignore
|
|
1194
1149
|
*/
|
|
1195
1150
|
|
|
1151
|
+
|
|
1152
|
+
|
|
1196
1153
|
/**
|
|
1197
1154
|
* Check if point is in region
|
|
1198
1155
|
* @param {object} point Point
|
|
@@ -1200,25 +1157,24 @@ var Options = function () {
|
|
|
1200
1157
|
* @returns {boolean}
|
|
1201
1158
|
* @private
|
|
1202
1159
|
*/
|
|
1203
|
-
|
|
1204
1160
|
function pointInRegion(point, region) {
|
|
1205
1161
|
// thanks to: http://bl.ocks.org/bycoffe/5575904
|
|
1206
1162
|
// ray-casting algorithm based on
|
|
1207
1163
|
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
|
1208
1164
|
var x = point.x,
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1165
|
+
y = point.value;
|
|
1166
|
+
var inside = !1;
|
|
1212
1167
|
for (var i = 0, j = region.length - 1; i < region.length; j = i++) {
|
|
1213
1168
|
var xi = region[i].x,
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1169
|
+
yi = region[i].y,
|
|
1170
|
+
xj = region[j].x,
|
|
1171
|
+
yj = region[j].y,
|
|
1172
|
+
intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
1173
|
+
intersect && (inside = !inside);
|
|
1218
1174
|
}
|
|
1219
|
-
|
|
1220
1175
|
return inside;
|
|
1221
1176
|
}
|
|
1177
|
+
|
|
1222
1178
|
/**
|
|
1223
1179
|
* Compare epochs
|
|
1224
1180
|
* @param {object} a Target
|
|
@@ -1226,47 +1182,41 @@ function pointInRegion(point, region) {
|
|
|
1226
1182
|
* @returns {number}
|
|
1227
1183
|
* @private
|
|
1228
1184
|
*/
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
1185
|
function compareEpochs(a, b) {
|
|
1232
1186
|
return a.epochs < b.epochs ? -1 : a.epochs > b.epochs ? 1 : 0;
|
|
1233
1187
|
}
|
|
1188
|
+
|
|
1234
1189
|
/**
|
|
1235
1190
|
* Get region area
|
|
1236
1191
|
* @param {Array} points Points
|
|
1237
1192
|
* @returns {number}
|
|
1238
1193
|
* @private
|
|
1239
1194
|
*/
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
1195
|
function getRegionArea(points) {
|
|
1243
1196
|
// thanks to: https://stackoverflow.com/questions/16282330/find-centerpoint-of-polygon-in-javascript
|
|
1244
|
-
for (var point1, point2, area = 0, i = 0, l = points.length, j = l - 1; i < l; j = i, i++) point1 = points[i], point2 = points[j], area += point1.x * point2.y, area -= point1.y * point2.x;
|
|
1245
1197
|
|
|
1198
|
+
for (var point1, point2, area = 0, i = 0, l = points.length, j = l - 1; i < l; j = i, i++) point1 = points[i], point2 = points[j], area += point1.x * point2.y, area -= point1.y * point2.x;
|
|
1246
1199
|
return area /= 2, area;
|
|
1247
1200
|
}
|
|
1201
|
+
|
|
1248
1202
|
/**
|
|
1249
1203
|
* Get centroid
|
|
1250
1204
|
* @param {Array} points Points
|
|
1251
1205
|
* @returns {object}
|
|
1252
1206
|
* @private
|
|
1253
1207
|
*/
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
1208
|
function getCentroid(points) {
|
|
1257
1209
|
for (var f, area = getRegionArea(points), x = 0, y = 0, i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
|
1258
|
-
var
|
|
1259
|
-
|
|
1260
|
-
f =
|
|
1210
|
+
var point1 = points[i],
|
|
1211
|
+
point2 = points[j];
|
|
1212
|
+
f = point1.x * point2.y - point2.x * point1.y, x += (point1.x + point2.x) * f, y += (point1.y + point2.y) * f;
|
|
1261
1213
|
}
|
|
1262
|
-
|
|
1263
1214
|
return f = area * 6, {
|
|
1264
1215
|
x: x / f,
|
|
1265
1216
|
y: y / f
|
|
1266
1217
|
};
|
|
1267
1218
|
}
|
|
1268
1219
|
|
|
1269
|
-
|
|
1270
1220
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/Elements.ts
|
|
1271
1221
|
/**
|
|
1272
1222
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -1275,13 +1225,13 @@ function getCentroid(points) {
|
|
|
1275
1225
|
// @ts-nocheck
|
|
1276
1226
|
|
|
1277
1227
|
|
|
1228
|
+
|
|
1278
1229
|
/**
|
|
1279
1230
|
* Stanford diagram plugin element class
|
|
1280
1231
|
* @class ColorScale
|
|
1281
1232
|
* @param {Stanford} owner Stanford instance
|
|
1282
1233
|
* @private
|
|
1283
1234
|
*/
|
|
1284
|
-
|
|
1285
1235
|
var Elements = /*#__PURE__*/function () {
|
|
1286
1236
|
function Elements(owner) {
|
|
1287
1237
|
this.owner = void 0, this.owner = owner;
|
|
@@ -1289,16 +1239,15 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1289
1239
|
var elements = owner.$$.$el.main.select(".bb-chart").append("g").attr("class", stanford_classes.stanfordElements);
|
|
1290
1240
|
elements.append("g").attr("class", stanford_classes.stanfordLines), elements.append("g").attr("class", stanford_classes.stanfordRegions);
|
|
1291
1241
|
}
|
|
1292
|
-
|
|
1293
1242
|
var _proto = Elements.prototype;
|
|
1294
1243
|
return _proto.updateStanfordLines = function updateStanfordLines(duration) {
|
|
1295
1244
|
var $$ = this.owner.$$,
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1245
|
+
config = $$.config,
|
|
1246
|
+
main = $$.$el.main,
|
|
1247
|
+
isRotated = config.axis_rotated,
|
|
1248
|
+
xvCustom = this.xvCustom.bind($$),
|
|
1249
|
+
yvCustom = this.yvCustom.bind($$),
|
|
1250
|
+
stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
|
|
1302
1251
|
stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove();
|
|
1303
1252
|
// enter
|
|
1304
1253
|
var stanfordLineEnter = stanfordLine.enter().append("g");
|
|
@@ -1315,13 +1264,13 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1315
1264
|
}).transition().style("opacity", "1");
|
|
1316
1265
|
}, _proto.updateStanfordRegions = function updateStanfordRegions(duration) {
|
|
1317
1266
|
var $$ = this.owner.$$,
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1267
|
+
config = $$.config,
|
|
1268
|
+
main = $$.$el.main,
|
|
1269
|
+
isRotated = config.axis_rotated,
|
|
1270
|
+
xvCustom = this.xvCustom.bind($$),
|
|
1271
|
+
yvCustom = this.yvCustom.bind($$),
|
|
1272
|
+
countPointsInRegion = this.owner.countEpochsInRegion.bind($$),
|
|
1273
|
+
stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
|
|
1325
1274
|
stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove();
|
|
1326
1275
|
// enter
|
|
1327
1276
|
var stanfordRegionEnter = stanfordRegion.enter().append("g");
|
|
@@ -1340,31 +1289,28 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1340
1289
|
}).text(function (d) {
|
|
1341
1290
|
if (d.text) {
|
|
1342
1291
|
var _countPointsInRegion = countPointsInRegion(d.points),
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1292
|
+
value = _countPointsInRegion.value,
|
|
1293
|
+
percentage = _countPointsInRegion.percentage;
|
|
1346
1294
|
return d.text(value, percentage);
|
|
1347
1295
|
}
|
|
1348
|
-
|
|
1349
1296
|
return "";
|
|
1350
1297
|
}).attr("text-anchor", "middle").attr("dominant-baseline", "middle").transition().style("opacity", "1");
|
|
1351
1298
|
}, _proto.updateStanfordElements = function updateStanfordElements(duration) {
|
|
1352
1299
|
duration === void 0 && (duration = 0), this.updateStanfordLines(duration), this.updateStanfordRegions(duration);
|
|
1353
1300
|
}, _proto.xvCustom = function xvCustom(d, xyValue) {
|
|
1354
1301
|
var $$ = this,
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1302
|
+
axis = $$.axis,
|
|
1303
|
+
config = $$.config,
|
|
1304
|
+
value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1358
1305
|
return axis.isTimeSeries() ? value = parseDate.call($$, value) : axis.isCategorized() && isString(value) && (value = config.axis_x_categories.indexOf(d.value)), Math.ceil($$.scale.x(value));
|
|
1359
1306
|
}, _proto.yvCustom = function yvCustom(d, xyValue) {
|
|
1360
1307
|
var $$ = this,
|
|
1361
|
-
|
|
1362
|
-
|
|
1308
|
+
yScale = d.axis && d.axis === "y2" ? $$.scale.y2 : $$.scale.y,
|
|
1309
|
+
value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1363
1310
|
return Math.ceil(yScale(value));
|
|
1364
1311
|
}, Elements;
|
|
1365
1312
|
}();
|
|
1366
1313
|
|
|
1367
|
-
|
|
1368
1314
|
// EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
|
|
1369
1315
|
var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(7);
|
|
1370
1316
|
// EXTERNAL MODULE: external {"commonjs":"d3-format","commonjs2":"d3-format","amd":"d3-format","root":"d3"}
|
|
@@ -1379,38 +1325,36 @@ var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __w
|
|
|
1379
1325
|
|
|
1380
1326
|
|
|
1381
1327
|
|
|
1328
|
+
|
|
1382
1329
|
/**
|
|
1383
1330
|
* Stanford diagram plugin color scale class
|
|
1384
1331
|
* @class ColorScale
|
|
1385
1332
|
* @param {Stanford} owner Stanford instance
|
|
1386
1333
|
* @private
|
|
1387
1334
|
*/
|
|
1388
|
-
|
|
1389
1335
|
var ColorScale = /*#__PURE__*/function () {
|
|
1390
1336
|
function ColorScale(owner) {
|
|
1391
1337
|
this.owner = void 0, this.colorScale = void 0, this.owner = owner;
|
|
1392
1338
|
}
|
|
1393
|
-
|
|
1394
1339
|
var _proto = ColorScale.prototype;
|
|
1395
1340
|
return _proto.drawColorScale = function drawColorScale() {
|
|
1396
1341
|
var _this$owner = this.owner,
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
|
|
1342
|
+
$$ = _this$owner.$$,
|
|
1343
|
+
config = _this$owner.config,
|
|
1344
|
+
target = $$.data.targets[0],
|
|
1345
|
+
height = $$.state.height - config.padding_bottom - config.padding_top,
|
|
1346
|
+
barWidth = config.scale_width,
|
|
1347
|
+
points = getRange(config.padding_bottom, height, 5),
|
|
1348
|
+
inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
|
|
1405
1349
|
this.colorScale && this.colorScale.remove(), this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale), this.colorScale.append("g").attr("transform", "translate(0, " + config.padding_top + ")").selectAll("bars").data(points).enter().append("rect").attr("y", function (d, i) {
|
|
1406
|
-
return i *
|
|
1407
|
-
}).attr("x", 0).attr("width", barWidth).attr("height",
|
|
1350
|
+
return i * 5;
|
|
1351
|
+
}).attr("x", 0).attr("width", barWidth).attr("height", 5).attr("fill", function (d) {
|
|
1408
1352
|
return inverseScale(d);
|
|
1409
1353
|
});
|
|
1410
1354
|
// Legend Axis
|
|
1411
|
-
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] +
|
|
1412
|
-
|
|
1413
|
-
|
|
1355
|
+
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]),
|
|
1356
|
+
legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
|
|
1357
|
+
scaleFormat = config.scale_format;
|
|
1414
1358
|
scaleFormat === "pow10" ? legendAxis.tickValues([1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7]) : isFunction(scaleFormat) ? legendAxis.tickFormat(scaleFormat) : legendAxis.tickFormat((0,external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_.format)("d"));
|
|
1415
1359
|
// Draw Axis
|
|
1416
1360
|
var axis = this.colorScale.append("g").attr("class", "legend axis").attr("transform", "translate(" + barWidth + ",0)").call(legendAxis);
|
|
@@ -1428,11 +1372,9 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1428
1372
|
}, ColorScale;
|
|
1429
1373
|
}();
|
|
1430
1374
|
|
|
1431
|
-
|
|
1432
1375
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/index.ts
|
|
1433
1376
|
|
|
1434
1377
|
|
|
1435
|
-
|
|
1436
1378
|
/**
|
|
1437
1379
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1438
1380
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1448,6 +1390,7 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1448
1390
|
|
|
1449
1391
|
|
|
1450
1392
|
|
|
1393
|
+
|
|
1451
1394
|
/**
|
|
1452
1395
|
* Stanford diagram plugin
|
|
1453
1396
|
* - **NOTE:**
|
|
@@ -1533,21 +1476,16 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1533
1476
|
* ]
|
|
1534
1477
|
* })
|
|
1535
1478
|
*/
|
|
1536
|
-
|
|
1537
1479
|
var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
1538
1480
|
function Stanford(options) {
|
|
1539
1481
|
var _this;
|
|
1540
|
-
|
|
1541
1482
|
return _this = _Plugin.call(this, options) || this, _this.config = void 0, _this.colorScale = void 0, _this.elements = void 0, _this.config = new Options(), _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
|
1542
1483
|
}
|
|
1543
|
-
|
|
1544
1484
|
_inheritsLoose(Stanford, _Plugin);
|
|
1545
|
-
|
|
1546
1485
|
var _proto = Stanford.prototype;
|
|
1547
1486
|
return _proto.$beforeInit = function $beforeInit() {
|
|
1548
1487
|
var _this2 = this,
|
|
1549
|
-
|
|
1550
|
-
|
|
1488
|
+
$$ = this.$$;
|
|
1551
1489
|
$$.config.data_xSort = !1, $$.isMultipleX = function () {
|
|
1552
1490
|
return !0;
|
|
1553
1491
|
}, $$.showGridFocus = function () {}, $$.labelishData = function (d) {
|
|
@@ -1556,7 +1494,6 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1556
1494
|
return 1;
|
|
1557
1495
|
};
|
|
1558
1496
|
var getCurrentPaddingRight = $$.getCurrentPaddingRight.bind($$);
|
|
1559
|
-
|
|
1560
1497
|
$$.getCurrentPaddingRight = function () {
|
|
1561
1498
|
return getCurrentPaddingRight() + (_this2.colorScale ? _this2.colorScale.getColorScalePadding() : 0);
|
|
1562
1499
|
};
|
|
@@ -1569,7 +1506,7 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1569
1506
|
return new Options();
|
|
1570
1507
|
}, _proto.convertData = function convertData() {
|
|
1571
1508
|
var data = this.$$.data.targets,
|
|
1572
|
-
|
|
1509
|
+
epochs = this.options.epochs;
|
|
1573
1510
|
data.forEach(function (d) {
|
|
1574
1511
|
d.values.forEach(function (v, i) {
|
|
1575
1512
|
v.epochs = epochs[i];
|
|
@@ -1577,19 +1514,19 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1577
1514
|
});
|
|
1578
1515
|
}, _proto.xvCustom = function xvCustom(d, xyValue) {
|
|
1579
1516
|
var $$ = this,
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1517
|
+
axis = $$.axis,
|
|
1518
|
+
config = $$.config,
|
|
1519
|
+
value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1583
1520
|
return axis.isTimeSeries() ? value = parseDate.call($$, value) : axis.isCategorized() && isString(value) && (value = config.axis_x_categories.indexOf(d.value)), Math.ceil($$.scale.x(value));
|
|
1584
1521
|
}, _proto.yvCustom = function yvCustom(d, xyValue) {
|
|
1585
1522
|
var $$ = this,
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1523
|
+
scale = $$.scale,
|
|
1524
|
+
yScale = d.axis && d.axis === "y2" ? scale.y2 : scale.y,
|
|
1525
|
+
value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1589
1526
|
return Math.ceil(yScale(value));
|
|
1590
1527
|
}, _proto.initStanfordData = function initStanfordData() {
|
|
1591
1528
|
var config = this.config,
|
|
1592
|
-
|
|
1529
|
+
target = this.$$.data.targets[0];
|
|
1593
1530
|
target.values.sort(compareEpochs);
|
|
1594
1531
|
// Get array of epochs
|
|
1595
1532
|
var epochs = target.values.map(function (a) {
|
|
@@ -1609,13 +1546,13 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1609
1546
|
});
|
|
1610
1547
|
}, _proto.countEpochsInRegion = function countEpochsInRegion(region) {
|
|
1611
1548
|
var $$ = this,
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1549
|
+
target = $$.data.targets[0],
|
|
1550
|
+
total = target.values.reduce(function (accumulator, currentValue) {
|
|
1551
|
+
return accumulator + +currentValue.epochs;
|
|
1552
|
+
}, 0),
|
|
1553
|
+
value = target.values.reduce(function (accumulator, currentValue) {
|
|
1554
|
+
return pointInRegion(currentValue, region) ? accumulator + +currentValue.epochs : accumulator;
|
|
1555
|
+
}, 0);
|
|
1619
1556
|
return {
|
|
1620
1557
|
value: value,
|
|
1621
1558
|
percentage: value === 0 ? 0 : +(value / total * 100).toFixed(1)
|
|
@@ -1623,9 +1560,8 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1623
1560
|
}, Stanford;
|
|
1624
1561
|
}(Plugin);
|
|
1625
1562
|
|
|
1626
|
-
|
|
1627
1563
|
}();
|
|
1628
|
-
__webpack_exports__ = __webpack_exports__
|
|
1564
|
+
__webpack_exports__ = __webpack_exports__["default"];
|
|
1629
1565
|
/******/ return __webpack_exports__;
|
|
1630
1566
|
/******/ })()
|
|
1631
1567
|
;
|