billboard.js 3.9.4 → 3.10.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/billboard.css +2 -2
- package/dist/billboard.js +2742 -2516
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2936 -2704
- package/dist/billboard.pkgd.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +15 -15
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +205 -186
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +231 -226
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +172 -152
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +161 -142
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/{billboardjs-plugin-bubblecompare.js → billboardjs-plugin-bubblecompare.pkgd.js} +52 -32
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-sparkline.js → billboardjs-plugin-sparkline.pkgd.js} +239 -200
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-stanford.js → billboardjs-plugin-stanford.pkgd.js} +301 -277
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-tableview.js → billboardjs-plugin-tableview.pkgd.js} +206 -166
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -0
- package/dist/plugin/pkgd/{billboardjs-plugin-textoverlap.js → billboardjs-plugin-textoverlap.pkgd.js} +308 -278
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +12 -0
- package/dist/theme/dark.css +5 -4
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +5 -4
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +5 -4
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +5 -4
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +718 -509
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +15 -9
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +21 -28
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +17 -11
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +13 -7
- package/package.json +32 -32
- package/src/Chart/api/axis.ts +4 -0
- package/src/Chart/api/category.ts +8 -4
- package/src/Chart/api/export.ts +1 -2
- package/src/Chart/api/subchart.ts +162 -89
- package/src/Chart/api/zoom.ts +69 -79
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +0 -8
- package/src/ChartInternal/data/IData.ts +4 -1
- package/src/ChartInternal/data/convert.helper.ts +1 -15
- package/src/ChartInternal/data/data.ts +8 -2
- package/src/ChartInternal/interactions/eventrect.ts +3 -4
- package/src/ChartInternal/interactions/flow.ts +1 -7
- package/src/ChartInternal/interactions/interaction.ts +11 -5
- package/src/ChartInternal/interactions/subchart.ts +36 -30
- package/src/ChartInternal/interactions/zoom.ts +13 -3
- package/src/ChartInternal/internals/category.ts +2 -2
- package/src/ChartInternal/internals/clip.ts +4 -5
- package/src/ChartInternal/internals/color.ts +49 -23
- package/src/ChartInternal/internals/domain.ts +46 -10
- package/src/ChartInternal/internals/grid.ts +57 -86
- package/src/ChartInternal/internals/redraw.ts +1 -6
- package/src/ChartInternal/internals/region.ts +35 -12
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/text.ts +1 -26
- package/src/ChartInternal/internals/title.ts +10 -48
- package/src/ChartInternal/internals/tooltip.ts +50 -54
- package/src/ChartInternal/shape/arc.ts +2 -2
- package/src/ChartInternal/shape/candlestick.ts +2 -17
- package/src/ChartInternal/shape/point.ts +36 -8
- package/src/ChartInternal/shape/radar.ts +1 -1
- package/src/ChartInternal/shape/shape.ts +50 -4
- package/src/ChartInternal/shape/treemap.ts +2 -2
- package/src/Plugin/bubblecompare/index.ts +1 -1
- package/src/Plugin/sparkline/index.ts +2 -2
- package/src/Plugin/stanford/Elements.ts +10 -2
- package/src/Plugin/stanford/index.ts +1 -24
- package/src/Plugin/tableview/index.ts +2 -2
- package/src/config/Options/axis/x.ts +1 -0
- package/src/config/Options/common/main.ts +12 -2
- package/src/config/Options/common/point.ts +41 -0
- package/src/config/Options/common/tooltip.ts +10 -10
- package/src/config/Options/data/axis.ts +3 -1
- package/src/config/Options/data/data.ts +10 -2
- package/src/config/Options/shape/area.ts +10 -4
- package/src/config/Options/shape/bar.ts +10 -4
- package/src/config/Store/State.ts +3 -0
- package/src/module/Cache.ts +7 -5
- package/src/module/browser.ts +34 -14
- package/src/module/util.ts +8 -4
- package/src/module/worker.ts +24 -13
- package/src/scss/billboard.scss +4 -2
- package/src/scss/theme/dark.scss +4 -2
- package/src/scss/theme/datalab.scss +4 -2
- package/src/scss/theme/graph.scss +4 -2
- package/src/scss/theme/insight.scss +4 -2
- package/types/chart.d.ts +11 -0
- package/types/options.d.ts +9 -3
- package/types/options.shape.d.ts +26 -0
- package/types/types.d.ts +15 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.10.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -188,7 +188,6 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
|
|
|
188
188
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
189
189
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
190
190
|
|
|
191
|
-
var _this = undefined;
|
|
192
191
|
/**
|
|
193
192
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
194
193
|
* billboard.js project is licensed under the MIT license
|
|
@@ -199,30 +198,45 @@ var _this = undefined;
|
|
|
199
198
|
*/
|
|
200
199
|
/* eslint-disable no-new-func, no-undef */
|
|
201
200
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Get global object
|
|
204
|
+
* @returns {object} window object
|
|
205
|
+
* @private
|
|
206
|
+
*/
|
|
207
|
+
function getGlobal() {
|
|
208
|
+
return 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 || Function("return this")();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get fallback object
|
|
213
|
+
* @param {object} w global object
|
|
214
|
+
* @returns {Array} fallback object array
|
|
215
|
+
* @private
|
|
216
|
+
*/
|
|
217
|
+
function getFallback(w) {
|
|
218
|
+
var _this = this;
|
|
219
|
+
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function",
|
|
220
|
+
hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function";
|
|
221
|
+
return [hasRAF ? w.requestAnimationFrame : function (cb) {
|
|
210
222
|
_newArrowCheck(this, _this);
|
|
211
223
|
return setTimeout(cb, 1);
|
|
212
|
-
}.bind(
|
|
213
|
-
cancelAnimationFrame = hasRAF ? win.cancelAnimationFrame : function (id) {
|
|
224
|
+
}.bind(this), hasRAF ? w.cancelAnimationFrame : function (id) {
|
|
214
225
|
_newArrowCheck(this, _this);
|
|
215
226
|
return clearTimeout(id);
|
|
216
|
-
}.bind(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
doc = win == null ? void 0 : win.document
|
|
220
|
-
|
|
221
|
-
|
|
227
|
+
}.bind(this), hasRIC ? w.requestIdleCallback : requestAnimationFrame, hasRIC ? w.cancelIdleCallback : cancelAnimationFrame];
|
|
228
|
+
}
|
|
229
|
+
const win = getGlobal(),
|
|
230
|
+
doc = win == null ? void 0 : win.document,
|
|
231
|
+
_getFallback = getFallback(win),
|
|
232
|
+
requestAnimationFrame = _getFallback[0],
|
|
233
|
+
cancelAnimationFrame = _getFallback[1],
|
|
234
|
+
requestIdleCallback = _getFallback[2],
|
|
235
|
+
cancelIdleCallback = _getFallback[3];
|
|
222
236
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
223
237
|
|
|
224
238
|
|
|
225
|
-
var
|
|
239
|
+
var _this = undefined;
|
|
226
240
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
227
241
|
function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
228
242
|
/**
|
|
@@ -234,64 +248,64 @@ function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t =
|
|
|
234
248
|
|
|
235
249
|
|
|
236
250
|
|
|
237
|
-
|
|
238
|
-
_newArrowCheck(this,
|
|
251
|
+
const isValue = function (v) {
|
|
252
|
+
_newArrowCheck(this, _this);
|
|
239
253
|
return v || v === 0;
|
|
240
254
|
}.bind(undefined),
|
|
241
255
|
isFunction = function (v) {
|
|
242
|
-
_newArrowCheck(this,
|
|
256
|
+
_newArrowCheck(this, _this);
|
|
243
257
|
return typeof v === "function";
|
|
244
258
|
}.bind(undefined),
|
|
245
259
|
isString = function (v) {
|
|
246
|
-
_newArrowCheck(this,
|
|
260
|
+
_newArrowCheck(this, _this);
|
|
247
261
|
return typeof v === "string";
|
|
248
262
|
}.bind(undefined),
|
|
249
263
|
isNumber = function (v) {
|
|
250
|
-
_newArrowCheck(this,
|
|
264
|
+
_newArrowCheck(this, _this);
|
|
251
265
|
return typeof v === "number";
|
|
252
266
|
}.bind(undefined),
|
|
253
267
|
isUndefined = function (v) {
|
|
254
|
-
_newArrowCheck(this,
|
|
268
|
+
_newArrowCheck(this, _this);
|
|
255
269
|
return typeof v === "undefined";
|
|
256
270
|
}.bind(undefined),
|
|
257
271
|
isDefined = function (v) {
|
|
258
|
-
_newArrowCheck(this,
|
|
272
|
+
_newArrowCheck(this, _this);
|
|
259
273
|
return typeof v !== "undefined";
|
|
260
274
|
}.bind(undefined),
|
|
261
275
|
isboolean = function (v) {
|
|
262
|
-
_newArrowCheck(this,
|
|
276
|
+
_newArrowCheck(this, _this);
|
|
263
277
|
return typeof v === "boolean";
|
|
264
278
|
}.bind(undefined),
|
|
265
279
|
ceil10 = function (v) {
|
|
266
|
-
_newArrowCheck(this,
|
|
280
|
+
_newArrowCheck(this, _this);
|
|
267
281
|
return Math.ceil(v / 10) * 10;
|
|
268
282
|
}.bind(undefined),
|
|
269
283
|
asHalfPixel = function (n) {
|
|
270
|
-
_newArrowCheck(this,
|
|
284
|
+
_newArrowCheck(this, _this);
|
|
271
285
|
return Math.ceil(n) + .5;
|
|
272
286
|
}.bind(undefined),
|
|
273
287
|
diffDomain = function (d) {
|
|
274
|
-
_newArrowCheck(this,
|
|
288
|
+
_newArrowCheck(this, _this);
|
|
275
289
|
return d[1] - d[0];
|
|
276
290
|
}.bind(undefined),
|
|
277
291
|
isObjectType = function (v) {
|
|
278
|
-
_newArrowCheck(this,
|
|
292
|
+
_newArrowCheck(this, _this);
|
|
279
293
|
return typeof v === "object";
|
|
280
294
|
}.bind(undefined),
|
|
281
295
|
isEmpty = function (o) {
|
|
282
|
-
_newArrowCheck(this,
|
|
296
|
+
_newArrowCheck(this, _this);
|
|
283
297
|
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
284
298
|
}.bind(undefined),
|
|
285
299
|
notEmpty = function (o) {
|
|
286
|
-
_newArrowCheck(this,
|
|
300
|
+
_newArrowCheck(this, _this);
|
|
287
301
|
return !isEmpty(o);
|
|
288
302
|
}.bind(undefined),
|
|
289
303
|
isArray = function (arr) {
|
|
290
|
-
_newArrowCheck(this,
|
|
304
|
+
_newArrowCheck(this, _this);
|
|
291
305
|
return Array.isArray(arr);
|
|
292
306
|
}.bind(undefined),
|
|
293
307
|
isObject = function (obj) {
|
|
294
|
-
_newArrowCheck(this,
|
|
308
|
+
_newArrowCheck(this, _this);
|
|
295
309
|
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
296
310
|
}.bind(undefined);
|
|
297
311
|
/**
|
|
@@ -327,8 +341,8 @@ function getOption(options, key, defaultValue) {
|
|
|
327
341
|
* @private
|
|
328
342
|
*/
|
|
329
343
|
function hasValue(dict, value) {
|
|
330
|
-
var _this2 = this
|
|
331
|
-
|
|
344
|
+
var _this2 = this;
|
|
345
|
+
let found = !1;
|
|
332
346
|
Object.keys(dict).forEach(function (key) {
|
|
333
347
|
_newArrowCheck(this, _this2);
|
|
334
348
|
return dict[key] === value && (found = !0);
|
|
@@ -345,7 +359,7 @@ function hasValue(dict, value) {
|
|
|
345
359
|
* @private
|
|
346
360
|
*/
|
|
347
361
|
function callFn(fn, thisArg) {
|
|
348
|
-
|
|
362
|
+
const isFn = isFunction(fn);
|
|
349
363
|
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
350
364
|
args[_key - 2] = arguments[_key];
|
|
351
365
|
}
|
|
@@ -360,14 +374,15 @@ function callFn(fn, thisArg) {
|
|
|
360
374
|
* @private
|
|
361
375
|
*/
|
|
362
376
|
function endall(transition, cb) {
|
|
363
|
-
var _this3 = this
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
377
|
+
var _this3 = this;
|
|
378
|
+
let n = 0;
|
|
379
|
+
const end = function () {
|
|
380
|
+
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
381
|
+
args[_key2] = arguments[_key2];
|
|
382
|
+
}
|
|
383
|
+
--n || cb.apply.apply(cb, [this].concat(args));
|
|
384
|
+
};
|
|
385
|
+
|
|
371
386
|
// if is transition selection
|
|
372
387
|
if ("duration" in transition) {
|
|
373
388
|
transition.each(function () {
|
|
@@ -386,8 +401,8 @@ function endall(transition, cb) {
|
|
|
386
401
|
* @returns {string}
|
|
387
402
|
* @private
|
|
388
403
|
*/
|
|
389
|
-
function
|
|
390
|
-
return isString(str) ? str.replace(
|
|
404
|
+
function sanitize(str) {
|
|
405
|
+
return isString(str) ? str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") : str;
|
|
391
406
|
}
|
|
392
407
|
|
|
393
408
|
/**
|
|
@@ -412,12 +427,12 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
412
427
|
if (text.indexOf("\n") === -1) {
|
|
413
428
|
node.text(text);
|
|
414
429
|
} else {
|
|
415
|
-
|
|
430
|
+
const diff = [node.text(), text].map(function (v) {
|
|
416
431
|
_newArrowCheck(this, _this4);
|
|
417
432
|
return v.replace(/[\s\n]/g, "");
|
|
418
433
|
}.bind(this));
|
|
419
434
|
if (diff[0] !== diff[1]) {
|
|
420
|
-
|
|
435
|
+
const multiline = text.split("\n"),
|
|
421
436
|
len = toMiddle ? multiline.length - 1 : 1;
|
|
422
437
|
// reset possible text
|
|
423
438
|
node.html("");
|
|
@@ -443,7 +458,7 @@ function getRectSegList(path) {
|
|
|
443
458
|
* | |
|
|
444
459
|
* seg0 ---------- seg3
|
|
445
460
|
* */
|
|
446
|
-
|
|
461
|
+
const _path$getBBox = path.getBBox(),
|
|
447
462
|
x = _path$getBBox.x,
|
|
448
463
|
y = _path$getBBox.y,
|
|
449
464
|
width = _path$getBBox.width,
|
|
@@ -477,7 +492,7 @@ function getRectSegList(path) {
|
|
|
477
492
|
* @private
|
|
478
493
|
*/
|
|
479
494
|
function getPathBox(path) {
|
|
480
|
-
|
|
495
|
+
const _path$getBoundingClie = path.getBoundingClientRect(),
|
|
481
496
|
width = _path$getBoundingClie.width,
|
|
482
497
|
height = _path$getBoundingClie.height,
|
|
483
498
|
items = getRectSegList(path),
|
|
@@ -500,9 +515,12 @@ function getPathBox(path) {
|
|
|
500
515
|
*/
|
|
501
516
|
function getPointer(event, element) {
|
|
502
517
|
var _ref,
|
|
503
|
-
touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
|
504
|
-
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
|
505
518
|
_this5 = this;
|
|
519
|
+
const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
|
|
520
|
+
let pointer = [0, 0];
|
|
521
|
+
try {
|
|
522
|
+
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
|
|
523
|
+
} catch (e) {}
|
|
506
524
|
return pointer.map(function (v) {
|
|
507
525
|
_newArrowCheck(this, _this5);
|
|
508
526
|
return isNaN(v) ? 0 : v;
|
|
@@ -516,10 +534,10 @@ function getPointer(event, element) {
|
|
|
516
534
|
* @private
|
|
517
535
|
*/
|
|
518
536
|
function getBrushSelection(ctx) {
|
|
519
|
-
|
|
537
|
+
const event = ctx.event,
|
|
520
538
|
$el = ctx.$el,
|
|
521
539
|
main = $el.subchart.main || $el.main;
|
|
522
|
-
|
|
540
|
+
let selection;
|
|
523
541
|
|
|
524
542
|
// check from event
|
|
525
543
|
if (event && event.type === "brush") {
|
|
@@ -539,7 +557,7 @@ function getBrushSelection(ctx) {
|
|
|
539
557
|
* @private
|
|
540
558
|
*/
|
|
541
559
|
function getBoundingRect(node) {
|
|
542
|
-
|
|
560
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
543
561
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
544
562
|
}
|
|
545
563
|
|
|
@@ -561,7 +579,7 @@ function getRandom(asStr, min, max) {
|
|
|
561
579
|
if (max === void 0) {
|
|
562
580
|
max = 1e4;
|
|
563
581
|
}
|
|
564
|
-
|
|
582
|
+
const crpt = win.crypto || win.msCrypto,
|
|
565
583
|
rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
566
584
|
return asStr ? rand + "" : rand;
|
|
567
585
|
}
|
|
@@ -580,8 +598,8 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
580
598
|
if (start > end) {
|
|
581
599
|
return -1;
|
|
582
600
|
}
|
|
583
|
-
|
|
584
|
-
|
|
601
|
+
const mid = Math.floor((start + end) / 2);
|
|
602
|
+
let _arr$mid = arr[mid],
|
|
585
603
|
x = _arr$mid.x,
|
|
586
604
|
_arr$mid$w = _arr$mid.w,
|
|
587
605
|
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
@@ -602,7 +620,7 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
602
620
|
* @private
|
|
603
621
|
*/
|
|
604
622
|
function brushEmpty(ctx) {
|
|
605
|
-
|
|
623
|
+
const selection = getBrushSelection(ctx);
|
|
606
624
|
if (selection) {
|
|
607
625
|
// brush selected area
|
|
608
626
|
// two-dimensional: [[x0, y0], [x1, y1]]
|
|
@@ -619,17 +637,19 @@ function brushEmpty(ctx) {
|
|
|
619
637
|
* @private
|
|
620
638
|
*/
|
|
621
639
|
function deepClone() {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
return r;
|
|
640
|
+
var _this6 = this;
|
|
641
|
+
const _clone = function clone(v) {
|
|
642
|
+
_newArrowCheck(this, _this6);
|
|
643
|
+
if (isObject(v) && v.constructor) {
|
|
644
|
+
const r = new v.constructor();
|
|
645
|
+
for (const k in v) {
|
|
646
|
+
r[k] = _clone(v[k]);
|
|
630
647
|
}
|
|
631
|
-
return
|
|
632
|
-
}
|
|
648
|
+
return r;
|
|
649
|
+
}
|
|
650
|
+
return v;
|
|
651
|
+
}.bind(this);
|
|
652
|
+
for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
633
653
|
objectN[_key3] = arguments[_key3];
|
|
634
654
|
}
|
|
635
655
|
return objectN.map(function (v) {
|
|
@@ -661,7 +681,7 @@ function extend(target, source) {
|
|
|
661
681
|
}
|
|
662
682
|
|
|
663
683
|
// exclude name with only numbers
|
|
664
|
-
for (
|
|
684
|
+
for (const p in source) {
|
|
665
685
|
if (/^\d+$/.test(p) || p in target) {
|
|
666
686
|
continue;
|
|
667
687
|
}
|
|
@@ -676,8 +696,8 @@ function extend(target, source) {
|
|
|
676
696
|
* @returns {string} capitalized string
|
|
677
697
|
* @private
|
|
678
698
|
*/
|
|
679
|
-
|
|
680
|
-
_newArrowCheck(this,
|
|
699
|
+
const capitalize = function (str) {
|
|
700
|
+
_newArrowCheck(this, _this);
|
|
681
701
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
682
702
|
}.bind(undefined);
|
|
683
703
|
|
|
@@ -705,8 +725,8 @@ function camelize(str, separator) {
|
|
|
705
725
|
* @returns {Array}
|
|
706
726
|
* @private
|
|
707
727
|
*/
|
|
708
|
-
|
|
709
|
-
_newArrowCheck(this,
|
|
728
|
+
const toArray = function (v) {
|
|
729
|
+
_newArrowCheck(this, _this);
|
|
710
730
|
return [].slice.call(v);
|
|
711
731
|
}.bind(undefined);
|
|
712
732
|
|
|
@@ -719,8 +739,8 @@ var toArray = function (v) {
|
|
|
719
739
|
* @private
|
|
720
740
|
*/
|
|
721
741
|
function addCssRules(style, selector, prop) {
|
|
722
|
-
var _this9 = this
|
|
723
|
-
|
|
742
|
+
var _this9 = this;
|
|
743
|
+
const rootSelctor = style.rootSelctor,
|
|
724
744
|
sheet = style.sheet,
|
|
725
745
|
getSelector = function (s) {
|
|
726
746
|
_newArrowCheck(this, _this9);
|
|
@@ -737,8 +757,8 @@ function addCssRules(style, selector, prop) {
|
|
|
737
757
|
* @private
|
|
738
758
|
*/
|
|
739
759
|
function getCssRules(styleSheets) {
|
|
740
|
-
var _this10 = this
|
|
741
|
-
|
|
760
|
+
var _this10 = this;
|
|
761
|
+
let rules = [];
|
|
742
762
|
styleSheets.forEach(function (sheet) {
|
|
743
763
|
_newArrowCheck(this, _this10);
|
|
744
764
|
try {
|
|
@@ -760,7 +780,7 @@ function getCssRules(styleSheets) {
|
|
|
760
780
|
* @private
|
|
761
781
|
*/
|
|
762
782
|
function getTranslation(node) {
|
|
763
|
-
|
|
783
|
+
const transform = node ? node.transform : null,
|
|
764
784
|
baseVal = transform && transform.baseVal;
|
|
765
785
|
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
766
786
|
a: 0,
|
|
@@ -779,8 +799,8 @@ function getTranslation(node) {
|
|
|
779
799
|
* @private
|
|
780
800
|
*/
|
|
781
801
|
function getUnique(data) {
|
|
782
|
-
var _this11 = this
|
|
783
|
-
|
|
802
|
+
var _this11 = this;
|
|
803
|
+
const isDate = data[0] instanceof Date,
|
|
784
804
|
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
785
805
|
_newArrowCheck(this, _this11);
|
|
786
806
|
return self.indexOf(v) === i;
|
|
@@ -819,11 +839,11 @@ function mergeObj(target) {
|
|
|
819
839
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
|
820
840
|
return target;
|
|
821
841
|
}
|
|
822
|
-
|
|
842
|
+
const source = objectN.shift();
|
|
823
843
|
if (isObject(target) && isObject(source)) {
|
|
824
844
|
Object.keys(source).forEach(function (key) {
|
|
825
845
|
_newArrowCheck(this, _this13);
|
|
826
|
-
|
|
846
|
+
const value = source[key];
|
|
827
847
|
if (isObject(value)) {
|
|
828
848
|
target[key] || (target[key] = {});
|
|
829
849
|
target[key] = mergeObj(target[key], value);
|
|
@@ -847,7 +867,7 @@ function sortValue(data, isAsc) {
|
|
|
847
867
|
if (isAsc === void 0) {
|
|
848
868
|
isAsc = !0;
|
|
849
869
|
}
|
|
850
|
-
|
|
870
|
+
let fn;
|
|
851
871
|
if (data[0] instanceof Date) {
|
|
852
872
|
fn = isAsc ? function (a, b) {
|
|
853
873
|
_newArrowCheck(this, _this14);
|
|
@@ -880,11 +900,11 @@ function sortValue(data, isAsc) {
|
|
|
880
900
|
* @private
|
|
881
901
|
*/
|
|
882
902
|
function getMinMax(type, data) {
|
|
883
|
-
var _this15 = this
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
903
|
+
var _this15 = this;
|
|
904
|
+
let res = data.filter(function (v) {
|
|
905
|
+
_newArrowCheck(this, _this15);
|
|
906
|
+
return notEmpty(v);
|
|
907
|
+
}.bind(this));
|
|
888
908
|
if (res.length) {
|
|
889
909
|
if (isNumber(res[0])) {
|
|
890
910
|
res = Math[type].apply(Math, res);
|
|
@@ -905,14 +925,14 @@ function getMinMax(type, data) {
|
|
|
905
925
|
* @returns {Array}
|
|
906
926
|
* @private
|
|
907
927
|
*/
|
|
908
|
-
|
|
928
|
+
const getRange = function (start, end, step) {
|
|
909
929
|
if (step === void 0) {
|
|
910
930
|
step = 1;
|
|
911
931
|
}
|
|
912
|
-
_newArrowCheck(this,
|
|
913
|
-
|
|
932
|
+
_newArrowCheck(this, _this);
|
|
933
|
+
const res = [],
|
|
914
934
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
915
|
-
for (
|
|
935
|
+
for (let i = start; i < n; i++) {
|
|
916
936
|
res.push(start + i * step);
|
|
917
937
|
}
|
|
918
938
|
return res;
|
|
@@ -920,8 +940,8 @@ var getRange = function (start, end, step) {
|
|
|
920
940
|
emulateEvent = {
|
|
921
941
|
mouse: function () {
|
|
922
942
|
var _this16 = this;
|
|
923
|
-
_newArrowCheck(this,
|
|
924
|
-
|
|
943
|
+
_newArrowCheck(this, _this);
|
|
944
|
+
const getParams = function () {
|
|
925
945
|
_newArrowCheck(this, _this16);
|
|
926
946
|
return {
|
|
927
947
|
bubbles: !1,
|
|
@@ -949,7 +969,7 @@ var getRange = function (start, end, step) {
|
|
|
949
969
|
params = getParams();
|
|
950
970
|
}
|
|
951
971
|
_newArrowCheck(this, _this16);
|
|
952
|
-
|
|
972
|
+
const mouseEvent = doc.createEvent("MouseEvent");
|
|
953
973
|
|
|
954
974
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
955
975
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
@@ -960,8 +980,8 @@ var getRange = function (start, end, step) {
|
|
|
960
980
|
}
|
|
961
981
|
}.bind(undefined)(),
|
|
962
982
|
touch: function touch(el, eventType, params) {
|
|
963
|
-
_newArrowCheck(this,
|
|
964
|
-
|
|
983
|
+
_newArrowCheck(this, _this);
|
|
984
|
+
const touchObj = new Touch(mergeObj({
|
|
965
985
|
identifier: Date.now(),
|
|
966
986
|
target: el,
|
|
967
987
|
radiusX: 2.5,
|
|
@@ -987,8 +1007,8 @@ var getRange = function (start, end, step) {
|
|
|
987
1007
|
* @private
|
|
988
1008
|
*/
|
|
989
1009
|
function tplProcess(tpl, data) {
|
|
990
|
-
|
|
991
|
-
for (
|
|
1010
|
+
let res = tpl;
|
|
1011
|
+
for (const x in data) {
|
|
992
1012
|
res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
|
993
1013
|
}
|
|
994
1014
|
return res;
|
|
@@ -1002,13 +1022,14 @@ function tplProcess(tpl, data) {
|
|
|
1002
1022
|
* @private
|
|
1003
1023
|
*/
|
|
1004
1024
|
function parseDate(date) {
|
|
1005
|
-
|
|
1025
|
+
let parsedDate;
|
|
1006
1026
|
if (date instanceof Date) {
|
|
1007
1027
|
parsedDate = date;
|
|
1008
1028
|
} else if (isString(date)) {
|
|
1009
|
-
var _format$dataTime
|
|
1010
|
-
|
|
1029
|
+
var _format$dataTime;
|
|
1030
|
+
const config = this.config,
|
|
1011
1031
|
format = this.format;
|
|
1032
|
+
|
|
1012
1033
|
// if fails to parse, try by new Date()
|
|
1013
1034
|
// https://github.com/naver/billboard.js/issues/1714
|
|
1014
1035
|
parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
|
@@ -1038,11 +1059,11 @@ function isTabVisible() {
|
|
|
1038
1059
|
* @private
|
|
1039
1060
|
*/
|
|
1040
1061
|
function convertInputType(mouse, touch) {
|
|
1041
|
-
var _this17 = this
|
|
1042
|
-
|
|
1062
|
+
var _this17 = this;
|
|
1063
|
+
const DocumentTouch = win.DocumentTouch,
|
|
1043
1064
|
matchMedia = win.matchMedia,
|
|
1044
|
-
navigator = win.navigator
|
|
1045
|
-
|
|
1065
|
+
navigator = win.navigator;
|
|
1066
|
+
let hasTouch = !1;
|
|
1046
1067
|
if (touch) {
|
|
1047
1068
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1048
1069
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
@@ -1058,7 +1079,7 @@ function convertInputType(mouse, touch) {
|
|
|
1058
1079
|
hasTouch = !0;
|
|
1059
1080
|
} else {
|
|
1060
1081
|
// Only as a last resort, fall back to user agent sniffing
|
|
1061
|
-
|
|
1082
|
+
const UA = navigator.userAgent;
|
|
1062
1083
|
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1063
1084
|
}
|
|
1064
1085
|
}
|
|
@@ -1067,7 +1088,7 @@ function convertInputType(mouse, touch) {
|
|
|
1067
1088
|
// Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
|
|
1068
1089
|
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1069
1090
|
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1070
|
-
|
|
1091
|
+
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1071
1092
|
_newArrowCheck(this, _this17);
|
|
1072
1093
|
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1073
1094
|
}.bind(this));
|
|
@@ -1106,22 +1127,20 @@ function runUntil(fn, conditionFn) {
|
|
|
1106
1127
|
* @private
|
|
1107
1128
|
*/
|
|
1108
1129
|
function loadConfig(config) {
|
|
1109
|
-
var _this = this
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
return undefined;
|
|
1124
|
-
}.bind(this);
|
|
1130
|
+
var _this = this;
|
|
1131
|
+
const thisConfig = this.config;
|
|
1132
|
+
let target, keys, read;
|
|
1133
|
+
const _find = function find() {
|
|
1134
|
+
_newArrowCheck(this, _this);
|
|
1135
|
+
const key = keys.shift();
|
|
1136
|
+
if (key && target && isObjectType(target) && key in target) {
|
|
1137
|
+
target = target[key];
|
|
1138
|
+
return _find();
|
|
1139
|
+
} else if (!key) {
|
|
1140
|
+
return target;
|
|
1141
|
+
}
|
|
1142
|
+
return undefined;
|
|
1143
|
+
}.bind(this);
|
|
1125
1144
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1126
1145
|
_newArrowCheck(this, _this);
|
|
1127
1146
|
target = config;
|
|
@@ -1156,7 +1175,7 @@ function loadConfig(config) {
|
|
|
1156
1175
|
* @example
|
|
1157
1176
|
* bb.plugin.stanford.version; // ex) 1.9.0
|
|
1158
1177
|
*/
|
|
1159
|
-
|
|
1178
|
+
let Plugin = /*#__PURE__*/function () {
|
|
1160
1179
|
/**
|
|
1161
1180
|
* Constructor
|
|
1162
1181
|
* @param {Any} options config option object
|
|
@@ -1210,7 +1229,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
1210
1229
|
};
|
|
1211
1230
|
return Plugin;
|
|
1212
1231
|
}();
|
|
1213
|
-
Plugin.version = "3.
|
|
1232
|
+
Plugin.version = "3.10.0-next.2";
|
|
1214
1233
|
|
|
1215
1234
|
;// CONCATENATED MODULE: ./src/Plugin/textoverlap/Options.ts
|
|
1216
1235
|
/**
|
|
@@ -1225,7 +1244,7 @@ Plugin.version = "3.9.4";
|
|
|
1225
1244
|
* @returns {TextOverlapOptions}
|
|
1226
1245
|
* @private
|
|
1227
1246
|
*/
|
|
1228
|
-
|
|
1247
|
+
let Options = function () {
|
|
1229
1248
|
return {
|
|
1230
1249
|
/**
|
|
1231
1250
|
* Selector string for target text nodes within chart element.
|
|
@@ -1320,7 +1339,7 @@ var Options = function () {
|
|
|
1320
1339
|
* ]
|
|
1321
1340
|
* })
|
|
1322
1341
|
*/
|
|
1323
|
-
|
|
1342
|
+
let TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
1324
1343
|
_inheritsLoose(TextOverlap, _Plugin);
|
|
1325
1344
|
function TextOverlap(options) {
|
|
1326
1345
|
var _this = _Plugin.call(this, options) || this;
|
|
@@ -1333,7 +1352,7 @@ var TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
|
1333
1352
|
loadConfig.call(this, this.options);
|
|
1334
1353
|
};
|
|
1335
1354
|
_proto.$redraw = function $redraw() {
|
|
1336
|
-
|
|
1355
|
+
const $el = this.$$.$el,
|
|
1337
1356
|
selector = this.config.selector,
|
|
1338
1357
|
text = selector ? $el.main.selectAll(selector) : $el.text;
|
|
1339
1358
|
text.empty() || this.preventLabelOverlap(text);
|
|
@@ -1346,16 +1365,16 @@ var TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
|
1346
1365
|
* @private
|
|
1347
1366
|
*/;
|
|
1348
1367
|
_proto.generateVoronoi = function generateVoronoi(points) {
|
|
1349
|
-
var _this2 = this
|
|
1350
|
-
|
|
1368
|
+
var _this2 = this;
|
|
1369
|
+
const $$ = this.$$,
|
|
1351
1370
|
scale = $$.scale,
|
|
1352
1371
|
_map = ["x", "y"].map(function (v) {
|
|
1353
1372
|
_newArrowCheck(this, _this2);
|
|
1354
1373
|
return scale[v].domain();
|
|
1355
1374
|
}.bind(this)),
|
|
1356
1375
|
min = _map[0],
|
|
1357
|
-
max = _map[1]
|
|
1358
|
-
|
|
1376
|
+
max = _map[1];
|
|
1377
|
+
var _ref = [max[0], min[1]];
|
|
1359
1378
|
min[1] = _ref[0];
|
|
1360
1379
|
max[0] = _ref[1];
|
|
1361
1380
|
return external_commonjs_d3_delaunay_commonjs2_d3_delaunay_amd_d3_delaunay_root_d3_.Delaunay.from(points).voronoi([].concat(min, max)); // bounds = [xmin, ymin, xmax, ymax], default value: [0, 0, 960, 500]
|
|
@@ -1367,20 +1386,20 @@ var TextOverlap = /*#__PURE__*/function (_Plugin) {
|
|
|
1367
1386
|
* @private
|
|
1368
1387
|
*/;
|
|
1369
1388
|
_proto.preventLabelOverlap = function preventLabelOverlap(text) {
|
|
1370
|
-
var _this3 = this
|
|
1371
|
-
|
|
1389
|
+
var _this3 = this;
|
|
1390
|
+
const _this$config = this.config,
|
|
1372
1391
|
extent = _this$config.extent,
|
|
1373
1392
|
area = _this$config.area,
|
|
1374
1393
|
points = text.data().map(function (v) {
|
|
1375
1394
|
_newArrowCheck(this, _this3);
|
|
1376
1395
|
return [v.index, v.value];
|
|
1377
1396
|
}.bind(this)),
|
|
1378
|
-
voronoi = this.generateVoronoi(points)
|
|
1379
|
-
|
|
1397
|
+
voronoi = this.generateVoronoi(points);
|
|
1398
|
+
let i = 0;
|
|
1380
1399
|
text.each(function () {
|
|
1381
|
-
|
|
1400
|
+
const cell = voronoi.cellPolygon(i);
|
|
1382
1401
|
if (cell && this) {
|
|
1383
|
-
|
|
1402
|
+
const _points$i = points[i],
|
|
1384
1403
|
x = _points$i[0],
|
|
1385
1404
|
y = _points$i[1],
|
|
1386
1405
|
_d3PolygonCentroid = (0,external_commonjs_d3_polygon_commonjs2_d3_polygon_amd_d3_polygon_root_d3_.polygonCentroid)(cell),
|