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
|
*/
|
|
@@ -212,7 +212,7 @@ function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t =
|
|
|
212
212
|
* CSS class names definition
|
|
213
213
|
* @private
|
|
214
214
|
*/
|
|
215
|
-
|
|
215
|
+
const $COMMON = {
|
|
216
216
|
button: "bb-button",
|
|
217
217
|
chart: "bb-chart",
|
|
218
218
|
empty: "bb-empty",
|
|
@@ -220,7 +220,7 @@ var $COMMON = {
|
|
|
220
220
|
target: "bb-target",
|
|
221
221
|
EXPANDED: "_expanded_"
|
|
222
222
|
};
|
|
223
|
-
|
|
223
|
+
const $ARC = {
|
|
224
224
|
arc: "bb-arc",
|
|
225
225
|
arcLabelLine: "bb-arc-label-line",
|
|
226
226
|
arcs: "bb-arcs",
|
|
@@ -230,11 +230,11 @@ var $ARC = {
|
|
|
230
230
|
chartArcsTitle: "bb-chart-arcs-title",
|
|
231
231
|
needle: "bb-needle"
|
|
232
232
|
};
|
|
233
|
-
|
|
233
|
+
const $AREA = {
|
|
234
234
|
area: "bb-area",
|
|
235
235
|
areas: "bb-areas"
|
|
236
236
|
};
|
|
237
|
-
|
|
237
|
+
const $AXIS = {
|
|
238
238
|
axis: "bb-axis",
|
|
239
239
|
axisX: "bb-axis-x",
|
|
240
240
|
axisXLabel: "bb-axis-x-label",
|
|
@@ -243,13 +243,13 @@ var $AXIS = {
|
|
|
243
243
|
axisY2Label: "bb-axis-y2-label",
|
|
244
244
|
axisYLabel: "bb-axis-y-label"
|
|
245
245
|
};
|
|
246
|
-
|
|
246
|
+
const $BAR = {
|
|
247
247
|
bar: "bb-bar",
|
|
248
248
|
bars: "bb-bars",
|
|
249
249
|
chartBar: "bb-chart-bar",
|
|
250
250
|
chartBars: "bb-chart-bars"
|
|
251
251
|
};
|
|
252
|
-
|
|
252
|
+
const $CANDLESTICK = {
|
|
253
253
|
candlestick: "bb-candlestick",
|
|
254
254
|
candlesticks: "bb-candlesticks",
|
|
255
255
|
chartCandlestick: "bb-chart-candlestick",
|
|
@@ -257,27 +257,27 @@ var $CANDLESTICK = {
|
|
|
257
257
|
valueDown: "bb-value-down",
|
|
258
258
|
valueUp: "bb-value-up"
|
|
259
259
|
};
|
|
260
|
-
|
|
260
|
+
const $CIRCLE = {
|
|
261
261
|
chartCircles: "bb-chart-circles",
|
|
262
262
|
circle: "bb-circle",
|
|
263
263
|
circles: "bb-circles"
|
|
264
264
|
};
|
|
265
|
-
|
|
265
|
+
const $COLOR = {
|
|
266
266
|
colorPattern: "bb-color-pattern",
|
|
267
267
|
colorScale: "bb-colorscale"
|
|
268
268
|
};
|
|
269
|
-
|
|
269
|
+
const $DRAG = {
|
|
270
270
|
dragarea: "bb-dragarea",
|
|
271
271
|
INCLUDED: "_included_"
|
|
272
272
|
};
|
|
273
|
-
|
|
273
|
+
const $GAUGE = {
|
|
274
274
|
chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
|
275
275
|
chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
|
276
276
|
chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
|
277
277
|
chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
|
278
278
|
gaugeValue: "bb-gauge-value"
|
|
279
279
|
};
|
|
280
|
-
|
|
280
|
+
const $LEGEND = {
|
|
281
281
|
legend: "bb-legend",
|
|
282
282
|
legendBackground: "bb-legend-background",
|
|
283
283
|
legendItem: "bb-legend-item",
|
|
@@ -286,26 +286,26 @@ var $LEGEND = {
|
|
|
286
286
|
legendItemPoint: "bb-legend-item-point",
|
|
287
287
|
legendItemTile: "bb-legend-item-tile"
|
|
288
288
|
};
|
|
289
|
-
|
|
289
|
+
const $LINE = {
|
|
290
290
|
chartLine: "bb-chart-line",
|
|
291
291
|
chartLines: "bb-chart-lines",
|
|
292
292
|
line: "bb-line",
|
|
293
293
|
lines: "bb-lines"
|
|
294
294
|
};
|
|
295
|
-
|
|
295
|
+
const $EVENT = {
|
|
296
296
|
eventRect: "bb-event-rect",
|
|
297
297
|
eventRects: "bb-event-rects",
|
|
298
298
|
eventRectsMultiple: "bb-event-rects-multiple",
|
|
299
299
|
eventRectsSingle: "bb-event-rects-single"
|
|
300
300
|
};
|
|
301
|
-
|
|
301
|
+
const $FOCUS = {
|
|
302
302
|
focused: "bb-focused",
|
|
303
303
|
defocused: "bb-defocused",
|
|
304
304
|
legendItemFocused: "bb-legend-item-focused",
|
|
305
305
|
xgridFocus: "bb-xgrid-focus",
|
|
306
306
|
ygridFocus: "bb-ygrid-focus"
|
|
307
307
|
};
|
|
308
|
-
|
|
308
|
+
const $GRID = {
|
|
309
309
|
grid: "bb-grid",
|
|
310
310
|
gridLines: "bb-grid-lines",
|
|
311
311
|
xgrid: "bb-xgrid",
|
|
@@ -317,32 +317,32 @@ var $GRID = {
|
|
|
317
317
|
ygridLines: "bb-ygrid-lines",
|
|
318
318
|
ygrids: "bb-ygrids"
|
|
319
319
|
};
|
|
320
|
-
|
|
320
|
+
const $LEVEL = {
|
|
321
321
|
level: "bb-level",
|
|
322
322
|
levels: "bb-levels"
|
|
323
323
|
};
|
|
324
|
-
|
|
324
|
+
const $RADAR = {
|
|
325
325
|
chartRadar: "bb-chart-radar",
|
|
326
326
|
chartRadars: "bb-chart-radars"
|
|
327
327
|
};
|
|
328
|
-
|
|
328
|
+
const $REGION = {
|
|
329
329
|
region: "bb-region",
|
|
330
330
|
regions: "bb-regions"
|
|
331
331
|
};
|
|
332
|
-
|
|
332
|
+
const $SELECT = {
|
|
333
333
|
selectedCircle: "bb-selected-circle",
|
|
334
334
|
selectedCircles: "bb-selected-circles",
|
|
335
335
|
SELECTED: "_selected_"
|
|
336
336
|
};
|
|
337
|
-
|
|
337
|
+
const $SHAPE = {
|
|
338
338
|
shape: "bb-shape",
|
|
339
339
|
shapes: "bb-shapes"
|
|
340
340
|
};
|
|
341
|
-
|
|
341
|
+
const $SUBCHART = {
|
|
342
342
|
brush: "bb-brush",
|
|
343
343
|
subchart: "bb-subchart"
|
|
344
344
|
};
|
|
345
|
-
|
|
345
|
+
const $TEXT = {
|
|
346
346
|
chartText: "bb-chart-text",
|
|
347
347
|
chartTexts: "bb-chart-texts",
|
|
348
348
|
text: "bb-text",
|
|
@@ -350,17 +350,17 @@ var $TEXT = {
|
|
|
350
350
|
title: "bb-title",
|
|
351
351
|
TextOverlapping: "text-overlapping"
|
|
352
352
|
};
|
|
353
|
-
|
|
353
|
+
const $TOOLTIP = {
|
|
354
354
|
tooltip: "bb-tooltip",
|
|
355
355
|
tooltipContainer: "bb-tooltip-container",
|
|
356
356
|
tooltipName: "bb-tooltip-name"
|
|
357
357
|
};
|
|
358
|
-
|
|
358
|
+
const $TREEMAP = {
|
|
359
359
|
treemap: "bb-treemap",
|
|
360
360
|
chartTreemap: "bb-chart-treemap",
|
|
361
361
|
chartTreemaps: "bb-chart-treemaps"
|
|
362
362
|
};
|
|
363
|
-
|
|
363
|
+
const $ZOOM = {
|
|
364
364
|
buttonZoomReset: "bb-zoom-reset",
|
|
365
365
|
zoomBrush: "bb-zoom-brush"
|
|
366
366
|
};
|
|
@@ -371,7 +371,6 @@ var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_
|
|
|
371
371
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
372
372
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
373
373
|
|
|
374
|
-
var _this = undefined;
|
|
375
374
|
/**
|
|
376
375
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
377
376
|
* billboard.js project is licensed under the MIT license
|
|
@@ -382,30 +381,45 @@ var _this = undefined;
|
|
|
382
381
|
*/
|
|
383
382
|
/* eslint-disable no-new-func, no-undef */
|
|
384
383
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Get global object
|
|
387
|
+
* @returns {object} window object
|
|
388
|
+
* @private
|
|
389
|
+
*/
|
|
390
|
+
function getGlobal() {
|
|
391
|
+
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")();
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Get fallback object
|
|
396
|
+
* @param {object} w global object
|
|
397
|
+
* @returns {Array} fallback object array
|
|
398
|
+
* @private
|
|
399
|
+
*/
|
|
400
|
+
function getFallback(w) {
|
|
401
|
+
var _this = this;
|
|
402
|
+
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function",
|
|
403
|
+
hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function";
|
|
404
|
+
return [hasRAF ? w.requestAnimationFrame : function (cb) {
|
|
393
405
|
_newArrowCheck(this, _this);
|
|
394
406
|
return setTimeout(cb, 1);
|
|
395
|
-
}.bind(
|
|
396
|
-
cancelAnimationFrame = hasRAF ? win.cancelAnimationFrame : function (id) {
|
|
407
|
+
}.bind(this), hasRAF ? w.cancelAnimationFrame : function (id) {
|
|
397
408
|
_newArrowCheck(this, _this);
|
|
398
409
|
return clearTimeout(id);
|
|
399
|
-
}.bind(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
doc = win == null ? void 0 : win.document
|
|
403
|
-
|
|
404
|
-
|
|
410
|
+
}.bind(this), hasRIC ? w.requestIdleCallback : requestAnimationFrame, hasRIC ? w.cancelIdleCallback : cancelAnimationFrame];
|
|
411
|
+
}
|
|
412
|
+
const win = getGlobal(),
|
|
413
|
+
doc = win == null ? void 0 : win.document,
|
|
414
|
+
_getFallback = getFallback(win),
|
|
415
|
+
requestAnimationFrame = _getFallback[0],
|
|
416
|
+
cancelAnimationFrame = _getFallback[1],
|
|
417
|
+
requestIdleCallback = _getFallback[2],
|
|
418
|
+
cancelIdleCallback = _getFallback[3];
|
|
405
419
|
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
406
420
|
|
|
407
421
|
|
|
408
|
-
var
|
|
422
|
+
var _this = undefined;
|
|
409
423
|
function util_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; }
|
|
410
424
|
function util_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? util_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : util_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
411
425
|
/**
|
|
@@ -417,64 +431,64 @@ function util_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) {
|
|
|
417
431
|
|
|
418
432
|
|
|
419
433
|
|
|
420
|
-
|
|
421
|
-
_newArrowCheck(this,
|
|
434
|
+
const isValue = function (v) {
|
|
435
|
+
_newArrowCheck(this, _this);
|
|
422
436
|
return v || v === 0;
|
|
423
437
|
}.bind(undefined),
|
|
424
438
|
isFunction = function (v) {
|
|
425
|
-
_newArrowCheck(this,
|
|
439
|
+
_newArrowCheck(this, _this);
|
|
426
440
|
return typeof v === "function";
|
|
427
441
|
}.bind(undefined),
|
|
428
442
|
isString = function (v) {
|
|
429
|
-
_newArrowCheck(this,
|
|
443
|
+
_newArrowCheck(this, _this);
|
|
430
444
|
return typeof v === "string";
|
|
431
445
|
}.bind(undefined),
|
|
432
446
|
isNumber = function (v) {
|
|
433
|
-
_newArrowCheck(this,
|
|
447
|
+
_newArrowCheck(this, _this);
|
|
434
448
|
return typeof v === "number";
|
|
435
449
|
}.bind(undefined),
|
|
436
450
|
isUndefined = function (v) {
|
|
437
|
-
_newArrowCheck(this,
|
|
451
|
+
_newArrowCheck(this, _this);
|
|
438
452
|
return typeof v === "undefined";
|
|
439
453
|
}.bind(undefined),
|
|
440
454
|
isDefined = function (v) {
|
|
441
|
-
_newArrowCheck(this,
|
|
455
|
+
_newArrowCheck(this, _this);
|
|
442
456
|
return typeof v !== "undefined";
|
|
443
457
|
}.bind(undefined),
|
|
444
458
|
isboolean = function (v) {
|
|
445
|
-
_newArrowCheck(this,
|
|
459
|
+
_newArrowCheck(this, _this);
|
|
446
460
|
return typeof v === "boolean";
|
|
447
461
|
}.bind(undefined),
|
|
448
462
|
ceil10 = function (v) {
|
|
449
|
-
_newArrowCheck(this,
|
|
463
|
+
_newArrowCheck(this, _this);
|
|
450
464
|
return Math.ceil(v / 10) * 10;
|
|
451
465
|
}.bind(undefined),
|
|
452
466
|
asHalfPixel = function (n) {
|
|
453
|
-
_newArrowCheck(this,
|
|
467
|
+
_newArrowCheck(this, _this);
|
|
454
468
|
return Math.ceil(n) + .5;
|
|
455
469
|
}.bind(undefined),
|
|
456
470
|
diffDomain = function (d) {
|
|
457
|
-
_newArrowCheck(this,
|
|
471
|
+
_newArrowCheck(this, _this);
|
|
458
472
|
return d[1] - d[0];
|
|
459
473
|
}.bind(undefined),
|
|
460
474
|
isObjectType = function (v) {
|
|
461
|
-
_newArrowCheck(this,
|
|
475
|
+
_newArrowCheck(this, _this);
|
|
462
476
|
return typeof v === "object";
|
|
463
477
|
}.bind(undefined),
|
|
464
478
|
isEmpty = function (o) {
|
|
465
|
-
_newArrowCheck(this,
|
|
479
|
+
_newArrowCheck(this, _this);
|
|
466
480
|
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
467
481
|
}.bind(undefined),
|
|
468
482
|
notEmpty = function (o) {
|
|
469
|
-
_newArrowCheck(this,
|
|
483
|
+
_newArrowCheck(this, _this);
|
|
470
484
|
return !isEmpty(o);
|
|
471
485
|
}.bind(undefined),
|
|
472
486
|
isArray = function (arr) {
|
|
473
|
-
_newArrowCheck(this,
|
|
487
|
+
_newArrowCheck(this, _this);
|
|
474
488
|
return Array.isArray(arr);
|
|
475
489
|
}.bind(undefined),
|
|
476
490
|
isObject = function (obj) {
|
|
477
|
-
_newArrowCheck(this,
|
|
491
|
+
_newArrowCheck(this, _this);
|
|
478
492
|
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
479
493
|
}.bind(undefined);
|
|
480
494
|
/**
|
|
@@ -510,8 +524,8 @@ function getOption(options, key, defaultValue) {
|
|
|
510
524
|
* @private
|
|
511
525
|
*/
|
|
512
526
|
function hasValue(dict, value) {
|
|
513
|
-
var _this2 = this
|
|
514
|
-
|
|
527
|
+
var _this2 = this;
|
|
528
|
+
let found = !1;
|
|
515
529
|
Object.keys(dict).forEach(function (key) {
|
|
516
530
|
_newArrowCheck(this, _this2);
|
|
517
531
|
return dict[key] === value && (found = !0);
|
|
@@ -528,7 +542,7 @@ function hasValue(dict, value) {
|
|
|
528
542
|
* @private
|
|
529
543
|
*/
|
|
530
544
|
function callFn(fn, thisArg) {
|
|
531
|
-
|
|
545
|
+
const isFn = isFunction(fn);
|
|
532
546
|
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
533
547
|
args[_key - 2] = arguments[_key];
|
|
534
548
|
}
|
|
@@ -543,14 +557,15 @@ function callFn(fn, thisArg) {
|
|
|
543
557
|
* @private
|
|
544
558
|
*/
|
|
545
559
|
function endall(transition, cb) {
|
|
546
|
-
var _this3 = this
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
560
|
+
var _this3 = this;
|
|
561
|
+
let n = 0;
|
|
562
|
+
const end = function () {
|
|
563
|
+
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
564
|
+
args[_key2] = arguments[_key2];
|
|
565
|
+
}
|
|
566
|
+
--n || cb.apply.apply(cb, [this].concat(args));
|
|
567
|
+
};
|
|
568
|
+
|
|
554
569
|
// if is transition selection
|
|
555
570
|
if ("duration" in transition) {
|
|
556
571
|
transition.each(function () {
|
|
@@ -569,8 +584,8 @@ function endall(transition, cb) {
|
|
|
569
584
|
* @returns {string}
|
|
570
585
|
* @private
|
|
571
586
|
*/
|
|
572
|
-
function
|
|
573
|
-
return isString(str) ? str.replace(
|
|
587
|
+
function sanitize(str) {
|
|
588
|
+
return isString(str) ? str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") : str;
|
|
574
589
|
}
|
|
575
590
|
|
|
576
591
|
/**
|
|
@@ -595,12 +610,12 @@ function setTextValue(node, text, dy, toMiddle) {
|
|
|
595
610
|
if (text.indexOf("\n") === -1) {
|
|
596
611
|
node.text(text);
|
|
597
612
|
} else {
|
|
598
|
-
|
|
613
|
+
const diff = [node.text(), text].map(function (v) {
|
|
599
614
|
_newArrowCheck(this, _this4);
|
|
600
615
|
return v.replace(/[\s\n]/g, "");
|
|
601
616
|
}.bind(this));
|
|
602
617
|
if (diff[0] !== diff[1]) {
|
|
603
|
-
|
|
618
|
+
const multiline = text.split("\n"),
|
|
604
619
|
len = toMiddle ? multiline.length - 1 : 1;
|
|
605
620
|
// reset possible text
|
|
606
621
|
node.html("");
|
|
@@ -626,7 +641,7 @@ function getRectSegList(path) {
|
|
|
626
641
|
* | |
|
|
627
642
|
* seg0 ---------- seg3
|
|
628
643
|
* */
|
|
629
|
-
|
|
644
|
+
const _path$getBBox = path.getBBox(),
|
|
630
645
|
x = _path$getBBox.x,
|
|
631
646
|
y = _path$getBBox.y,
|
|
632
647
|
width = _path$getBBox.width,
|
|
@@ -660,7 +675,7 @@ function getRectSegList(path) {
|
|
|
660
675
|
* @private
|
|
661
676
|
*/
|
|
662
677
|
function getPathBox(path) {
|
|
663
|
-
|
|
678
|
+
const _path$getBoundingClie = path.getBoundingClientRect(),
|
|
664
679
|
width = _path$getBoundingClie.width,
|
|
665
680
|
height = _path$getBoundingClie.height,
|
|
666
681
|
items = getRectSegList(path),
|
|
@@ -683,9 +698,12 @@ function getPathBox(path) {
|
|
|
683
698
|
*/
|
|
684
699
|
function getPointer(event, element) {
|
|
685
700
|
var _ref,
|
|
686
|
-
touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
|
687
|
-
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
|
688
701
|
_this5 = this;
|
|
702
|
+
const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
|
|
703
|
+
let pointer = [0, 0];
|
|
704
|
+
try {
|
|
705
|
+
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
|
|
706
|
+
} catch (e) {}
|
|
689
707
|
return pointer.map(function (v) {
|
|
690
708
|
_newArrowCheck(this, _this5);
|
|
691
709
|
return isNaN(v) ? 0 : v;
|
|
@@ -699,10 +717,10 @@ function getPointer(event, element) {
|
|
|
699
717
|
* @private
|
|
700
718
|
*/
|
|
701
719
|
function getBrushSelection(ctx) {
|
|
702
|
-
|
|
720
|
+
const event = ctx.event,
|
|
703
721
|
$el = ctx.$el,
|
|
704
722
|
main = $el.subchart.main || $el.main;
|
|
705
|
-
|
|
723
|
+
let selection;
|
|
706
724
|
|
|
707
725
|
// check from event
|
|
708
726
|
if (event && event.type === "brush") {
|
|
@@ -722,7 +740,7 @@ function getBrushSelection(ctx) {
|
|
|
722
740
|
* @private
|
|
723
741
|
*/
|
|
724
742
|
function getBoundingRect(node) {
|
|
725
|
-
|
|
743
|
+
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
726
744
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
727
745
|
}
|
|
728
746
|
|
|
@@ -744,7 +762,7 @@ function getRandom(asStr, min, max) {
|
|
|
744
762
|
if (max === void 0) {
|
|
745
763
|
max = 1e4;
|
|
746
764
|
}
|
|
747
|
-
|
|
765
|
+
const crpt = win.crypto || win.msCrypto,
|
|
748
766
|
rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
749
767
|
return asStr ? rand + "" : rand;
|
|
750
768
|
}
|
|
@@ -763,8 +781,8 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
763
781
|
if (start > end) {
|
|
764
782
|
return -1;
|
|
765
783
|
}
|
|
766
|
-
|
|
767
|
-
|
|
784
|
+
const mid = Math.floor((start + end) / 2);
|
|
785
|
+
let _arr$mid = arr[mid],
|
|
768
786
|
x = _arr$mid.x,
|
|
769
787
|
_arr$mid$w = _arr$mid.w,
|
|
770
788
|
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
@@ -785,7 +803,7 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
785
803
|
* @private
|
|
786
804
|
*/
|
|
787
805
|
function brushEmpty(ctx) {
|
|
788
|
-
|
|
806
|
+
const selection = getBrushSelection(ctx);
|
|
789
807
|
if (selection) {
|
|
790
808
|
// brush selected area
|
|
791
809
|
// two-dimensional: [[x0, y0], [x1, y1]]
|
|
@@ -802,17 +820,19 @@ function brushEmpty(ctx) {
|
|
|
802
820
|
* @private
|
|
803
821
|
*/
|
|
804
822
|
function deepClone() {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
return r;
|
|
823
|
+
var _this6 = this;
|
|
824
|
+
const _clone = function clone(v) {
|
|
825
|
+
_newArrowCheck(this, _this6);
|
|
826
|
+
if (isObject(v) && v.constructor) {
|
|
827
|
+
const r = new v.constructor();
|
|
828
|
+
for (const k in v) {
|
|
829
|
+
r[k] = _clone(v[k]);
|
|
813
830
|
}
|
|
814
|
-
return
|
|
815
|
-
}
|
|
831
|
+
return r;
|
|
832
|
+
}
|
|
833
|
+
return v;
|
|
834
|
+
}.bind(this);
|
|
835
|
+
for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
816
836
|
objectN[_key3] = arguments[_key3];
|
|
817
837
|
}
|
|
818
838
|
return objectN.map(function (v) {
|
|
@@ -844,7 +864,7 @@ function extend(target, source) {
|
|
|
844
864
|
}
|
|
845
865
|
|
|
846
866
|
// exclude name with only numbers
|
|
847
|
-
for (
|
|
867
|
+
for (const p in source) {
|
|
848
868
|
if (/^\d+$/.test(p) || p in target) {
|
|
849
869
|
continue;
|
|
850
870
|
}
|
|
@@ -859,8 +879,8 @@ function extend(target, source) {
|
|
|
859
879
|
* @returns {string} capitalized string
|
|
860
880
|
* @private
|
|
861
881
|
*/
|
|
862
|
-
|
|
863
|
-
_newArrowCheck(this,
|
|
882
|
+
const capitalize = function (str) {
|
|
883
|
+
_newArrowCheck(this, _this);
|
|
864
884
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
865
885
|
}.bind(undefined);
|
|
866
886
|
|
|
@@ -888,8 +908,8 @@ function camelize(str, separator) {
|
|
|
888
908
|
* @returns {Array}
|
|
889
909
|
* @private
|
|
890
910
|
*/
|
|
891
|
-
|
|
892
|
-
_newArrowCheck(this,
|
|
911
|
+
const toArray = function (v) {
|
|
912
|
+
_newArrowCheck(this, _this);
|
|
893
913
|
return [].slice.call(v);
|
|
894
914
|
}.bind(undefined);
|
|
895
915
|
|
|
@@ -902,8 +922,8 @@ var toArray = function (v) {
|
|
|
902
922
|
* @private
|
|
903
923
|
*/
|
|
904
924
|
function addCssRules(style, selector, prop) {
|
|
905
|
-
var _this9 = this
|
|
906
|
-
|
|
925
|
+
var _this9 = this;
|
|
926
|
+
const rootSelctor = style.rootSelctor,
|
|
907
927
|
sheet = style.sheet,
|
|
908
928
|
getSelector = function (s) {
|
|
909
929
|
_newArrowCheck(this, _this9);
|
|
@@ -920,8 +940,8 @@ function addCssRules(style, selector, prop) {
|
|
|
920
940
|
* @private
|
|
921
941
|
*/
|
|
922
942
|
function getCssRules(styleSheets) {
|
|
923
|
-
var _this10 = this
|
|
924
|
-
|
|
943
|
+
var _this10 = this;
|
|
944
|
+
let rules = [];
|
|
925
945
|
styleSheets.forEach(function (sheet) {
|
|
926
946
|
_newArrowCheck(this, _this10);
|
|
927
947
|
try {
|
|
@@ -943,7 +963,7 @@ function getCssRules(styleSheets) {
|
|
|
943
963
|
* @private
|
|
944
964
|
*/
|
|
945
965
|
function getTranslation(node) {
|
|
946
|
-
|
|
966
|
+
const transform = node ? node.transform : null,
|
|
947
967
|
baseVal = transform && transform.baseVal;
|
|
948
968
|
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
949
969
|
a: 0,
|
|
@@ -962,8 +982,8 @@ function getTranslation(node) {
|
|
|
962
982
|
* @private
|
|
963
983
|
*/
|
|
964
984
|
function getUnique(data) {
|
|
965
|
-
var _this11 = this
|
|
966
|
-
|
|
985
|
+
var _this11 = this;
|
|
986
|
+
const isDate = data[0] instanceof Date,
|
|
967
987
|
d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
|
968
988
|
_newArrowCheck(this, _this11);
|
|
969
989
|
return self.indexOf(v) === i;
|
|
@@ -1002,11 +1022,11 @@ function mergeObj(target) {
|
|
|
1002
1022
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
|
1003
1023
|
return target;
|
|
1004
1024
|
}
|
|
1005
|
-
|
|
1025
|
+
const source = objectN.shift();
|
|
1006
1026
|
if (isObject(target) && isObject(source)) {
|
|
1007
1027
|
Object.keys(source).forEach(function (key) {
|
|
1008
1028
|
_newArrowCheck(this, _this13);
|
|
1009
|
-
|
|
1029
|
+
const value = source[key];
|
|
1010
1030
|
if (isObject(value)) {
|
|
1011
1031
|
target[key] || (target[key] = {});
|
|
1012
1032
|
target[key] = mergeObj(target[key], value);
|
|
@@ -1030,7 +1050,7 @@ function sortValue(data, isAsc) {
|
|
|
1030
1050
|
if (isAsc === void 0) {
|
|
1031
1051
|
isAsc = !0;
|
|
1032
1052
|
}
|
|
1033
|
-
|
|
1053
|
+
let fn;
|
|
1034
1054
|
if (data[0] instanceof Date) {
|
|
1035
1055
|
fn = isAsc ? function (a, b) {
|
|
1036
1056
|
_newArrowCheck(this, _this14);
|
|
@@ -1063,11 +1083,11 @@ function sortValue(data, isAsc) {
|
|
|
1063
1083
|
* @private
|
|
1064
1084
|
*/
|
|
1065
1085
|
function getMinMax(type, data) {
|
|
1066
|
-
var _this15 = this
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1086
|
+
var _this15 = this;
|
|
1087
|
+
let res = data.filter(function (v) {
|
|
1088
|
+
_newArrowCheck(this, _this15);
|
|
1089
|
+
return notEmpty(v);
|
|
1090
|
+
}.bind(this));
|
|
1071
1091
|
if (res.length) {
|
|
1072
1092
|
if (isNumber(res[0])) {
|
|
1073
1093
|
res = Math[type].apply(Math, res);
|
|
@@ -1088,14 +1108,14 @@ function getMinMax(type, data) {
|
|
|
1088
1108
|
* @returns {Array}
|
|
1089
1109
|
* @private
|
|
1090
1110
|
*/
|
|
1091
|
-
|
|
1111
|
+
const getRange = function (start, end, step) {
|
|
1092
1112
|
if (step === void 0) {
|
|
1093
1113
|
step = 1;
|
|
1094
1114
|
}
|
|
1095
|
-
_newArrowCheck(this,
|
|
1096
|
-
|
|
1115
|
+
_newArrowCheck(this, _this);
|
|
1116
|
+
const res = [],
|
|
1097
1117
|
n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
1098
|
-
for (
|
|
1118
|
+
for (let i = start; i < n; i++) {
|
|
1099
1119
|
res.push(start + i * step);
|
|
1100
1120
|
}
|
|
1101
1121
|
return res;
|
|
@@ -1103,8 +1123,8 @@ var getRange = function (start, end, step) {
|
|
|
1103
1123
|
emulateEvent = {
|
|
1104
1124
|
mouse: function () {
|
|
1105
1125
|
var _this16 = this;
|
|
1106
|
-
_newArrowCheck(this,
|
|
1107
|
-
|
|
1126
|
+
_newArrowCheck(this, _this);
|
|
1127
|
+
const getParams = function () {
|
|
1108
1128
|
_newArrowCheck(this, _this16);
|
|
1109
1129
|
return {
|
|
1110
1130
|
bubbles: !1,
|
|
@@ -1132,7 +1152,7 @@ var getRange = function (start, end, step) {
|
|
|
1132
1152
|
params = getParams();
|
|
1133
1153
|
}
|
|
1134
1154
|
_newArrowCheck(this, _this16);
|
|
1135
|
-
|
|
1155
|
+
const mouseEvent = doc.createEvent("MouseEvent");
|
|
1136
1156
|
|
|
1137
1157
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
1138
1158
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
@@ -1143,8 +1163,8 @@ var getRange = function (start, end, step) {
|
|
|
1143
1163
|
}
|
|
1144
1164
|
}.bind(undefined)(),
|
|
1145
1165
|
touch: function touch(el, eventType, params) {
|
|
1146
|
-
_newArrowCheck(this,
|
|
1147
|
-
|
|
1166
|
+
_newArrowCheck(this, _this);
|
|
1167
|
+
const touchObj = new Touch(mergeObj({
|
|
1148
1168
|
identifier: Date.now(),
|
|
1149
1169
|
target: el,
|
|
1150
1170
|
radiusX: 2.5,
|
|
@@ -1170,8 +1190,8 @@ var getRange = function (start, end, step) {
|
|
|
1170
1190
|
* @private
|
|
1171
1191
|
*/
|
|
1172
1192
|
function tplProcess(tpl, data) {
|
|
1173
|
-
|
|
1174
|
-
for (
|
|
1193
|
+
let res = tpl;
|
|
1194
|
+
for (const x in data) {
|
|
1175
1195
|
res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
|
1176
1196
|
}
|
|
1177
1197
|
return res;
|
|
@@ -1185,13 +1205,14 @@ function tplProcess(tpl, data) {
|
|
|
1185
1205
|
* @private
|
|
1186
1206
|
*/
|
|
1187
1207
|
function parseDate(date) {
|
|
1188
|
-
|
|
1208
|
+
let parsedDate;
|
|
1189
1209
|
if (date instanceof Date) {
|
|
1190
1210
|
parsedDate = date;
|
|
1191
1211
|
} else if (isString(date)) {
|
|
1192
|
-
var _format$dataTime
|
|
1193
|
-
|
|
1212
|
+
var _format$dataTime;
|
|
1213
|
+
const config = this.config,
|
|
1194
1214
|
format = this.format;
|
|
1215
|
+
|
|
1195
1216
|
// if fails to parse, try by new Date()
|
|
1196
1217
|
// https://github.com/naver/billboard.js/issues/1714
|
|
1197
1218
|
parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
|
@@ -1221,11 +1242,11 @@ function isTabVisible() {
|
|
|
1221
1242
|
* @private
|
|
1222
1243
|
*/
|
|
1223
1244
|
function convertInputType(mouse, touch) {
|
|
1224
|
-
var _this17 = this
|
|
1225
|
-
|
|
1245
|
+
var _this17 = this;
|
|
1246
|
+
const DocumentTouch = win.DocumentTouch,
|
|
1226
1247
|
matchMedia = win.matchMedia,
|
|
1227
|
-
navigator = win.navigator
|
|
1228
|
-
|
|
1248
|
+
navigator = win.navigator;
|
|
1249
|
+
let hasTouch = !1;
|
|
1229
1250
|
if (touch) {
|
|
1230
1251
|
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1231
1252
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
@@ -1241,7 +1262,7 @@ function convertInputType(mouse, touch) {
|
|
|
1241
1262
|
hasTouch = !0;
|
|
1242
1263
|
} else {
|
|
1243
1264
|
// Only as a last resort, fall back to user agent sniffing
|
|
1244
|
-
|
|
1265
|
+
const UA = navigator.userAgent;
|
|
1245
1266
|
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1246
1267
|
}
|
|
1247
1268
|
}
|
|
@@ -1250,7 +1271,7 @@ function convertInputType(mouse, touch) {
|
|
|
1250
1271
|
// 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
|
|
1251
1272
|
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1252
1273
|
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1253
|
-
|
|
1274
|
+
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1254
1275
|
_newArrowCheck(this, _this17);
|
|
1255
1276
|
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1256
1277
|
}.bind(this));
|
|
@@ -1289,22 +1310,20 @@ function runUntil(fn, conditionFn) {
|
|
|
1289
1310
|
* @private
|
|
1290
1311
|
*/
|
|
1291
1312
|
function loadConfig(config) {
|
|
1292
|
-
var _this = this
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
return undefined;
|
|
1307
|
-
}.bind(this);
|
|
1313
|
+
var _this = this;
|
|
1314
|
+
const thisConfig = this.config;
|
|
1315
|
+
let target, keys, read;
|
|
1316
|
+
const _find = function find() {
|
|
1317
|
+
_newArrowCheck(this, _this);
|
|
1318
|
+
const key = keys.shift();
|
|
1319
|
+
if (key && target && isObjectType(target) && key in target) {
|
|
1320
|
+
target = target[key];
|
|
1321
|
+
return _find();
|
|
1322
|
+
} else if (!key) {
|
|
1323
|
+
return target;
|
|
1324
|
+
}
|
|
1325
|
+
return undefined;
|
|
1326
|
+
}.bind(this);
|
|
1308
1327
|
Object.keys(thisConfig).forEach(function (key) {
|
|
1309
1328
|
_newArrowCheck(this, _this);
|
|
1310
1329
|
target = config;
|
|
@@ -1339,7 +1358,7 @@ function loadConfig(config) {
|
|
|
1339
1358
|
* @example
|
|
1340
1359
|
* bb.plugin.stanford.version; // ex) 1.9.0
|
|
1341
1360
|
*/
|
|
1342
|
-
|
|
1361
|
+
let Plugin = /*#__PURE__*/function () {
|
|
1343
1362
|
/**
|
|
1344
1363
|
* Constructor
|
|
1345
1364
|
* @param {Any} options config option object
|
|
@@ -1393,7 +1412,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
1393
1412
|
};
|
|
1394
1413
|
return Plugin;
|
|
1395
1414
|
}();
|
|
1396
|
-
Plugin.version = "3.
|
|
1415
|
+
Plugin.version = "3.10.0-next.2";
|
|
1397
1416
|
|
|
1398
1417
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/Options.ts
|
|
1399
1418
|
/**
|
|
@@ -1408,7 +1427,7 @@ Plugin.version = "3.9.4";
|
|
|
1408
1427
|
* @returns {StanfordOptions}
|
|
1409
1428
|
* @private
|
|
1410
1429
|
*/
|
|
1411
|
-
|
|
1430
|
+
let Options = function () {
|
|
1412
1431
|
return {
|
|
1413
1432
|
/**
|
|
1414
1433
|
* Set the color of the color scale. This function receives a value between 0 and 1, and should return a color.
|
|
@@ -1575,16 +1594,15 @@ function pointInRegion(point, region) {
|
|
|
1575
1594
|
// thanks to: http://bl.ocks.org/bycoffe/5575904
|
|
1576
1595
|
// ray-casting algorithm based on
|
|
1577
1596
|
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
|
1578
|
-
|
|
1597
|
+
const x = point.x,
|
|
1579
1598
|
y = point.value;
|
|
1580
|
-
|
|
1581
|
-
for (
|
|
1582
|
-
|
|
1599
|
+
let inside = !1;
|
|
1600
|
+
for (let i = 0, j = region.length - 1; i < region.length; j = i++) {
|
|
1601
|
+
const xi = region[i].x,
|
|
1583
1602
|
yi = region[i].y,
|
|
1584
1603
|
xj = region[j].x,
|
|
1585
|
-
yj = region[j].y
|
|
1586
|
-
|
|
1587
|
-
if (intersect) {
|
|
1604
|
+
yj = region[j].y;
|
|
1605
|
+
if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) {
|
|
1588
1606
|
inside = !inside;
|
|
1589
1607
|
}
|
|
1590
1608
|
}
|
|
@@ -1616,10 +1634,10 @@ function compareEpochs(a, b) {
|
|
|
1616
1634
|
*/
|
|
1617
1635
|
function getRegionArea(points) {
|
|
1618
1636
|
// thanks to: https://stackoverflow.com/questions/16282330/find-centerpoint-of-polygon-in-javascript
|
|
1619
|
-
|
|
1637
|
+
let area = 0,
|
|
1620
1638
|
point1,
|
|
1621
1639
|
point2;
|
|
1622
|
-
for (
|
|
1640
|
+
for (let i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
|
1623
1641
|
point1 = points[i];
|
|
1624
1642
|
point2 = points[j];
|
|
1625
1643
|
area += point1.x * point2.y;
|
|
@@ -1636,12 +1654,12 @@ function getRegionArea(points) {
|
|
|
1636
1654
|
* @private
|
|
1637
1655
|
*/
|
|
1638
1656
|
function getCentroid(points) {
|
|
1639
|
-
|
|
1640
|
-
|
|
1657
|
+
const area = getRegionArea(points);
|
|
1658
|
+
let x = 0,
|
|
1641
1659
|
y = 0,
|
|
1642
1660
|
f;
|
|
1643
|
-
for (
|
|
1644
|
-
|
|
1661
|
+
for (let i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
|
1662
|
+
const point1 = points[i],
|
|
1645
1663
|
point2 = points[j];
|
|
1646
1664
|
f = point1.x * point2.y - point2.x * point1.y;
|
|
1647
1665
|
x += (point1.x + point2.x) * f;
|
|
@@ -1670,66 +1688,71 @@ function getCentroid(points) {
|
|
|
1670
1688
|
* @param {Stanford} owner Stanford instance
|
|
1671
1689
|
* @private
|
|
1672
1690
|
*/
|
|
1673
|
-
|
|
1691
|
+
let Elements = /*#__PURE__*/function () {
|
|
1674
1692
|
function Elements(owner) {
|
|
1675
1693
|
this.owner = void 0;
|
|
1676
1694
|
this.owner = owner;
|
|
1677
1695
|
|
|
1678
1696
|
// MEMO: Avoid blocking eventRect
|
|
1679
|
-
|
|
1697
|
+
const elements = owner.$$.$el.main.select(".bb-chart").append("g").attr("class", stanford_classes.stanfordElements);
|
|
1680
1698
|
elements.append("g").attr("class", stanford_classes.stanfordLines);
|
|
1681
1699
|
elements.append("g").attr("class", stanford_classes.stanfordRegions);
|
|
1682
1700
|
}
|
|
1683
1701
|
var _proto = Elements.prototype;
|
|
1684
1702
|
_proto.updateStanfordLines = function updateStanfordLines(duration) {
|
|
1685
|
-
var _this = this
|
|
1686
|
-
|
|
1703
|
+
var _this = this;
|
|
1704
|
+
const $$ = this.owner.$$,
|
|
1687
1705
|
config = $$.config,
|
|
1688
1706
|
main = $$.$el.main,
|
|
1689
1707
|
isRotated = config.axis_rotated,
|
|
1690
1708
|
xvCustom = this.xvCustom.bind($$),
|
|
1691
1709
|
yvCustom = this.yvCustom.bind($$),
|
|
1692
1710
|
stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
|
|
1711
|
+
|
|
1693
1712
|
// Stanford-Lines
|
|
1694
1713
|
|
|
1695
1714
|
// exit
|
|
1696
1715
|
stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove();
|
|
1697
1716
|
|
|
1698
1717
|
// enter
|
|
1699
|
-
|
|
1718
|
+
const stanfordLineEnter = stanfordLine.enter().append("g");
|
|
1700
1719
|
stanfordLineEnter.append("line").style("opacity", "0");
|
|
1701
1720
|
stanfordLineEnter.merge(stanfordLine).attr("class", function (d) {
|
|
1702
1721
|
_newArrowCheck(this, _this);
|
|
1703
1722
|
return stanford_classes.stanfordLine + (d.class ? " " + d.class : "");
|
|
1704
1723
|
}.bind(this)).select("line").transition().duration(duration).attr("x1", function (d) {
|
|
1705
1724
|
_newArrowCheck(this, _this);
|
|
1706
|
-
|
|
1725
|
+
const v = isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
|
|
1726
|
+
return v;
|
|
1707
1727
|
}.bind(this)).attr("x2", function (d) {
|
|
1708
1728
|
_newArrowCheck(this, _this);
|
|
1709
1729
|
return isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2");
|
|
1710
1730
|
}.bind(this)).attr("y1", function (d) {
|
|
1711
1731
|
_newArrowCheck(this, _this);
|
|
1712
|
-
|
|
1732
|
+
const v = isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
|
|
1733
|
+
return v;
|
|
1713
1734
|
}.bind(this)).attr("y2", function (d) {
|
|
1714
1735
|
_newArrowCheck(this, _this);
|
|
1715
1736
|
return isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2");
|
|
1716
1737
|
}.bind(this)).transition().style("opacity", null);
|
|
1717
1738
|
};
|
|
1718
1739
|
_proto.updateStanfordRegions = function updateStanfordRegions(duration) {
|
|
1719
|
-
var _this2 = this
|
|
1720
|
-
|
|
1740
|
+
var _this2 = this;
|
|
1741
|
+
const $$ = this.owner.$$,
|
|
1721
1742
|
config = $$.config,
|
|
1722
1743
|
main = $$.$el.main,
|
|
1723
1744
|
isRotated = config.axis_rotated,
|
|
1724
1745
|
xvCustom = this.xvCustom.bind($$),
|
|
1725
1746
|
yvCustom = this.yvCustom.bind($$),
|
|
1726
|
-
countPointsInRegion = this.owner.countEpochsInRegion.bind($$)
|
|
1727
|
-
|
|
1747
|
+
countPointsInRegion = this.owner.countEpochsInRegion.bind($$);
|
|
1748
|
+
// Stanford-Regions
|
|
1749
|
+
let stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
|
|
1750
|
+
|
|
1728
1751
|
// exit
|
|
1729
1752
|
stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove();
|
|
1730
1753
|
|
|
1731
1754
|
// enter
|
|
1732
|
-
|
|
1755
|
+
const stanfordRegionEnter = stanfordRegion.enter().append("g");
|
|
1733
1756
|
stanfordRegionEnter.append("polygon").style("opacity", "0");
|
|
1734
1757
|
stanfordRegionEnter.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0");
|
|
1735
1758
|
stanfordRegion = stanfordRegionEnter.merge(stanfordRegion);
|
|
@@ -1758,7 +1781,7 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1758
1781
|
}.bind(this)).text(function (d) {
|
|
1759
1782
|
_newArrowCheck(this, _this2);
|
|
1760
1783
|
if (d.text) {
|
|
1761
|
-
|
|
1784
|
+
const _countPointsInRegion = countPointsInRegion(d.points),
|
|
1762
1785
|
value = _countPointsInRegion.value,
|
|
1763
1786
|
percentage = _countPointsInRegion.percentage;
|
|
1764
1787
|
return d.text(value, percentage);
|
|
@@ -1774,10 +1797,10 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1774
1797
|
this.updateStanfordRegions(duration);
|
|
1775
1798
|
};
|
|
1776
1799
|
_proto.xvCustom = function xvCustom(d, xyValue) {
|
|
1777
|
-
|
|
1800
|
+
const $$ = this,
|
|
1778
1801
|
axis = $$.axis,
|
|
1779
1802
|
config = $$.config;
|
|
1780
|
-
|
|
1803
|
+
let value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1781
1804
|
if (axis.isTimeSeries()) {
|
|
1782
1805
|
value = parseDate.call($$, value);
|
|
1783
1806
|
} else if (axis.isCategorized() && isString(value)) {
|
|
@@ -1786,7 +1809,7 @@ var Elements = /*#__PURE__*/function () {
|
|
|
1786
1809
|
return Math.ceil($$.scale.x(value));
|
|
1787
1810
|
};
|
|
1788
1811
|
_proto.yvCustom = function yvCustom(d, xyValue) {
|
|
1789
|
-
|
|
1812
|
+
const $$ = this,
|
|
1790
1813
|
yScale = d.axis && d.axis === "y2" ? $$.scale.y2 : $$.scale.y,
|
|
1791
1814
|
value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1792
1815
|
return Math.ceil(yScale(value));
|
|
@@ -1816,7 +1839,7 @@ var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __w
|
|
|
1816
1839
|
* @param {Stanford} owner Stanford instance
|
|
1817
1840
|
* @private
|
|
1818
1841
|
*/
|
|
1819
|
-
|
|
1842
|
+
let ColorScale = /*#__PURE__*/function () {
|
|
1820
1843
|
function ColorScale(owner) {
|
|
1821
1844
|
this.owner = void 0;
|
|
1822
1845
|
this.colorScale = void 0;
|
|
@@ -1824,8 +1847,8 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1824
1847
|
}
|
|
1825
1848
|
var _proto = ColorScale.prototype;
|
|
1826
1849
|
_proto.drawColorScale = function drawColorScale() {
|
|
1827
|
-
var _this = this
|
|
1828
|
-
|
|
1850
|
+
var _this = this;
|
|
1851
|
+
const _this$owner = this.owner,
|
|
1829
1852
|
$$ = _this$owner.$$,
|
|
1830
1853
|
config = _this$owner.config,
|
|
1831
1854
|
target = $$.data.targets[0],
|
|
@@ -1846,7 +1869,7 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1846
1869
|
}.bind(this));
|
|
1847
1870
|
|
|
1848
1871
|
// Legend Axis
|
|
1849
|
-
|
|
1872
|
+
const axisScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSymlog)().domain([target.minEpochs, target.maxEpochs]).range([points[0] + config.padding_top + points[points.length - 1] + 5 - 1, points[0] + config.padding_top]),
|
|
1850
1873
|
legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
|
|
1851
1874
|
scaleFormat = config.scale_format;
|
|
1852
1875
|
if (scaleFormat === "pow10") {
|
|
@@ -1858,7 +1881,7 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1858
1881
|
}
|
|
1859
1882
|
|
|
1860
1883
|
// Draw Axis
|
|
1861
|
-
|
|
1884
|
+
const axis = this.colorScale.append("g").attr("class", "legend axis").attr("transform", "translate(" + barWidth + ",0)").call(legendAxis);
|
|
1862
1885
|
if (scaleFormat === "pow10") {
|
|
1863
1886
|
axis.selectAll(".tick text").text(null).filter(function (d) {
|
|
1864
1887
|
_newArrowCheck(this, _this);
|
|
@@ -1986,7 +2009,7 @@ var ColorScale = /*#__PURE__*/function () {
|
|
|
1986
2009
|
* ]
|
|
1987
2010
|
* })
|
|
1988
2011
|
*/
|
|
1989
|
-
|
|
2012
|
+
let Stanford = /*#__PURE__*/function (_Plugin) {
|
|
1990
2013
|
_inheritsLoose(Stanford, _Plugin);
|
|
1991
2014
|
function Stanford(options) {
|
|
1992
2015
|
var _this = _Plugin.call(this, options) || this;
|
|
@@ -1998,8 +2021,9 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
1998
2021
|
}
|
|
1999
2022
|
var _proto = Stanford.prototype;
|
|
2000
2023
|
_proto.$beforeInit = function $beforeInit() {
|
|
2001
|
-
var _this2 = this
|
|
2002
|
-
|
|
2024
|
+
var _this2 = this;
|
|
2025
|
+
const $$ = this.$$;
|
|
2026
|
+
|
|
2003
2027
|
// override on config values & methods
|
|
2004
2028
|
$$.config.data_xSort = !1;
|
|
2005
2029
|
$$.isMultipleX = function () {
|
|
@@ -2017,14 +2041,14 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2017
2041
|
_newArrowCheck(this, _this2);
|
|
2018
2042
|
return 1;
|
|
2019
2043
|
}.bind(this);
|
|
2020
|
-
|
|
2044
|
+
const getCurrentPaddingRight = $$.getCurrentPaddingRight.bind($$);
|
|
2021
2045
|
$$.getCurrentPaddingRight = function () {
|
|
2022
2046
|
_newArrowCheck(this, _this2);
|
|
2023
2047
|
return getCurrentPaddingRight() + (this.colorScale ? this.colorScale.getColorScalePadding() : 0);
|
|
2024
2048
|
}.bind(this);
|
|
2025
2049
|
};
|
|
2026
2050
|
_proto.$init = function $init() {
|
|
2027
|
-
|
|
2051
|
+
const $$ = this.$$;
|
|
2028
2052
|
loadConfig.call(this, this.options);
|
|
2029
2053
|
$$.color = this.getStanfordPointColor.bind($$);
|
|
2030
2054
|
this.colorScale = new ColorScale(this);
|
|
@@ -2044,8 +2068,8 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2044
2068
|
return new Options();
|
|
2045
2069
|
};
|
|
2046
2070
|
_proto.convertData = function convertData() {
|
|
2047
|
-
var _this3 = this
|
|
2048
|
-
|
|
2071
|
+
var _this3 = this;
|
|
2072
|
+
const data = this.$$.data.targets,
|
|
2049
2073
|
epochs = this.options.epochs;
|
|
2050
2074
|
data.forEach(function (d) {
|
|
2051
2075
|
var _this4 = this;
|
|
@@ -2060,35 +2084,16 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2060
2084
|
d.colorscale = undefined;
|
|
2061
2085
|
}.bind(this));
|
|
2062
2086
|
};
|
|
2063
|
-
_proto.xvCustom = function xvCustom(d, xyValue) {
|
|
2064
|
-
var $$ = this,
|
|
2065
|
-
axis = $$.axis,
|
|
2066
|
-
config = $$.config;
|
|
2067
|
-
var value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
2068
|
-
if (axis.isTimeSeries()) {
|
|
2069
|
-
value = parseDate.call($$, value);
|
|
2070
|
-
} else if (axis.isCategorized() && isString(value)) {
|
|
2071
|
-
value = config.axis_x_categories.indexOf(d.value);
|
|
2072
|
-
}
|
|
2073
|
-
return Math.ceil($$.scale.x(value));
|
|
2074
|
-
};
|
|
2075
|
-
_proto.yvCustom = function yvCustom(d, xyValue) {
|
|
2076
|
-
var $$ = this,
|
|
2077
|
-
scale = $$.scale,
|
|
2078
|
-
yScale = d.axis && d.axis === "y2" ? scale.y2 : scale.y,
|
|
2079
|
-
value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
2080
|
-
return Math.ceil(yScale(value));
|
|
2081
|
-
};
|
|
2082
2087
|
_proto.initStanfordData = function initStanfordData() {
|
|
2083
|
-
var _this5 = this
|
|
2084
|
-
|
|
2088
|
+
var _this5 = this;
|
|
2089
|
+
const config = this.config,
|
|
2085
2090
|
target = this.$$.data.targets[0];
|
|
2086
2091
|
// TODO STANFORD see if (data.js -> orderTargets)+ can be used instead
|
|
2087
2092
|
// Make larger values appear on top
|
|
2088
2093
|
target.values.sort(compareEpochs);
|
|
2089
2094
|
|
|
2090
2095
|
// Get array of epochs
|
|
2091
|
-
|
|
2096
|
+
const epochs = target.values.map(function (a) {
|
|
2092
2097
|
_newArrowCheck(this, _this5);
|
|
2093
2098
|
return a.epochs;
|
|
2094
2099
|
}.bind(this));
|
|
@@ -2098,19 +2103,19 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2098
2103
|
target.colorscale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequentialLog)(target.colors).domain([target.minEpochs, target.maxEpochs]);
|
|
2099
2104
|
};
|
|
2100
2105
|
_proto.getStanfordPointColor = function getStanfordPointColor(d) {
|
|
2101
|
-
|
|
2106
|
+
const target = this.data.targets[0];
|
|
2102
2107
|
return target.colorscale(d.epochs);
|
|
2103
2108
|
};
|
|
2104
2109
|
_proto.setStanfordTooltip = function setStanfordTooltip() {
|
|
2105
|
-
|
|
2110
|
+
const config = this.$$.config;
|
|
2106
2111
|
if (isEmpty(config.tooltip_contents)) {
|
|
2107
2112
|
config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
|
|
2108
|
-
var _this6 = this
|
|
2109
|
-
|
|
2110
|
-
|
|
2113
|
+
var _this6 = this;
|
|
2114
|
+
const data_x = config.data_x;
|
|
2115
|
+
let html = "<table class=\"" + $TOOLTIP.tooltip + "\"><tbody>";
|
|
2111
2116
|
d.forEach(function (v) {
|
|
2112
2117
|
_newArrowCheck(this, _this6);
|
|
2113
|
-
|
|
2118
|
+
const _v$id = v.id,
|
|
2114
2119
|
id = _v$id === void 0 ? "" : _v$id,
|
|
2115
2120
|
_v$value = v.value,
|
|
2116
2121
|
value = _v$value === void 0 ? 0 : _v$value,
|
|
@@ -2125,8 +2130,8 @@ var Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2125
2130
|
}
|
|
2126
2131
|
};
|
|
2127
2132
|
_proto.countEpochsInRegion = function countEpochsInRegion(region) {
|
|
2128
|
-
var _this7 = this
|
|
2129
|
-
|
|
2133
|
+
var _this7 = this;
|
|
2134
|
+
const $$ = this,
|
|
2130
2135
|
target = $$.data.targets[0],
|
|
2131
2136
|
total = target.values.reduce(function (accumulator, currentValue) {
|
|
2132
2137
|
_newArrowCheck(this, _this7);
|