billboard.js 2.2.6 → 2.2.8-a
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 +7 -0
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +3001 -3650
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/{billboard.esm.js → billboard.mjs} +379 -378
- package/dist/billboard.pkgd.js +18206 -14604
- package/dist/billboard.pkgd.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +30 -45
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/{billboardjs-plugin-bubblecompare.esm.js → billboardjs-plugin-bubblecompare.mjs} +14 -21
- package/dist/plugin/billboardjs-plugin-stanford.js +281 -345
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/{billboardjs-plugin-stanford.esm.js → billboardjs-plugin-stanford.mjs} +31 -39
- package/dist/plugin/billboardjs-plugin-textoverlap.js +243 -291
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/{billboardjs-plugin-textoverlap.esm.js → billboardjs-plugin-textoverlap.mjs} +20 -28
- 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 +2 -2
- package/src/.DS_Store +0 -0
- package/src/ChartInternal/.DS_Store +0 -0
- package/src/ChartInternal/data/data.ts +3 -2
- package/src/ChartInternal/internals/redraw.ts +7 -6
- package/src/ChartInternal/shape/.DS_Store +0 -0
- package/src/ChartInternal/shape/arc.ts +4 -2
- package/src/Plugin/.DS_Store +0 -0
- package/src/config/.DS_Store +0 -0
- package/src/config/Options/.DS_Store +0 -0
- package/src/config/Store/.DS_Store +0 -0
- package/types/.DS_Store +0 -0
- package/types/plugin/.DS_Store +0 -0
|
@@ -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.8a
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -62,8 +62,9 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
|
|
|
62
62
|
/******/ // The require function
|
|
63
63
|
/******/ function __webpack_require__(moduleId) {
|
|
64
64
|
/******/ // Check if module is in cache
|
|
65
|
-
/******/
|
|
66
|
-
/******/
|
|
65
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
66
|
+
/******/ if (cachedModule !== undefined) {
|
|
67
|
+
/******/ return cachedModule.exports;
|
|
67
68
|
/******/ }
|
|
68
69
|
/******/ // Create a new module (and put it into the cache)
|
|
69
70
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
@@ -112,16 +113,14 @@ function _assertThisInitialized(self) {
|
|
|
112
113
|
if (self === void 0) {
|
|
113
114
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
114
115
|
}
|
|
115
|
-
|
|
116
116
|
return self;
|
|
117
117
|
}
|
|
118
118
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
119
119
|
function _setPrototypeOf(o, p) {
|
|
120
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
120
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
121
121
|
o.__proto__ = p;
|
|
122
122
|
return o;
|
|
123
123
|
};
|
|
124
|
-
|
|
125
124
|
return _setPrototypeOf(o, p);
|
|
126
125
|
}
|
|
127
126
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
@@ -137,8 +136,39 @@ var external_commonjs_d3_voronoi_commonjs2_d3_voronoi_amd_d3_voronoi_root_d3_ =
|
|
|
137
136
|
var external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_ = __webpack_require__(11);
|
|
138
137
|
// EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
|
|
139
138
|
var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
|
139
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
140
|
+
function _typeof(obj) {
|
|
141
|
+
"@babel/helpers - typeof";
|
|
142
|
+
|
|
143
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
144
|
+
return typeof obj;
|
|
145
|
+
} : function (obj) {
|
|
146
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
147
|
+
}, _typeof(obj);
|
|
148
|
+
}
|
|
149
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
150
|
+
|
|
151
|
+
function _toPrimitive(input, hint) {
|
|
152
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
153
|
+
var prim = input[Symbol.toPrimitive];
|
|
154
|
+
if (prim !== undefined) {
|
|
155
|
+
var res = prim.call(input, hint || "default");
|
|
156
|
+
if (_typeof(res) !== "object") return res;
|
|
157
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
158
|
+
}
|
|
159
|
+
return (hint === "string" ? String : Number)(input);
|
|
160
|
+
}
|
|
161
|
+
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
function _toPropertyKey(arg) {
|
|
165
|
+
var key = _toPrimitive(arg, "string");
|
|
166
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
167
|
+
}
|
|
140
168
|
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
169
|
+
|
|
141
170
|
function _defineProperty(obj, key, value) {
|
|
171
|
+
key = _toPropertyKey(key);
|
|
142
172
|
if (key in obj) {
|
|
143
173
|
Object.defineProperty(obj, key, {
|
|
144
174
|
value: value,
|
|
@@ -149,7 +179,6 @@ function _defineProperty(obj, key, value) {
|
|
|
149
179
|
} else {
|
|
150
180
|
obj[key] = value;
|
|
151
181
|
}
|
|
152
|
-
|
|
153
182
|
return obj;
|
|
154
183
|
}
|
|
155
184
|
// EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
|
|
@@ -159,27 +188,23 @@ var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webp
|
|
|
159
188
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
160
189
|
* billboard.js project is licensed under the MIT license
|
|
161
190
|
*/
|
|
162
|
-
|
|
163
191
|
/**
|
|
164
192
|
* Window object
|
|
165
193
|
* @private
|
|
166
194
|
*/
|
|
167
|
-
|
|
168
195
|
/* eslint-disable no-new-func, no-undef */
|
|
169
196
|
|
|
170
|
-
|
|
171
197
|
var win = function () {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}(),
|
|
175
|
-
|
|
198
|
+
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;
|
|
199
|
+
return root || Function("return this")();
|
|
200
|
+
}(),
|
|
201
|
+
doc = win && win.document;
|
|
176
202
|
/* eslint-enable no-new-func, no-undef */
|
|
177
203
|
;// CONCATENATED MODULE: ./src/config/classes.ts
|
|
178
204
|
/**
|
|
179
205
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
180
206
|
* billboard.js project is licensed under the MIT license
|
|
181
207
|
*/
|
|
182
|
-
|
|
183
208
|
/**
|
|
184
209
|
* CSS class names definition
|
|
185
210
|
* @private
|
|
@@ -285,11 +310,8 @@ var win = function () {
|
|
|
285
310
|
});
|
|
286
311
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
287
312
|
|
|
288
|
-
|
|
289
313
|
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; }
|
|
290
|
-
|
|
291
|
-
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; }
|
|
292
|
-
|
|
314
|
+
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; }
|
|
293
315
|
/**
|
|
294
316
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
295
317
|
* billboard.js project is licensed under the MIT license
|
|
@@ -300,53 +322,51 @@ function _objectSpread(target) { for (var source, i = 1; i < arguments.length; i
|
|
|
300
322
|
|
|
301
323
|
|
|
302
324
|
|
|
303
|
-
|
|
304
325
|
var isValue = function (v) {
|
|
305
|
-
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
},
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
},
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
},
|
|
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
|
-
|
|
326
|
+
return v || v === 0;
|
|
327
|
+
},
|
|
328
|
+
isFunction = function (v) {
|
|
329
|
+
return typeof v === "function";
|
|
330
|
+
},
|
|
331
|
+
isString = function (v) {
|
|
332
|
+
return typeof v === "string";
|
|
333
|
+
},
|
|
334
|
+
isNumber = function (v) {
|
|
335
|
+
return typeof v === "number";
|
|
336
|
+
},
|
|
337
|
+
isUndefined = function (v) {
|
|
338
|
+
return typeof v === "undefined";
|
|
339
|
+
},
|
|
340
|
+
isDefined = function (v) {
|
|
341
|
+
return typeof v !== "undefined";
|
|
342
|
+
},
|
|
343
|
+
isboolean = function (v) {
|
|
344
|
+
return typeof v === "boolean";
|
|
345
|
+
},
|
|
346
|
+
ceil10 = function (v) {
|
|
347
|
+
return Math.ceil(v / 10) * 10;
|
|
348
|
+
},
|
|
349
|
+
asHalfPixel = function (n) {
|
|
350
|
+
return Math.ceil(n) + .5;
|
|
351
|
+
},
|
|
352
|
+
diffDomain = function (d) {
|
|
353
|
+
return d[1] - d[0];
|
|
354
|
+
},
|
|
355
|
+
isObjectType = function (v) {
|
|
356
|
+
return typeof v === "object";
|
|
357
|
+
},
|
|
358
|
+
isEmpty = function (o) {
|
|
359
|
+
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
360
|
+
},
|
|
361
|
+
notEmpty = function (o) {
|
|
362
|
+
return !isEmpty(o);
|
|
363
|
+
},
|
|
364
|
+
isArray = function (arr) {
|
|
365
|
+
return Array.isArray(arr);
|
|
366
|
+
},
|
|
367
|
+
isObject = function (obj) {
|
|
368
|
+
return obj && !obj.nodeType && isObjectType(obj) && !isArray(obj);
|
|
369
|
+
};
|
|
350
370
|
/**
|
|
351
371
|
* Get specified key value from object
|
|
352
372
|
* If default value is given, will return if given key value not found
|
|
@@ -359,6 +379,7 @@ var isValue = function (v) {
|
|
|
359
379
|
function getOption(options, key, defaultValue) {
|
|
360
380
|
return isDefined(options[key]) ? options[key] : defaultValue;
|
|
361
381
|
}
|
|
382
|
+
|
|
362
383
|
/**
|
|
363
384
|
* Check if value exist in the given object
|
|
364
385
|
* @param {object} dict Target object to be checked
|
|
@@ -366,14 +387,13 @@ function getOption(options, key, defaultValue) {
|
|
|
366
387
|
* @returns {boolean}
|
|
367
388
|
* @private
|
|
368
389
|
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
390
|
function hasValue(dict, value) {
|
|
372
391
|
var found = !1;
|
|
373
392
|
return Object.keys(dict).forEach(function (key) {
|
|
374
393
|
return dict[key] === value && (found = !0);
|
|
375
394
|
}), found;
|
|
376
395
|
}
|
|
396
|
+
|
|
377
397
|
/**
|
|
378
398
|
* Call function with arguments
|
|
379
399
|
* @param {Function} fn Function to be called
|
|
@@ -381,42 +401,37 @@ function hasValue(dict, value) {
|
|
|
381
401
|
* @returns {boolean} true: fn is function, false: fn is not function
|
|
382
402
|
* @private
|
|
383
403
|
*/
|
|
384
|
-
|
|
385
|
-
|
|
386
404
|
function callFn(fn) {
|
|
387
405
|
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];
|
|
388
|
-
|
|
389
406
|
return isFn && fn.call.apply(fn, args), isFn;
|
|
390
407
|
}
|
|
408
|
+
|
|
391
409
|
/**
|
|
392
410
|
* Call function after all transitions ends
|
|
393
411
|
* @param {d3.transition} transition Transition
|
|
394
412
|
* @param {Fucntion} cb Callback function
|
|
395
413
|
* @private
|
|
396
414
|
*/
|
|
397
|
-
|
|
398
|
-
|
|
399
415
|
function endall(transition, cb) {
|
|
400
416
|
var n = 0;
|
|
401
417
|
transition.each(function () {
|
|
402
418
|
return ++n;
|
|
403
419
|
}).on("end", function () {
|
|
404
420
|
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
|
|
405
|
-
|
|
406
421
|
--n || cb.apply.apply(cb, [this].concat(args));
|
|
407
422
|
});
|
|
408
423
|
}
|
|
424
|
+
|
|
409
425
|
/**
|
|
410
426
|
* Replace tag sign to html entity
|
|
411
427
|
* @param {string} str Target string value
|
|
412
428
|
* @returns {string}
|
|
413
429
|
* @private
|
|
414
430
|
*/
|
|
415
|
-
|
|
416
|
-
|
|
417
431
|
function sanitise(str) {
|
|
418
432
|
return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
|
419
433
|
}
|
|
434
|
+
|
|
420
435
|
/**
|
|
421
436
|
* Set text value. If there's multiline add nodes.
|
|
422
437
|
* @param {d3Selection} node Text node
|
|
@@ -425,31 +440,27 @@ function sanitise(str) {
|
|
|
425
440
|
* @param {boolean} toMiddle To be alingned vertically middle
|
|
426
441
|
* @private
|
|
427
442
|
*/
|
|
428
|
-
|
|
429
|
-
|
|
430
443
|
function setTextValue(node, text, dy, toMiddle) {
|
|
431
444
|
if (dy === void 0 && (dy = [-1, 1]), toMiddle === void 0 && (toMiddle = !1), node && isString(text)) if (text.indexOf("\n") === -1) node.text(text);else {
|
|
432
445
|
var diff = [node.text(), text].map(function (v) {
|
|
433
446
|
return v.replace(/[\s\n]/g, "");
|
|
434
447
|
});
|
|
435
|
-
|
|
436
448
|
if (diff[0] !== diff[1]) {
|
|
437
449
|
var multiline = text.split("\n"),
|
|
438
|
-
|
|
450
|
+
len = toMiddle ? multiline.length - 1 : 1;
|
|
439
451
|
node.html(""), multiline.forEach(function (v, i) {
|
|
440
452
|
node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
|
441
453
|
});
|
|
442
454
|
}
|
|
443
455
|
}
|
|
444
456
|
}
|
|
457
|
+
|
|
445
458
|
/**
|
|
446
459
|
* Substitution of SVGPathSeg API polyfill
|
|
447
460
|
* @param {SVGGraphicsElement} path Target svg element
|
|
448
461
|
* @returns {Array}
|
|
449
462
|
* @private
|
|
450
463
|
*/
|
|
451
|
-
|
|
452
|
-
|
|
453
464
|
function getRectSegList(path) {
|
|
454
465
|
/*
|
|
455
466
|
* seg1 ---------- seg2
|
|
@@ -459,45 +470,45 @@ function getRectSegList(path) {
|
|
|
459
470
|
* seg0 ---------- seg3
|
|
460
471
|
* */
|
|
461
472
|
var _path$getBBox = path.getBBox(),
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
473
|
+
x = _path$getBBox.x,
|
|
474
|
+
y = _path$getBBox.y,
|
|
475
|
+
width = _path$getBBox.width,
|
|
476
|
+
height = _path$getBBox.height;
|
|
467
477
|
return [{
|
|
468
478
|
x: x,
|
|
469
479
|
y: y + height
|
|
470
|
-
},
|
|
480
|
+
},
|
|
481
|
+
// seg0
|
|
471
482
|
{
|
|
472
483
|
x: x,
|
|
473
484
|
y: y
|
|
474
|
-
},
|
|
485
|
+
},
|
|
486
|
+
// seg1
|
|
475
487
|
{
|
|
476
488
|
x: x + width,
|
|
477
489
|
y: y
|
|
478
|
-
},
|
|
490
|
+
},
|
|
491
|
+
// seg2
|
|
479
492
|
{
|
|
480
493
|
x: x + width,
|
|
481
494
|
y: y + height
|
|
482
495
|
} // seg3
|
|
483
496
|
];
|
|
484
497
|
}
|
|
498
|
+
|
|
485
499
|
/**
|
|
486
500
|
* Get svg bounding path box dimension
|
|
487
501
|
* @param {SVGGraphicsElement} path Target svg element
|
|
488
502
|
* @returns {object}
|
|
489
503
|
* @private
|
|
490
504
|
*/
|
|
491
|
-
|
|
492
|
-
|
|
493
505
|
function getPathBox(path) {
|
|
494
506
|
var _path$getBoundingClie = path.getBoundingClientRect(),
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
507
|
+
width = _path$getBoundingClie.width,
|
|
508
|
+
height = _path$getBoundingClie.height,
|
|
509
|
+
items = getRectSegList(path),
|
|
510
|
+
x = items[0].x,
|
|
511
|
+
y = Math.min(items[0].y, items[1].y);
|
|
501
512
|
return {
|
|
502
513
|
x: x,
|
|
503
514
|
y: y,
|
|
@@ -505,6 +516,7 @@ function getPathBox(path) {
|
|
|
505
516
|
height: height
|
|
506
517
|
};
|
|
507
518
|
}
|
|
519
|
+
|
|
508
520
|
/**
|
|
509
521
|
* Return brush selection array
|
|
510
522
|
* @param {object} {} Selection object
|
|
@@ -512,15 +524,14 @@ function getPathBox(path) {
|
|
|
512
524
|
* @returns {d3.brushSelection}
|
|
513
525
|
* @private
|
|
514
526
|
*/
|
|
515
|
-
|
|
516
|
-
|
|
517
527
|
function getBrushSelection(_ref) {
|
|
518
528
|
var selection,
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
529
|
+
$el = _ref.$el,
|
|
530
|
+
event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.event,
|
|
531
|
+
main = $el.subchart.main || $el.main;
|
|
522
532
|
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;
|
|
523
533
|
}
|
|
534
|
+
|
|
524
535
|
/**
|
|
525
536
|
* Get boundingClientRect.
|
|
526
537
|
* Cache the evaluated value once it was called.
|
|
@@ -528,25 +539,23 @@ function getBrushSelection(_ref) {
|
|
|
528
539
|
* @returns {object}
|
|
529
540
|
* @private
|
|
530
541
|
*/
|
|
531
|
-
|
|
532
|
-
|
|
533
542
|
function getBoundingRect(node) {
|
|
534
543
|
var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
535
544
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
536
545
|
}
|
|
546
|
+
|
|
537
547
|
/**
|
|
538
548
|
* Retrun random number
|
|
539
549
|
* @param {boolean} asStr Convert returned value as string
|
|
540
550
|
* @returns {number|string}
|
|
541
551
|
* @private
|
|
542
552
|
*/
|
|
543
|
-
|
|
544
|
-
|
|
545
553
|
function getRandom(asStr) {
|
|
546
554
|
asStr === void 0 && (asStr = !0);
|
|
547
555
|
var rand = Math.random();
|
|
548
556
|
return asStr ? rand + "" : rand;
|
|
549
557
|
}
|
|
558
|
+
|
|
550
559
|
/**
|
|
551
560
|
* Find index based on binary search
|
|
552
561
|
* @param {Array} arr Data array
|
|
@@ -557,64 +566,50 @@ function getRandom(asStr) {
|
|
|
557
566
|
* @returns {number} Index number
|
|
558
567
|
* @private
|
|
559
568
|
*/
|
|
560
|
-
|
|
561
|
-
|
|
562
569
|
function findIndex(arr, v, start, end, isRotated) {
|
|
563
570
|
if (start > end) return -1;
|
|
564
571
|
var mid = Math.floor((start + end) / 2),
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
572
|
+
_arr$mid = arr[mid],
|
|
573
|
+
x = _arr$mid.x,
|
|
574
|
+
_arr$mid$w = _arr$mid.w,
|
|
575
|
+
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
569
576
|
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);
|
|
570
577
|
}
|
|
578
|
+
|
|
571
579
|
/**
|
|
572
580
|
* Check if brush is empty
|
|
573
581
|
* @param {object} ctx Bursh context
|
|
574
582
|
* @returns {boolean}
|
|
575
583
|
* @private
|
|
576
584
|
*/
|
|
577
|
-
|
|
578
|
-
|
|
579
585
|
function brushEmpty(ctx) {
|
|
580
586
|
var selection = getBrushSelection(ctx);
|
|
581
587
|
return !selection || selection[0] === selection[1];
|
|
582
588
|
}
|
|
589
|
+
|
|
583
590
|
/**
|
|
584
591
|
* Deep copy object
|
|
585
592
|
* @param {object} objectN Source object
|
|
586
593
|
* @returns {object} Cloned object
|
|
587
594
|
* @private
|
|
588
595
|
*/
|
|
589
|
-
|
|
590
|
-
|
|
591
596
|
function deepClone() {
|
|
592
|
-
|
|
593
|
-
function clone() {
|
|
594
|
-
return _clone.apply(this, arguments);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
return clone.toString = function () {
|
|
598
|
-
return _clone.toString();
|
|
599
|
-
}, clone;
|
|
600
|
-
}(function (v) {
|
|
597
|
+
var clone = function (v) {
|
|
601
598
|
if (isObject(v) && v.constructor) {
|
|
602
599
|
var r = new v.constructor();
|
|
603
|
-
|
|
604
600
|
for (var k in v) r[k] = clone(v[k]);
|
|
605
|
-
|
|
606
601
|
return r;
|
|
607
602
|
}
|
|
608
|
-
|
|
609
603
|
return v;
|
|
610
|
-
}
|
|
611
|
-
|
|
604
|
+
};
|
|
605
|
+
for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) objectN[_key3] = arguments[_key3];
|
|
612
606
|
return objectN.map(function (v) {
|
|
613
607
|
return clone(v);
|
|
614
608
|
}).reduce(function (a, c) {
|
|
615
609
|
return _objectSpread(_objectSpread({}, a), c);
|
|
616
610
|
});
|
|
617
611
|
}
|
|
612
|
+
|
|
618
613
|
/**
|
|
619
614
|
* Extend target from source object
|
|
620
615
|
* @param {object} target Target object
|
|
@@ -622,38 +617,32 @@ function deepClone() {
|
|
|
622
617
|
* @returns {object}
|
|
623
618
|
* @private
|
|
624
619
|
*/
|
|
625
|
-
|
|
626
|
-
|
|
627
620
|
function extend(target, source) {
|
|
628
621
|
// exclude name with only numbers
|
|
629
622
|
for (var p in target === void 0 && (target = {}), isArray(source) && source.forEach(function (v) {
|
|
630
623
|
return extend(target, v);
|
|
631
624
|
}), source) /^\d+$/.test(p) || p in target || (target[p] = source[p]);
|
|
632
|
-
|
|
633
625
|
return target;
|
|
634
626
|
}
|
|
627
|
+
|
|
635
628
|
/**
|
|
636
629
|
* Return first letter capitalized
|
|
637
630
|
* @param {string} str Target string
|
|
638
631
|
* @returns {string} capitalized string
|
|
639
632
|
* @private
|
|
640
633
|
*/
|
|
641
|
-
|
|
642
|
-
|
|
643
634
|
var capitalize = function (str) {
|
|
644
|
-
|
|
645
|
-
},
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
};
|
|
635
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
636
|
+
},
|
|
637
|
+
toArray = function (v) {
|
|
638
|
+
return [].slice.call(v);
|
|
639
|
+
};
|
|
649
640
|
/**
|
|
650
641
|
* Convert to array
|
|
651
642
|
* @param {object} v Target to be converted
|
|
652
643
|
* @returns {Array}
|
|
653
644
|
* @private
|
|
654
645
|
*/
|
|
655
|
-
|
|
656
|
-
|
|
657
646
|
/**
|
|
658
647
|
* Get css rules for specified stylesheets
|
|
659
648
|
* @param {Array} styleSheets The stylesheets to get the rules from
|
|
@@ -670,17 +659,16 @@ function getCssRules(styleSheets) {
|
|
|
670
659
|
}
|
|
671
660
|
}), rules;
|
|
672
661
|
}
|
|
662
|
+
|
|
673
663
|
/**
|
|
674
664
|
* Gets the SVGMatrix of an SVGGElement
|
|
675
665
|
* @param {SVGElement} node Node element
|
|
676
666
|
* @returns {SVGMatrix} matrix
|
|
677
667
|
* @private
|
|
678
668
|
*/
|
|
679
|
-
|
|
680
|
-
|
|
681
669
|
var getTranslation = function (node) {
|
|
682
670
|
var transform = node ? node.transform : null,
|
|
683
|
-
|
|
671
|
+
baseVal = transform && transform.baseVal;
|
|
684
672
|
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
685
673
|
a: 0,
|
|
686
674
|
b: 0,
|
|
@@ -690,36 +678,35 @@ var getTranslation = function (node) {
|
|
|
690
678
|
f: 0
|
|
691
679
|
};
|
|
692
680
|
};
|
|
681
|
+
|
|
693
682
|
/**
|
|
694
683
|
* Get unique value from array
|
|
695
684
|
* @param {Array} data Source data
|
|
696
685
|
* @returns {Array} Unique array value
|
|
697
686
|
* @private
|
|
698
687
|
*/
|
|
699
|
-
|
|
700
|
-
|
|
701
688
|
function getUnique(data) {
|
|
702
689
|
var isDate = data[0] instanceof Date,
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
690
|
+
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
691
|
+
return self.indexOf(v) === i;
|
|
692
|
+
});
|
|
706
693
|
return isDate ? d.map(function (v) {
|
|
707
694
|
return new Date(v);
|
|
708
695
|
}) : d;
|
|
709
696
|
}
|
|
697
|
+
|
|
710
698
|
/**
|
|
711
699
|
* Merge array
|
|
712
700
|
* @param {Array} arr Source array
|
|
713
701
|
* @returns {Array}
|
|
714
702
|
* @private
|
|
715
703
|
*/
|
|
716
|
-
|
|
717
|
-
|
|
718
704
|
function mergeArray(arr) {
|
|
719
705
|
return arr && arr.length ? arr.reduce(function (p, c) {
|
|
720
706
|
return p.concat(c);
|
|
721
707
|
}) : [];
|
|
722
708
|
}
|
|
709
|
+
|
|
723
710
|
/**
|
|
724
711
|
* Merge object returning new object
|
|
725
712
|
* @param {object} target Target object
|
|
@@ -727,11 +714,8 @@ function mergeArray(arr) {
|
|
|
727
714
|
* @returns {object} merged target object
|
|
728
715
|
* @private
|
|
729
716
|
*/
|
|
730
|
-
|
|
731
|
-
|
|
732
717
|
function mergeObj(target) {
|
|
733
718
|
for (var _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) objectN[_key4 - 1] = arguments[_key4];
|
|
734
|
-
|
|
735
719
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
|
|
736
720
|
var source = objectN.shift();
|
|
737
721
|
return isObject(target) && isObject(source) && Object.keys(source).forEach(function (key) {
|
|
@@ -739,6 +723,7 @@ function mergeObj(target) {
|
|
|
739
723
|
isObject(value) ? (!target[key] && (target[key] = {}), target[key] = mergeObj(target[key], value)) : target[key] = isArray(value) ? value.concat() : value;
|
|
740
724
|
}), mergeObj.apply(void 0, [target].concat(objectN));
|
|
741
725
|
}
|
|
726
|
+
|
|
742
727
|
/**
|
|
743
728
|
* Sort value
|
|
744
729
|
* @param {Array} data value to be sorted
|
|
@@ -746,8 +731,6 @@ function mergeObj(target) {
|
|
|
746
731
|
* @returns {number|string|Date} sorted date
|
|
747
732
|
* @private
|
|
748
733
|
*/
|
|
749
|
-
|
|
750
|
-
|
|
751
734
|
function sortValue(data, isAsc) {
|
|
752
735
|
isAsc === void 0 && (isAsc = !0);
|
|
753
736
|
var fn;
|
|
@@ -761,6 +744,7 @@ function sortValue(data, isAsc) {
|
|
|
761
744
|
return a > b && -1 || a < b && 1 || a === b && 0;
|
|
762
745
|
}), data.concat().sort(fn);
|
|
763
746
|
}
|
|
747
|
+
|
|
764
748
|
/**
|
|
765
749
|
* Get min/max value
|
|
766
750
|
* @param {string} type 'min' or 'max'
|
|
@@ -768,14 +752,13 @@ function sortValue(data, isAsc) {
|
|
|
768
752
|
* @returns {number|Date|undefined}
|
|
769
753
|
* @private
|
|
770
754
|
*/
|
|
771
|
-
|
|
772
|
-
|
|
773
755
|
function getMinMax(type, data) {
|
|
774
756
|
var res = data.filter(function (v) {
|
|
775
757
|
return notEmpty(v);
|
|
776
758
|
});
|
|
777
759
|
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;
|
|
778
760
|
}
|
|
761
|
+
|
|
779
762
|
/**
|
|
780
763
|
* Get range
|
|
781
764
|
* @param {number} start Start number
|
|
@@ -784,66 +767,61 @@ function getMinMax(type, data) {
|
|
|
784
767
|
* @returns {Array}
|
|
785
768
|
* @private
|
|
786
769
|
*/
|
|
787
|
-
|
|
788
|
-
|
|
789
770
|
var getRange = function (start, end, step) {
|
|
790
|
-
|
|
791
|
-
|
|
771
|
+
step === void 0 && (step = 1);
|
|
772
|
+
var res = [],
|
|
792
773
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
clientY: 0
|
|
808
|
-
};
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
try {
|
|
812
|
-
return new MouseEvent("t"), function (el, eventType, params) {
|
|
813
|
-
params === void 0 && (params = getParams()), el.dispatchEvent(new MouseEvent(eventType, params));
|
|
814
|
-
};
|
|
815
|
-
} catch (e) {
|
|
816
|
-
// Polyfills DOM4 MouseEvent
|
|
817
|
-
return function (el, eventType, params) {
|
|
818
|
-
params === void 0 && (params = getParams());
|
|
819
|
-
var mouseEvent = doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
820
|
-
|
|
821
|
-
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
|
|
822
|
-
params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
|
774
|
+
for (var i = start; i < n; i++) res.push(start + i * step);
|
|
775
|
+
return res;
|
|
776
|
+
},
|
|
777
|
+
emulateEvent = {
|
|
778
|
+
mouse: function () {
|
|
779
|
+
var getParams = function () {
|
|
780
|
+
return {
|
|
781
|
+
bubbles: !1,
|
|
782
|
+
cancelable: !1,
|
|
783
|
+
screenX: 0,
|
|
784
|
+
screenY: 0,
|
|
785
|
+
clientX: 0,
|
|
786
|
+
clientY: 0
|
|
787
|
+
};
|
|
823
788
|
};
|
|
789
|
+
try {
|
|
790
|
+
return new MouseEvent("t"), function (el, eventType, params) {
|
|
791
|
+
params === void 0 && (params = getParams()), el.dispatchEvent(new MouseEvent(eventType, params));
|
|
792
|
+
};
|
|
793
|
+
} catch (e) {
|
|
794
|
+
// Polyfills DOM4 MouseEvent
|
|
795
|
+
return function (el, eventType, params) {
|
|
796
|
+
params === void 0 && (params = getParams());
|
|
797
|
+
var mouseEvent = doc.createEvent("MouseEvent");
|
|
798
|
+
|
|
799
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
800
|
+
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
801
|
+
// the event's mouse click count
|
|
802
|
+
params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
}(),
|
|
806
|
+
touch: function touch(el, eventType, params) {
|
|
807
|
+
var touchObj = new Touch(mergeObj({
|
|
808
|
+
identifier: Date.now(),
|
|
809
|
+
target: el,
|
|
810
|
+
radiusX: 2.5,
|
|
811
|
+
radiusY: 2.5,
|
|
812
|
+
rotationAngle: 10,
|
|
813
|
+
force: .5
|
|
814
|
+
}, params));
|
|
815
|
+
el.dispatchEvent(new TouchEvent(eventType, {
|
|
816
|
+
cancelable: !0,
|
|
817
|
+
bubbles: !0,
|
|
818
|
+
shiftKey: !0,
|
|
819
|
+
touches: [touchObj],
|
|
820
|
+
targetTouches: [],
|
|
821
|
+
changedTouches: [touchObj]
|
|
822
|
+
}));
|
|
824
823
|
}
|
|
825
|
-
}
|
|
826
|
-
touch: function touch(el, eventType, params) {
|
|
827
|
-
var touchObj = new Touch(mergeObj({
|
|
828
|
-
identifier: Date.now(),
|
|
829
|
-
target: el,
|
|
830
|
-
radiusX: 2.5,
|
|
831
|
-
radiusY: 2.5,
|
|
832
|
-
rotationAngle: 10,
|
|
833
|
-
force: .5
|
|
834
|
-
}, params));
|
|
835
|
-
el.dispatchEvent(new TouchEvent(eventType, {
|
|
836
|
-
cancelable: !0,
|
|
837
|
-
bubbles: !0,
|
|
838
|
-
shiftKey: !0,
|
|
839
|
-
touches: [touchObj],
|
|
840
|
-
targetTouches: [],
|
|
841
|
-
changedTouches: [touchObj]
|
|
842
|
-
}));
|
|
843
|
-
}
|
|
844
|
-
}; // emulate event
|
|
845
|
-
|
|
846
|
-
|
|
824
|
+
}; // emulate event
|
|
847
825
|
/**
|
|
848
826
|
* Process the template & return bound string
|
|
849
827
|
* @param {string} tpl Template string
|
|
@@ -853,11 +831,10 @@ var getRange = function (start, end, step) {
|
|
|
853
831
|
*/
|
|
854
832
|
function tplProcess(tpl, data) {
|
|
855
833
|
var res = tpl;
|
|
856
|
-
|
|
857
834
|
for (var x in data) res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
|
858
|
-
|
|
859
835
|
return res;
|
|
860
836
|
}
|
|
837
|
+
|
|
861
838
|
/**
|
|
862
839
|
* Get parsed date value
|
|
863
840
|
* (It must be called in 'ChartInternal' context)
|
|
@@ -865,27 +842,25 @@ function tplProcess(tpl, data) {
|
|
|
865
842
|
* @returns {Date}
|
|
866
843
|
* @private
|
|
867
844
|
*/
|
|
868
|
-
|
|
869
|
-
|
|
870
845
|
function parseDate(date) {
|
|
871
846
|
var parsedDate;
|
|
872
847
|
if (date instanceof Date) parsedDate = date;else if (isString(date)) {
|
|
873
848
|
var config = this.config,
|
|
874
|
-
|
|
849
|
+
format = this.format;
|
|
875
850
|
parsedDate = format.dataTime(config.data_xFormat)(date);
|
|
876
851
|
} else isNumber(date) && !isNaN(date) && (parsedDate = new Date(+date));
|
|
877
852
|
return (!parsedDate || isNaN(+parsedDate)) && console && console.error && console.error("Failed to parse x '" + date + "' to Date object"), parsedDate;
|
|
878
853
|
}
|
|
854
|
+
|
|
879
855
|
/**
|
|
880
856
|
* Return if the current doc is visible or not
|
|
881
857
|
* @returns {boolean}
|
|
882
858
|
* @private
|
|
883
859
|
*/
|
|
884
|
-
|
|
885
|
-
|
|
886
860
|
function isTabVisible() {
|
|
887
861
|
return !doc.hidden;
|
|
888
862
|
}
|
|
863
|
+
|
|
889
864
|
/**
|
|
890
865
|
* Get the current input type
|
|
891
866
|
* @param {boolean} mouse Config value: interaction.inputType.mouse
|
|
@@ -893,20 +868,17 @@ function isTabVisible() {
|
|
|
893
868
|
* @returns {string} "mouse" | "touch" | null
|
|
894
869
|
* @private
|
|
895
870
|
*/
|
|
896
|
-
|
|
897
|
-
|
|
898
871
|
function convertInputType(mouse, touch) {
|
|
899
|
-
var isMobile = !1;
|
|
872
|
+
var isMobile = !1;
|
|
900
873
|
|
|
874
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#Mobile_Tablet_or_Desktop
|
|
901
875
|
if (/Mobi/.test(win.navigator.userAgent) && touch) {
|
|
902
876
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
903
877
|
var hasTouchPoints = win.navigator && "maxTouchPoints" in win.navigator && win.navigator.maxTouchPoints > 0,
|
|
904
|
-
|
|
878
|
+
hasTouch = "ontouchmove" in win || win.DocumentTouch && doc instanceof win.DocumentTouch; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
905
879
|
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
906
|
-
|
|
907
880
|
isMobile = hasTouchPoints || hasTouch;
|
|
908
881
|
}
|
|
909
|
-
|
|
910
882
|
var hasMouse = !(!mouse || isMobile) && "onmouseover" in win;
|
|
911
883
|
return hasMouse && "mouse" || isMobile && "touch" || null;
|
|
912
884
|
}
|
|
@@ -916,22 +888,18 @@ function convertInputType(mouse, touch) {
|
|
|
916
888
|
* billboard.js project is licensed under the MIT license
|
|
917
889
|
*/
|
|
918
890
|
|
|
919
|
-
|
|
920
891
|
/**
|
|
921
892
|
* Load configuration option
|
|
922
893
|
* @param {object} config User's generation config value
|
|
923
894
|
* @private
|
|
924
895
|
*/
|
|
925
896
|
function loadConfig(config) {
|
|
926
|
-
var
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
thisConfig = this.config,
|
|
930
|
-
find = function () {
|
|
897
|
+
var thisConfig = this.config;
|
|
898
|
+
var target, keys, read;
|
|
899
|
+
var find = function () {
|
|
931
900
|
var key = keys.shift();
|
|
932
901
|
return key && target && isObjectType(target) && key in target ? (target = target[key], find()) : key ? undefined : target;
|
|
933
902
|
};
|
|
934
|
-
|
|
935
903
|
Object.keys(thisConfig).forEach(function (key) {
|
|
936
904
|
target = config, keys = key.split("_"), read = find(), isDefined(read) && (thisConfig[key] = read);
|
|
937
905
|
});
|
|
@@ -941,12 +909,10 @@ function loadConfig(config) {
|
|
|
941
909
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
942
910
|
* billboard.js project is licensed under the MIT license
|
|
943
911
|
*/
|
|
944
|
-
|
|
945
912
|
/**
|
|
946
913
|
* Base class to generate billboard.js plugin
|
|
947
914
|
* @class Plugin
|
|
948
915
|
*/
|
|
949
|
-
|
|
950
916
|
/**
|
|
951
917
|
* Version info string for plugin
|
|
952
918
|
* @name version
|
|
@@ -965,50 +931,46 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
965
931
|
function Plugin(options) {
|
|
966
932
|
options === void 0 && (options = {}), this.$$ = void 0, this.options = void 0, this.options = options;
|
|
967
933
|
}
|
|
934
|
+
|
|
968
935
|
/**
|
|
969
936
|
* Lifecycle hook for 'beforeInit' phase.
|
|
970
937
|
* @private
|
|
971
938
|
*/
|
|
972
|
-
|
|
973
|
-
|
|
974
939
|
var _proto = Plugin.prototype;
|
|
975
940
|
return _proto.$beforeInit = function $beforeInit() {}
|
|
941
|
+
|
|
976
942
|
/**
|
|
977
943
|
* Lifecycle hook for 'init' phase.
|
|
978
944
|
* @private
|
|
979
|
-
|
|
980
|
-
|
|
945
|
+
*/, _proto.$init = function $init() {}
|
|
946
|
+
|
|
981
947
|
/**
|
|
982
948
|
* Lifecycle hook for 'afterInit' phase.
|
|
983
949
|
* @private
|
|
984
|
-
|
|
985
|
-
|
|
950
|
+
*/, _proto.$afterInit = function $afterInit() {}
|
|
951
|
+
|
|
986
952
|
/**
|
|
987
953
|
* Lifecycle hook for 'redraw' phase.
|
|
988
954
|
* @private
|
|
989
|
-
|
|
990
|
-
|
|
955
|
+
*/, _proto.$redraw = function $redraw() {}
|
|
956
|
+
|
|
991
957
|
/**
|
|
992
958
|
* Lifecycle hook for 'willDestroy' phase.
|
|
993
959
|
* @private
|
|
994
|
-
|
|
995
|
-
, _proto.$willDestroy = function $willDestroy() {
|
|
960
|
+
*/, _proto.$willDestroy = function $willDestroy() {
|
|
996
961
|
var _this = this;
|
|
997
|
-
|
|
998
962
|
Object.keys(this).forEach(function (key) {
|
|
999
963
|
_this[key] = null, delete _this[key];
|
|
1000
964
|
});
|
|
1001
965
|
}, Plugin;
|
|
1002
966
|
}();
|
|
1003
|
-
|
|
1004
|
-
Plugin.version = "2.2.5";
|
|
967
|
+
Plugin.version = "2.2.8a";
|
|
1005
968
|
|
|
1006
969
|
;// CONCATENATED MODULE: ./src/Plugin/textoverlap/Options.ts
|
|
1007
970
|
/**
|
|
1008
971
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1009
972
|
* billboard.js project is licensed under the MIT license
|
|
1010
973
|
*/
|
|
1011
|
-
|
|
1012
974
|
/**
|
|
1013
975
|
* TextOverlap plugin option class
|
|
1014
976
|
* @class TextOverlapOptions
|
|
@@ -1030,7 +992,6 @@ var Options = function () {
|
|
|
1030
992
|
* selector: ".bb-texts text"
|
|
1031
993
|
*/
|
|
1032
994
|
selector: ".bb-texts text",
|
|
1033
|
-
|
|
1034
995
|
/**
|
|
1035
996
|
* Set extent of label overlap prevention
|
|
1036
997
|
* @name extent
|
|
@@ -1041,7 +1002,6 @@ var Options = function () {
|
|
|
1041
1002
|
* extent: 1
|
|
1042
1003
|
*/
|
|
1043
1004
|
extent: 1,
|
|
1044
|
-
|
|
1045
1005
|
/**
|
|
1046
1006
|
* Set minimum area needed to show a data label
|
|
1047
1007
|
* @name area
|
|
@@ -1055,11 +1015,9 @@ var Options = function () {
|
|
|
1055
1015
|
};
|
|
1056
1016
|
};
|
|
1057
1017
|
|
|
1058
|
-
|
|
1059
1018
|
;// CONCATENATED MODULE: ./src/Plugin/textoverlap/index.ts
|
|
1060
1019
|
|
|
1061
1020
|
|
|
1062
|
-
|
|
1063
1021
|
/**
|
|
1064
1022
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1065
1023
|
* billboard.js project is licensed under the MIT license
|
|
@@ -1070,6 +1028,7 @@ var Options = function () {
|
|
|
1070
1028
|
|
|
1071
1029
|
|
|
1072
1030
|
|
|
1031
|
+
|
|
1073
1032
|
/**
|
|
1074
1033
|
* TextOverlap plugin<br>
|
|
1075
1034
|
* Prevents label overlap using [Voronoi layout](https://en.wikipedia.org/wiki/Voronoi_diagram).
|
|
@@ -1113,16 +1072,12 @@ var Options = function () {
|
|
|
1113
1072
|
* ]
|
|
1114
1073
|
* })
|
|
1115
1074
|
*/
|
|
1116
|
-
|
|
1117
1075
|
var TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
1118
1076
|
function TextOverlap(options) {
|
|
1119
1077
|
var _this;
|
|
1120
|
-
|
|
1121
1078
|
return _this = _Plugin.call(this, options) || this, _this.config = void 0, _this.config = new Options(), _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
|
1122
1079
|
}
|
|
1123
|
-
|
|
1124
1080
|
_inheritsLoose(TextOverlap, _Plugin);
|
|
1125
|
-
|
|
1126
1081
|
var _proto = TextOverlap.prototype;
|
|
1127
1082
|
return _proto.$init = function $init() {
|
|
1128
1083
|
loadConfig.call(this, this.options);
|
|
@@ -1130,62 +1085,59 @@ var TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
|
1130
1085
|
var text = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.selectAll)(this.config.selector);
|
|
1131
1086
|
text.empty() || this.preventLabelOverlap(text);
|
|
1132
1087
|
}
|
|
1088
|
+
|
|
1133
1089
|
/**
|
|
1134
1090
|
* Generates the voronoi layout for data labels
|
|
1135
1091
|
* @param {object} data Indices values
|
|
1136
1092
|
* @returns {object} Voronoi layout points and corresponding Data points
|
|
1137
1093
|
* @private
|
|
1138
|
-
|
|
1139
|
-
, _proto.generateVoronoi = function generateVoronoi(data) {
|
|
1094
|
+
*/, _proto.generateVoronoi = function generateVoronoi(data) {
|
|
1140
1095
|
var $$ = this.$$,
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1096
|
+
scale = $$.scale,
|
|
1097
|
+
_map = ["x", "y"].map(function (v) {
|
|
1098
|
+
return scale[v].domain();
|
|
1099
|
+
}),
|
|
1100
|
+
min = _map[0],
|
|
1101
|
+
max = _map[1],
|
|
1102
|
+
_ref = [max[0], min[1]];
|
|
1149
1103
|
return min[1] = _ref[0], max[0] = _ref[1], (0,external_commonjs_d3_voronoi_commonjs2_d3_voronoi_amd_d3_voronoi_root_d3_.voronoi)().extent([min, max]).polygons(data);
|
|
1150
1104
|
}
|
|
1105
|
+
|
|
1151
1106
|
/**
|
|
1152
1107
|
* Set text label's position to preventg overlap.
|
|
1153
1108
|
* @param {d3Selection} text target text selection
|
|
1154
1109
|
* @private
|
|
1155
|
-
|
|
1156
|
-
, _proto.preventLabelOverlap = function preventLabelOverlap(text) {
|
|
1110
|
+
*/, _proto.preventLabelOverlap = function preventLabelOverlap(text) {
|
|
1157
1111
|
var _this$config = this.config,
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1112
|
+
extent = _this$config.extent,
|
|
1113
|
+
area = _this$config.area,
|
|
1114
|
+
cells = this.generateVoronoi(text.data().map(function (v) {
|
|
1115
|
+
return [v.x, v.value];
|
|
1116
|
+
})),
|
|
1117
|
+
i = 0;
|
|
1164
1118
|
text.each(function () {
|
|
1165
1119
|
var cell = cells[i++];
|
|
1166
|
-
|
|
1167
1120
|
if (cell && this) {
|
|
1168
1121
|
var _cell$data = cell.data,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1122
|
+
x = _cell$data[0],
|
|
1123
|
+
y = _cell$data[1],
|
|
1124
|
+
_d3PolygonCentroid = (0,external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_.polygonCentroid)(cell),
|
|
1125
|
+
cx = _d3PolygonCentroid[0],
|
|
1126
|
+
cy = _d3PolygonCentroid[1],
|
|
1127
|
+
angle = Math.round(Math.atan2(cy - y, cx - x) / Math.PI * 2),
|
|
1128
|
+
xTranslate = extent * (angle === 0 ? 1 : -1),
|
|
1129
|
+
yTranslate = angle === -1 ? -extent : extent + 5,
|
|
1130
|
+
txtAnchor = Math.abs(angle) === 1 ? "middle" : angle === 0 ? "start" : "end";
|
|
1131
|
+
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this)
|
|
1132
|
+
// @ts-ignore
|
|
1180
1133
|
.attr("display", (0,external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_.polygonArea)(cell) < area ? "none" : null).attr("text-anchor", txtAnchor).attr("dy", "0." + (angle === 1 ? 71 : 35) + "em").attr("transform", "translate(" + xTranslate + ", " + yTranslate + ")");
|
|
1181
1134
|
}
|
|
1182
1135
|
});
|
|
1183
1136
|
}, TextOverlap;
|
|
1184
1137
|
}(Plugin);
|
|
1185
1138
|
|
|
1186
|
-
|
|
1187
1139
|
}();
|
|
1188
|
-
__webpack_exports__ = __webpack_exports__
|
|
1140
|
+
__webpack_exports__ = __webpack_exports__["default"];
|
|
1189
1141
|
/******/ return __webpack_exports__;
|
|
1190
1142
|
/******/ })()
|
|
1191
1143
|
;
|