billboard.js 3.11.3 → 3.12.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 +1 -5
- package/dist/billboard.css +13 -1
- package/dist/billboard.js +19672 -24210
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +26 -3
- package/dist/billboard.pkgd.js +24515 -30430
- package/dist/billboard.pkgd.min.js +33 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +77 -175
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -3
- package/dist/plugin/billboardjs-plugin-sparkline.js +429 -1134
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +666 -1524
- package/dist/plugin/billboardjs-plugin-stanford.min.js +15 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +503 -1175
- package/dist/plugin/billboardjs-plugin-tableview.min.js +30 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +351 -1055
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1387 -1854
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -3
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2760 -3959
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3504 -5057
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2906 -4072
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +33 -3
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +3076 -4506
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -3
- package/dist/theme/dark.css +12 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +12 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +12 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +12 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +12 -1
- package/dist/theme/modern.min.css +3 -4
- package/dist-esm/billboard.js +9297 -8527
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +20 -27
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +155 -149
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +302 -289
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +236 -236
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +41 -43
- package/package.json +29 -49
- package/src/Chart/api/axis.ts +6 -13
- package/src/Chart/api/chart.ts +12 -11
- package/src/Chart/api/data.ts +8 -7
- package/src/Chart/api/export.ts +28 -21
- package/src/Chart/api/flow.ts +4 -2
- package/src/Chart/api/grid.ts +1 -5
- package/src/Chart/api/load.ts +2 -2
- package/src/Chart/api/regions.ts +29 -5
- package/src/Chart/api/selection.ts +2 -2
- package/src/Chart/api/show.ts +2 -3
- package/src/Chart/api/subchart.ts +2 -2
- package/src/Chart/api/tooltip.ts +8 -9
- package/src/Chart/api/x.ts +2 -2
- package/src/Chart/api/zoom.ts +2 -2
- package/src/ChartInternal/Axis/Axis.ts +119 -44
- package/src/ChartInternal/Axis/AxisRenderer.ts +53 -38
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +2 -2
- package/src/ChartInternal/ChartInternal.ts +87 -55
- package/src/ChartInternal/data/IData.ts +31 -31
- package/src/ChartInternal/data/convert.helper.ts +66 -68
- package/src/ChartInternal/data/convert.ts +11 -11
- package/src/ChartInternal/data/data.ts +51 -27
- package/src/ChartInternal/data/load.ts +7 -6
- package/src/ChartInternal/interactions/drag.ts +2 -1
- package/src/ChartInternal/interactions/eventrect.ts +84 -32
- package/src/ChartInternal/interactions/flow.ts +14 -4
- package/src/ChartInternal/interactions/interaction.ts +51 -22
- package/src/ChartInternal/interactions/subchart.ts +27 -25
- package/src/ChartInternal/interactions/zoom.ts +29 -18
- package/src/ChartInternal/internals/category.ts +1 -1
- package/src/ChartInternal/internals/class.ts +6 -6
- package/src/ChartInternal/internals/clip.ts +8 -4
- package/src/ChartInternal/internals/color.ts +70 -42
- package/src/ChartInternal/internals/domain.ts +59 -28
- package/src/ChartInternal/internals/format.ts +5 -5
- package/src/ChartInternal/internals/grid.ts +131 -47
- package/src/ChartInternal/internals/legend.ts +93 -61
- package/src/ChartInternal/internals/redraw.ts +6 -2
- package/src/ChartInternal/internals/region.ts +5 -3
- package/src/ChartInternal/internals/scale.ts +28 -15
- package/src/ChartInternal/internals/selection.ts +14 -13
- package/src/ChartInternal/internals/size.axis.ts +18 -10
- package/src/ChartInternal/internals/size.ts +98 -67
- package/src/ChartInternal/internals/style.ts +21 -19
- package/src/ChartInternal/internals/text.ts +79 -43
- package/src/ChartInternal/internals/title.ts +2 -2
- package/src/ChartInternal/internals/tooltip.ts +78 -32
- package/src/ChartInternal/internals/transform.ts +4 -4
- package/src/ChartInternal/internals/type.ts +17 -12
- package/src/ChartInternal/shape/arc.ts +78 -44
- package/src/ChartInternal/shape/area.ts +19 -22
- package/src/ChartInternal/shape/bar.ts +41 -31
- package/src/ChartInternal/shape/bubble.ts +5 -5
- package/src/ChartInternal/shape/candlestick.ts +15 -13
- package/src/ChartInternal/shape/funnel.ts +317 -0
- package/src/ChartInternal/shape/gauge.ts +16 -9
- package/src/ChartInternal/shape/line.ts +62 -46
- package/src/ChartInternal/shape/point.common.ts +1 -4
- package/src/ChartInternal/shape/point.ts +54 -34
- package/src/ChartInternal/shape/polar.ts +4 -2
- package/src/ChartInternal/shape/radar.ts +40 -22
- package/src/ChartInternal/shape/shape.ts +84 -58
- package/src/ChartInternal/shape/treemap.ts +31 -20
- package/src/Plugin/bubblecompare/index.ts +1 -3
- package/src/Plugin/sparkline/index.ts +3 -4
- package/src/Plugin/stanford/ColorScale.ts +3 -2
- package/src/Plugin/stanford/Elements.ts +15 -6
- package/src/Plugin/stanford/Options.ts +5 -5
- package/src/Plugin/stanford/index.ts +13 -9
- package/src/Plugin/tableview/Options.ts +1 -1
- package/src/Plugin/tableview/const.ts +1 -4
- package/src/Plugin/tableview/index.ts +11 -9
- package/src/Plugin/textoverlap/index.ts +4 -6
- package/src/config/Options/Options.ts +3 -3
- package/src/config/Options/axis/axis.ts +36 -0
- package/src/config/Options/axis/x.ts +34 -14
- package/src/config/Options/axis/y.ts +13 -13
- package/src/config/Options/axis/y2.ts +23 -10
- package/src/config/Options/common/color.ts +4 -4
- package/src/config/Options/common/grid.ts +4 -4
- package/src/config/Options/common/legend.ts +12 -13
- package/src/config/Options/common/main.ts +23 -23
- package/src/config/Options/common/point.ts +17 -18
- package/src/config/Options/common/title.ts +2 -2
- package/src/config/Options/common/tooltip.ts +13 -11
- package/src/config/Options/data/axis.ts +2 -2
- package/src/config/Options/data/data.ts +48 -45
- package/src/config/Options/interaction/interaction.ts +1 -1
- package/src/config/Options/interaction/subchart.ts +2 -2
- package/src/config/Options/interaction/zoom.ts +9 -9
- package/src/config/Options/shape/arc.ts +10 -13
- package/src/config/Options/shape/area.ts +5 -7
- package/src/config/Options/shape/bar.ts +8 -10
- package/src/config/Options/shape/bubble.ts +1 -1
- package/src/config/Options/shape/candlestick.ts +2 -2
- package/src/config/Options/shape/donut.ts +4 -4
- package/src/config/Options/shape/funnel.ts +38 -0
- package/src/config/Options/shape/gauge.ts +6 -6
- package/src/config/Options/shape/line.ts +3 -3
- package/src/config/Options/shape/pie.ts +5 -5
- package/src/config/Options/shape/polar.ts +3 -3
- package/src/config/Options/shape/radar.ts +2 -2
- package/src/config/Options/shape/scatter.ts +1 -1
- package/src/config/Options/shape/treemap.ts +1 -1
- package/src/config/Store/Element.ts +8 -5
- package/src/config/Store/State.ts +20 -13
- package/src/config/classes.ts +14 -4
- package/src/config/config.ts +1 -1
- package/src/config/const.ts +2 -0
- package/src/config/resolver/axis.ts +4 -4
- package/src/config/resolver/interaction.ts +3 -7
- package/src/config/resolver/shape.ts +17 -12
- package/src/core.ts +2 -3
- package/src/index.esm.ts +3 -6
- package/src/index.ts +2 -2
- package/src/module/Cache.ts +2 -3
- package/src/module/browser.ts +15 -10
- package/src/module/error.ts +9 -8
- package/src/module/generator.ts +3 -5
- package/src/module/util.ts +62 -39
- package/src/module/worker.ts +14 -11
- package/src/scss/billboard.scss +18 -0
- package/src/scss/theme/dark.scss +17 -0
- package/src/scss/theme/datalab.scss +17 -0
- package/src/scss/theme/graph.scss +17 -0
- package/src/scss/theme/insight.scss +17 -0
- package/src/scss/theme/modern.scss +17 -0
- package/types/axis.d.ts +17 -0
- package/types/bb.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/options.d.ts +9 -0
- package/types/options.shape.d.ts +26 -1
- package/types/types.d.ts +1 -0
|
@@ -5,20 +5,20 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.12.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(require("d3-
|
|
14
|
+
module.exports = factory(require("d3-color"), require("d3-interpolate"), require("d3-scale"), require("d3-brush"), require("d3-selection"), require("d3-axis"), require("d3-format"));
|
|
15
15
|
else if(typeof define === 'function' && define.amd)
|
|
16
|
-
define("bb", ["d3-
|
|
16
|
+
define("bb", ["d3-color", "d3-interpolate", "d3-scale", "d3-brush", "d3-selection", "d3-axis", "d3-format"], factory);
|
|
17
17
|
else if(typeof exports === 'object')
|
|
18
|
-
exports["bb"] = factory(require("d3-
|
|
18
|
+
exports["bb"] = factory(require("d3-color"), require("d3-interpolate"), require("d3-scale"), require("d3-brush"), require("d3-selection"), require("d3-axis"), require("d3-format"));
|
|
19
19
|
else
|
|
20
20
|
root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["stanford"] = factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]);
|
|
21
|
-
})(this, function(__WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__7__,
|
|
21
|
+
})(this, function(__WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__) {
|
|
22
22
|
return /******/ (function() { // webpackBootstrap
|
|
23
23
|
/******/ "use strict";
|
|
24
24
|
/******/ var __webpack_modules__ = ([
|
|
@@ -121,97 +121,29 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
121
121
|
"default": function() { return /* binding */ Stanford; }
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
|
|
125
|
-
function _newArrowCheck(innerThis, boundThis) {
|
|
126
|
-
if (innerThis !== boundThis) {
|
|
127
|
-
throw new TypeError("Cannot instantiate an arrow function");
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
131
|
-
function _assertThisInitialized(self) {
|
|
132
|
-
if (self === void 0) {
|
|
133
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
134
|
-
}
|
|
135
|
-
return self;
|
|
136
|
-
}
|
|
137
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
138
|
-
function _setPrototypeOf(o, p) {
|
|
139
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
140
|
-
o.__proto__ = p;
|
|
141
|
-
return o;
|
|
142
|
-
};
|
|
143
|
-
return _setPrototypeOf(o, p);
|
|
144
|
-
}
|
|
145
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
146
|
-
|
|
147
|
-
function _inheritsLoose(subClass, superClass) {
|
|
148
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
149
|
-
subClass.prototype.constructor = subClass;
|
|
150
|
-
_setPrototypeOf(subClass, superClass);
|
|
151
|
-
}
|
|
152
|
-
// EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"}
|
|
153
|
-
var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(5);
|
|
154
124
|
// EXTERNAL MODULE: external {"commonjs":"d3-color","commonjs2":"d3-color","amd":"d3-color","root":"d3"}
|
|
155
|
-
var external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_ = __webpack_require__(
|
|
125
|
+
var external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_ = __webpack_require__(5);
|
|
126
|
+
// EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"}
|
|
127
|
+
var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(6);
|
|
156
128
|
// EXTERNAL MODULE: external {"commonjs":"d3-scale","commonjs2":"d3-scale","amd":"d3-scale","root":"d3"}
|
|
157
129
|
var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webpack_require__(7);
|
|
158
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
159
|
-
function _typeof(o) {
|
|
160
|
-
"@babel/helpers - typeof";
|
|
161
|
-
|
|
162
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
163
|
-
return typeof o;
|
|
164
|
-
} : function (o) {
|
|
165
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
166
|
-
}, _typeof(o);
|
|
167
|
-
}
|
|
168
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
169
|
-
|
|
170
|
-
function toPrimitive(t, r) {
|
|
171
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
172
|
-
var e = t[Symbol.toPrimitive];
|
|
173
|
-
if (void 0 !== e) {
|
|
174
|
-
var i = e.call(t, r || "default");
|
|
175
|
-
if ("object" != _typeof(i)) return i;
|
|
176
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
177
|
-
}
|
|
178
|
-
return ("string" === r ? String : Number)(t);
|
|
179
|
-
}
|
|
180
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
function toPropertyKey(t) {
|
|
184
|
-
var i = toPrimitive(t, "string");
|
|
185
|
-
return "symbol" == _typeof(i) ? i : String(i);
|
|
186
|
-
}
|
|
187
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
188
|
-
|
|
189
|
-
function _defineProperty(obj, key, value) {
|
|
190
|
-
key = toPropertyKey(key);
|
|
191
|
-
if (key in obj) {
|
|
192
|
-
Object.defineProperty(obj, key, {
|
|
193
|
-
value: value,
|
|
194
|
-
enumerable: true,
|
|
195
|
-
configurable: true,
|
|
196
|
-
writable: true
|
|
197
|
-
});
|
|
198
|
-
} else {
|
|
199
|
-
obj[key] = value;
|
|
200
|
-
}
|
|
201
|
-
return obj;
|
|
202
|
-
}
|
|
203
130
|
;// CONCATENATED MODULE: ./src/config/classes.ts
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
131
|
+
var __defProp = Object.defineProperty;
|
|
132
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
133
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
134
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
135
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
136
|
+
var __spreadValues = (a, b) => {
|
|
137
|
+
for (var prop in b || (b = {}))
|
|
138
|
+
if (__hasOwnProp.call(b, prop))
|
|
139
|
+
__defNormalProp(a, prop, b[prop]);
|
|
140
|
+
if (__getOwnPropSymbols)
|
|
141
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
142
|
+
if (__propIsEnum.call(b, prop))
|
|
143
|
+
__defNormalProp(a, prop, b[prop]);
|
|
144
|
+
}
|
|
145
|
+
return a;
|
|
146
|
+
};
|
|
215
147
|
const $COMMON = {
|
|
216
148
|
button: "bb-button",
|
|
217
149
|
chart: "bb-chart",
|
|
@@ -242,7 +174,10 @@ const $AXIS = {
|
|
|
242
174
|
axisY: "bb-axis-y",
|
|
243
175
|
axisY2: "bb-axis-y2",
|
|
244
176
|
axisY2Label: "bb-axis-y2-label",
|
|
245
|
-
axisYLabel: "bb-axis-y-label"
|
|
177
|
+
axisYLabel: "bb-axis-y-label",
|
|
178
|
+
axisXTooltip: "bb-axis-x-tooltip",
|
|
179
|
+
axisYTooltip: "bb-axis-y-tooltip",
|
|
180
|
+
axisY2Tooltip: "bb-axis-y2-tooltip"
|
|
246
181
|
};
|
|
247
182
|
const $BAR = {
|
|
248
183
|
bar: "bb-bar",
|
|
@@ -271,6 +206,12 @@ const $DRAG = {
|
|
|
271
206
|
dragarea: "bb-dragarea",
|
|
272
207
|
INCLUDED: "_included_"
|
|
273
208
|
};
|
|
209
|
+
const $FUNNEL = {
|
|
210
|
+
funnel: "bb-funnel",
|
|
211
|
+
chartFunnel: "bb-chart-funnel",
|
|
212
|
+
chartFunnels: "bb-chart-funnels",
|
|
213
|
+
funnelBackground: "bb-funnel-background"
|
|
214
|
+
};
|
|
274
215
|
const $GAUGE = {
|
|
275
216
|
chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
|
276
217
|
chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
|
@@ -365,430 +306,181 @@ const $ZOOM = {
|
|
|
365
306
|
buttonZoomReset: "bb-zoom-reset",
|
|
366
307
|
zoomBrush: "bb-zoom-brush"
|
|
367
308
|
};
|
|
368
|
-
/* harmony default export */ var classes = (
|
|
369
|
-
|
|
370
|
-
var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
|
309
|
+
/* harmony default export */ var classes = (__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $FUNNEL), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $TREEMAP), $ZOOM));
|
|
310
|
+
|
|
371
311
|
// EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
|
|
372
312
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
313
|
+
// EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
|
|
314
|
+
var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
|
373
315
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
377
|
-
* billboard.js project is licensed under the MIT license
|
|
378
|
-
*/
|
|
379
|
-
/**
|
|
380
|
-
* Window object
|
|
381
|
-
* @private
|
|
382
|
-
*/
|
|
383
|
-
/* eslint-disable no-new-func, no-undef */
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
/**
|
|
387
|
-
* Get global object
|
|
388
|
-
* @returns {object} window object
|
|
389
|
-
* @private
|
|
390
|
-
*/
|
|
391
316
|
function getGlobal() {
|
|
392
317
|
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")();
|
|
393
318
|
}
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Get fallback object
|
|
397
|
-
* @param {object} w global object
|
|
398
|
-
* @returns {Array} fallback object array
|
|
399
|
-
* @private
|
|
400
|
-
*/
|
|
401
319
|
function getFallback(w) {
|
|
402
|
-
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}.bind(this);
|
|
413
|
-
return [hasRAF ? w.requestAnimationFrame : request, hasRAF ? w.cancelAnimationFrame : cancel, hasRIC ? w.requestIdleCallback : request, hasRIC ? w.cancelIdleCallback : cancel];
|
|
320
|
+
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function";
|
|
321
|
+
const hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function";
|
|
322
|
+
const request = (cb) => setTimeout(cb, 1);
|
|
323
|
+
const cancel = (id) => clearTimeout(id);
|
|
324
|
+
return [
|
|
325
|
+
hasRAF ? w.requestAnimationFrame : request,
|
|
326
|
+
hasRAF ? w.cancelAnimationFrame : cancel,
|
|
327
|
+
hasRIC ? w.requestIdleCallback : request,
|
|
328
|
+
hasRIC ? w.cancelIdleCallback : cancel
|
|
329
|
+
];
|
|
414
330
|
}
|
|
415
|
-
const win = getGlobal()
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
requestAnimationFrame
|
|
419
|
-
cancelAnimationFrame
|
|
420
|
-
requestIdleCallback
|
|
421
|
-
cancelIdleCallback
|
|
422
|
-
|
|
331
|
+
const win = getGlobal();
|
|
332
|
+
const doc = win == null ? void 0 : win.document;
|
|
333
|
+
const [
|
|
334
|
+
requestAnimationFrame,
|
|
335
|
+
cancelAnimationFrame,
|
|
336
|
+
requestIdleCallback,
|
|
337
|
+
cancelIdleCallback
|
|
338
|
+
] = getFallback(win);
|
|
423
339
|
|
|
424
340
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
341
|
+
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
342
|
+
var util_defProp = Object.defineProperty;
|
|
343
|
+
var util_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
344
|
+
var util_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
345
|
+
var util_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
346
|
+
var util_defNormalProp = (obj, key, value) => key in obj ? util_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
347
|
+
var util_spreadValues = (a, b) => {
|
|
348
|
+
for (var prop in b || (b = {}))
|
|
349
|
+
if (util_hasOwnProp.call(b, prop))
|
|
350
|
+
util_defNormalProp(a, prop, b[prop]);
|
|
351
|
+
if (util_getOwnPropSymbols)
|
|
352
|
+
for (var prop of util_getOwnPropSymbols(b)) {
|
|
353
|
+
if (util_propIsEnum.call(b, prop))
|
|
354
|
+
util_defNormalProp(a, prop, b[prop]);
|
|
355
|
+
}
|
|
356
|
+
return a;
|
|
357
|
+
};
|
|
433
358
|
|
|
434
359
|
|
|
435
360
|
|
|
436
361
|
|
|
437
|
-
const isValue =
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}.bind(undefined),
|
|
453
|
-
isUndefined = function (v) {
|
|
454
|
-
_newArrowCheck(this, _this);
|
|
455
|
-
return typeof v === "undefined";
|
|
456
|
-
}.bind(undefined),
|
|
457
|
-
isDefined = function (v) {
|
|
458
|
-
_newArrowCheck(this, _this);
|
|
459
|
-
return typeof v !== "undefined";
|
|
460
|
-
}.bind(undefined),
|
|
461
|
-
isboolean = function (v) {
|
|
462
|
-
_newArrowCheck(this, _this);
|
|
463
|
-
return typeof v === "boolean";
|
|
464
|
-
}.bind(undefined),
|
|
465
|
-
ceil10 = function (v) {
|
|
466
|
-
_newArrowCheck(this, _this);
|
|
467
|
-
return Math.ceil(v / 10) * 10;
|
|
468
|
-
}.bind(undefined),
|
|
469
|
-
asHalfPixel = function (n) {
|
|
470
|
-
_newArrowCheck(this, _this);
|
|
471
|
-
return Math.ceil(n) + .5;
|
|
472
|
-
}.bind(undefined),
|
|
473
|
-
diffDomain = function (d) {
|
|
474
|
-
_newArrowCheck(this, _this);
|
|
475
|
-
return d[1] - d[0];
|
|
476
|
-
}.bind(undefined),
|
|
477
|
-
isObjectType = function (v) {
|
|
478
|
-
_newArrowCheck(this, _this);
|
|
479
|
-
return typeof v === "object";
|
|
480
|
-
}.bind(undefined),
|
|
481
|
-
isEmpty = function (o) {
|
|
482
|
-
_newArrowCheck(this, _this);
|
|
483
|
-
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
484
|
-
}.bind(undefined),
|
|
485
|
-
notEmpty = function (o) {
|
|
486
|
-
_newArrowCheck(this, _this);
|
|
487
|
-
return !isEmpty(o);
|
|
488
|
-
}.bind(undefined),
|
|
489
|
-
isArray = function (arr) {
|
|
490
|
-
_newArrowCheck(this, _this);
|
|
491
|
-
return Array.isArray(arr);
|
|
492
|
-
}.bind(undefined),
|
|
493
|
-
isObject = function (obj) {
|
|
494
|
-
_newArrowCheck(this, _this);
|
|
495
|
-
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
496
|
-
}.bind(undefined);
|
|
497
|
-
/**
|
|
498
|
-
* Check if is array
|
|
499
|
-
* @param {Array} arr Data to be checked
|
|
500
|
-
* @returns {boolean}
|
|
501
|
-
* @private
|
|
502
|
-
*/
|
|
503
|
-
/**
|
|
504
|
-
* Check if is object
|
|
505
|
-
* @param {object} obj Data to be checked
|
|
506
|
-
* @returns {boolean}
|
|
507
|
-
* @private
|
|
508
|
-
*/
|
|
509
|
-
/**
|
|
510
|
-
* Get specified key value from object
|
|
511
|
-
* If default value is given, will return if given key value not found
|
|
512
|
-
* @param {object} options Source object
|
|
513
|
-
* @param {string} key Key value
|
|
514
|
-
* @param {*} defaultValue Default value
|
|
515
|
-
* @returns {*}
|
|
516
|
-
* @private
|
|
517
|
-
*/
|
|
362
|
+
const isValue = (v) => v || v === 0;
|
|
363
|
+
const isFunction = (v) => typeof v === "function";
|
|
364
|
+
const isString = (v) => typeof v === "string";
|
|
365
|
+
const isNumber = (v) => typeof v === "number";
|
|
366
|
+
const isUndefined = (v) => typeof v === "undefined";
|
|
367
|
+
const isDefined = (v) => typeof v !== "undefined";
|
|
368
|
+
const isBoolean = (v) => typeof v === "boolean";
|
|
369
|
+
const ceil10 = (v) => Math.ceil(v / 10) * 10;
|
|
370
|
+
const asHalfPixel = (n) => Math.ceil(n) + 0.5;
|
|
371
|
+
const diffDomain = (d) => d[1] - d[0];
|
|
372
|
+
const isObjectType = (v) => typeof v === "object";
|
|
373
|
+
const isEmpty = (o) => isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
374
|
+
const notEmpty = (o) => !isEmpty(o);
|
|
375
|
+
const isArray = (arr) => Array.isArray(arr);
|
|
376
|
+
const isObject = (obj) => obj && !(obj == null ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
518
377
|
function getOption(options, key, defaultValue) {
|
|
519
378
|
return isDefined(options[key]) ? options[key] : defaultValue;
|
|
520
379
|
}
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Check if value exist in the given object
|
|
524
|
-
* @param {object} dict Target object to be checked
|
|
525
|
-
* @param {*} value Value to be checked
|
|
526
|
-
* @returns {boolean}
|
|
527
|
-
* @private
|
|
528
|
-
*/
|
|
529
380
|
function hasValue(dict, value) {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
Object.keys(dict).forEach(function (key) {
|
|
533
|
-
_newArrowCheck(this, _this2);
|
|
534
|
-
return dict[key] === value && (found = !0);
|
|
535
|
-
}.bind(this));
|
|
381
|
+
let found = false;
|
|
382
|
+
Object.keys(dict).forEach((key) => dict[key] === value && (found = true));
|
|
536
383
|
return found;
|
|
537
384
|
}
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Call function with arguments
|
|
541
|
-
* @param {Function} fn Function to be called
|
|
542
|
-
* @param {*} thisArg "this" value for fn
|
|
543
|
-
* @param {*} args Arguments for fn
|
|
544
|
-
* @returns {boolean} true: fn is function, false: fn is not function
|
|
545
|
-
* @private
|
|
546
|
-
*/
|
|
547
|
-
function callFn(fn, thisArg) {
|
|
385
|
+
function callFn(fn, thisArg, ...args) {
|
|
548
386
|
const isFn = isFunction(fn);
|
|
549
|
-
|
|
550
|
-
args[_key - 2] = arguments[_key];
|
|
551
|
-
}
|
|
552
|
-
isFn && fn.call.apply(fn, [thisArg].concat(args));
|
|
387
|
+
isFn && fn.call(thisArg, ...args);
|
|
553
388
|
return isFn;
|
|
554
389
|
}
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* Call function after all transitions ends
|
|
558
|
-
* @param {d3.transition} transition Transition
|
|
559
|
-
* @param {Fucntion} cb Callback function
|
|
560
|
-
* @private
|
|
561
|
-
*/
|
|
562
390
|
function endall(transition, cb) {
|
|
563
|
-
var _this3 = this;
|
|
564
391
|
let n = 0;
|
|
565
|
-
const end = function
|
|
566
|
-
|
|
567
|
-
args[_key2] = arguments[_key2];
|
|
568
|
-
}
|
|
569
|
-
--n || cb.apply.apply(cb, [this].concat(args));
|
|
392
|
+
const end = function(...args) {
|
|
393
|
+
!--n && cb.apply(this, ...args);
|
|
570
394
|
};
|
|
571
|
-
|
|
572
|
-
// if is transition selection
|
|
573
395
|
if ("duration" in transition) {
|
|
574
|
-
transition.each(
|
|
575
|
-
_newArrowCheck(this, _this3);
|
|
576
|
-
return ++n;
|
|
577
|
-
}.bind(this)).on("end", end);
|
|
396
|
+
transition.each(() => ++n).on("end", end);
|
|
578
397
|
} else {
|
|
579
398
|
++n;
|
|
580
399
|
transition.call(end);
|
|
581
400
|
}
|
|
582
401
|
}
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Replace tag sign to html entity
|
|
586
|
-
* @param {string} str Target string value
|
|
587
|
-
* @returns {string}
|
|
588
|
-
* @private
|
|
589
|
-
*/
|
|
590
402
|
function sanitize(str) {
|
|
591
403
|
return isString(str) ? str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") : str;
|
|
592
404
|
}
|
|
593
|
-
|
|
594
|
-
/**
|
|
595
|
-
* Set text value. If there's multiline add nodes.
|
|
596
|
-
* @param {d3Selection} node Text node
|
|
597
|
-
* @param {string} text Text value string
|
|
598
|
-
* @param {Array} dy dy value for multilined text
|
|
599
|
-
* @param {boolean} toMiddle To be alingned vertically middle
|
|
600
|
-
* @private
|
|
601
|
-
*/
|
|
602
|
-
function setTextValue(node, text, dy, toMiddle) {
|
|
603
|
-
var _this4 = this;
|
|
604
|
-
if (dy === void 0) {
|
|
605
|
-
dy = [-1, 1];
|
|
606
|
-
}
|
|
607
|
-
if (toMiddle === void 0) {
|
|
608
|
-
toMiddle = !1;
|
|
609
|
-
}
|
|
405
|
+
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
610
406
|
if (!node || !isString(text)) {
|
|
611
407
|
return;
|
|
612
408
|
}
|
|
613
409
|
if (text.indexOf("\n") === -1) {
|
|
614
410
|
node.text(text);
|
|
615
411
|
} else {
|
|
616
|
-
const diff = [node.text(), text].map(
|
|
617
|
-
_newArrowCheck(this, _this4);
|
|
618
|
-
return v.replace(/[\s\n]/g, "");
|
|
619
|
-
}.bind(this));
|
|
412
|
+
const diff = [node.text(), text].map((v) => v.replace(/[\s\n]/g, ""));
|
|
620
413
|
if (diff[0] !== diff[1]) {
|
|
621
|
-
const multiline = text.split("\n")
|
|
622
|
-
|
|
623
|
-
// reset possible text
|
|
414
|
+
const multiline = text.split("\n");
|
|
415
|
+
const len = toMiddle ? multiline.length - 1 : 1;
|
|
624
416
|
node.html("");
|
|
625
|
-
multiline.forEach(
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
}.bind(this));
|
|
417
|
+
multiline.forEach((v, i) => {
|
|
418
|
+
node.append("tspan").attr("x", 0).attr("dy", `${i === 0 ? dy[0] * len : dy[1]}em`).text(v);
|
|
419
|
+
});
|
|
629
420
|
}
|
|
630
421
|
}
|
|
631
422
|
}
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* Substitution of SVGPathSeg API polyfill
|
|
635
|
-
* @param {SVGGraphicsElement} path Target svg element
|
|
636
|
-
* @returns {Array}
|
|
637
|
-
* @private
|
|
638
|
-
*/
|
|
639
423
|
function getRectSegList(path) {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
x
|
|
649
|
-
|
|
650
|
-
width = _path$getBBox.width,
|
|
651
|
-
height = _path$getBBox.height;
|
|
652
|
-
return [{
|
|
653
|
-
x: x,
|
|
654
|
-
y: y + height
|
|
655
|
-
},
|
|
656
|
-
// seg0
|
|
657
|
-
{
|
|
658
|
-
x: x,
|
|
659
|
-
y: y
|
|
660
|
-
},
|
|
661
|
-
// seg1
|
|
662
|
-
{
|
|
663
|
-
x: x + width,
|
|
664
|
-
y: y
|
|
665
|
-
},
|
|
666
|
-
// seg2
|
|
667
|
-
{
|
|
668
|
-
x: x + width,
|
|
669
|
-
y: y + height
|
|
670
|
-
} // seg3
|
|
424
|
+
const { x, y, width, height } = path.getBBox();
|
|
425
|
+
return [
|
|
426
|
+
{ x, y: y + height },
|
|
427
|
+
// seg0
|
|
428
|
+
{ x, y },
|
|
429
|
+
// seg1
|
|
430
|
+
{ x: x + width, y },
|
|
431
|
+
// seg2
|
|
432
|
+
{ x: x + width, y: y + height }
|
|
433
|
+
// seg3
|
|
671
434
|
];
|
|
672
435
|
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Get svg bounding path box dimension
|
|
676
|
-
* @param {SVGGraphicsElement} path Target svg element
|
|
677
|
-
* @returns {object}
|
|
678
|
-
* @private
|
|
679
|
-
*/
|
|
680
436
|
function getPathBox(path) {
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
x = items[0].x,
|
|
686
|
-
y = Math.min(items[0].y, items[1].y);
|
|
437
|
+
const { width, height } = path.getBoundingClientRect();
|
|
438
|
+
const items = getRectSegList(path);
|
|
439
|
+
const x = items[0].x;
|
|
440
|
+
const y = Math.min(items[0].y, items[1].y);
|
|
687
441
|
return {
|
|
688
|
-
x
|
|
689
|
-
y
|
|
690
|
-
width
|
|
691
|
-
height
|
|
442
|
+
x,
|
|
443
|
+
y,
|
|
444
|
+
width,
|
|
445
|
+
height
|
|
692
446
|
};
|
|
693
447
|
}
|
|
694
|
-
|
|
695
|
-
/**
|
|
696
|
-
* Get event's current position coordinates
|
|
697
|
-
* @param {object} event Event object
|
|
698
|
-
* @param {SVGElement|HTMLElement} element Target element
|
|
699
|
-
* @returns {Array} [x, y] Coordinates x, y array
|
|
700
|
-
* @private
|
|
701
|
-
*/
|
|
702
448
|
function getPointer(event, element) {
|
|
703
|
-
var
|
|
704
|
-
|
|
705
|
-
const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
|
|
449
|
+
var _a;
|
|
450
|
+
const touches = event && ((_a = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _a[0]);
|
|
706
451
|
let pointer = [0, 0];
|
|
707
452
|
try {
|
|
708
453
|
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
|
|
709
|
-
} catch (e) {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
return isNaN(v) ? 0 : v;
|
|
713
|
-
}.bind(this));
|
|
454
|
+
} catch (e) {
|
|
455
|
+
}
|
|
456
|
+
return pointer.map((v) => isNaN(v) ? 0 : v);
|
|
714
457
|
}
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* Return brush selection array
|
|
718
|
-
* @param {object} ctx Current instance
|
|
719
|
-
* @returns {d3.brushSelection}
|
|
720
|
-
* @private
|
|
721
|
-
*/
|
|
722
458
|
function getBrushSelection(ctx) {
|
|
723
|
-
const event = ctx
|
|
724
|
-
|
|
725
|
-
main = $el.subchart.main || $el.main;
|
|
459
|
+
const { event, $el } = ctx;
|
|
460
|
+
const main = $el.subchart.main || $el.main;
|
|
726
461
|
let selection;
|
|
727
|
-
|
|
728
|
-
// check from event
|
|
729
462
|
if (event && event.type === "brush") {
|
|
730
463
|
selection = event.selection;
|
|
731
|
-
// check from brush area selection
|
|
732
464
|
} else if (main && (selection = main.select(".bb-brush").node())) {
|
|
733
465
|
selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
|
|
734
466
|
}
|
|
735
467
|
return selection;
|
|
736
468
|
}
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Get boundingClientRect.
|
|
740
|
-
* Cache the evaluated value once it was called.
|
|
741
|
-
* @param {HTMLElement} node Target element
|
|
742
|
-
* @returns {object}
|
|
743
|
-
* @private
|
|
744
|
-
*/
|
|
745
469
|
function getBoundingRect(node) {
|
|
746
470
|
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
747
471
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
748
472
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
* @param {number} min Minimum value
|
|
754
|
-
* @param {number} max Maximum value
|
|
755
|
-
* @returns {number|string}
|
|
756
|
-
* @private
|
|
757
|
-
*/
|
|
758
|
-
function getRandom(asStr, min, max) {
|
|
759
|
-
if (asStr === void 0) {
|
|
760
|
-
asStr = !0;
|
|
761
|
-
}
|
|
762
|
-
if (min === void 0) {
|
|
763
|
-
min = 0;
|
|
764
|
-
}
|
|
765
|
-
if (max === void 0) {
|
|
766
|
-
max = 1e4;
|
|
767
|
-
}
|
|
768
|
-
const crpt = win.crypto || win.msCrypto,
|
|
769
|
-
rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
770
|
-
return asStr ? rand + "" : rand;
|
|
473
|
+
function getRandom(asStr = true, min = 0, max = 1e4) {
|
|
474
|
+
const crpt = win.crypto || win.msCrypto;
|
|
475
|
+
const rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
476
|
+
return asStr ? String(rand) : rand;
|
|
771
477
|
}
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* Find index based on binary search
|
|
775
|
-
* @param {Array} arr Data array
|
|
776
|
-
* @param {number} v Target number to find
|
|
777
|
-
* @param {number} start Start index of data array
|
|
778
|
-
* @param {number} end End index of data arr
|
|
779
|
-
* @param {boolean} isRotated Weather is roted axis
|
|
780
|
-
* @returns {number} Index number
|
|
781
|
-
* @private
|
|
782
|
-
*/
|
|
783
478
|
function findIndex(arr, v, start, end, isRotated) {
|
|
784
479
|
if (start > end) {
|
|
785
480
|
return -1;
|
|
786
481
|
}
|
|
787
482
|
const mid = Math.floor((start + end) / 2);
|
|
788
|
-
let
|
|
789
|
-
x = _arr$mid.x,
|
|
790
|
-
_arr$mid$w = _arr$mid.w,
|
|
791
|
-
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
483
|
+
let { x, w = 0 } = arr[mid];
|
|
792
484
|
if (isRotated) {
|
|
793
485
|
x = arr[mid].y;
|
|
794
486
|
w = arr[mid].h;
|
|
@@ -798,75 +490,30 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
798
490
|
}
|
|
799
491
|
return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
|
|
800
492
|
}
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Check if brush is empty
|
|
804
|
-
* @param {object} ctx Bursh context
|
|
805
|
-
* @returns {boolean}
|
|
806
|
-
* @private
|
|
807
|
-
*/
|
|
808
493
|
function brushEmpty(ctx) {
|
|
809
494
|
const selection = getBrushSelection(ctx);
|
|
810
495
|
if (selection) {
|
|
811
|
-
// brush selected area
|
|
812
|
-
// two-dimensional: [[x0, y0], [x1, y1]]
|
|
813
|
-
// one-dimensional: [x0, x1] or [y0, y1]
|
|
814
496
|
return selection[0] === selection[1];
|
|
815
497
|
}
|
|
816
|
-
return
|
|
498
|
+
return true;
|
|
817
499
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
* Deep copy object
|
|
821
|
-
* @param {object} objectN Source object
|
|
822
|
-
* @returns {object} Cloned object
|
|
823
|
-
* @private
|
|
824
|
-
*/
|
|
825
|
-
function deepClone() {
|
|
826
|
-
var _this6 = this;
|
|
827
|
-
const _clone = function clone(v) {
|
|
828
|
-
_newArrowCheck(this, _this6);
|
|
500
|
+
function deepClone(...objectN) {
|
|
501
|
+
const clone = (v) => {
|
|
829
502
|
if (isObject(v) && v.constructor) {
|
|
830
503
|
const r = new v.constructor();
|
|
831
504
|
for (const k in v) {
|
|
832
|
-
r[k] =
|
|
505
|
+
r[k] = clone(v[k]);
|
|
833
506
|
}
|
|
834
507
|
return r;
|
|
835
508
|
}
|
|
836
509
|
return v;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
objectN[_key3] = arguments[_key3];
|
|
840
|
-
}
|
|
841
|
-
return objectN.map(function (v) {
|
|
842
|
-
_newArrowCheck(this, _this6);
|
|
843
|
-
return _clone(v);
|
|
844
|
-
}.bind(this)).reduce(function (a, c) {
|
|
845
|
-
_newArrowCheck(this, _this6);
|
|
846
|
-
return util_objectSpread(util_objectSpread({}, a), c);
|
|
847
|
-
}.bind(this));
|
|
510
|
+
};
|
|
511
|
+
return objectN.map((v) => clone(v)).reduce((a, c) => util_spreadValues(util_spreadValues({}, a), c));
|
|
848
512
|
}
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* Extend target from source object
|
|
852
|
-
* @param {object} target Target object
|
|
853
|
-
* @param {object|Array} source Source object
|
|
854
|
-
* @returns {object}
|
|
855
|
-
* @private
|
|
856
|
-
*/
|
|
857
|
-
function extend(target, source) {
|
|
858
|
-
var _this7 = this;
|
|
859
|
-
if (target === void 0) {
|
|
860
|
-
target = {};
|
|
861
|
-
}
|
|
513
|
+
function extend(target = {}, source) {
|
|
862
514
|
if (isArray(source)) {
|
|
863
|
-
source.forEach(
|
|
864
|
-
_newArrowCheck(this, _this7);
|
|
865
|
-
return extend(target, v);
|
|
866
|
-
}.bind(this));
|
|
515
|
+
source.forEach((v) => extend(target, v));
|
|
867
516
|
}
|
|
868
|
-
|
|
869
|
-
// exclude name with only numbers
|
|
870
517
|
for (const p in source) {
|
|
871
518
|
if (/^\d+$/.test(p) || p in target) {
|
|
872
519
|
continue;
|
|
@@ -875,716 +522,310 @@ function extend(target, source) {
|
|
|
875
522
|
}
|
|
876
523
|
return target;
|
|
877
524
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
* @param {string} str Target string
|
|
882
|
-
* @returns {string} capitalized string
|
|
883
|
-
* @private
|
|
884
|
-
*/
|
|
885
|
-
const capitalize = function (str) {
|
|
886
|
-
_newArrowCheck(this, _this);
|
|
887
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
888
|
-
}.bind(undefined);
|
|
889
|
-
|
|
890
|
-
/**
|
|
891
|
-
* Camelize from kebob style string
|
|
892
|
-
* @param {string} str Target string
|
|
893
|
-
* @param {string} separator Separator string
|
|
894
|
-
* @returns {string} camelized string
|
|
895
|
-
* @private
|
|
896
|
-
*/
|
|
897
|
-
function camelize(str, separator) {
|
|
898
|
-
var _this8 = this;
|
|
899
|
-
if (separator === void 0) {
|
|
900
|
-
separator = "-";
|
|
901
|
-
}
|
|
902
|
-
return str.split(separator).map(function (v, i) {
|
|
903
|
-
_newArrowCheck(this, _this8);
|
|
904
|
-
return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
|
|
905
|
-
}.bind(this)).join("");
|
|
525
|
+
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
526
|
+
function camelize(str, separator = "-") {
|
|
527
|
+
return str.split(separator).map((v, i) => i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase()).join("");
|
|
906
528
|
}
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* Convert to array
|
|
910
|
-
* @param {object} v Target to be converted
|
|
911
|
-
* @returns {Array}
|
|
912
|
-
* @private
|
|
913
|
-
*/
|
|
914
|
-
const toArray = function (v) {
|
|
915
|
-
_newArrowCheck(this, _this);
|
|
916
|
-
return [].slice.call(v);
|
|
917
|
-
}.bind(undefined);
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* Add CSS rules
|
|
921
|
-
* @param {object} style Style object
|
|
922
|
-
* @param {string} selector Selector string
|
|
923
|
-
* @param {Array} prop Prps arrary
|
|
924
|
-
* @returns {number} Newely added rule index
|
|
925
|
-
* @private
|
|
926
|
-
*/
|
|
529
|
+
const toArray = (v) => [].slice.call(v);
|
|
927
530
|
function addCssRules(style, selector, prop) {
|
|
928
|
-
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
}.bind(this),
|
|
936
|
-
rule = rootSelector + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
|
937
|
-
return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
|
531
|
+
const { rootSelector = "", sheet } = style;
|
|
532
|
+
const getSelector = (s) => s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
|
|
533
|
+
const rule = `${rootSelector} ${getSelector(selector)} {${prop.join(";")}}`;
|
|
534
|
+
return sheet[sheet.insertRule ? "insertRule" : "addRule"](
|
|
535
|
+
rule,
|
|
536
|
+
sheet.cssRules.length
|
|
537
|
+
);
|
|
938
538
|
}
|
|
939
|
-
|
|
940
|
-
/**
|
|
941
|
-
* Get css rules for specified stylesheets
|
|
942
|
-
* @param {Array} styleSheets The stylesheets to get the rules from
|
|
943
|
-
* @returns {Array}
|
|
944
|
-
* @private
|
|
945
|
-
*/
|
|
946
539
|
function getCssRules(styleSheets) {
|
|
947
|
-
var _this10 = this;
|
|
948
540
|
let rules = [];
|
|
949
|
-
styleSheets.forEach(
|
|
950
|
-
|
|
541
|
+
styleSheets.forEach((sheet) => {
|
|
542
|
+
var _a;
|
|
951
543
|
try {
|
|
952
544
|
if (sheet.cssRules && sheet.cssRules.length) {
|
|
953
545
|
rules = rules.concat(toArray(sheet.cssRules));
|
|
954
546
|
}
|
|
955
547
|
} catch (e) {
|
|
956
|
-
|
|
957
|
-
(_window$console = win.console) == null || _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString());
|
|
548
|
+
(_a = win.console) == null ? void 0 : _a.warn(`Error while reading rules from ${sheet.href}: ${e.toString()}`);
|
|
958
549
|
}
|
|
959
|
-
}
|
|
550
|
+
});
|
|
960
551
|
return rules;
|
|
961
552
|
}
|
|
962
|
-
|
|
963
|
-
/**
|
|
964
|
-
* Get current window and container scroll position
|
|
965
|
-
* @param {HTMLElement} node Target element
|
|
966
|
-
* @returns {object} window scroll position
|
|
967
|
-
* @private
|
|
968
|
-
*/
|
|
969
553
|
function getScrollPosition(node) {
|
|
970
|
-
var
|
|
554
|
+
var _a, _b, _c, _d;
|
|
971
555
|
return {
|
|
972
|
-
x: (
|
|
973
|
-
y: (
|
|
556
|
+
x: ((_b = (_a = win.pageXOffset) != null ? _a : win.scrollX) != null ? _b : 0) + node.scrollLeft,
|
|
557
|
+
y: ((_d = (_c = win.pageYOffset) != null ? _c : win.scrollY) != null ? _d : 0) + node.scrollTop
|
|
974
558
|
};
|
|
975
559
|
}
|
|
976
|
-
|
|
977
|
-
/**
|
|
978
|
-
* Gets the SVGMatrix of an SVGGElement
|
|
979
|
-
* @param {SVGElement} node Node element
|
|
980
|
-
* @returns {SVGMatrix} matrix
|
|
981
|
-
* @private
|
|
982
|
-
*/
|
|
983
560
|
function getTranslation(node) {
|
|
984
|
-
const transform = node ? node.transform : null
|
|
985
|
-
|
|
986
|
-
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
987
|
-
a: 0,
|
|
988
|
-
b: 0,
|
|
989
|
-
c: 0,
|
|
990
|
-
d: 0,
|
|
991
|
-
e: 0,
|
|
992
|
-
f: 0
|
|
993
|
-
};
|
|
561
|
+
const transform = node ? node.transform : null;
|
|
562
|
+
const baseVal = transform && transform.baseVal;
|
|
563
|
+
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 };
|
|
994
564
|
}
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* Get unique value from array
|
|
998
|
-
* @param {Array} data Source data
|
|
999
|
-
* @returns {Array} Unique array value
|
|
1000
|
-
* @private
|
|
1001
|
-
*/
|
|
1002
565
|
function getUnique(data) {
|
|
1003
|
-
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
_newArrowCheck(this, _this11);
|
|
1007
|
-
return self.indexOf(v) === i;
|
|
1008
|
-
}.bind(this));
|
|
1009
|
-
return isDate ? d.map(function (v) {
|
|
1010
|
-
_newArrowCheck(this, _this11);
|
|
1011
|
-
return new Date(v);
|
|
1012
|
-
}.bind(this)) : d;
|
|
566
|
+
const isDate = data[0] instanceof Date;
|
|
567
|
+
const d = (isDate ? data.map(Number) : data).filter((v, i, self) => self.indexOf(v) === i);
|
|
568
|
+
return isDate ? d.map((v) => new Date(v)) : d;
|
|
1013
569
|
}
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
1016
|
-
* Merge array
|
|
1017
|
-
* @param {Array} arr Source array
|
|
1018
|
-
* @returns {Array}
|
|
1019
|
-
* @private
|
|
1020
|
-
*/
|
|
1021
570
|
function mergeArray(arr) {
|
|
1022
|
-
|
|
1023
|
-
return arr && arr.length ? arr.reduce(function (p, c) {
|
|
1024
|
-
_newArrowCheck(this, _this12);
|
|
1025
|
-
return p.concat(c);
|
|
1026
|
-
}.bind(this)) : [];
|
|
571
|
+
return arr && arr.length ? arr.reduce((p, c) => p.concat(c)) : [];
|
|
1027
572
|
}
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* Merge object returning new object
|
|
1031
|
-
* @param {object} target Target object
|
|
1032
|
-
* @param {object} objectN Source object
|
|
1033
|
-
* @returns {object} merged target object
|
|
1034
|
-
* @private
|
|
1035
|
-
*/
|
|
1036
|
-
function mergeObj(target) {
|
|
1037
|
-
for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
1038
|
-
objectN[_key4 - 1] = arguments[_key4];
|
|
1039
|
-
}
|
|
573
|
+
function mergeObj(target, ...objectN) {
|
|
1040
574
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
|
1041
575
|
return target;
|
|
1042
576
|
}
|
|
1043
577
|
const source = objectN.shift();
|
|
1044
578
|
if (isObject(target) && isObject(source)) {
|
|
1045
|
-
Object.keys(source).forEach(
|
|
1046
|
-
_newArrowCheck(this, _this13);
|
|
579
|
+
Object.keys(source).forEach((key) => {
|
|
1047
580
|
const value = source[key];
|
|
1048
581
|
if (isObject(value)) {
|
|
1049
|
-
target[key]
|
|
582
|
+
!target[key] && (target[key] = {});
|
|
1050
583
|
target[key] = mergeObj(target[key], value);
|
|
1051
584
|
} else {
|
|
1052
585
|
target[key] = isArray(value) ? value.concat() : value;
|
|
1053
586
|
}
|
|
1054
|
-
}
|
|
587
|
+
});
|
|
1055
588
|
}
|
|
1056
|
-
return mergeObj
|
|
589
|
+
return mergeObj(target, ...objectN);
|
|
1057
590
|
}
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Sort value
|
|
1061
|
-
* @param {Array} data value to be sorted
|
|
1062
|
-
* @param {boolean} isAsc true: asc, false: desc
|
|
1063
|
-
* @returns {number|string|Date} sorted date
|
|
1064
|
-
* @private
|
|
1065
|
-
*/
|
|
1066
|
-
function sortValue(data, isAsc) {
|
|
1067
|
-
var _this14 = this;
|
|
1068
|
-
if (isAsc === void 0) {
|
|
1069
|
-
isAsc = !0;
|
|
1070
|
-
}
|
|
591
|
+
function sortValue(data, isAsc = true) {
|
|
1071
592
|
let fn;
|
|
1072
593
|
if (data[0] instanceof Date) {
|
|
1073
|
-
fn = isAsc ?
|
|
1074
|
-
_newArrowCheck(this, _this14);
|
|
1075
|
-
return a - b;
|
|
1076
|
-
}.bind(this) : function (a, b) {
|
|
1077
|
-
_newArrowCheck(this, _this14);
|
|
1078
|
-
return b - a;
|
|
1079
|
-
}.bind(this);
|
|
594
|
+
fn = isAsc ? (a, b) => a - b : (a, b) => b - a;
|
|
1080
595
|
} else {
|
|
1081
596
|
if (isAsc && !data.every(isNaN)) {
|
|
1082
|
-
fn =
|
|
1083
|
-
_newArrowCheck(this, _this14);
|
|
1084
|
-
return a - b;
|
|
1085
|
-
}.bind(this);
|
|
597
|
+
fn = (a, b) => a - b;
|
|
1086
598
|
} else if (!isAsc) {
|
|
1087
|
-
fn =
|
|
1088
|
-
_newArrowCheck(this, _this14);
|
|
1089
|
-
return a > b && -1 || a < b && 1 || a === b && 0;
|
|
1090
|
-
}.bind(this);
|
|
599
|
+
fn = (a, b) => a > b && -1 || a < b && 1 || a === b && 0;
|
|
1091
600
|
}
|
|
1092
601
|
}
|
|
1093
602
|
return data.concat().sort(fn);
|
|
1094
603
|
}
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
* Get min/max value
|
|
1098
|
-
* @param {string} type 'min' or 'max'
|
|
1099
|
-
* @param {Array} data Array data value
|
|
1100
|
-
* @returns {number|Date|undefined}
|
|
1101
|
-
* @private
|
|
1102
|
-
*/
|
|
1103
604
|
function getMinMax(type, data) {
|
|
1104
|
-
|
|
1105
|
-
let res = data.filter(function (v) {
|
|
1106
|
-
_newArrowCheck(this, _this15);
|
|
1107
|
-
return notEmpty(v);
|
|
1108
|
-
}.bind(this));
|
|
605
|
+
let res = data.filter((v) => notEmpty(v));
|
|
1109
606
|
if (res.length) {
|
|
1110
607
|
if (isNumber(res[0])) {
|
|
1111
|
-
res = Math[type]
|
|
608
|
+
res = Math[type](...res);
|
|
1112
609
|
} else if (res[0] instanceof Date) {
|
|
1113
610
|
res = sortValue(res, type === "min")[0];
|
|
1114
611
|
}
|
|
1115
612
|
} else {
|
|
1116
|
-
res =
|
|
613
|
+
res = void 0;
|
|
1117
614
|
}
|
|
1118
615
|
return res;
|
|
1119
616
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
bubbles
|
|
1149
|
-
cancelable
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
clientX: 0,
|
|
1153
|
-
clientY: 0
|
|
1154
|
-
};
|
|
1155
|
-
}.bind(this);
|
|
1156
|
-
try {
|
|
1157
|
-
// eslint-disable-next-line no-new
|
|
1158
|
-
new MouseEvent("t");
|
|
1159
|
-
return function (el, eventType, params) {
|
|
1160
|
-
if (params === void 0) {
|
|
1161
|
-
params = getParams();
|
|
1162
|
-
}
|
|
1163
|
-
_newArrowCheck(this, _this16);
|
|
1164
|
-
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
1165
|
-
}.bind(this);
|
|
1166
|
-
} catch (e) {
|
|
1167
|
-
// Polyfills DOM4 MouseEvent
|
|
1168
|
-
return function (el, eventType, params) {
|
|
1169
|
-
if (params === void 0) {
|
|
1170
|
-
params = getParams();
|
|
1171
|
-
}
|
|
1172
|
-
_newArrowCheck(this, _this16);
|
|
1173
|
-
const mouseEvent = doc.createEvent("MouseEvent");
|
|
1174
|
-
|
|
1175
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
1176
|
-
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
617
|
+
const getRange = (start, end, step = 1) => {
|
|
618
|
+
const res = [];
|
|
619
|
+
const n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
620
|
+
for (let i = start; i < n; i++) {
|
|
621
|
+
res.push(start + i * step);
|
|
622
|
+
}
|
|
623
|
+
return res;
|
|
624
|
+
};
|
|
625
|
+
const emulateEvent = {
|
|
626
|
+
mouse: (() => {
|
|
627
|
+
const getParams = () => ({
|
|
628
|
+
bubbles: false,
|
|
629
|
+
cancelable: false,
|
|
630
|
+
screenX: 0,
|
|
631
|
+
screenY: 0,
|
|
632
|
+
clientX: 0,
|
|
633
|
+
clientY: 0
|
|
634
|
+
});
|
|
635
|
+
try {
|
|
636
|
+
new MouseEvent("t");
|
|
637
|
+
return (el, eventType, params = getParams()) => {
|
|
638
|
+
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
639
|
+
};
|
|
640
|
+
} catch (e) {
|
|
641
|
+
return (el, eventType, params = getParams()) => {
|
|
642
|
+
const mouseEvent = doc.createEvent("MouseEvent");
|
|
643
|
+
mouseEvent.initMouseEvent(
|
|
644
|
+
eventType,
|
|
645
|
+
params.bubbles,
|
|
646
|
+
params.cancelable,
|
|
647
|
+
win,
|
|
648
|
+
0,
|
|
1177
649
|
// the event's mouse click count
|
|
1178
|
-
params.screenX,
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
650
|
+
params.screenX,
|
|
651
|
+
params.screenY,
|
|
652
|
+
params.clientX,
|
|
653
|
+
params.clientY,
|
|
654
|
+
false,
|
|
655
|
+
false,
|
|
656
|
+
false,
|
|
657
|
+
false,
|
|
658
|
+
0,
|
|
659
|
+
null
|
|
660
|
+
);
|
|
661
|
+
el.dispatchEvent(mouseEvent);
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
})(),
|
|
665
|
+
touch: (el, eventType, params) => {
|
|
666
|
+
const touchObj = new Touch(mergeObj({
|
|
667
|
+
identifier: Date.now(),
|
|
668
|
+
target: el,
|
|
669
|
+
radiusX: 2.5,
|
|
670
|
+
radiusY: 2.5,
|
|
671
|
+
rotationAngle: 10,
|
|
672
|
+
force: 0.5
|
|
673
|
+
}, params));
|
|
674
|
+
el.dispatchEvent(new TouchEvent(eventType, {
|
|
675
|
+
cancelable: true,
|
|
676
|
+
bubbles: true,
|
|
677
|
+
shiftKey: true,
|
|
678
|
+
touches: [touchObj],
|
|
679
|
+
targetTouches: [],
|
|
680
|
+
changedTouches: [touchObj]
|
|
681
|
+
}));
|
|
682
|
+
}
|
|
683
|
+
};
|
|
1210
684
|
function tplProcess(tpl, data) {
|
|
1211
685
|
let res = tpl;
|
|
1212
686
|
for (const x in data) {
|
|
1213
|
-
res = res.replace(new RegExp(
|
|
687
|
+
res = res.replace(new RegExp(`{=${x}}`, "g"), data[x]);
|
|
1214
688
|
}
|
|
1215
689
|
return res;
|
|
1216
690
|
}
|
|
1217
|
-
|
|
1218
|
-
/**
|
|
1219
|
-
* Get parsed date value
|
|
1220
|
-
* (It must be called in 'ChartInternal' context)
|
|
1221
|
-
* @param {Date|string|number} date Value of date to be parsed
|
|
1222
|
-
* @returns {Date}
|
|
1223
|
-
* @private
|
|
1224
|
-
*/
|
|
1225
691
|
function parseDate(date) {
|
|
692
|
+
var _a;
|
|
1226
693
|
let parsedDate;
|
|
1227
694
|
if (date instanceof Date) {
|
|
1228
695
|
parsedDate = date;
|
|
1229
696
|
} else if (isString(date)) {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
format = this.format;
|
|
1233
|
-
|
|
1234
|
-
// if fails to parse, try by new Date()
|
|
1235
|
-
// https://github.com/naver/billboard.js/issues/1714
|
|
1236
|
-
parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
|
697
|
+
const { config, format } = this;
|
|
698
|
+
parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) != null ? _a : new Date(date);
|
|
1237
699
|
} else if (isNumber(date) && !isNaN(date)) {
|
|
1238
|
-
parsedDate = new Date(+date);
|
|
700
|
+
parsedDate = /* @__PURE__ */ new Date(+date);
|
|
1239
701
|
}
|
|
1240
702
|
if (!parsedDate || isNaN(+parsedDate)) {
|
|
1241
|
-
console && console.error && console.error(
|
|
703
|
+
console && console.error && console.error(`Failed to parse x '${date}' to Date object`);
|
|
1242
704
|
}
|
|
1243
705
|
return parsedDate;
|
|
1244
706
|
}
|
|
1245
|
-
|
|
1246
|
-
/**
|
|
1247
|
-
* Return if the current doc is visible or not
|
|
1248
|
-
* @returns {boolean}
|
|
1249
|
-
* @private
|
|
1250
|
-
*/
|
|
1251
707
|
function isTabVisible() {
|
|
1252
|
-
|
|
708
|
+
var _a, _b;
|
|
709
|
+
return ((_a = doc) == null ? void 0 : _a.hidden) === false || ((_b = doc) == null ? void 0 : _b.visibilityState) === "visible";
|
|
1253
710
|
}
|
|
1254
|
-
|
|
1255
|
-
/**
|
|
1256
|
-
* Get the current input type
|
|
1257
|
-
* @param {boolean} mouse Config value: interaction.inputType.mouse
|
|
1258
|
-
* @param {boolean} touch Config value: interaction.inputType.touch
|
|
1259
|
-
* @returns {string} "mouse" | "touch" | null
|
|
1260
|
-
* @private
|
|
1261
|
-
*/
|
|
1262
711
|
function convertInputType(mouse, touch) {
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
matchMedia = win.matchMedia,
|
|
1266
|
-
navigator = win.navigator;
|
|
1267
|
-
let hasTouch = !1;
|
|
712
|
+
const { DocumentTouch, matchMedia, navigator } = win;
|
|
713
|
+
let hasTouch = false;
|
|
1268
714
|
if (touch) {
|
|
1269
|
-
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1270
715
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
1271
716
|
hasTouch = navigator.maxTouchPoints > 0;
|
|
1272
|
-
|
|
1273
|
-
// Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
1274
|
-
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
1275
717
|
} else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
|
|
1276
|
-
hasTouch =
|
|
718
|
+
hasTouch = true;
|
|
1277
719
|
} else {
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
hasTouch = !0;
|
|
720
|
+
if (matchMedia == null ? void 0 : matchMedia("(pointer:coarse)").matches) {
|
|
721
|
+
hasTouch = true;
|
|
1281
722
|
} else {
|
|
1282
|
-
// Only as a last resort, fall back to user agent sniffing
|
|
1283
723
|
const UA = navigator.userAgent;
|
|
1284
724
|
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1285
725
|
}
|
|
1286
726
|
}
|
|
1287
727
|
}
|
|
1288
|
-
|
|
1289
|
-
// 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
|
|
1290
|
-
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1291
|
-
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1292
|
-
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1293
|
-
_newArrowCheck(this, _this17);
|
|
1294
|
-
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1295
|
-
}.bind(this));
|
|
1296
|
-
|
|
1297
|
-
// fallback to 'mouse' if no input type is detected.
|
|
728
|
+
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some((v) => matchMedia == null ? void 0 : matchMedia(`(${v})`).matches);
|
|
1298
729
|
return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
|
1299
730
|
}
|
|
1300
|
-
|
|
1301
|
-
/**
|
|
1302
|
-
* Run function until given condition function return true
|
|
1303
|
-
* @param {Function} fn Function to be executed when condition is true
|
|
1304
|
-
* @param {Function} conditionFn Condition function to check if condition is true
|
|
1305
|
-
* @private
|
|
1306
|
-
*/
|
|
1307
731
|
function runUntil(fn, conditionFn) {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
requestAnimationFrame(function () {
|
|
1311
|
-
_newArrowCheck(this, _this18);
|
|
1312
|
-
return runUntil(fn, conditionFn);
|
|
1313
|
-
}.bind(this));
|
|
732
|
+
if (conditionFn() === false) {
|
|
733
|
+
requestAnimationFrame(() => runUntil(fn, conditionFn));
|
|
1314
734
|
} else {
|
|
1315
735
|
fn();
|
|
1316
736
|
}
|
|
1317
737
|
}
|
|
1318
|
-
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1319
738
|
|
|
1320
|
-
|
|
1321
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1322
|
-
* billboard.js project is licensed under the MIT license
|
|
1323
|
-
*/
|
|
739
|
+
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1324
740
|
|
|
1325
|
-
/**
|
|
1326
|
-
* Load configuration option
|
|
1327
|
-
* @param {object} config User's generation config value
|
|
1328
|
-
* @private
|
|
1329
|
-
*/
|
|
1330
741
|
function loadConfig(config) {
|
|
1331
|
-
var _this = this;
|
|
1332
742
|
const thisConfig = this.config;
|
|
1333
|
-
let target
|
|
1334
|
-
|
|
1335
|
-
|
|
743
|
+
let target;
|
|
744
|
+
let keys;
|
|
745
|
+
let read;
|
|
746
|
+
const find = () => {
|
|
1336
747
|
const key = keys.shift();
|
|
1337
748
|
if (key && target && isObjectType(target) && key in target) {
|
|
1338
749
|
target = target[key];
|
|
1339
|
-
return
|
|
750
|
+
return find();
|
|
1340
751
|
} else if (!key) {
|
|
1341
752
|
return target;
|
|
1342
753
|
}
|
|
1343
|
-
return
|
|
1344
|
-
}
|
|
1345
|
-
Object.keys(thisConfig).forEach(
|
|
1346
|
-
_newArrowCheck(this, _this);
|
|
754
|
+
return void 0;
|
|
755
|
+
};
|
|
756
|
+
Object.keys(thisConfig).forEach((key) => {
|
|
1347
757
|
target = config;
|
|
1348
758
|
keys = key.split("_");
|
|
1349
|
-
read =
|
|
759
|
+
read = find();
|
|
1350
760
|
if (isDefined(read)) {
|
|
1351
761
|
thisConfig[key] = read;
|
|
1352
762
|
}
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
// only should run in the ChartInternal context
|
|
763
|
+
});
|
|
1356
764
|
if (this.api) {
|
|
1357
765
|
this.state.orgConfig = config;
|
|
1358
766
|
}
|
|
1359
767
|
}
|
|
1360
|
-
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
1361
768
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
/**
|
|
1371
|
-
* Version info string for plugin
|
|
1372
|
-
* @name version
|
|
1373
|
-
* @static
|
|
1374
|
-
* @memberof Plugin
|
|
1375
|
-
* @type {string}
|
|
1376
|
-
* @example
|
|
1377
|
-
* bb.plugin.stanford.version; // ex) 1.9.0
|
|
1378
|
-
*/
|
|
1379
|
-
let Plugin = /*#__PURE__*/function () {
|
|
769
|
+
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
770
|
+
var Plugin_defProp = Object.defineProperty;
|
|
771
|
+
var Plugin_defNormalProp = (obj, key, value) => key in obj ? Plugin_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
772
|
+
var __publicField = (obj, key, value) => {
|
|
773
|
+
Plugin_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
774
|
+
return value;
|
|
775
|
+
};
|
|
776
|
+
class Plugin {
|
|
1380
777
|
/**
|
|
1381
778
|
* Constructor
|
|
1382
779
|
* @param {Any} options config option object
|
|
1383
780
|
* @private
|
|
1384
781
|
*/
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
}
|
|
1389
|
-
this.$$ = void 0;
|
|
1390
|
-
this.options = void 0;
|
|
782
|
+
constructor(options = {}) {
|
|
783
|
+
__publicField(this, "$$");
|
|
784
|
+
__publicField(this, "options");
|
|
1391
785
|
this.options = options;
|
|
1392
786
|
}
|
|
1393
|
-
|
|
1394
787
|
/**
|
|
1395
788
|
* Lifecycle hook for 'beforeInit' phase.
|
|
1396
789
|
* @private
|
|
1397
790
|
*/
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
791
|
+
$beforeInit() {
|
|
792
|
+
}
|
|
1401
793
|
/**
|
|
1402
794
|
* Lifecycle hook for 'init' phase.
|
|
1403
795
|
* @private
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
796
|
+
*/
|
|
797
|
+
$init() {
|
|
798
|
+
}
|
|
1407
799
|
/**
|
|
1408
800
|
* Lifecycle hook for 'afterInit' phase.
|
|
1409
801
|
* @private
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
802
|
+
*/
|
|
803
|
+
$afterInit() {
|
|
804
|
+
}
|
|
1413
805
|
/**
|
|
1414
806
|
* Lifecycle hook for 'redraw' phase.
|
|
1415
807
|
* @private
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
808
|
+
*/
|
|
809
|
+
$redraw() {
|
|
810
|
+
}
|
|
1419
811
|
/**
|
|
1420
812
|
* Lifecycle hook for 'willDestroy' phase.
|
|
1421
813
|
* @private
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
Object.keys(this).forEach(function (key) {
|
|
1426
|
-
_newArrowCheck(this, _this);
|
|
814
|
+
*/
|
|
815
|
+
$willDestroy() {
|
|
816
|
+
Object.keys(this).forEach((key) => {
|
|
1427
817
|
this[key] = null;
|
|
1428
818
|
delete this[key];
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
Plugin.version = "3.11.3";
|
|
1434
|
-
|
|
1435
|
-
;// CONCATENATED MODULE: ./src/Plugin/stanford/Options.ts
|
|
1436
|
-
/**
|
|
1437
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1438
|
-
* billboard.js project is licensed under the MIT license
|
|
1439
|
-
*/
|
|
1440
|
-
/**
|
|
1441
|
-
* Stanford diagram plugin option class
|
|
1442
|
-
* @class StanfordOptions
|
|
1443
|
-
* @param {Options} options Stanford plugin options
|
|
1444
|
-
* @augments Plugin
|
|
1445
|
-
* @returns {StanfordOptions}
|
|
1446
|
-
* @private
|
|
1447
|
-
*/
|
|
1448
|
-
let Options = function () {
|
|
1449
|
-
return {
|
|
1450
|
-
/**
|
|
1451
|
-
* Set the color of the color scale. This function receives a value between 0 and 1, and should return a color.
|
|
1452
|
-
* @name colors
|
|
1453
|
-
* @memberof plugin-stanford
|
|
1454
|
-
* @type {Function}
|
|
1455
|
-
* @default undefined
|
|
1456
|
-
* @example
|
|
1457
|
-
* colors: d3.interpolateHslLong(
|
|
1458
|
-
* d3.hsl(250, 1, 0.5), d3.hsl(0, 1, 0.5)
|
|
1459
|
-
* )
|
|
1460
|
-
*/
|
|
1461
|
-
colors: undefined,
|
|
1462
|
-
/**
|
|
1463
|
-
* Specify the key of epochs values in the data.
|
|
1464
|
-
* @name epochs
|
|
1465
|
-
* @memberof plugin-stanford
|
|
1466
|
-
* @type {Array}
|
|
1467
|
-
* @default []
|
|
1468
|
-
* @example
|
|
1469
|
-
* epochs: [ 1, 1, 2, 2, ... ]
|
|
1470
|
-
*/
|
|
1471
|
-
epochs: [],
|
|
1472
|
-
/**
|
|
1473
|
-
* Show additional lines anywhere on the chart.
|
|
1474
|
-
* - Each line object should consist with following options:
|
|
1475
|
-
*
|
|
1476
|
-
* | Key | Type | Description |
|
|
1477
|
-
* | --- | --- | --- |
|
|
1478
|
-
* | x1 | Number | Starting position on the x axis |
|
|
1479
|
-
* | y1 | Number | Starting position on the y axis |
|
|
1480
|
-
* | x2 | Number | Ending position on the x axis |
|
|
1481
|
-
* | y2 | Number | Ending position on the y axis |
|
|
1482
|
-
* | class | String | Optional value. Set a custom css class to this line. |
|
|
1483
|
-
* @type {Array}
|
|
1484
|
-
* @memberof plugin-stanford
|
|
1485
|
-
* @default []
|
|
1486
|
-
* @example
|
|
1487
|
-
* lines: [
|
|
1488
|
-
* { x1: 0, y1: 0, x2: 65, y2: 65, class: "line1" },
|
|
1489
|
-
* { x1: 0, x2: 65, y1: 40, y2: 40, class: "line2" }
|
|
1490
|
-
* ]
|
|
1491
|
-
*/
|
|
1492
|
-
lines: [],
|
|
1493
|
-
/**
|
|
1494
|
-
* Set scale values
|
|
1495
|
-
* @name scale
|
|
1496
|
-
* @memberof plugin-stanford
|
|
1497
|
-
* @type {object}
|
|
1498
|
-
* @property {object} [scale] scale object
|
|
1499
|
-
* @property {number} [scale.min=undefined] Minimum value of the color scale. Default: lowest value in epochs
|
|
1500
|
-
* @property {number} [scale.max=undefined] Maximum value of the color scale. Default: highest value in epochs
|
|
1501
|
-
* @property {number} [scale.width=20] Width of the color scale
|
|
1502
|
-
* @property {string|Function} [scale.format=undefined] Format of the axis of the color scale. Use 'pow10' to format as powers of 10 or a custom function. Example: d3.format("d")
|
|
1503
|
-
* @example
|
|
1504
|
-
* scale: {
|
|
1505
|
-
* max: 10000,
|
|
1506
|
-
* min: 1,
|
|
1507
|
-
* width: 500,
|
|
1508
|
-
*
|
|
1509
|
-
* // specify 'pow10' to format as powers of 10
|
|
1510
|
-
* format: "pow10",
|
|
1511
|
-
*
|
|
1512
|
-
* // or specify a format function
|
|
1513
|
-
* format: function(x) {
|
|
1514
|
-
* return x +"%";
|
|
1515
|
-
* }
|
|
1516
|
-
* },
|
|
1517
|
-
*/
|
|
1518
|
-
scale_min: undefined,
|
|
1519
|
-
scale_max: undefined,
|
|
1520
|
-
scale_width: 20,
|
|
1521
|
-
scale_format: undefined,
|
|
1522
|
-
/**
|
|
1523
|
-
* The padding for color scale element
|
|
1524
|
-
* @name padding
|
|
1525
|
-
* @memberof plugin-stanford
|
|
1526
|
-
* @type {object}
|
|
1527
|
-
* @property {object} [padding] padding object
|
|
1528
|
-
* @property {number} [padding.top=0] Top padding value.
|
|
1529
|
-
* @property {number} [padding.right=0] Right padding value.
|
|
1530
|
-
* @property {number} [padding.bottom=0] Bottom padding value.
|
|
1531
|
-
* @property {number} [padding.left=0] Left padding value.
|
|
1532
|
-
* @example
|
|
1533
|
-
* padding: {
|
|
1534
|
-
* top: 15,
|
|
1535
|
-
* right: 0,
|
|
1536
|
-
* bottom: 0,
|
|
1537
|
-
* left: 0
|
|
1538
|
-
* },
|
|
1539
|
-
*/
|
|
1540
|
-
padding_top: 0,
|
|
1541
|
-
padding_right: 0,
|
|
1542
|
-
padding_bottom: 0,
|
|
1543
|
-
padding_left: 0,
|
|
1544
|
-
/**
|
|
1545
|
-
* Show additional regions anywhere on the chart.
|
|
1546
|
-
* - Each region object should consist with following options:
|
|
1547
|
-
*
|
|
1548
|
-
* | Key | Type | Default | Attributes | Description |
|
|
1549
|
-
* | --- | --- | --- | --- | --- |
|
|
1550
|
-
* | points | Array | | | Accepts a group of objects that has x and y.<br>These points should be added in a counter-clockwise fashion to make a closed polygon. |
|
|
1551
|
-
* | opacity | Number | `0.2` | <optional> | Sets the opacity of the region as value between 0 and 1 |
|
|
1552
|
-
* | text | Function | | <optional> | This function receives a value and percentage of the number of epochs in this region.<br>Return a string to place text in the middle of the region. |
|
|
1553
|
-
* | class | String | | <optional> | Se a custom css class to this region, use the fill property in css to set a background color. |
|
|
1554
|
-
* @name regions
|
|
1555
|
-
* @memberof plugin-stanford
|
|
1556
|
-
* @type {Array}
|
|
1557
|
-
* @default []
|
|
1558
|
-
* @example
|
|
1559
|
-
* regions: [
|
|
1560
|
-
* {
|
|
1561
|
-
* points: [ // add points counter-clockwise
|
|
1562
|
-
* { x: 0, y: 0 },
|
|
1563
|
-
* { x: 40, y: 40 },
|
|
1564
|
-
* { x: 0, y: 40 },
|
|
1565
|
-
* ],
|
|
1566
|
-
* text: function (value, percentage) {
|
|
1567
|
-
* return `Normal Operations: ${value} (${percentage}%)`;
|
|
1568
|
-
* },
|
|
1569
|
-
* opacity: 0.2, // 0 to 1
|
|
1570
|
-
* class: "test-polygon1"
|
|
1571
|
-
* },
|
|
1572
|
-
* ...
|
|
1573
|
-
* ]
|
|
1574
|
-
*/
|
|
1575
|
-
regions: []
|
|
1576
|
-
};
|
|
1577
|
-
};
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
__publicField(Plugin, "version", "3.12.0-next.2");
|
|
1578
823
|
|
|
824
|
+
// EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
|
|
825
|
+
var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(8);
|
|
826
|
+
// EXTERNAL MODULE: external {"commonjs":"d3-format","commonjs2":"d3-format","amd":"d3-format","root":"d3"}
|
|
827
|
+
var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __webpack_require__(9);
|
|
1579
828
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/classes.ts
|
|
1580
|
-
/**
|
|
1581
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1582
|
-
* billboard.js project is licensed under the MIT license
|
|
1583
|
-
*/
|
|
1584
|
-
/**
|
|
1585
|
-
* CSS class names definition
|
|
1586
|
-
* @private
|
|
1587
|
-
*/
|
|
1588
829
|
/* harmony default export */ var stanford_classes = ({
|
|
1589
830
|
colorScale: "bb-colorscale",
|
|
1590
831
|
stanfordElements: "bb-stanford-elements",
|
|
@@ -1593,47 +834,86 @@ let Options = function () {
|
|
|
1593
834
|
stanfordRegion: "bb-stanford-region",
|
|
1594
835
|
stanfordRegions: "bb-stanford-regions"
|
|
1595
836
|
});
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
837
|
+
|
|
838
|
+
;// CONCATENATED MODULE: ./src/Plugin/stanford/ColorScale.ts
|
|
839
|
+
var ColorScale_defProp = Object.defineProperty;
|
|
840
|
+
var ColorScale_defNormalProp = (obj, key, value) => key in obj ? ColorScale_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
841
|
+
var ColorScale_publicField = (obj, key, value) => {
|
|
842
|
+
ColorScale_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
843
|
+
return value;
|
|
844
|
+
};
|
|
1602
845
|
|
|
1603
846
|
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
class ColorScale {
|
|
851
|
+
constructor(owner) {
|
|
852
|
+
ColorScale_publicField(this, "owner");
|
|
853
|
+
ColorScale_publicField(this, "colorScale");
|
|
854
|
+
this.owner = owner;
|
|
855
|
+
}
|
|
856
|
+
drawColorScale() {
|
|
857
|
+
const { $$, config } = this.owner;
|
|
858
|
+
const target = $$.data.targets[0];
|
|
859
|
+
const height = $$.state.height - config.padding_bottom - config.padding_top;
|
|
860
|
+
const barWidth = config.scale_width;
|
|
861
|
+
const barHeight = 5;
|
|
862
|
+
const points = getRange(config.padding_bottom, height, barHeight);
|
|
863
|
+
const inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
|
|
864
|
+
if (this.colorScale) {
|
|
865
|
+
this.colorScale.remove();
|
|
866
|
+
}
|
|
867
|
+
this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale);
|
|
868
|
+
this.colorScale.append("g").attr("transform", `translate(0, ${config.padding_top})`).selectAll("bars").data(points).enter().append("rect").attr("y", (d, i) => i * barHeight).attr("x", 0).attr("width", barWidth).attr("height", barHeight).attr("fill", (d) => inverseScale(d));
|
|
869
|
+
const axisScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSymlog)().domain([target.minEpochs, target.maxEpochs]).range([
|
|
870
|
+
points[0] + config.padding_top + points[points.length - 1] + barHeight - 1,
|
|
871
|
+
points[0] + config.padding_top
|
|
872
|
+
]);
|
|
873
|
+
const legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale);
|
|
874
|
+
const scaleFormat = config.scale_format;
|
|
875
|
+
if (scaleFormat === "pow10") {
|
|
876
|
+
legendAxis.tickValues([1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7]);
|
|
877
|
+
} else if (isFunction(scaleFormat)) {
|
|
878
|
+
legendAxis.tickFormat(scaleFormat);
|
|
879
|
+
} else {
|
|
880
|
+
legendAxis.tickFormat((0,external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_.format)("d"));
|
|
881
|
+
}
|
|
882
|
+
const axis = this.colorScale.append("g").attr("class", "legend axis").attr("transform", `translate(${barWidth},0)`).call(legendAxis);
|
|
883
|
+
if (scaleFormat === "pow10") {
|
|
884
|
+
axis.selectAll(".tick text").text(null).filter((d) => d / Math.pow(10, Math.ceil(Math.log(d) / Math.LN10 - 1e-12)) === 1).text(10).append("tspan").attr("dy", "-.7em").text((d) => Math.round(Math.log(d) / Math.LN10));
|
|
885
|
+
}
|
|
886
|
+
this.colorScale.attr(
|
|
887
|
+
"transform",
|
|
888
|
+
`translate(${$$.state.current.width - this.xForColorScale()}, 0)`
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
xForColorScale() {
|
|
892
|
+
return this.owner.config.padding_right + this.colorScale.node().getBBox().width;
|
|
893
|
+
}
|
|
894
|
+
getColorScalePadding() {
|
|
895
|
+
return this.xForColorScale() + this.owner.config.padding_left + 20;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
;// CONCATENATED MODULE: ./src/Plugin/stanford/util.ts
|
|
900
|
+
|
|
1611
901
|
function pointInRegion(point, region) {
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
const x = point.x,
|
|
1616
|
-
y = point.value;
|
|
1617
|
-
let inside = !1;
|
|
902
|
+
const x = point.x;
|
|
903
|
+
const y = point.value;
|
|
904
|
+
let inside = false;
|
|
1618
905
|
for (let i = 0, j = region.length - 1; i < region.length; j = i++) {
|
|
1619
|
-
const xi = region[i].x
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
906
|
+
const xi = region[i].x;
|
|
907
|
+
const yi = region[i].y;
|
|
908
|
+
const xj = region[j].x;
|
|
909
|
+
const yj = region[j].y;
|
|
910
|
+
const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
|
911
|
+
if (intersect) {
|
|
1624
912
|
inside = !inside;
|
|
1625
913
|
}
|
|
1626
914
|
}
|
|
1627
915
|
return inside;
|
|
1628
916
|
}
|
|
1629
|
-
|
|
1630
|
-
/**
|
|
1631
|
-
* Compare epochs
|
|
1632
|
-
* @param {object} a Target
|
|
1633
|
-
* @param {object} b Source
|
|
1634
|
-
* @returns {number}
|
|
1635
|
-
* @private
|
|
1636
|
-
*/
|
|
1637
917
|
function compareEpochs(a, b) {
|
|
1638
918
|
if (a.epochs < b.epochs) {
|
|
1639
919
|
return -1;
|
|
@@ -1643,18 +923,10 @@ function compareEpochs(a, b) {
|
|
|
1643
923
|
}
|
|
1644
924
|
return 0;
|
|
1645
925
|
}
|
|
1646
|
-
|
|
1647
|
-
/**
|
|
1648
|
-
* Get region area
|
|
1649
|
-
* @param {Array} points Points
|
|
1650
|
-
* @returns {number}
|
|
1651
|
-
* @private
|
|
1652
|
-
*/
|
|
1653
926
|
function getRegionArea(points) {
|
|
1654
|
-
|
|
1655
|
-
let
|
|
1656
|
-
|
|
1657
|
-
point2;
|
|
927
|
+
let area = 0;
|
|
928
|
+
let point1;
|
|
929
|
+
let point2;
|
|
1658
930
|
for (let i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
|
1659
931
|
point1 = points[i];
|
|
1660
932
|
point2 = points[j];
|
|
@@ -1664,21 +936,14 @@ function getRegionArea(points) {
|
|
|
1664
936
|
area /= 2;
|
|
1665
937
|
return area;
|
|
1666
938
|
}
|
|
1667
|
-
|
|
1668
|
-
/**
|
|
1669
|
-
* Get centroid
|
|
1670
|
-
* @param {Array} points Points
|
|
1671
|
-
* @returns {object}
|
|
1672
|
-
* @private
|
|
1673
|
-
*/
|
|
1674
939
|
function getCentroid(points) {
|
|
1675
940
|
const area = getRegionArea(points);
|
|
1676
|
-
let x = 0
|
|
1677
|
-
|
|
1678
|
-
|
|
941
|
+
let x = 0;
|
|
942
|
+
let y = 0;
|
|
943
|
+
let f;
|
|
1679
944
|
for (let i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
|
1680
|
-
const point1 = points[i]
|
|
1681
|
-
|
|
945
|
+
const point1 = points[i];
|
|
946
|
+
const point2 = points[j];
|
|
1682
947
|
f = point1.x * point2.y - point2.x * point1.y;
|
|
1683
948
|
x += (point1.x + point2.x) * f;
|
|
1684
949
|
y += (point1.y + point2.y) * f;
|
|
@@ -1690,134 +955,82 @@ function getCentroid(points) {
|
|
|
1690
955
|
};
|
|
1691
956
|
}
|
|
1692
957
|
|
|
1693
|
-
;// CONCATENATED MODULE: ./src/Plugin/stanford/Elements.ts
|
|
1694
|
-
|
|
1695
|
-
/**
|
|
1696
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1697
|
-
* billboard.js project is licensed under the MIT license
|
|
1698
|
-
*/
|
|
1699
|
-
// @ts-nocheck
|
|
1700
958
|
|
|
959
|
+
;// CONCATENATED MODULE: ./src/Plugin/stanford/Elements.ts
|
|
960
|
+
var Elements_defProp = Object.defineProperty;
|
|
961
|
+
var Elements_defNormalProp = (obj, key, value) => key in obj ? Elements_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
962
|
+
var Elements_publicField = (obj, key, value) => {
|
|
963
|
+
Elements_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
964
|
+
return value;
|
|
965
|
+
};
|
|
1701
966
|
|
|
1702
967
|
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
* @param {Stanford} owner Stanford instance
|
|
1707
|
-
* @private
|
|
1708
|
-
*/
|
|
1709
|
-
let Elements = /*#__PURE__*/function () {
|
|
1710
|
-
function Elements(owner) {
|
|
1711
|
-
this.owner = void 0;
|
|
968
|
+
class Elements {
|
|
969
|
+
constructor(owner) {
|
|
970
|
+
Elements_publicField(this, "owner");
|
|
1712
971
|
this.owner = owner;
|
|
1713
|
-
|
|
1714
|
-
// MEMO: Avoid blocking eventRect
|
|
1715
972
|
const elements = owner.$$.$el.main.select(".bb-chart").append("g").attr("class", stanford_classes.stanfordElements);
|
|
1716
973
|
elements.append("g").attr("class", stanford_classes.stanfordLines);
|
|
1717
974
|
elements.append("g").attr("class", stanford_classes.stanfordRegions);
|
|
1718
975
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
xvCustom = this.xvCustom.bind($$),
|
|
1727
|
-
yvCustom = this.yvCustom.bind($$),
|
|
1728
|
-
stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
|
|
1729
|
-
|
|
1730
|
-
// Stanford-Lines
|
|
1731
|
-
|
|
1732
|
-
// exit
|
|
976
|
+
updateStanfordLines(duration) {
|
|
977
|
+
const { $$ } = this.owner;
|
|
978
|
+
const { config, $el: { main } } = $$;
|
|
979
|
+
const isRotated = config.axis_rotated;
|
|
980
|
+
const xvCustom = this.xvCustom.bind($$);
|
|
981
|
+
const yvCustom = this.yvCustom.bind($$);
|
|
982
|
+
const stanfordLine = main.select(`.${stanford_classes.stanfordLines}`).style("shape-rendering", "geometricprecision").selectAll(`.${stanford_classes.stanfordLine}`).data(this.owner.config.lines);
|
|
1733
983
|
stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove();
|
|
1734
|
-
|
|
1735
|
-
// enter
|
|
1736
984
|
const stanfordLineEnter = stanfordLine.enter().append("g");
|
|
1737
985
|
stanfordLineEnter.append("line").style("opacity", "0");
|
|
1738
|
-
stanfordLineEnter.merge(stanfordLine).attr("class",
|
|
1739
|
-
_newArrowCheck(this, _this);
|
|
1740
|
-
return stanford_classes.stanfordLine + (d.class ? " " + d.class : "");
|
|
1741
|
-
}.bind(this)).select("line").transition().duration(duration).attr("x1", function (d) {
|
|
1742
|
-
_newArrowCheck(this, _this);
|
|
986
|
+
stanfordLineEnter.merge(stanfordLine).attr("class", (d) => stanford_classes.stanfordLine + (d.class ? ` ${d.class}` : "")).select("line").transition().duration(duration).attr("x1", (d) => {
|
|
1743
987
|
const v = isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
|
|
1744
988
|
return v;
|
|
1745
|
-
}.
|
|
1746
|
-
_newArrowCheck(this, _this);
|
|
1747
|
-
return isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2");
|
|
1748
|
-
}.bind(this)).attr("y1", function (d) {
|
|
1749
|
-
_newArrowCheck(this, _this);
|
|
989
|
+
}).attr("x2", (d) => isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2")).attr("y1", (d) => {
|
|
1750
990
|
const v = isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
|
|
1751
991
|
return v;
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
const
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
isRotated = config.axis_rotated,
|
|
1763
|
-
xvCustom = this.xvCustom.bind($$),
|
|
1764
|
-
yvCustom = this.yvCustom.bind($$),
|
|
1765
|
-
countPointsInRegion = this.owner.countEpochsInRegion.bind($$);
|
|
1766
|
-
// Stanford-Regions
|
|
1767
|
-
let stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
|
|
1768
|
-
|
|
1769
|
-
// exit
|
|
992
|
+
}).attr("y2", (d) => isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2")).transition().style("opacity", null);
|
|
993
|
+
}
|
|
994
|
+
updateStanfordRegions(duration) {
|
|
995
|
+
const { $$ } = this.owner;
|
|
996
|
+
const { config, $el: { main } } = $$;
|
|
997
|
+
const isRotated = config.axis_rotated;
|
|
998
|
+
const xvCustom = this.xvCustom.bind($$);
|
|
999
|
+
const yvCustom = this.yvCustom.bind($$);
|
|
1000
|
+
const countPointsInRegion = this.owner.countEpochsInRegion.bind($$);
|
|
1001
|
+
let stanfordRegion = main.select(`.${stanford_classes.stanfordRegions}`).selectAll(`.${stanford_classes.stanfordRegion}`).data(this.owner.config.regions);
|
|
1770
1002
|
stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove();
|
|
1771
|
-
|
|
1772
|
-
// enter
|
|
1773
1003
|
const stanfordRegionEnter = stanfordRegion.enter().append("g");
|
|
1774
1004
|
stanfordRegionEnter.append("polygon").style("opacity", "0");
|
|
1775
1005
|
stanfordRegionEnter.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0");
|
|
1776
1006
|
stanfordRegion = stanfordRegionEnter.merge(stanfordRegion);
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
_newArrowCheck(this, _this2);
|
|
1791
|
-
return (d.opacity ? d.opacity : .2) + "";
|
|
1792
|
-
}.bind(this));
|
|
1793
|
-
stanfordRegion.select("text").transition().duration(duration).attr("x", function (d) {
|
|
1794
|
-
_newArrowCheck(this, _this2);
|
|
1795
|
-
return isRotated ? yvCustom(getCentroid(d.points), "y") : xvCustom(getCentroid(d.points), "x");
|
|
1796
|
-
}.bind(this)).attr("y", function (d) {
|
|
1797
|
-
_newArrowCheck(this, _this2);
|
|
1798
|
-
return isRotated ? xvCustom(getCentroid(d.points), "x") : yvCustom(getCentroid(d.points), "y");
|
|
1799
|
-
}.bind(this)).text(function (d) {
|
|
1800
|
-
_newArrowCheck(this, _this2);
|
|
1007
|
+
stanfordRegion.attr("class", (d) => stanford_classes.stanfordRegion + (d.class ? ` ${d.class}` : "")).select("polygon").transition().duration(duration).attr("points", (d) => d.points.map(
|
|
1008
|
+
(value) => [
|
|
1009
|
+
isRotated ? yvCustom(value, "y") : xvCustom(value, "x"),
|
|
1010
|
+
isRotated ? xvCustom(value, "x") : yvCustom(value, "y")
|
|
1011
|
+
].join(",")
|
|
1012
|
+
).join(" ")).transition().style("opacity", (d) => String(d.opacity ? d.opacity : 0.2));
|
|
1013
|
+
stanfordRegion.select("text").transition().duration(duration).attr(
|
|
1014
|
+
"x",
|
|
1015
|
+
(d) => isRotated ? yvCustom(getCentroid(d.points), "y") : xvCustom(getCentroid(d.points), "x")
|
|
1016
|
+
).attr(
|
|
1017
|
+
"y",
|
|
1018
|
+
(d) => isRotated ? xvCustom(getCentroid(d.points), "x") : yvCustom(getCentroid(d.points), "y")
|
|
1019
|
+
).text((d) => {
|
|
1801
1020
|
if (d.text) {
|
|
1802
|
-
const
|
|
1803
|
-
value = _countPointsInRegion.value,
|
|
1804
|
-
percentage = _countPointsInRegion.percentage;
|
|
1021
|
+
const { value, percentage } = countPointsInRegion(d.points);
|
|
1805
1022
|
return d.text(value, percentage);
|
|
1806
1023
|
}
|
|
1807
1024
|
return "";
|
|
1808
|
-
}
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
if (duration === void 0) {
|
|
1812
|
-
duration = 0;
|
|
1813
|
-
}
|
|
1025
|
+
}).attr("text-anchor", "middle").attr("dominant-baseline", "middle").transition().style("opacity", null);
|
|
1026
|
+
}
|
|
1027
|
+
updateStanfordElements(duration = 0) {
|
|
1814
1028
|
this.updateStanfordLines(duration);
|
|
1815
1029
|
this.updateStanfordRegions(duration);
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
const $$ = this
|
|
1819
|
-
|
|
1820
|
-
config = $$.config;
|
|
1030
|
+
}
|
|
1031
|
+
xvCustom(d, xyValue) {
|
|
1032
|
+
const $$ = this;
|
|
1033
|
+
const { axis, config } = $$;
|
|
1821
1034
|
let value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1822
1035
|
if (axis.isTimeSeries()) {
|
|
1823
1036
|
value = parseDate.call($$, value);
|
|
@@ -1825,113 +1038,156 @@ let Elements = /*#__PURE__*/function () {
|
|
|
1825
1038
|
value = config.axis_x_categories.indexOf(d.value);
|
|
1826
1039
|
}
|
|
1827
1040
|
return Math.ceil($$.scale.x(value));
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
const $$ = this
|
|
1831
|
-
|
|
1832
|
-
|
|
1041
|
+
}
|
|
1042
|
+
yvCustom(d, xyValue) {
|
|
1043
|
+
const $$ = this;
|
|
1044
|
+
const yScale = d.axis && d.axis === "y2" ? $$.scale.y2 : $$.scale.y;
|
|
1045
|
+
const value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
|
1833
1046
|
return Math.ceil(yScale(value));
|
|
1834
|
-
};
|
|
1835
|
-
return Elements;
|
|
1836
|
-
}();
|
|
1837
|
-
|
|
1838
|
-
// EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
|
|
1839
|
-
var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(8);
|
|
1840
|
-
// EXTERNAL MODULE: external {"commonjs":"d3-format","commonjs2":"d3-format","amd":"d3-format","root":"d3"}
|
|
1841
|
-
var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __webpack_require__(9);
|
|
1842
|
-
;// CONCATENATED MODULE: ./src/Plugin/stanford/ColorScale.ts
|
|
1843
|
-
|
|
1844
|
-
/**
|
|
1845
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1846
|
-
* billboard.js project is licensed under the MIT license
|
|
1847
|
-
*/
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
/**
|
|
1855
|
-
* Stanford diagram plugin color scale class
|
|
1856
|
-
* @class ColorScale
|
|
1857
|
-
* @param {Stanford} owner Stanford instance
|
|
1858
|
-
* @private
|
|
1859
|
-
*/
|
|
1860
|
-
let ColorScale = /*#__PURE__*/function () {
|
|
1861
|
-
function ColorScale(owner) {
|
|
1862
|
-
this.owner = void 0;
|
|
1863
|
-
this.colorScale = void 0;
|
|
1864
|
-
this.owner = owner;
|
|
1865
1047
|
}
|
|
1866
|
-
|
|
1867
|
-
_proto.drawColorScale = function drawColorScale() {
|
|
1868
|
-
var _this = this;
|
|
1869
|
-
const _this$owner = this.owner,
|
|
1870
|
-
$$ = _this$owner.$$,
|
|
1871
|
-
config = _this$owner.config,
|
|
1872
|
-
target = $$.data.targets[0],
|
|
1873
|
-
height = $$.state.height - config.padding_bottom - config.padding_top,
|
|
1874
|
-
barWidth = config.scale_width,
|
|
1875
|
-
points = getRange(config.padding_bottom, height, 5),
|
|
1876
|
-
inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
|
|
1877
|
-
if (this.colorScale) {
|
|
1878
|
-
this.colorScale.remove();
|
|
1879
|
-
}
|
|
1880
|
-
this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale);
|
|
1881
|
-
this.colorScale.append("g").attr("transform", "translate(0, " + config.padding_top + ")").selectAll("bars").data(points).enter().append("rect").attr("y", function (d, i) {
|
|
1882
|
-
_newArrowCheck(this, _this);
|
|
1883
|
-
return i * 5;
|
|
1884
|
-
}.bind(this)).attr("x", 0).attr("width", barWidth).attr("height", 5).attr("fill", function (d) {
|
|
1885
|
-
_newArrowCheck(this, _this);
|
|
1886
|
-
return inverseScale(d);
|
|
1887
|
-
}.bind(this));
|
|
1888
|
-
|
|
1889
|
-
// Legend Axis
|
|
1890
|
-
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]),
|
|
1891
|
-
legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
|
|
1892
|
-
scaleFormat = config.scale_format;
|
|
1893
|
-
if (scaleFormat === "pow10") {
|
|
1894
|
-
legendAxis.tickValues([1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7]);
|
|
1895
|
-
} else if (isFunction(scaleFormat)) {
|
|
1896
|
-
legendAxis.tickFormat(scaleFormat);
|
|
1897
|
-
} else {
|
|
1898
|
-
legendAxis.tickFormat((0,external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_.format)("d"));
|
|
1899
|
-
}
|
|
1048
|
+
}
|
|
1900
1049
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1050
|
+
;// CONCATENATED MODULE: ./src/Plugin/stanford/Options.ts
|
|
1051
|
+
class Options {
|
|
1052
|
+
constructor() {
|
|
1053
|
+
return {
|
|
1054
|
+
/**
|
|
1055
|
+
* Set the color of the color scale. This function receives a value between 0 and 1, and should return a color.
|
|
1056
|
+
* @name colors
|
|
1057
|
+
* @memberof plugin-stanford
|
|
1058
|
+
* @type {Function}
|
|
1059
|
+
* @default undefined
|
|
1060
|
+
* @example
|
|
1061
|
+
* colors: d3.interpolateHslLong(
|
|
1062
|
+
* d3.hsl(250, 1, 0.5), d3.hsl(0, 1, 0.5)
|
|
1063
|
+
* )
|
|
1064
|
+
*/
|
|
1065
|
+
colors: void 0,
|
|
1066
|
+
/**
|
|
1067
|
+
* Specify the key of epochs values in the data.
|
|
1068
|
+
* @name epochs
|
|
1069
|
+
* @memberof plugin-stanford
|
|
1070
|
+
* @type {Array}
|
|
1071
|
+
* @default []
|
|
1072
|
+
* @example
|
|
1073
|
+
* epochs: [ 1, 1, 2, 2, ... ]
|
|
1074
|
+
*/
|
|
1075
|
+
epochs: [],
|
|
1076
|
+
/**
|
|
1077
|
+
* Show additional lines anywhere on the chart.
|
|
1078
|
+
* - Each line object should consist with following options:
|
|
1079
|
+
*
|
|
1080
|
+
* | Key | Type | Description |
|
|
1081
|
+
* | --- | --- | --- |
|
|
1082
|
+
* | x1 | Number | Starting position on the x axis |
|
|
1083
|
+
* | y1 | Number | Starting position on the y axis |
|
|
1084
|
+
* | x2 | Number | Ending position on the x axis |
|
|
1085
|
+
* | y2 | Number | Ending position on the y axis |
|
|
1086
|
+
* | class | String | Optional value. Set a custom css class to this line. |
|
|
1087
|
+
* @type {Array}
|
|
1088
|
+
* @memberof plugin-stanford
|
|
1089
|
+
* @default []
|
|
1090
|
+
* @example
|
|
1091
|
+
* lines: [
|
|
1092
|
+
* { x1: 0, y1: 0, x2: 65, y2: 65, class: "line1" },
|
|
1093
|
+
* { x1: 0, x2: 65, y1: 40, y2: 40, class: "line2" }
|
|
1094
|
+
* ]
|
|
1095
|
+
*/
|
|
1096
|
+
lines: [],
|
|
1097
|
+
/**
|
|
1098
|
+
* Set scale values
|
|
1099
|
+
* @name scale
|
|
1100
|
+
* @memberof plugin-stanford
|
|
1101
|
+
* @type {object}
|
|
1102
|
+
* @property {object} [scale] scale object
|
|
1103
|
+
* @property {number} [scale.min=undefined] Minimum value of the color scale. Default: lowest value in epochs
|
|
1104
|
+
* @property {number} [scale.max=undefined] Maximum value of the color scale. Default: highest value in epochs
|
|
1105
|
+
* @property {number} [scale.width=20] Width of the color scale
|
|
1106
|
+
* @property {string|Function} [scale.format=undefined] Format of the axis of the color scale. Use 'pow10' to format as powers of 10 or a custom function. Example: d3.format("d")
|
|
1107
|
+
* @example
|
|
1108
|
+
* scale: {
|
|
1109
|
+
* max: 10000,
|
|
1110
|
+
* min: 1,
|
|
1111
|
+
* width: 500,
|
|
1112
|
+
*
|
|
1113
|
+
* // specify 'pow10' to format as powers of 10
|
|
1114
|
+
* format: "pow10",
|
|
1115
|
+
*
|
|
1116
|
+
* // or specify a format function
|
|
1117
|
+
* format: function(x) {
|
|
1118
|
+
* return x +"%";
|
|
1119
|
+
* }
|
|
1120
|
+
* },
|
|
1121
|
+
*/
|
|
1122
|
+
scale_min: void 0,
|
|
1123
|
+
scale_max: void 0,
|
|
1124
|
+
scale_width: 20,
|
|
1125
|
+
scale_format: void 0,
|
|
1126
|
+
/**
|
|
1127
|
+
* The padding for color scale element
|
|
1128
|
+
* @name padding
|
|
1129
|
+
* @memberof plugin-stanford
|
|
1130
|
+
* @type {object}
|
|
1131
|
+
* @property {object} [padding] padding object
|
|
1132
|
+
* @property {number} [padding.top=0] Top padding value.
|
|
1133
|
+
* @property {number} [padding.right=0] Right padding value.
|
|
1134
|
+
* @property {number} [padding.bottom=0] Bottom padding value.
|
|
1135
|
+
* @property {number} [padding.left=0] Left padding value.
|
|
1136
|
+
* @example
|
|
1137
|
+
* padding: {
|
|
1138
|
+
* top: 15,
|
|
1139
|
+
* right: 0,
|
|
1140
|
+
* bottom: 0,
|
|
1141
|
+
* left: 0
|
|
1142
|
+
* },
|
|
1143
|
+
*/
|
|
1144
|
+
padding_top: 0,
|
|
1145
|
+
padding_right: 0,
|
|
1146
|
+
padding_bottom: 0,
|
|
1147
|
+
padding_left: 0,
|
|
1148
|
+
/**
|
|
1149
|
+
* Show additional regions anywhere on the chart.
|
|
1150
|
+
* - Each region object should consist with following options:
|
|
1151
|
+
*
|
|
1152
|
+
* | Key | Type | Default | Attributes | Description |
|
|
1153
|
+
* | --- | --- | --- | --- | --- |
|
|
1154
|
+
* | points | Array | | | Accepts a group of objects that has x and y.<br>These points should be added in a counter-clockwise fashion to make a closed polygon. |
|
|
1155
|
+
* | opacity | Number | `0.2` | <optional> | Sets the opacity of the region as value between 0 and 1 |
|
|
1156
|
+
* | text | Function | | <optional> | This function receives a value and percentage of the number of epochs in this region.<br>Return a string to place text in the middle of the region. |
|
|
1157
|
+
* | class | String | | <optional> | Se a custom css class to this region, use the fill property in css to set a background color. |
|
|
1158
|
+
* @name regions
|
|
1159
|
+
* @memberof plugin-stanford
|
|
1160
|
+
* @type {Array}
|
|
1161
|
+
* @default []
|
|
1162
|
+
* @example
|
|
1163
|
+
* regions: [
|
|
1164
|
+
* {
|
|
1165
|
+
* points: [ // add points counter-clockwise
|
|
1166
|
+
* { x: 0, y: 0 },
|
|
1167
|
+
* { x: 40, y: 40 },
|
|
1168
|
+
* { x: 0, y: 40 },
|
|
1169
|
+
* ],
|
|
1170
|
+
* text: function (value, percentage) {
|
|
1171
|
+
* return `Normal Operations: ${value} (${percentage}%)`;
|
|
1172
|
+
* },
|
|
1173
|
+
* opacity: 0.2, // 0 to 1
|
|
1174
|
+
* class: "test-polygon1"
|
|
1175
|
+
* },
|
|
1176
|
+
* ...
|
|
1177
|
+
* ]
|
|
1178
|
+
*/
|
|
1179
|
+
regions: []
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1924
1183
|
|
|
1925
1184
|
;// CONCATENATED MODULE: ./src/Plugin/stanford/index.ts
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
*/
|
|
1933
|
-
// @ts-nocheck
|
|
1934
|
-
|
|
1185
|
+
var stanford_defProp = Object.defineProperty;
|
|
1186
|
+
var stanford_defNormalProp = (obj, key, value) => key in obj ? stanford_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1187
|
+
var stanford_publicField = (obj, key, value) => {
|
|
1188
|
+
stanford_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1189
|
+
return value;
|
|
1190
|
+
};
|
|
1935
1191
|
|
|
1936
1192
|
|
|
1937
1193
|
|
|
@@ -1942,133 +1198,32 @@ let ColorScale = /*#__PURE__*/function () {
|
|
|
1942
1198
|
|
|
1943
1199
|
|
|
1944
1200
|
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
* - [d3-interpolate](https://github.com/d3/d3-interpolate)
|
|
1954
|
-
* - [d3-color](https://github.com/d3/d3-color)
|
|
1955
|
-
* - [d3-scale](https://github.com/d3/d3-scale)
|
|
1956
|
-
* - [d3-brush](https://github.com/d3/d3-brush)
|
|
1957
|
-
* - [d3-axis](https://github.com/d3/d3-axis)
|
|
1958
|
-
* - [d3-format](https://github.com/d3/d3-format)
|
|
1959
|
-
* @class plugin-stanford
|
|
1960
|
-
* @requires d3-selection
|
|
1961
|
-
* @requires d3-interpolate
|
|
1962
|
-
* @requires d3-color
|
|
1963
|
-
* @requires d3-scale
|
|
1964
|
-
* @requires d3-brush
|
|
1965
|
-
* @requires d3-axis
|
|
1966
|
-
* @requires d3-format
|
|
1967
|
-
* @param {object} options Stanford plugin options
|
|
1968
|
-
* @augments Plugin
|
|
1969
|
-
* @returns {Stanford}
|
|
1970
|
-
* @example
|
|
1971
|
-
* // Plugin must be loaded before the use.
|
|
1972
|
-
* <script src="$YOUR_PATH/plugin/billboardjs-plugin-stanford.js"></script>
|
|
1973
|
-
*
|
|
1974
|
-
* var chart = bb.generate({
|
|
1975
|
-
* data: {
|
|
1976
|
-
* columns: [ ... ],
|
|
1977
|
-
* type: "scatter"
|
|
1978
|
-
* }
|
|
1979
|
-
* ...
|
|
1980
|
-
* plugins: [
|
|
1981
|
-
* new bb.plugin.stanford({
|
|
1982
|
-
* colors: d3.interpolateHslLong(
|
|
1983
|
-
* d3.hsl(250, 1, 0.5), d3.hsl(0, 1, 0.5)
|
|
1984
|
-
* ),
|
|
1985
|
-
* epochs: [ 1, 1, 2, 2, ... ],
|
|
1986
|
-
* lines: [
|
|
1987
|
-
* { x1: 0, y1: 0, x2: 65, y2: 65, class: "line1" },
|
|
1988
|
-
* { x1: 0, x2: 65, y1: 40, y2: 40, class: "line2" }
|
|
1989
|
-
* ],
|
|
1990
|
-
* scale: {
|
|
1991
|
-
* max: 10000,
|
|
1992
|
-
* min: 1,
|
|
1993
|
-
* width: 500,
|
|
1994
|
-
* format: 'pow10',
|
|
1995
|
-
* },
|
|
1996
|
-
* padding: {
|
|
1997
|
-
* top: 15,
|
|
1998
|
-
* right: 0,
|
|
1999
|
-
* bottom: 0,
|
|
2000
|
-
* left: 0
|
|
2001
|
-
* },
|
|
2002
|
-
* regions: [
|
|
2003
|
-
* {
|
|
2004
|
-
* points: [ // add points counter-clockwise
|
|
2005
|
-
* { x: 0, y: 0 },
|
|
2006
|
-
* { x: 40, y: 40 },
|
|
2007
|
-
* { x: 0, y: 40 }
|
|
2008
|
-
* ],
|
|
2009
|
-
* text: function (value, percentage) {
|
|
2010
|
-
* return `Normal Operations: ${value} (${percentage}%)`;
|
|
2011
|
-
* },
|
|
2012
|
-
* opacity: 0.2, // 0 to 1
|
|
2013
|
-
* class: "test-polygon1"
|
|
2014
|
-
* },
|
|
2015
|
-
* ...
|
|
2016
|
-
* ]
|
|
2017
|
-
* }
|
|
2018
|
-
* ]
|
|
2019
|
-
* });
|
|
2020
|
-
* @example
|
|
2021
|
-
* import {bb} from "billboard.js";
|
|
2022
|
-
* import Stanford from "billboard.js/dist/billboardjs-plugin-stanford";
|
|
2023
|
-
*
|
|
2024
|
-
* bb.generate({
|
|
2025
|
-
* plugins: [
|
|
2026
|
-
* new Stanford({ ... })
|
|
2027
|
-
* ]
|
|
2028
|
-
* })
|
|
2029
|
-
*/
|
|
2030
|
-
let Stanford = /*#__PURE__*/function (_Plugin) {
|
|
2031
|
-
_inheritsLoose(Stanford, _Plugin);
|
|
2032
|
-
function Stanford(options) {
|
|
2033
|
-
var _this = _Plugin.call(this, options) || this;
|
|
2034
|
-
_this.config = void 0;
|
|
2035
|
-
_this.colorScale = void 0;
|
|
2036
|
-
_this.elements = void 0;
|
|
2037
|
-
_this.config = new Options();
|
|
2038
|
-
return _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
|
1201
|
+
class Stanford extends Plugin {
|
|
1202
|
+
constructor(options) {
|
|
1203
|
+
super(options);
|
|
1204
|
+
stanford_publicField(this, "config");
|
|
1205
|
+
stanford_publicField(this, "colorScale");
|
|
1206
|
+
stanford_publicField(this, "elements");
|
|
1207
|
+
this.config = new Options();
|
|
1208
|
+
return this;
|
|
2039
1209
|
}
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
$$.
|
|
2047
|
-
$$.
|
|
2048
|
-
_newArrowCheck(this, _this2);
|
|
2049
|
-
return !0;
|
|
2050
|
-
}.bind(this);
|
|
2051
|
-
$$.showGridFocus = function () {
|
|
2052
|
-
_newArrowCheck(this, _this2);
|
|
2053
|
-
}.bind(this);
|
|
2054
|
-
$$.labelishData = function (d) {
|
|
2055
|
-
_newArrowCheck(this, _this2);
|
|
2056
|
-
return d.values;
|
|
2057
|
-
}.bind(this);
|
|
2058
|
-
$$.opacityForCircle = function () {
|
|
2059
|
-
_newArrowCheck(this, _this2);
|
|
2060
|
-
return 1;
|
|
2061
|
-
}.bind(this);
|
|
1210
|
+
$beforeInit() {
|
|
1211
|
+
const { $$ } = this;
|
|
1212
|
+
$$.config.data_xSort = false;
|
|
1213
|
+
$$.isMultipleX = () => true;
|
|
1214
|
+
$$.showGridFocus = () => {
|
|
1215
|
+
};
|
|
1216
|
+
$$.labelishData = (d) => d.values;
|
|
1217
|
+
$$.opacityForCircle = () => 1;
|
|
2062
1218
|
const getCurrentPadding = $$.getCurrentPadding.bind($$);
|
|
2063
|
-
$$.getCurrentPadding =
|
|
2064
|
-
_newArrowCheck(this, _this2);
|
|
1219
|
+
$$.getCurrentPadding = () => {
|
|
2065
1220
|
const padding = getCurrentPadding();
|
|
2066
1221
|
padding.right += this.colorScale ? this.colorScale.getColorScalePadding() : 0;
|
|
2067
1222
|
return padding;
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
const $$ = this
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
$init() {
|
|
1226
|
+
const { $$ } = this;
|
|
2072
1227
|
loadConfig.call(this, this.options);
|
|
2073
1228
|
$$.color = this.getStanfordPointColor.bind($$);
|
|
2074
1229
|
this.colorScale = new ColorScale(this);
|
|
@@ -2079,99 +1234,86 @@ let Stanford = /*#__PURE__*/function (_Plugin) {
|
|
|
2079
1234
|
this.colorScale.drawColorScale();
|
|
2080
1235
|
$$.right += this.colorScale ? this.colorScale.getColorScalePadding() : 0;
|
|
2081
1236
|
this.$redraw();
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
var
|
|
2085
|
-
(
|
|
2086
|
-
(
|
|
2087
|
-
}
|
|
2088
|
-
|
|
1237
|
+
}
|
|
1238
|
+
$redraw(duration) {
|
|
1239
|
+
var _a, _b;
|
|
1240
|
+
(_a = this.colorScale) == null ? void 0 : _a.drawColorScale();
|
|
1241
|
+
(_b = this.elements) == null ? void 0 : _b.updateStanfordElements(duration);
|
|
1242
|
+
}
|
|
1243
|
+
getOptions() {
|
|
2089
1244
|
return new Options();
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
const
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
var _this4 = this;
|
|
2097
|
-
_newArrowCheck(this, _this3);
|
|
2098
|
-
d.values.forEach(function (v, i) {
|
|
2099
|
-
_newArrowCheck(this, _this4);
|
|
1245
|
+
}
|
|
1246
|
+
convertData() {
|
|
1247
|
+
const data = this.$$.data.targets;
|
|
1248
|
+
const epochs = this.options.epochs;
|
|
1249
|
+
data.forEach((d) => {
|
|
1250
|
+
d.values.forEach((v, i) => {
|
|
2100
1251
|
v.epochs = epochs[i];
|
|
2101
|
-
}
|
|
2102
|
-
d.minEpochs =
|
|
2103
|
-
d.maxEpochs =
|
|
2104
|
-
d.colors =
|
|
2105
|
-
d.colorscale =
|
|
2106
|
-
}
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
const
|
|
2111
|
-
target = this.$$.data.targets[0];
|
|
2112
|
-
// TODO STANFORD see if (data.js -> orderTargets)+ can be used instead
|
|
2113
|
-
// Make larger values appear on top
|
|
1252
|
+
});
|
|
1253
|
+
d.minEpochs = void 0;
|
|
1254
|
+
d.maxEpochs = void 0;
|
|
1255
|
+
d.colors = void 0;
|
|
1256
|
+
d.colorscale = void 0;
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
initStanfordData() {
|
|
1260
|
+
const { config } = this;
|
|
1261
|
+
const target = this.$$.data.targets[0];
|
|
2114
1262
|
target.values.sort(compareEpochs);
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
return a.epochs;
|
|
2120
|
-
}.bind(this));
|
|
2121
|
-
target.minEpochs = !isNaN(config.scale_min) ? config.scale_min : Math.min.apply(Math, epochs);
|
|
2122
|
-
target.maxEpochs = !isNaN(config.scale_max) ? config.scale_max : Math.max.apply(Math, epochs);
|
|
2123
|
-
target.colors = isFunction(config.colors) ? config.colors : (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolateHslLong)((0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(250, 1, .5), (0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(0, 1, .5));
|
|
1263
|
+
const epochs = target.values.map((a) => a.epochs);
|
|
1264
|
+
target.minEpochs = !isNaN(config.scale_min) ? config.scale_min : Math.min(...epochs);
|
|
1265
|
+
target.maxEpochs = !isNaN(config.scale_max) ? config.scale_max : Math.max(...epochs);
|
|
1266
|
+
target.colors = isFunction(config.colors) ? config.colors : (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolateHslLong)((0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(250, 1, 0.5), (0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(0, 1, 0.5));
|
|
2124
1267
|
target.colorscale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequentialLog)(target.colors).domain([target.minEpochs, target.maxEpochs]);
|
|
2125
|
-
}
|
|
2126
|
-
|
|
1268
|
+
}
|
|
1269
|
+
getStanfordPointColor(d) {
|
|
2127
1270
|
const target = this.data.targets[0];
|
|
2128
1271
|
return target.colorscale(d.epochs);
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
const config = this
|
|
1272
|
+
}
|
|
1273
|
+
setStanfordTooltip() {
|
|
1274
|
+
const { config } = this.$$;
|
|
2132
1275
|
if (isEmpty(config.tooltip_contents)) {
|
|
2133
|
-
config.tooltip_contents = function
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
1276
|
+
config.tooltip_contents = function(d, defaultTitleFormat, defaultValueFormat, color) {
|
|
1277
|
+
const { data_x } = config;
|
|
1278
|
+
let html = `<table class="${$TOOLTIP.tooltip}"><tbody>`;
|
|
1279
|
+
d.forEach((v) => {
|
|
1280
|
+
const { id = "", value = 0, epochs = 0, x = "" } = v;
|
|
1281
|
+
html += `<tr>
|
|
1282
|
+
<th>${data_x || ""}</th>
|
|
1283
|
+
<th class="value">${defaultTitleFormat(x)}</th>
|
|
1284
|
+
</tr>
|
|
1285
|
+
<tr>
|
|
1286
|
+
<th>${v.id}</th>
|
|
1287
|
+
<th class="value">${defaultValueFormat(value)}</th>
|
|
1288
|
+
</tr>
|
|
1289
|
+
<tr class="${$TOOLTIP.tooltipName}-${id}">
|
|
1290
|
+
<td class="name"><span style="background-color:${color(v)}"></span>Epochs</td>
|
|
1291
|
+
<td class="value">${defaultValueFormat(epochs)}</td>
|
|
1292
|
+
</tr>`;
|
|
1293
|
+
});
|
|
1294
|
+
return `${html}</tbody></table>`;
|
|
2150
1295
|
};
|
|
2151
1296
|
}
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
return accumulator;
|
|
2167
|
-
}.bind(this), 0);
|
|
1297
|
+
}
|
|
1298
|
+
countEpochsInRegion(region) {
|
|
1299
|
+
const $$ = this;
|
|
1300
|
+
const target = $$.data.targets[0];
|
|
1301
|
+
const total = target.values.reduce(
|
|
1302
|
+
(accumulator, currentValue) => accumulator + Number(currentValue.epochs),
|
|
1303
|
+
0
|
|
1304
|
+
);
|
|
1305
|
+
const value = target.values.reduce((accumulator, currentValue) => {
|
|
1306
|
+
if (pointInRegion(currentValue, region)) {
|
|
1307
|
+
return accumulator + Number(currentValue.epochs);
|
|
1308
|
+
}
|
|
1309
|
+
return accumulator;
|
|
1310
|
+
}, 0);
|
|
2168
1311
|
return {
|
|
2169
|
-
value
|
|
1312
|
+
value,
|
|
2170
1313
|
percentage: value !== 0 ? +(value / total * 100).toFixed(1) : 0
|
|
2171
1314
|
};
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
}(Plugin);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
2175
1317
|
|
|
2176
1318
|
}();
|
|
2177
1319
|
__webpack_exports__ = __webpack_exports__["default"];
|