billboard.js 4.0.3 → 4.1.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 +82 -7
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +1848 -494
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +19 -24
- package/dist/billboard.pkgd.js +1844 -679
- package/dist/billboard.pkgd.min.js +24 -29
- package/dist/billboard.react.js +205 -0
- package/dist/billboard.react.min.js +9 -0
- package/dist/billboard.worker.js +10 -0
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +5 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +6 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +6 -3
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +59 -27
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +75 -55
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +5 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +6 -3
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +59 -27
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +68 -3557
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/Chart/Chart.js +134 -152
- package/dist-esm/Chart/api/axis.js +217 -237
- package/dist-esm/Chart/api/category.js +54 -54
- package/dist-esm/Chart/api/chart.js +172 -215
- package/dist-esm/Chart/api/color.js +21 -21
- package/dist-esm/Chart/api/data.js +172 -173
- package/dist-esm/Chart/api/export.js +242 -262
- package/dist-esm/Chart/api/flow.js +198 -254
- package/dist-esm/Chart/api/focus.js +136 -143
- package/dist-esm/Chart/api/grid.js +191 -190
- package/dist-esm/Chart/api/group.js +31 -34
- package/dist-esm/Chart/api/legend.js +54 -63
- package/dist-esm/Chart/api/load.js +237 -257
- package/dist-esm/Chart/api/regions.js +148 -168
- package/dist-esm/Chart/api/selection.js +181 -139
- package/dist-esm/Chart/api/show.js +133 -147
- package/dist-esm/Chart/api/stubs.js +43 -42
- package/dist-esm/Chart/api/subchart.js +155 -172
- package/dist-esm/Chart/api/tooltip.js +132 -177
- package/dist-esm/Chart/api/x.js +67 -71
- package/dist-esm/Chart/api/zoom.js +183 -220
- package/dist-esm/ChartInternal/Axis/Axis.js +1059 -1266
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +408 -540
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +113 -149
- package/dist-esm/ChartInternal/ChartInternal.js +573 -749
- package/dist-esm/ChartInternal/data/convert.helper.js +133 -159
- package/dist-esm/ChartInternal/data/convert.js +200 -229
- package/dist-esm/ChartInternal/data/data.js +967 -1153
- package/dist-esm/ChartInternal/data/load.js +145 -197
- package/dist-esm/ChartInternal/interactions/drag.js +86 -122
- package/dist-esm/ChartInternal/interactions/eventrect.js +455 -621
- package/dist-esm/ChartInternal/interactions/flow.js +151 -215
- package/dist-esm/ChartInternal/interactions/interaction.js +214 -252
- package/dist-esm/ChartInternal/interactions/subchart.js +425 -300
- package/dist-esm/ChartInternal/interactions/zoom.js +321 -440
- package/dist-esm/ChartInternal/internals/category.js +18 -18
- package/dist-esm/ChartInternal/internals/class.js +89 -99
- package/dist-esm/ChartInternal/internals/clip.js +88 -119
- package/dist-esm/ChartInternal/internals/color.js +233 -288
- package/dist-esm/ChartInternal/internals/domain.js +452 -588
- package/dist-esm/ChartInternal/internals/format.js +64 -77
- package/dist-esm/ChartInternal/internals/grid.js +333 -457
- package/dist-esm/ChartInternal/internals/legend.js +675 -927
- package/dist-esm/ChartInternal/internals/redraw.js +200 -289
- package/dist-esm/ChartInternal/internals/region.js +106 -159
- package/dist-esm/ChartInternal/internals/scale.js +186 -215
- package/dist-esm/ChartInternal/internals/selection.js +132 -159
- package/dist-esm/ChartInternal/internals/size.axis.js +92 -139
- package/dist-esm/ChartInternal/internals/size.js +286 -394
- package/dist-esm/ChartInternal/internals/style.js +39 -41
- package/dist-esm/ChartInternal/internals/subchart.util.js +49 -0
- package/dist-esm/ChartInternal/internals/text.arc.js +155 -219
- package/dist-esm/ChartInternal/internals/text.js +368 -528
- package/dist-esm/ChartInternal/internals/text.util.js +179 -239
- package/dist-esm/ChartInternal/internals/title.js +96 -121
- package/dist-esm/ChartInternal/internals/tooltip.js +450 -586
- package/dist-esm/ChartInternal/internals/transform.js +79 -97
- package/dist-esm/ChartInternal/internals/type.js +285 -236
- package/dist-esm/ChartInternal/shape/arc.js +825 -1112
- package/dist-esm/ChartInternal/shape/area.js +73 -94
- package/dist-esm/ChartInternal/shape/bar.js +227 -288
- package/dist-esm/ChartInternal/shape/bubble.js +9 -8
- package/dist-esm/ChartInternal/shape/candlestick.js +110 -138
- package/dist-esm/ChartInternal/shape/core/barRadius.js +197 -133
- package/dist-esm/ChartInternal/shape/core/bubble.js +64 -73
- package/dist-esm/ChartInternal/shape/core/candlestick.js +93 -86
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +68 -75
- package/dist-esm/ChartInternal/shape/core/geometry.js +112 -112
- package/dist-esm/ChartInternal/shape/core/path.js +142 -115
- package/dist-esm/ChartInternal/shape/core/point.js +105 -125
- package/dist-esm/ChartInternal/shape/core/treemap.js +83 -88
- package/dist-esm/ChartInternal/shape/funnel.js +310 -338
- package/dist-esm/ChartInternal/shape/gauge.js +71 -103
- package/dist-esm/ChartInternal/shape/line.js +208 -278
- package/dist-esm/ChartInternal/shape/point.js +310 -425
- package/dist-esm/ChartInternal/shape/polar.js +84 -109
- package/dist-esm/ChartInternal/shape/radar.js +228 -318
- package/dist-esm/ChartInternal/shape/shape.js +782 -843
- package/dist-esm/ChartInternal/shape/treemap.js +152 -190
- package/dist-esm/canvas/CanvasAxisRenderer.js +1180 -1328
- package/dist-esm/canvas/CanvasEngine.js +148 -166
- package/dist-esm/canvas/CanvasPainter.js +395 -411
- package/dist-esm/canvas/CanvasRenderer.js +1584 -1834
- package/dist-esm/canvas/CanvasTheme.js +899 -802
- package/dist-esm/canvas/HitDetector.js +394 -463
- package/dist-esm/canvas/axisTicks.js +672 -786
- package/dist-esm/canvas/classes.js +19 -17
- package/dist-esm/canvas/color.js +40 -59
- package/dist-esm/canvas/geometry.js +38 -38
- package/dist-esm/canvas/labels.js +318 -371
- package/dist-esm/canvas/pointPattern.js +578 -580
- package/dist-esm/canvas/util.js +242 -262
- package/dist-esm/config/Options/Options.js +29 -32
- package/dist-esm/config/Options/axis/axis.js +101 -101
- package/dist-esm/config/Options/axis/x.js +759 -755
- package/dist-esm/config/Options/axis/y.js +525 -522
- package/dist-esm/config/Options/axis/y2.js +501 -485
- package/dist-esm/config/Options/common/boost.js +93 -32
- package/dist-esm/config/Options/common/color.js +88 -87
- package/dist-esm/config/Options/common/grid.js +74 -73
- package/dist-esm/config/Options/common/legend.js +180 -179
- package/dist-esm/config/Options/common/main.js +474 -473
- package/dist-esm/config/Options/common/point.js +160 -159
- package/dist-esm/config/Options/common/title.js +47 -46
- package/dist-esm/config/Options/common/tooltip.js +253 -252
- package/dist-esm/config/Options/data/axis.js +173 -172
- package/dist-esm/config/Options/data/data.js +958 -957
- package/dist-esm/config/Options/data/selection.js +131 -130
- package/dist-esm/config/Options/interaction/interaction.js +53 -52
- package/dist-esm/config/Options/interaction/subchart.js +164 -73
- package/dist-esm/config/Options/interaction/zoom.js +86 -85
- package/dist-esm/config/Options/shape/arc.js +150 -149
- package/dist-esm/config/Options/shape/area.js +69 -68
- package/dist-esm/config/Options/shape/bar.js +147 -146
- package/dist-esm/config/Options/shape/bubble.js +35 -34
- package/dist-esm/config/Options/shape/candlestick.js +61 -60
- package/dist-esm/config/Options/shape/donut.js +181 -180
- package/dist-esm/config/Options/shape/funnel.js +49 -48
- package/dist-esm/config/Options/shape/gauge.js +237 -236
- package/dist-esm/config/Options/shape/line.js +58 -57
- package/dist-esm/config/Options/shape/pie.js +185 -184
- package/dist-esm/config/Options/shape/polar.js +167 -166
- package/dist-esm/config/Options/shape/radar.js +76 -75
- package/dist-esm/config/Options/shape/scatter.js +36 -36
- package/dist-esm/config/Options/shape/spline.js +46 -46
- package/dist-esm/config/Options/shape/treemap.js +80 -79
- package/dist-esm/config/Store/Element.js +64 -62
- package/dist-esm/config/Store/State.js +189 -200
- package/dist-esm/config/Store/Store.js +25 -26
- package/dist-esm/config/classes.js +157 -155
- package/dist-esm/config/config.js +26 -35
- package/dist-esm/config/const.js +120 -128
- package/dist-esm/config/resolver/axis.core.js +25 -25
- package/dist-esm/config/resolver/axis.js +26 -27
- package/dist-esm/config/resolver/canvas.js +2071 -2472
- package/dist-esm/config/resolver/canvasShape.js +201 -177
- package/dist-esm/config/resolver/category.js +26 -27
- package/dist-esm/config/resolver/export.js +24 -26
- package/dist-esm/config/resolver/flow.js +29 -31
- package/dist-esm/config/resolver/grid.js +34 -35
- package/dist-esm/config/resolver/interaction/selection.js +17 -17
- package/dist-esm/config/resolver/interaction/subchart.js +17 -17
- package/dist-esm/config/resolver/interaction/zoom.js +17 -17
- package/dist-esm/config/resolver/regions.js +30 -31
- package/dist-esm/config/resolver/shape/arc.helpers.js +19 -19
- package/dist-esm/config/resolver/shape/area.js +17 -17
- package/dist-esm/config/resolver/shape/axis.helpers.js +28 -25
- package/dist-esm/config/resolver/shape/bar.js +13 -13
- package/dist-esm/config/resolver/shape/bubble.js +18 -14
- package/dist-esm/config/resolver/shape/candlestick.js +13 -13
- package/dist-esm/config/resolver/shape/donut.js +11 -11
- package/dist-esm/config/resolver/shape/funnel.js +11 -11
- package/dist-esm/config/resolver/shape/gauge.js +12 -12
- package/dist-esm/config/resolver/shape/line.js +10 -10
- package/dist-esm/config/resolver/shape/pie.js +11 -11
- package/dist-esm/config/resolver/shape/polar.js +12 -12
- package/dist-esm/config/resolver/shape/radar.js +22 -14
- package/dist-esm/config/resolver/shape/scatter.js +13 -13
- package/dist-esm/config/resolver/shape/treemap.js +11 -11
- package/dist-esm/core.js +208 -211
- package/dist-esm/index.canvas.js +14 -13
- package/dist-esm/index.esm.js +25 -24
- package/dist-esm/module/Cache.js +117 -129
- package/dist-esm/module/browser.js +30 -35
- package/dist-esm/module/dsv.js +107 -127
- package/dist-esm/module/error.js +45 -52
- package/dist-esm/module/generator.js +75 -83
- package/dist-esm/module/sanitize.js +302 -399
- package/dist-esm/module/util/brush.js +27 -38
- package/dist-esm/module/util/dom.js +288 -348
- package/dist-esm/module/util/object.js +277 -341
- package/dist-esm/module/util/type-checks.js +21 -25
- package/dist-esm/module/worker.js +312 -130
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +185 -198
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +442 -450
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +813 -950
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +708 -788
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +344 -301
- package/dist-esm/react/index.js +157 -0
- package/package.json +28 -8
- package/src/Chart/api/selection.ts +130 -5
- package/src/ChartInternal/Axis/Axis.ts +164 -65
- package/src/ChartInternal/Axis/AxisRenderer.ts +41 -8
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/convert.ts +54 -4
- package/src/ChartInternal/data/data.ts +4 -1
- package/src/ChartInternal/interactions/eventrect.ts +8 -2
- package/src/ChartInternal/interactions/subchart.ts +437 -66
- package/src/ChartInternal/internals/color.ts +2 -2
- package/src/ChartInternal/internals/domain.ts +15 -3
- package/src/ChartInternal/internals/grid.ts +21 -1
- package/src/ChartInternal/internals/scale.ts +9 -2
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/subchart.util.ts +55 -0
- package/src/ChartInternal/internals/text.arc.ts +3 -1
- package/src/ChartInternal/internals/text.ts +18 -5
- package/src/ChartInternal/internals/transform.ts +8 -2
- package/src/ChartInternal/internals/type.ts +105 -1
- package/src/ChartInternal/shape/IShape.ts +6 -3
- package/src/ChartInternal/shape/bar.ts +62 -31
- package/src/ChartInternal/shape/core/barRadius.ts +129 -0
- package/src/ChartInternal/shape/core/candlestick.ts +1 -1
- package/src/ChartInternal/shape/core/path.ts +76 -9
- package/src/ChartInternal/shape/funnel.ts +2 -3
- package/src/ChartInternal/shape/point.ts +2 -2
- package/src/ChartInternal/shape/shape.ts +149 -17
- package/src/Plugin/stanford/index.ts +0 -4
- package/src/Plugin/tableview/index.ts +85 -3
- package/src/Plugin/textoverlap/index.ts +9 -15
- package/src/canvas/CanvasAxisRenderer.ts +184 -36
- package/src/canvas/CanvasRenderer.ts +247 -160
- package/src/canvas/CanvasTheme.ts +212 -0
- package/src/canvas/axisTicks.ts +122 -40
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/common/boost.ts +64 -4
- package/src/config/Options/common/color.ts +2 -2
- package/src/config/Options/interaction/subchart.ts +98 -1
- package/src/config/Options/shape/gauge.ts +1 -1
- package/src/config/Options/shape/treemap.ts +2 -2
- package/src/config/Store/Element.ts +3 -1
- package/src/config/Store/State.ts +1 -0
- package/src/config/classes.ts +1 -0
- package/src/config/resolver/canvas.ts +92 -10
- package/src/module/util/type-checks.ts +3 -1
- package/src/module/voronoi.ts +119 -0
- package/src/module/worker.entry.ts +61 -0
- package/src/module/worker.ts +346 -63
- package/src/react/index.ts +193 -0
- package/types/options.d.ts +206 -3
- package/types/react/index.d.ts +27 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -65,6 +65,34 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
65
65
|
"default": function() { return /* binding */ TableView; }
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
+
// UNUSED EXPORTS: isValidTableViewOptions
|
|
69
|
+
|
|
70
|
+
;// ./src/module/util/type-checks.ts
|
|
71
|
+
const isValue = (v) => v || v === 0;
|
|
72
|
+
const isFunction = (v) => typeof v === "function";
|
|
73
|
+
const isString = (v) => typeof v === "string";
|
|
74
|
+
const isNumber = (v) => typeof v === "number";
|
|
75
|
+
const isUndefined = (v) => typeof v === "undefined";
|
|
76
|
+
const isDefined = (v) => typeof v !== "undefined";
|
|
77
|
+
const isBoolean = (v) => typeof v === "boolean";
|
|
78
|
+
const ceil10 = (v) => Math.ceil(v / 10) * 10;
|
|
79
|
+
const asHalfPixel = (n) => Math.ceil(n) + 0.5;
|
|
80
|
+
const diffDomain = (d) => d[1] - d[0];
|
|
81
|
+
const isObjectType = (v) => typeof v === "object";
|
|
82
|
+
const isEmptyObject = (obj) => {
|
|
83
|
+
for (const x in obj) {
|
|
84
|
+
if (Object.prototype.hasOwnProperty.call(obj, x)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
};
|
|
90
|
+
const isEmpty = (o) => isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && isEmptyObject(o) || isNumber(o) && isNaN(o);
|
|
91
|
+
const notEmpty = (o) => !isEmpty(o);
|
|
92
|
+
const isArray = (arr) => Array.isArray(arr);
|
|
93
|
+
const isObject = (obj) => obj && !(obj == null ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
94
|
+
|
|
95
|
+
|
|
68
96
|
;// ./src/module/browser.ts
|
|
69
97
|
function getGlobal() {
|
|
70
98
|
return typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof self === "object" && self !== null && self.Object === Object && self || Function("return this")();
|
|
@@ -410,30 +438,6 @@ function sanitize(str) {
|
|
|
410
438
|
);
|
|
411
439
|
}
|
|
412
440
|
|
|
413
|
-
;// ./src/module/util/type-checks.ts
|
|
414
|
-
const isValue = (v) => v || v === 0;
|
|
415
|
-
const isFunction = (v) => typeof v === "function";
|
|
416
|
-
const isString = (v) => typeof v === "string";
|
|
417
|
-
const isNumber = (v) => typeof v === "number";
|
|
418
|
-
const isUndefined = (v) => typeof v === "undefined";
|
|
419
|
-
const isDefined = (v) => typeof v !== "undefined";
|
|
420
|
-
const isBoolean = (v) => typeof v === "boolean";
|
|
421
|
-
const ceil10 = (v) => Math.ceil(v / 10) * 10;
|
|
422
|
-
const asHalfPixel = (n) => Math.ceil(n) + 0.5;
|
|
423
|
-
const diffDomain = (d) => d[1] - d[0];
|
|
424
|
-
const isObjectType = (v) => typeof v === "object";
|
|
425
|
-
const isEmptyObject = (obj) => {
|
|
426
|
-
for (const x in obj) {
|
|
427
|
-
return false;
|
|
428
|
-
}
|
|
429
|
-
return true;
|
|
430
|
-
};
|
|
431
|
-
const isEmpty = (o) => isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && isEmptyObject(o) || isNumber(o) && isNaN(o);
|
|
432
|
-
const notEmpty = (o) => !isEmpty(o);
|
|
433
|
-
const isArray = (arr) => Array.isArray(arr);
|
|
434
|
-
const isObject = (obj) => obj && !(obj == null ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
435
|
-
|
|
436
|
-
|
|
437
441
|
;// ./src/module/util/object.ts
|
|
438
442
|
var __defProp = Object.defineProperty;
|
|
439
443
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -758,7 +762,7 @@ class Plugin {
|
|
|
758
762
|
});
|
|
759
763
|
}
|
|
760
764
|
}
|
|
761
|
-
__publicField(Plugin, "version", "4.0.
|
|
765
|
+
__publicField(Plugin, "version", "4.1.0-next.2");
|
|
762
766
|
|
|
763
767
|
;// ./src/Plugin/tableview/const.ts
|
|
764
768
|
|
|
@@ -939,10 +943,38 @@ var tableview_publicField = (obj, key, value) => tableview_defNormalProp(obj, ty
|
|
|
939
943
|
|
|
940
944
|
|
|
941
945
|
|
|
946
|
+
const optionValidators = {
|
|
947
|
+
selector: isString,
|
|
948
|
+
categoryTitle: isString,
|
|
949
|
+
categoryFormat: isFunction,
|
|
950
|
+
class: isString,
|
|
951
|
+
style: isBoolean,
|
|
952
|
+
title: isString,
|
|
953
|
+
updateOnToggle: isBoolean,
|
|
954
|
+
nullString: isString,
|
|
955
|
+
numberFormat: isFunction
|
|
956
|
+
};
|
|
957
|
+
function isValidTableViewOptions(options) {
|
|
958
|
+
if (!isObjectType(options) || isArray(options) || options === null) {
|
|
959
|
+
return false;
|
|
960
|
+
}
|
|
961
|
+
return Object.entries(options).every(([key, value]) => {
|
|
962
|
+
const validate = optionValidators[key];
|
|
963
|
+
return !isFunction(validate) || value === void 0 || validate(value);
|
|
964
|
+
});
|
|
965
|
+
}
|
|
942
966
|
class TableView extends Plugin {
|
|
943
|
-
constructor(options) {
|
|
967
|
+
constructor(options = {}) {
|
|
968
|
+
var _a;
|
|
944
969
|
super(options);
|
|
945
970
|
tableview_publicField(this, "element");
|
|
971
|
+
if (!isValidTableViewOptions(options)) {
|
|
972
|
+
(_a = console == null ? void 0 : console.error) == null ? void 0 : _a.call(
|
|
973
|
+
console,
|
|
974
|
+
"[billboard.js] TableView plugin received invalid options; unsupported values will be ignored.",
|
|
975
|
+
options
|
|
976
|
+
);
|
|
977
|
+
}
|
|
946
978
|
this.config = new Options();
|
|
947
979
|
return this;
|
|
948
980
|
}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
|
-
*/(function(a,
|
|
12
|
-
`).replace(/&tab;/gi," ").replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&#(\d+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,10))).replace(/&#x([0-9a-f]+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,16)))}function
|
|
11
|
+
*/(function(a,b){typeof exports=="object"&&typeof module=="object"?module.exports=b():typeof define=="function"&&define.amd?define("bb",[],b):typeof exports=="object"?exports.bb=b():(a.bb=a.bb||{},a.bb.plugin=a.bb.plugin||{},a.bb.plugin.tableview=b())})(this,function(){return(function(){"use strict";var d={};(function(){d.d=function(e,t){if(Array.isArray(t))for(var n=0;n<t.length;){var r=t[n++],o=t[n++];d.o(e,r)?o===0&&n++:o===0?Object.defineProperty(e,r,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,r,{enumerable:!0,get:o})}else for(var r in t)d.o(t,r)&&!d.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(function(){d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}})();var a={};d.d(a,{default:function(){return Be}});const b=e=>e||e===0,x=e=>typeof e=="function",p=e=>typeof e=="string",M=e=>typeof e=="number",te=e=>typeof e=="undefined",ne=e=>typeof e!="undefined",z=e=>typeof e=="boolean",He=e=>Math.ceil(e/10)*10,Xe=e=>Math.ceil(e)+.5,Ze=e=>e[1]-e[0],v=e=>typeof e=="object",re=e=>{for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0},oe=e=>te(e)||e===null||p(e)&&e.length===0||v(e)&&!(e instanceof Date)&&re(e)||M(e)&&isNaN(e),Qe=e=>!oe(e),I=e=>Array.isArray(e),Ye=e=>e&&!(e!=null&&e.nodeType)&&v(e)&&!I(e),ie=new Set(["span","div","p","br","b","i","em","small","strong","mark","u","s","sub","sup","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","hr","pre","code","blockquote","abbr","ins","del","a","img","figure","figcaption","svg","g","path","circle","ellipse","rect","line","polyline","polygon","text","tspan","textPath","use","defs","symbol","clipPath","mask","linearGradient","radialGradient","stop","pattern","marker","title","desc"]),se=new Set(["class","id","style","title","lang","dir","href","src","alt","width","height","colspan","rowspan","scope","headers","d","points","x","y","x1","x2","y1","y2","cx","cy","r","rx","ry","dx","dy","viewBox","preserveAspectRatio","transform","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-opacity","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","opacity","clip-path","clip-rule","mask","font-family","font-size","font-weight","font-style","text-anchor","dominant-baseline","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","patternUnits","patternTransform","marker-start","marker-mid","marker-end","markerWidth","markerHeight","refX","refY","xlink:href"]),O=new Map;ie.forEach(e=>O.set(e.toLowerCase(),e));const E=new Map;se.forEach(e=>E.set(e.toLowerCase(),e));const ae=new Set(["http:","https:","mailto:"]),le=new Set(["href","src","xlink:href"]),ce=/^<\/?([a-zA-Z][a-zA-Z0-9]*)/,fe=/^<\/([a-zA-Z][a-zA-Z0-9]*)\s*>$/,ue=/^<([a-zA-Z][a-zA-Z0-9]*)([\s\S]*?)(\/?)>$/,R=/([a-zA-Z][\w:-]*)\s*(?:=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g,V=/url\s*\(\s*["']?([^"')]+)["']?\s*\)/gi,de=["expression(","behavior:","binding:","@import","@charset","-moz-binding:"];function C(e){return e.replace(/:/gi,":").replace(/&newline;/gi,`
|
|
12
|
+
`).replace(/&tab;/gi," ").replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&#(\d+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,10))).replace(/&#x([0-9a-f]+);?/gi,(t,n)=>String.fromCharCode(parseInt(n,16)))}function G(e){const n=C(e).trim().replace(/[\s\u0000-\u001f]/g,"").toLowerCase();if(!n||n.startsWith("#"))return!0;const r=n.match(/^[^/?#]*:/);return r?ae.has(r[0]):!0}function pe(e){const n=C(e).replace(/[\u0000-\u001f]/g,"");V.lastIndex=0;let r;for(;(r=V.exec(n))!==null;)if(!G(r[1]))return null;const o=n.toLowerCase().replace(/\s/g,"");for(const i of de)if(o.includes(i))return null;return e}const he={'"':""","'":"'","`":"`"},ge=/["'`]/g;function P(e){return e.replace(ge,t=>he[t])}function be(e,t,n=!1){if(le.has(e))return G(t)?n?P(t):t:null;if(e==="style"){const o=pe(t);return o===null?null:n?P(o):o}const r=C(t).toLowerCase().replace(/\s/g,"");return/\bon\w+=/.test(r)?null:n?P(t):t}function me(e){const t=e.match(ce);return t?t[1].toLowerCase():null}function ye(e){const t=me(e);return t!==null&&O.has(t)}function _e(e){var t,n,r;const o=e.match(fe);if(o){const f=o[1].toLowerCase();return`</${(t=O.get(f))!=null?t:f}>`}const i=e.match(ue);if(!i)return"";const[,s,l,g]=i,c=s.toLowerCase(),u=(n=O.get(c))!=null?n:c,A=[];R.lastIndex=0;let _;for(;(_=R.exec(l))!==null;){const f=_[1].toLowerCase(),Y=_[2],J=_[3],j=_[4];if(f.startsWith("on"))continue;const K=(r=E.get(f))!=null?r:f;let $,w;if(Y!==void 0)$=Y,w='"';else if(J!==void 0)$=J,w="'";else if(j!==void 0)$=j,w='"';else{E.has(f)&&A.push(K);continue}if(E.has(f)){const ee=be(f,$,j!==void 0);ee!==null&&A.push(`${K}=${w}${ee}${w}`)}}const We=A.length>0?` ${A.join(" ")}`:"";return`<${u}${We}${g?"/>":">"}`}function we(e){return typeof e!="string"||!e||e.indexOf("<")===-1?e:e.replace(/<\/?[^>]*>|[^<>\s]+>/g,t=>t.startsWith("<!--")?"":t.startsWith("<")?ye(t)?_e(t):t.replace(/</g,"<"):t.slice(0,-1)+">")}var ve,U,Oe,N,m,Ee,F,D,Te=Object.defineProperty,k=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,q=(e,t,n)=>t in e?Te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B=(e,t)=>{for(var n in t||(t={}))Se.call(t,n)&&q(e,n,t[n]);if(k)for(var n of k(t))Ae.call(t,n)&&q(e,n,t[n]);return e};function W(e,t){for(let n=0;n<e.length;n++){const r=e[n];r!==null&&U(r)&&t(r,n)}}function Je(e,t,n){return U(e[t])?e[t]:n}function Ke(e,t){for(const n in e)if(e[n]===t)return!0;return!1}function et(e,t,...n){const r=Oe(e);return r&&e.call(t,...n),r}function tt(e,t){let n=0;const r=function(...o){!--n&&t.apply(this,o)};"duration"in e?e.each(()=>++n).on("end",r):(++n,e.call(r))}const nt=e=>e.charAt(0).toUpperCase()+e.slice(1);function rt(e,t="-"){return e.split(t).map((n,r)=>r?n.charAt(0).toUpperCase()+n.slice(1).toLowerCase():n.toLowerCase()).join("")}const ot=e=>[].slice.call(e);function it(...e){const t=n=>{if(N(n))return n.map(t);if(m(n)&&n.constructor){const r=new n.constructor;for(const o in n)r[o]=t(n[o]);return r}return n};return e.map(n=>t(n)).reduce((n,r)=>B(B({},n),r))}function $e(e={},t){N(t)&&t.forEach(n=>$e(e,n));for(const n in t)/^\d+$/.test(n)||n in e||(e[n]=t[n]);return e}function st(e){const t=e[0]instanceof Date,n=Array.from(new Set(t?e.map(Number):e));return t?n.map(r=>new Date(r)):n}function at(e){return e&&e.length?e.reduce((t,n)=>t.concat(n)):[]}function H(e,...t){if(!t.length||t.length===1&&!t[0])return e;const n=t.shift();return m(e)&&m(n)&&Object.keys(n).forEach(r=>{if(!/^(__proto__|constructor|prototype)$/i.test(r)){const o=n[r];o instanceof Date?e[r]=new Date(o.getTime()):m(o)?(!e[r]&&(e[r]={}),e[r]=H(e[r],o)):e[r]=N(o)?o.concat():o}}),H(e,...t)}function xe(e,t=!0){let n;return e[0]instanceof Date?n=t?(r,o)=>r-o:(r,o)=>o-r:t&&!e.every(isNaN)?n=(r,o)=>r-o:t||(n=(r,o)=>r>o&&-1||r<o&&1||r===o&&0),e.concat().sort(n)}function lt(e,t){let n=t.filter(r=>Ee(r));if(n.length)if(F(n[0])){let r=e==="min"?1/0:-1/0;for(const o of n)(e==="min"?o<r:o>r)&&(r=o);n=r}else n[0]instanceof Date&&(n=xe(n,e==="min")[0]);else n=void 0;return n}const ct=(e,t,n=1)=>{const r=[],o=Math.max(0,Math.ceil((t-e)/n))|0;for(let i=0;i<o;i++)r.push(e+i*n);return r};let Ce=0;function ft(e=!0){const t=++Ce;return e?String(t):t}function X(e,t,n,r,o){if(n>r)return-1;const i=Math.floor((n+r)/2);let{x:s,w:l=0}=e[i];return o&&(s=e[i].y,l=e[i].h),t>=s&&t<=s+l?i:t<s?X(e,t,n,i-1,o):X(e,t,i+1,r,o)}function T(e,t){return we(e.replace(/\{=([^}]+)\}/g,(n,r)=>{var o;return(o=t[r])!=null?o:""}))}function ut(e){var t;let n;if(e instanceof Date)n=e;else if(D(e)){const{config:r,format:o}=this;n=(t=o.dataTime(r.data_xFormat)(e))!=null?t:new Date(e)}else F(e)&&!isNaN(e)&&(n=new Date(+e));return(!n||isNaN(+n))&&console&&console.error&&console.error(`Failed to parse x '${e}' to Date object`),n}function dt(e){if(m(e)&&!D(e)){const s=e;return{top:s.top||0,right:s.right||0,bottom:s.bottom||0,left:s.left||0}}const t=(D(e)?e.trim().split(/\s+/):[e]).map(s=>+s||0),[n,r=n,o=n,i=r]=t;return{top:n,right:r,bottom:o,left:i}}function Pe(e,t){t()===!1?ve(()=>Pe(e,t)):e()}function pt(e,t=(n=>n)){const n=new Set;return W(e,(r,o)=>{n.add(t(r,o))}),n}function ht(e,t,n=(r=>r)){const r=new Map;return W(e,(o,i)=>{r.set(t(o,i),n(o,i))}),r}function Ne(e){const t=this.config;let n,r,o;const i=()=>{const s=r.shift();if(s&&n&&v(n)&&s in n)return n=n[s],i();if(!s)return n};Object.keys(t).forEach(s=>{n=e,r=s.split("_"),o=i(),ne(o)&&(t[s]=o)}),this.api&&(this.state.orgConfig=e)}var De=Object.defineProperty,Le=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,S=(e,t,n)=>Le(e,typeof t!="symbol"?t+"":t,n);class Z{constructor(t={}){S(this,"$$"),S(this,"options"),S(this,"config"),this.options=t}loadConfig(){Ne.call(this,this.options)}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(t=>{this[t]=null,delete this[t]})}}S(Z,"version","4.1.0-next.2");const h={id:"__tableview-style__",class:"bb-tableview",rule:`.bb-tableview {
|
|
13
13
|
border-collapse:collapse;
|
|
14
14
|
border-spacing:0;
|
|
15
15
|
background:#fff;
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
font-size:1.1em;
|
|
34
34
|
font-weight:700;
|
|
35
35
|
margin-bottom: -1px;
|
|
36
|
-
}`},
|
|
36
|
+
}`},y={body:`<caption>{=title}</caption>
|
|
37
37
|
<thead><tr>{=thead}</tr></thead>
|
|
38
|
-
<tbody>{=tbody}</tbody>`,thead:'<th scope="col">{=title}</th>',tbodyHeader:'<th scope="row">{=value}</th>',tbody:"<td>{=value}</td>"};class
|
|
38
|
+
<tbody>{=tbody}</tbody>`,thead:'<th scope="col">{=title}</th>',tbodyHeader:'<th scope="row">{=value}</th>',tbody:"<td>{=value}</td>"};class je{constructor(){return{selector:void 0,categoryTitle:"Category",categoryFormat:function(t){let n=t;return this.$$.axis.isCategorized()?n=this.$$.categoryName(t):this.$$.axis.isTimeSeries()&&(n=t.toLocaleDateString()),n},class:void 0,style:!0,title:void 0,updateOnToggle:!0,nullString:"-",numberFormat:function(t){return t.toLocaleString()}}}}var Me=Object.defineProperty,ze=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable,L=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ge=(e,t)=>{for(var n in t||(t={}))Re.call(t,n)&&L(e,n,t[n]);if(Q)for(var n of Q(t))Ve.call(t,n)&&L(e,n,t[n]);return e},Ue=(e,t)=>ze(e,Ie(t)),Fe=(e,t,n)=>L(e,typeof t!="symbol"?t+"":t,n);const ke={selector:p,categoryTitle:p,categoryFormat:x,class:p,style:z,title:p,updateOnToggle:z,nullString:p,numberFormat:x};function qe(e){return!v(e)||I(e)||e===null?!1:Object.entries(e).every(([t,n])=>{const r=ke[t];return!x(r)||n===void 0||r(n)})}class Be extends Z{constructor(t={}){var n;return super(t),Fe(this,"element"),qe(t)||(n=console==null?void 0:console.error)==null||n.call(console,"[billboard.js] TableView plugin received invalid options; unsupported values will be ignored.",t),this.config=new je,this}$beforeInit(){this.loadConfig()}$init(){const{class:t,selector:n,style:r}=this.config;let o=document.querySelector(n||`.${t||h.class}`);if(!o){const i=this.$$.$el.chart.node();o=document.createElement("table"),i.parentNode.insertBefore(o,i.nextSibling)}if(o.tagName!=="TABLE"){const i=document.createElement("table");o.appendChild(i),o=i}if(r&&!document.getElementById(h.id)){const i=document.createElement("style");i.id=h.id,i.innerHTML=h.rule,(document.head||document.getElementsByTagName("head")[0]).appendChild(i)}o.classList.add(...[r&&h.class,t].filter(Boolean)),this.element=o}generateTable(){const{$$:t,config:n,element:r}=this,o=t.filterTargetsToShow(t.data.targets);let i=T(y.thead,{title:o.length?this.config.categoryTitle:""}),s="";const l=[];o.forEach(g=>{i+=T(y.thead,{title:g.id}),g.values.forEach((c,u)=>{l[u]||(l[u]=[c.x]),l[u].push(c.value)})}),l.forEach(g=>{s+=`<tr>${g.map((c,u)=>T(u?y.tbody:y.tbodyHeader,{value:u===0?n.categoryFormat.bind(this)(c):M(c)?n.numberFormat.bind(this)(c):n.nullString})).join("")}</tr>`}),r.innerHTML=T(y.body,Ue(Ge({},n),{title:n.title||t.config.title_text||"",thead:i,tbody:s}))}$redraw(){const{state:t}=this.$$;!(t.resizing||!this.config.updateOnToggle&&t.toggling)&&this.generateTable()}$willDestroy(){var t,n;if((t=this.element.parentNode)==null||t.removeChild(this.element),this.$$.charts.length===1){const r=document.getElementById(h.id);(n=r==null?void 0:r.parentNode)==null||n.removeChild(r)}}}return a=a.default,a})()});
|
|
@@ -5,56 +5,24 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
12
12
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
13
13
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
14
|
-
module.exports = factory(
|
|
14
|
+
module.exports = factory();
|
|
15
15
|
else if(typeof define === 'function' && define.amd)
|
|
16
|
-
define("bb", [
|
|
16
|
+
define("bb", [], factory);
|
|
17
17
|
else if(typeof exports === 'object')
|
|
18
|
-
exports["bb"] = factory(
|
|
18
|
+
exports["bb"] = factory();
|
|
19
19
|
else
|
|
20
|
-
root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["textoverlap"] = factory(
|
|
21
|
-
})(this, function(
|
|
20
|
+
root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["textoverlap"] = factory();
|
|
21
|
+
})(this, function() {
|
|
22
22
|
return /******/ (function() { // webpackBootstrap
|
|
23
23
|
/******/ "use strict";
|
|
24
|
-
/******/
|
|
25
|
-
|
|
26
|
-
/***/ 9:
|
|
27
|
-
/***/ (function(module) {
|
|
28
|
-
|
|
29
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
|
|
30
|
-
|
|
31
|
-
/***/ })
|
|
32
|
-
|
|
33
|
-
/******/ });
|
|
34
|
-
/************************************************************************/
|
|
35
|
-
/******/ // The module cache
|
|
36
|
-
/******/ var __webpack_module_cache__ = {};
|
|
37
|
-
/******/
|
|
38
|
-
/******/ // The require function
|
|
39
|
-
/******/ function __webpack_require__(moduleId) {
|
|
40
|
-
/******/ // Check if module is in cache
|
|
41
|
-
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
42
|
-
/******/ if (cachedModule !== undefined) {
|
|
43
|
-
/******/ return cachedModule.exports;
|
|
44
|
-
/******/ }
|
|
45
|
-
/******/ // Create a new module (and put it into the cache)
|
|
46
|
-
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
47
|
-
/******/ // no module.id needed
|
|
48
|
-
/******/ // no module.loaded needed
|
|
49
|
-
/******/ exports: {}
|
|
50
|
-
/******/ };
|
|
51
|
-
/******/
|
|
52
|
-
/******/ // Execute the module function
|
|
53
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
54
|
-
/******/
|
|
55
|
-
/******/ // Return the exports of the module
|
|
56
|
-
/******/ return module.exports;
|
|
57
|
-
/******/ }
|
|
24
|
+
/******/ // The require scope
|
|
25
|
+
/******/ var __webpack_require__ = {};
|
|
58
26
|
/******/
|
|
59
27
|
/************************************************************************/
|
|
60
28
|
/******/ /* webpack/runtime/define property getters */
|
|
@@ -91,16 +59,12 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
|
|
|
91
59
|
/******/
|
|
92
60
|
/************************************************************************/
|
|
93
61
|
var __webpack_exports__ = {};
|
|
94
|
-
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
95
|
-
!function() {
|
|
96
62
|
|
|
97
63
|
// EXPORTS
|
|
98
64
|
__webpack_require__.d(__webpack_exports__, {
|
|
99
65
|
"default": function() { return /* binding */ TextOverlap; }
|
|
100
66
|
});
|
|
101
67
|
|
|
102
|
-
// EXTERNAL MODULE: external {"commonjs":"d3-delaunay","commonjs2":"d3-delaunay","amd":"d3-delaunay","root":"d3"}
|
|
103
|
-
var external_commonjs_d3_delaunay_commonjs2_d3_delaunay_amd_d3_delaunay_root_d3_ = __webpack_require__(9);
|
|
104
68
|
;// ./src/module/polygon.ts
|
|
105
69
|
function polygonArea(polygon) {
|
|
106
70
|
const n = polygon.length;
|
|
@@ -131,6 +95,62 @@ function polygonCentroid(polygon) {
|
|
|
131
95
|
return [x / k, y / k];
|
|
132
96
|
}
|
|
133
97
|
|
|
98
|
+
;// ./src/module/voronoi.ts
|
|
99
|
+
const EPSILON = 1e-9;
|
|
100
|
+
function clipByBisector(polygon, a, b) {
|
|
101
|
+
const dx = b[0] - a[0];
|
|
102
|
+
const dy = b[1] - a[1];
|
|
103
|
+
const c = (dx * (a[0] + b[0]) + dy * (a[1] + b[1])) / 2;
|
|
104
|
+
const output = [];
|
|
105
|
+
const n = polygon.length;
|
|
106
|
+
let prev = polygon[n - 1];
|
|
107
|
+
let prevDist = dx * prev[0] + dy * prev[1] - c;
|
|
108
|
+
for (let i = 0; i < n; i++) {
|
|
109
|
+
const curr = polygon[i];
|
|
110
|
+
const currDist = dx * curr[0] + dy * curr[1] - c;
|
|
111
|
+
if (prevDist > 0 !== currDist > 0) {
|
|
112
|
+
const t = prevDist / (prevDist - currDist);
|
|
113
|
+
output.push([
|
|
114
|
+
prev[0] + t * (curr[0] - prev[0]),
|
|
115
|
+
prev[1] + t * (curr[1] - prev[1])
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
if (currDist <= 0) {
|
|
119
|
+
output.push(curr);
|
|
120
|
+
}
|
|
121
|
+
prev = curr;
|
|
122
|
+
prevDist = currDist;
|
|
123
|
+
}
|
|
124
|
+
return output;
|
|
125
|
+
}
|
|
126
|
+
function voronoiCells(points, bounds) {
|
|
127
|
+
const [x0, y0, x1, y1] = [
|
|
128
|
+
Math.min(bounds[0], bounds[2]),
|
|
129
|
+
Math.min(bounds[1], bounds[3]),
|
|
130
|
+
Math.max(bounds[0], bounds[2]),
|
|
131
|
+
Math.max(bounds[1], bounds[3])
|
|
132
|
+
];
|
|
133
|
+
const rect = [[x0, y0], [x1, y0], [x1, y1], [x0, y1]];
|
|
134
|
+
const n = points.length;
|
|
135
|
+
return points.map((site, i) => {
|
|
136
|
+
let cell = rect;
|
|
137
|
+
for (let j = 0; j < n && cell.length > 2; j++) {
|
|
138
|
+
if (j === i) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const other = points[j];
|
|
142
|
+
if (Math.abs(other[0] - site[0]) < EPSILON && Math.abs(other[1] - site[1]) < EPSILON) {
|
|
143
|
+
if (j < i) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
cell = clipByBisector(cell, site, other);
|
|
149
|
+
}
|
|
150
|
+
return cell.length > 2 ? [...cell, cell[0]] : null;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
134
154
|
;// ./src/module/util/type-checks.ts
|
|
135
155
|
const isValue = (v) => v || v === 0;
|
|
136
156
|
const isFunction = (v) => typeof v === "function";
|
|
@@ -145,7 +165,9 @@ const diffDomain = (d) => d[1] - d[0];
|
|
|
145
165
|
const isObjectType = (v) => typeof v === "object";
|
|
146
166
|
const isEmptyObject = (obj) => {
|
|
147
167
|
for (const x in obj) {
|
|
148
|
-
|
|
168
|
+
if (Object.prototype.hasOwnProperty.call(obj, x)) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
149
171
|
}
|
|
150
172
|
return true;
|
|
151
173
|
};
|
|
@@ -244,7 +266,7 @@ class Plugin {
|
|
|
244
266
|
});
|
|
245
267
|
}
|
|
246
268
|
}
|
|
247
|
-
__publicField(Plugin, "version", "4.0.
|
|
269
|
+
__publicField(Plugin, "version", "4.1.0-next.2");
|
|
248
270
|
|
|
249
271
|
;// ./src/Plugin/textoverlap/Options.ts
|
|
250
272
|
class Options {
|
|
@@ -303,12 +325,14 @@ class TextOverlap extends Plugin {
|
|
|
303
325
|
$redraw() {
|
|
304
326
|
const { $$: { $el }, config: { selector } } = this;
|
|
305
327
|
const text = selector ? $el.main.selectAll(selector) : $el.text;
|
|
306
|
-
!text.empty()
|
|
328
|
+
if (!text.empty()) {
|
|
329
|
+
this.preventLabelOverlap(text);
|
|
330
|
+
}
|
|
307
331
|
}
|
|
308
332
|
/**
|
|
309
333
|
* Generates the voronoi layout for data labels
|
|
310
334
|
* @param {Array} points Indices values
|
|
311
|
-
* @returns {
|
|
335
|
+
* @returns {Array} Voronoi cell polygons, in point order
|
|
312
336
|
* @private
|
|
313
337
|
*/
|
|
314
338
|
generateVoronoi(points) {
|
|
@@ -316,10 +340,7 @@ class TextOverlap extends Plugin {
|
|
|
316
340
|
const { scale } = $$;
|
|
317
341
|
const [min, max] = ["x", "y"].map((v) => scale[v].domain());
|
|
318
342
|
[min[1], max[0]] = [max[0], min[1]];
|
|
319
|
-
return
|
|
320
|
-
...min,
|
|
321
|
-
...max
|
|
322
|
-
]);
|
|
343
|
+
return voronoiCells(points, [...min, ...max]);
|
|
323
344
|
}
|
|
324
345
|
/**
|
|
325
346
|
* Set text label's position to preventg overlap.
|
|
@@ -329,10 +350,10 @@ class TextOverlap extends Plugin {
|
|
|
329
350
|
preventLabelOverlap(text) {
|
|
330
351
|
const { extent, area } = this.config;
|
|
331
352
|
const points = text.data().map((v) => [v.index, v.value]);
|
|
332
|
-
const
|
|
353
|
+
const cells = this.generateVoronoi(points);
|
|
333
354
|
let i = 0;
|
|
334
355
|
text.each(function() {
|
|
335
|
-
const cell =
|
|
356
|
+
const cell = cells[i];
|
|
336
357
|
if (cell && this) {
|
|
337
358
|
const [x, y] = points[i];
|
|
338
359
|
const [cx, cy] = polygonCentroid(cell);
|
|
@@ -351,7 +372,6 @@ class TextOverlap extends Plugin {
|
|
|
351
372
|
}
|
|
352
373
|
}
|
|
353
374
|
|
|
354
|
-
}();
|
|
355
375
|
__webpack_exports__ = __webpack_exports__["default"];
|
|
356
376
|
/******/ return __webpack_exports__;
|
|
357
377
|
/******/ })()
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
|
-
*/(function(
|
|
11
|
+
*/(function(u,d){typeof exports=="object"&&typeof module=="object"?module.exports=d():typeof define=="function"&&define.amd?define("bb",[],d):typeof exports=="object"?exports.bb=d():(u.bb=u.bb||{},u.bb.plugin=u.bb.plugin||{},u.bb.plugin.textoverlap=d())})(this,function(){return(function(){"use strict";var y={};(function(){y.d=function(t,e){if(Array.isArray(e))for(var n=0;n<e.length;){var r=e[n++],s=e[n++];y.o(t,r)?s===0&&n++:s===0?Object.defineProperty(t,r,{enumerable:!0,value:e[n++]}):Object.defineProperty(t,r,{enumerable:!0,get:s})}else for(var r in e)y.o(e,r)&&!y.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})}})(),(function(){y.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}})();var u={};y.d(u,{default:function(){return B}});function d(t){const e=t.length;let n=0,r=t[e-1];for(let s=0;s<e;s++){const i=r;r=t[s],n+=i[1]*r[0]-i[0]*r[1]}return n/2}function O(t){const e=t.length;let n=0,r=0,s=0,i=t[e-1];for(let o=0;o<e;o++){const l=i;i=t[o];const c=l[0]*i[1]-i[0]*l[1];s+=c,n+=(l[0]+i[0])*c,r+=(l[1]+i[1])*c}return s*=3,[n/s,r/s]}const x=1e-9;function _(t,e,n){const r=n[0]-e[0],s=n[1]-e[1],i=(r*(e[0]+n[0])+s*(e[1]+n[1]))/2,o=[],l=t.length;let c=t[l-1],p=r*c[0]+s*c[1]-i;for(let f=0;f<l;f++){const a=t[f],h=r*a[0]+s*a[1]-i;if(p>0!=h>0){const b=p/(p-h);o.push([c[0]+b*(a[0]-c[0]),c[1]+b*(a[1]-c[1])])}h<=0&&o.push(a),c=a,p=h}return o}function $(t,e){const[n,r,s,i]=[Math.min(e[0],e[2]),Math.min(e[1],e[3]),Math.max(e[0],e[2]),Math.max(e[1],e[3])],o=[[n,r],[s,r],[s,i],[n,i]],l=t.length;return t.map((c,p)=>{let f=o;for(let a=0;a<l&&f.length>2;a++){if(a===p)continue;const h=t[a];if(Math.abs(h[0]-c[0])<x&&Math.abs(h[1]-c[1])<x){if(a<p)return null;continue}f=_(f,c,h)}return f.length>2?[...f,f[0]]:null})}const S=t=>t||t===0,U=t=>typeof t=="function",M=t=>typeof t=="string",A=t=>typeof t=="number",P=t=>typeof t=="undefined",w=t=>typeof t!="undefined",k=t=>typeof t=="boolean",q=t=>Math.ceil(t/10)*10,H=t=>Math.ceil(t)+.5,z=t=>t[1]-t[0],g=t=>typeof t=="object",j=t=>{for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0},C=t=>P(t)||t===null||M(t)&&t.length===0||g(t)&&!(t instanceof Date)&&j(t)||A(t)&&isNaN(t),G=t=>!C(t),D=t=>Array.isArray(t),J=t=>t&&!(t!=null&&t.nodeType)&&g(t)&&!D(t);function E(t){const e=this.config;let n,r,s;const i=()=>{const o=r.shift();if(o&&n&&g(n)&&o in n)return n=n[o],i();if(!o)return n};Object.keys(e).forEach(o=>{n=t,r=o.split("_"),s=i(),w(s)&&(e[o]=s)}),this.api&&(this.state.orgConfig=t)}var N=Object.defineProperty,T=(t,e,n)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m=(t,e,n)=>T(t,typeof e!="symbol"?e+"":e,n);class v{constructor(e={}){m(this,"$$"),m(this,"options"),m(this,"config"),this.options=e}loadConfig(){E.call(this,this.options)}$beforeInit(){}$init(){}$afterInit(){}$redraw(){}$willDestroy(){Object.keys(this).forEach(e=>{this[e]=null,delete this[e]})}}m(v,"version","4.1.0-next.2");class I{constructor(){return{selector:void 0,extent:1,area:0}}}class B extends v{constructor(e){return super(e),this.config=new I,this}$init(){this.loadConfig()}$redraw(){const{$$:{$el:e},config:{selector:n}}=this,r=n?e.main.selectAll(n):e.text;r.empty()||this.preventLabelOverlap(r)}generateVoronoi(e){const{$$:n}=this,{scale:r}=n,[s,i]=["x","y"].map(o=>r[o].domain());return[s[1],i[0]]=[i[0],s[1]],$(e,[...s,...i])}preventLabelOverlap(e){const{extent:n,area:r}=this.config,s=e.data().map(l=>[l.index,l.value]),i=this.generateVoronoi(s);let o=0;e.each(function(){const l=i[o];if(l&&this){const[c,p]=s[o],[f,a]=O(l),h=Math.abs(d(l)),b=Math.round(Math.atan2(a-p,f-c)/Math.PI*2),L=n*(b===0?1:-1),V=b===-1?-n:n+5,F=Math.abs(b)===1?"middle":b===0?"start":"end";this.style.display=h<r?"none":"",this.setAttribute("text-anchor",F),this.setAttribute("dy",`0.${b===1?71:35}em`),this.setAttribute("transform",`translate(${L}, ${V})`)}o++})}}return u=u.default,u})()});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.
|
|
8
|
+
* @version 4.1.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -23910,7 +23910,9 @@ const diffDomain = (d) => d[1] - d[0];
|
|
|
23910
23910
|
const isObjectType = (v) => typeof v === "object";
|
|
23911
23911
|
const isEmptyObject = (obj) => {
|
|
23912
23912
|
for (const x in obj) {
|
|
23913
|
-
|
|
23913
|
+
if (Object.prototype.hasOwnProperty.call(obj, x)) {
|
|
23914
|
+
return false;
|
|
23915
|
+
}
|
|
23914
23916
|
}
|
|
23915
23917
|
return true;
|
|
23916
23918
|
};
|
|
@@ -24009,7 +24011,7 @@ class Plugin {
|
|
|
24009
24011
|
});
|
|
24010
24012
|
}
|
|
24011
24013
|
}
|
|
24012
|
-
__publicField(Plugin, "version", "4.0.
|
|
24014
|
+
__publicField(Plugin, "version", "4.1.0-next.2");
|
|
24013
24015
|
|
|
24014
24016
|
;// ./src/Plugin/bubblecompare/index.ts
|
|
24015
24017
|
var bubblecompare_defProp = Object.defineProperty;
|