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-brush"), require("d3-selection"));
|
|
15
15
|
else if(typeof define === 'function' && define.amd)
|
|
16
|
-
define("bb", ["d3-
|
|
16
|
+
define("bb", ["d3-brush", "d3-selection"], factory);
|
|
17
17
|
else if(typeof exports === 'object')
|
|
18
|
-
exports["bb"] = factory(require("d3-
|
|
18
|
+
exports["bb"] = factory(require("d3-brush"), require("d3-selection"));
|
|
19
19
|
else
|
|
20
20
|
root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["sparkline"] = factory(root["d3"], root["d3"]);
|
|
21
|
-
})(this, function(
|
|
21
|
+
})(this, function(__WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__1__) {
|
|
22
22
|
return /******/ (function() { // webpackBootstrap
|
|
23
23
|
/******/ "use strict";
|
|
24
24
|
/******/ var __webpack_modules__ = ([
|
|
@@ -90,91 +90,23 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
90
90
|
"default": function() { return /* binding */ Sparkline; }
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/newArrowCheck.js
|
|
94
|
-
function _newArrowCheck(innerThis, boundThis) {
|
|
95
|
-
if (innerThis !== boundThis) {
|
|
96
|
-
throw new TypeError("Cannot instantiate an arrow function");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
100
|
-
function _assertThisInitialized(self) {
|
|
101
|
-
if (self === void 0) {
|
|
102
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
103
|
-
}
|
|
104
|
-
return self;
|
|
105
|
-
}
|
|
106
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
107
|
-
function _setPrototypeOf(o, p) {
|
|
108
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
109
|
-
o.__proto__ = p;
|
|
110
|
-
return o;
|
|
111
|
-
};
|
|
112
|
-
return _setPrototypeOf(o, p);
|
|
113
|
-
}
|
|
114
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
115
|
-
|
|
116
|
-
function _inheritsLoose(subClass, superClass) {
|
|
117
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
118
|
-
subClass.prototype.constructor = subClass;
|
|
119
|
-
_setPrototypeOf(subClass, superClass);
|
|
120
|
-
}
|
|
121
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
122
|
-
function _typeof(o) {
|
|
123
|
-
"@babel/helpers - typeof";
|
|
124
|
-
|
|
125
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
126
|
-
return typeof o;
|
|
127
|
-
} : function (o) {
|
|
128
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
129
|
-
}, _typeof(o);
|
|
130
|
-
}
|
|
131
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
132
|
-
|
|
133
|
-
function toPrimitive(t, r) {
|
|
134
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
135
|
-
var e = t[Symbol.toPrimitive];
|
|
136
|
-
if (void 0 !== e) {
|
|
137
|
-
var i = e.call(t, r || "default");
|
|
138
|
-
if ("object" != _typeof(i)) return i;
|
|
139
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
140
|
-
}
|
|
141
|
-
return ("string" === r ? String : Number)(t);
|
|
142
|
-
}
|
|
143
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
function toPropertyKey(t) {
|
|
147
|
-
var i = toPrimitive(t, "string");
|
|
148
|
-
return "symbol" == _typeof(i) ? i : String(i);
|
|
149
|
-
}
|
|
150
|
-
;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
151
|
-
|
|
152
|
-
function _defineProperty(obj, key, value) {
|
|
153
|
-
key = toPropertyKey(key);
|
|
154
|
-
if (key in obj) {
|
|
155
|
-
Object.defineProperty(obj, key, {
|
|
156
|
-
value: value,
|
|
157
|
-
enumerable: true,
|
|
158
|
-
configurable: true,
|
|
159
|
-
writable: true
|
|
160
|
-
});
|
|
161
|
-
} else {
|
|
162
|
-
obj[key] = value;
|
|
163
|
-
}
|
|
164
|
-
return obj;
|
|
165
|
-
}
|
|
166
93
|
;// CONCATENATED MODULE: ./src/config/classes.ts
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
94
|
+
var __defProp = Object.defineProperty;
|
|
95
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
96
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
97
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
98
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
99
|
+
var __spreadValues = (a, b) => {
|
|
100
|
+
for (var prop in b || (b = {}))
|
|
101
|
+
if (__hasOwnProp.call(b, prop))
|
|
102
|
+
__defNormalProp(a, prop, b[prop]);
|
|
103
|
+
if (__getOwnPropSymbols)
|
|
104
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
105
|
+
if (__propIsEnum.call(b, prop))
|
|
106
|
+
__defNormalProp(a, prop, b[prop]);
|
|
107
|
+
}
|
|
108
|
+
return a;
|
|
109
|
+
};
|
|
178
110
|
const $COMMON = {
|
|
179
111
|
button: "bb-button",
|
|
180
112
|
chart: "bb-chart",
|
|
@@ -205,7 +137,10 @@ const $AXIS = {
|
|
|
205
137
|
axisY: "bb-axis-y",
|
|
206
138
|
axisY2: "bb-axis-y2",
|
|
207
139
|
axisY2Label: "bb-axis-y2-label",
|
|
208
|
-
axisYLabel: "bb-axis-y-label"
|
|
140
|
+
axisYLabel: "bb-axis-y-label",
|
|
141
|
+
axisXTooltip: "bb-axis-x-tooltip",
|
|
142
|
+
axisYTooltip: "bb-axis-y-tooltip",
|
|
143
|
+
axisY2Tooltip: "bb-axis-y2-tooltip"
|
|
209
144
|
};
|
|
210
145
|
const $BAR = {
|
|
211
146
|
bar: "bb-bar",
|
|
@@ -234,6 +169,12 @@ const $DRAG = {
|
|
|
234
169
|
dragarea: "bb-dragarea",
|
|
235
170
|
INCLUDED: "_included_"
|
|
236
171
|
};
|
|
172
|
+
const $FUNNEL = {
|
|
173
|
+
funnel: "bb-funnel",
|
|
174
|
+
chartFunnel: "bb-chart-funnel",
|
|
175
|
+
chartFunnels: "bb-chart-funnels",
|
|
176
|
+
funnelBackground: "bb-funnel-background"
|
|
177
|
+
};
|
|
237
178
|
const $GAUGE = {
|
|
238
179
|
chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
|
239
180
|
chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
|
@@ -328,534 +269,181 @@ const $ZOOM = {
|
|
|
328
269
|
buttonZoomReset: "bb-zoom-reset",
|
|
329
270
|
zoomBrush: "bb-zoom-brush"
|
|
330
271
|
};
|
|
331
|
-
/* harmony default export */ var classes = (
|
|
332
|
-
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
336
|
-
* billboard.js project is licensed under the MIT license
|
|
337
|
-
*/
|
|
338
|
-
/**
|
|
339
|
-
* Base class to generate billboard.js plugin
|
|
340
|
-
* @class Plugin
|
|
341
|
-
*/
|
|
342
|
-
/**
|
|
343
|
-
* Version info string for plugin
|
|
344
|
-
* @name version
|
|
345
|
-
* @static
|
|
346
|
-
* @memberof Plugin
|
|
347
|
-
* @type {string}
|
|
348
|
-
* @example
|
|
349
|
-
* bb.plugin.stanford.version; // ex) 1.9.0
|
|
350
|
-
*/
|
|
351
|
-
let Plugin = /*#__PURE__*/function () {
|
|
352
|
-
/**
|
|
353
|
-
* Constructor
|
|
354
|
-
* @param {Any} options config option object
|
|
355
|
-
* @private
|
|
356
|
-
*/
|
|
357
|
-
function Plugin(options) {
|
|
358
|
-
if (options === void 0) {
|
|
359
|
-
options = {};
|
|
360
|
-
}
|
|
361
|
-
this.$$ = void 0;
|
|
362
|
-
this.options = void 0;
|
|
363
|
-
this.options = options;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Lifecycle hook for 'beforeInit' phase.
|
|
368
|
-
* @private
|
|
369
|
-
*/
|
|
370
|
-
var _proto = Plugin.prototype;
|
|
371
|
-
_proto.$beforeInit = function $beforeInit() {}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Lifecycle hook for 'init' phase.
|
|
375
|
-
* @private
|
|
376
|
-
*/;
|
|
377
|
-
_proto.$init = function $init() {}
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Lifecycle hook for 'afterInit' phase.
|
|
381
|
-
* @private
|
|
382
|
-
*/;
|
|
383
|
-
_proto.$afterInit = function $afterInit() {}
|
|
272
|
+
/* 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));
|
|
384
273
|
|
|
385
|
-
/**
|
|
386
|
-
* Lifecycle hook for 'redraw' phase.
|
|
387
|
-
* @private
|
|
388
|
-
*/;
|
|
389
|
-
_proto.$redraw = function $redraw() {}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Lifecycle hook for 'willDestroy' phase.
|
|
393
|
-
* @private
|
|
394
|
-
*/;
|
|
395
|
-
_proto.$willDestroy = function $willDestroy() {
|
|
396
|
-
var _this = this;
|
|
397
|
-
Object.keys(this).forEach(function (key) {
|
|
398
|
-
_newArrowCheck(this, _this);
|
|
399
|
-
this[key] = null;
|
|
400
|
-
delete this[key];
|
|
401
|
-
}.bind(this));
|
|
402
|
-
};
|
|
403
|
-
return Plugin;
|
|
404
|
-
}();
|
|
405
|
-
Plugin.version = "3.11.3";
|
|
406
|
-
|
|
407
|
-
;// CONCATENATED MODULE: ./src/Plugin/sparkline/Options.ts
|
|
408
|
-
/**
|
|
409
|
-
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
410
|
-
* billboard.js project is licensed under the MIT license
|
|
411
|
-
*/
|
|
412
|
-
/**
|
|
413
|
-
* Sparkline plugin option class
|
|
414
|
-
* @class SparklineOptions
|
|
415
|
-
* @param {Options} options Sparkline plugin options
|
|
416
|
-
* @augments Plugin
|
|
417
|
-
* @returns {TableviewOptions}
|
|
418
|
-
* @private
|
|
419
|
-
*/
|
|
420
|
-
let Options = function () {
|
|
421
|
-
return {
|
|
422
|
-
/**
|
|
423
|
-
* Specify sparkline charts holder selector.
|
|
424
|
-
* - **NOTE:** The amount of holder should match with the amount of data. If has less, will append necessaray amount nodes as sibling of main chart.
|
|
425
|
-
* @name selector
|
|
426
|
-
* @memberof plugin-sparkline
|
|
427
|
-
* @type {string}
|
|
428
|
-
* @default undefined
|
|
429
|
-
* @example
|
|
430
|
-
* selector: ".sparkline"
|
|
431
|
-
*/
|
|
432
|
-
selector: undefined
|
|
433
|
-
};
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
// EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
|
|
437
|
-
var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
|
438
274
|
// EXTERNAL MODULE: external {"commonjs":"d3-brush","commonjs2":"d3-brush","amd":"d3-brush","root":"d3"}
|
|
439
275
|
var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
|
276
|
+
// EXTERNAL MODULE: external {"commonjs":"d3-selection","commonjs2":"d3-selection","amd":"d3-selection","root":"d3"}
|
|
277
|
+
var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
|
440
278
|
;// CONCATENATED MODULE: ./src/module/browser.ts
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
444
|
-
* billboard.js project is licensed under the MIT license
|
|
445
|
-
*/
|
|
446
|
-
/**
|
|
447
|
-
* Window object
|
|
448
|
-
* @private
|
|
449
|
-
*/
|
|
450
|
-
/* eslint-disable no-new-func, no-undef */
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Get global object
|
|
455
|
-
* @returns {object} window object
|
|
456
|
-
* @private
|
|
457
|
-
*/
|
|
458
279
|
function getGlobal() {
|
|
459
280
|
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")();
|
|
460
281
|
}
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Get fallback object
|
|
464
|
-
* @param {object} w global object
|
|
465
|
-
* @returns {Array} fallback object array
|
|
466
|
-
* @private
|
|
467
|
-
*/
|
|
468
282
|
function getFallback(w) {
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}.bind(this);
|
|
480
|
-
return [hasRAF ? w.requestAnimationFrame : request, hasRAF ? w.cancelAnimationFrame : cancel, hasRIC ? w.requestIdleCallback : request, hasRIC ? w.cancelIdleCallback : cancel];
|
|
283
|
+
const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function";
|
|
284
|
+
const hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function";
|
|
285
|
+
const request = (cb) => setTimeout(cb, 1);
|
|
286
|
+
const cancel = (id) => clearTimeout(id);
|
|
287
|
+
return [
|
|
288
|
+
hasRAF ? w.requestAnimationFrame : request,
|
|
289
|
+
hasRAF ? w.cancelAnimationFrame : cancel,
|
|
290
|
+
hasRIC ? w.requestIdleCallback : request,
|
|
291
|
+
hasRIC ? w.cancelIdleCallback : cancel
|
|
292
|
+
];
|
|
481
293
|
}
|
|
482
|
-
const win = getGlobal()
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
requestAnimationFrame
|
|
486
|
-
cancelAnimationFrame
|
|
487
|
-
requestIdleCallback
|
|
488
|
-
cancelIdleCallback
|
|
489
|
-
|
|
294
|
+
const win = getGlobal();
|
|
295
|
+
const doc = win == null ? void 0 : win.document;
|
|
296
|
+
const [
|
|
297
|
+
requestAnimationFrame,
|
|
298
|
+
cancelAnimationFrame,
|
|
299
|
+
requestIdleCallback,
|
|
300
|
+
cancelIdleCallback
|
|
301
|
+
] = getFallback(win);
|
|
490
302
|
|
|
491
303
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
304
|
+
;// CONCATENATED MODULE: ./src/module/util.ts
|
|
305
|
+
var util_defProp = Object.defineProperty;
|
|
306
|
+
var util_getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
307
|
+
var util_hasOwnProp = Object.prototype.hasOwnProperty;
|
|
308
|
+
var util_propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
309
|
+
var util_defNormalProp = (obj, key, value) => key in obj ? util_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
310
|
+
var util_spreadValues = (a, b) => {
|
|
311
|
+
for (var prop in b || (b = {}))
|
|
312
|
+
if (util_hasOwnProp.call(b, prop))
|
|
313
|
+
util_defNormalProp(a, prop, b[prop]);
|
|
314
|
+
if (util_getOwnPropSymbols)
|
|
315
|
+
for (var prop of util_getOwnPropSymbols(b)) {
|
|
316
|
+
if (util_propIsEnum.call(b, prop))
|
|
317
|
+
util_defNormalProp(a, prop, b[prop]);
|
|
318
|
+
}
|
|
319
|
+
return a;
|
|
320
|
+
};
|
|
500
321
|
|
|
501
322
|
|
|
502
323
|
|
|
503
324
|
|
|
504
|
-
const isValue =
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}.bind(undefined),
|
|
520
|
-
isUndefined = function (v) {
|
|
521
|
-
_newArrowCheck(this, _this);
|
|
522
|
-
return typeof v === "undefined";
|
|
523
|
-
}.bind(undefined),
|
|
524
|
-
isDefined = function (v) {
|
|
525
|
-
_newArrowCheck(this, _this);
|
|
526
|
-
return typeof v !== "undefined";
|
|
527
|
-
}.bind(undefined),
|
|
528
|
-
isboolean = function (v) {
|
|
529
|
-
_newArrowCheck(this, _this);
|
|
530
|
-
return typeof v === "boolean";
|
|
531
|
-
}.bind(undefined),
|
|
532
|
-
ceil10 = function (v) {
|
|
533
|
-
_newArrowCheck(this, _this);
|
|
534
|
-
return Math.ceil(v / 10) * 10;
|
|
535
|
-
}.bind(undefined),
|
|
536
|
-
asHalfPixel = function (n) {
|
|
537
|
-
_newArrowCheck(this, _this);
|
|
538
|
-
return Math.ceil(n) + .5;
|
|
539
|
-
}.bind(undefined),
|
|
540
|
-
diffDomain = function (d) {
|
|
541
|
-
_newArrowCheck(this, _this);
|
|
542
|
-
return d[1] - d[0];
|
|
543
|
-
}.bind(undefined),
|
|
544
|
-
isObjectType = function (v) {
|
|
545
|
-
_newArrowCheck(this, _this);
|
|
546
|
-
return typeof v === "object";
|
|
547
|
-
}.bind(undefined),
|
|
548
|
-
isEmpty = function (o) {
|
|
549
|
-
_newArrowCheck(this, _this);
|
|
550
|
-
return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
|
551
|
-
}.bind(undefined),
|
|
552
|
-
notEmpty = function (o) {
|
|
553
|
-
_newArrowCheck(this, _this);
|
|
554
|
-
return !isEmpty(o);
|
|
555
|
-
}.bind(undefined),
|
|
556
|
-
isArray = function (arr) {
|
|
557
|
-
_newArrowCheck(this, _this);
|
|
558
|
-
return Array.isArray(arr);
|
|
559
|
-
}.bind(undefined),
|
|
560
|
-
isObject = function (obj) {
|
|
561
|
-
_newArrowCheck(this, _this);
|
|
562
|
-
return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
563
|
-
}.bind(undefined);
|
|
564
|
-
/**
|
|
565
|
-
* Check if is array
|
|
566
|
-
* @param {Array} arr Data to be checked
|
|
567
|
-
* @returns {boolean}
|
|
568
|
-
* @private
|
|
569
|
-
*/
|
|
570
|
-
/**
|
|
571
|
-
* Check if is object
|
|
572
|
-
* @param {object} obj Data to be checked
|
|
573
|
-
* @returns {boolean}
|
|
574
|
-
* @private
|
|
575
|
-
*/
|
|
576
|
-
/**
|
|
577
|
-
* Get specified key value from object
|
|
578
|
-
* If default value is given, will return if given key value not found
|
|
579
|
-
* @param {object} options Source object
|
|
580
|
-
* @param {string} key Key value
|
|
581
|
-
* @param {*} defaultValue Default value
|
|
582
|
-
* @returns {*}
|
|
583
|
-
* @private
|
|
584
|
-
*/
|
|
325
|
+
const isValue = (v) => v || v === 0;
|
|
326
|
+
const isFunction = (v) => typeof v === "function";
|
|
327
|
+
const isString = (v) => typeof v === "string";
|
|
328
|
+
const isNumber = (v) => typeof v === "number";
|
|
329
|
+
const isUndefined = (v) => typeof v === "undefined";
|
|
330
|
+
const isDefined = (v) => typeof v !== "undefined";
|
|
331
|
+
const isBoolean = (v) => typeof v === "boolean";
|
|
332
|
+
const ceil10 = (v) => Math.ceil(v / 10) * 10;
|
|
333
|
+
const asHalfPixel = (n) => Math.ceil(n) + 0.5;
|
|
334
|
+
const diffDomain = (d) => d[1] - d[0];
|
|
335
|
+
const isObjectType = (v) => typeof v === "object";
|
|
336
|
+
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);
|
|
337
|
+
const notEmpty = (o) => !isEmpty(o);
|
|
338
|
+
const isArray = (arr) => Array.isArray(arr);
|
|
339
|
+
const isObject = (obj) => obj && !(obj == null ? void 0 : obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
|
585
340
|
function getOption(options, key, defaultValue) {
|
|
586
341
|
return isDefined(options[key]) ? options[key] : defaultValue;
|
|
587
342
|
}
|
|
588
|
-
|
|
589
|
-
/**
|
|
590
|
-
* Check if value exist in the given object
|
|
591
|
-
* @param {object} dict Target object to be checked
|
|
592
|
-
* @param {*} value Value to be checked
|
|
593
|
-
* @returns {boolean}
|
|
594
|
-
* @private
|
|
595
|
-
*/
|
|
596
343
|
function hasValue(dict, value) {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
Object.keys(dict).forEach(function (key) {
|
|
600
|
-
_newArrowCheck(this, _this2);
|
|
601
|
-
return dict[key] === value && (found = !0);
|
|
602
|
-
}.bind(this));
|
|
344
|
+
let found = false;
|
|
345
|
+
Object.keys(dict).forEach((key) => dict[key] === value && (found = true));
|
|
603
346
|
return found;
|
|
604
347
|
}
|
|
605
|
-
|
|
606
|
-
/**
|
|
607
|
-
* Call function with arguments
|
|
608
|
-
* @param {Function} fn Function to be called
|
|
609
|
-
* @param {*} thisArg "this" value for fn
|
|
610
|
-
* @param {*} args Arguments for fn
|
|
611
|
-
* @returns {boolean} true: fn is function, false: fn is not function
|
|
612
|
-
* @private
|
|
613
|
-
*/
|
|
614
|
-
function callFn(fn, thisArg) {
|
|
348
|
+
function callFn(fn, thisArg, ...args) {
|
|
615
349
|
const isFn = isFunction(fn);
|
|
616
|
-
|
|
617
|
-
args[_key - 2] = arguments[_key];
|
|
618
|
-
}
|
|
619
|
-
isFn && fn.call.apply(fn, [thisArg].concat(args));
|
|
350
|
+
isFn && fn.call(thisArg, ...args);
|
|
620
351
|
return isFn;
|
|
621
352
|
}
|
|
622
|
-
|
|
623
|
-
/**
|
|
624
|
-
* Call function after all transitions ends
|
|
625
|
-
* @param {d3.transition} transition Transition
|
|
626
|
-
* @param {Fucntion} cb Callback function
|
|
627
|
-
* @private
|
|
628
|
-
*/
|
|
629
353
|
function endall(transition, cb) {
|
|
630
|
-
var _this3 = this;
|
|
631
354
|
let n = 0;
|
|
632
|
-
const end = function
|
|
633
|
-
|
|
634
|
-
args[_key2] = arguments[_key2];
|
|
635
|
-
}
|
|
636
|
-
--n || cb.apply.apply(cb, [this].concat(args));
|
|
355
|
+
const end = function(...args) {
|
|
356
|
+
!--n && cb.apply(this, ...args);
|
|
637
357
|
};
|
|
638
|
-
|
|
639
|
-
// if is transition selection
|
|
640
358
|
if ("duration" in transition) {
|
|
641
|
-
transition.each(
|
|
642
|
-
_newArrowCheck(this, _this3);
|
|
643
|
-
return ++n;
|
|
644
|
-
}.bind(this)).on("end", end);
|
|
359
|
+
transition.each(() => ++n).on("end", end);
|
|
645
360
|
} else {
|
|
646
361
|
++n;
|
|
647
362
|
transition.call(end);
|
|
648
363
|
}
|
|
649
364
|
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* Replace tag sign to html entity
|
|
653
|
-
* @param {string} str Target string value
|
|
654
|
-
* @returns {string}
|
|
655
|
-
* @private
|
|
656
|
-
*/
|
|
657
365
|
function sanitize(str) {
|
|
658
366
|
return isString(str) ? str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") : str;
|
|
659
367
|
}
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Set text value. If there's multiline add nodes.
|
|
663
|
-
* @param {d3Selection} node Text node
|
|
664
|
-
* @param {string} text Text value string
|
|
665
|
-
* @param {Array} dy dy value for multilined text
|
|
666
|
-
* @param {boolean} toMiddle To be alingned vertically middle
|
|
667
|
-
* @private
|
|
668
|
-
*/
|
|
669
|
-
function setTextValue(node, text, dy, toMiddle) {
|
|
670
|
-
var _this4 = this;
|
|
671
|
-
if (dy === void 0) {
|
|
672
|
-
dy = [-1, 1];
|
|
673
|
-
}
|
|
674
|
-
if (toMiddle === void 0) {
|
|
675
|
-
toMiddle = !1;
|
|
676
|
-
}
|
|
368
|
+
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
677
369
|
if (!node || !isString(text)) {
|
|
678
370
|
return;
|
|
679
371
|
}
|
|
680
372
|
if (text.indexOf("\n") === -1) {
|
|
681
373
|
node.text(text);
|
|
682
374
|
} else {
|
|
683
|
-
const diff = [node.text(), text].map(
|
|
684
|
-
_newArrowCheck(this, _this4);
|
|
685
|
-
return v.replace(/[\s\n]/g, "");
|
|
686
|
-
}.bind(this));
|
|
375
|
+
const diff = [node.text(), text].map((v) => v.replace(/[\s\n]/g, ""));
|
|
687
376
|
if (diff[0] !== diff[1]) {
|
|
688
|
-
const multiline = text.split("\n")
|
|
689
|
-
|
|
690
|
-
// reset possible text
|
|
377
|
+
const multiline = text.split("\n");
|
|
378
|
+
const len = toMiddle ? multiline.length - 1 : 1;
|
|
691
379
|
node.html("");
|
|
692
|
-
multiline.forEach(
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}.bind(this));
|
|
380
|
+
multiline.forEach((v, i) => {
|
|
381
|
+
node.append("tspan").attr("x", 0).attr("dy", `${i === 0 ? dy[0] * len : dy[1]}em`).text(v);
|
|
382
|
+
});
|
|
696
383
|
}
|
|
697
384
|
}
|
|
698
385
|
}
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* Substitution of SVGPathSeg API polyfill
|
|
702
|
-
* @param {SVGGraphicsElement} path Target svg element
|
|
703
|
-
* @returns {Array}
|
|
704
|
-
* @private
|
|
705
|
-
*/
|
|
706
386
|
function getRectSegList(path) {
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
x
|
|
716
|
-
|
|
717
|
-
width = _path$getBBox.width,
|
|
718
|
-
height = _path$getBBox.height;
|
|
719
|
-
return [{
|
|
720
|
-
x: x,
|
|
721
|
-
y: y + height
|
|
722
|
-
},
|
|
723
|
-
// seg0
|
|
724
|
-
{
|
|
725
|
-
x: x,
|
|
726
|
-
y: y
|
|
727
|
-
},
|
|
728
|
-
// seg1
|
|
729
|
-
{
|
|
730
|
-
x: x + width,
|
|
731
|
-
y: y
|
|
732
|
-
},
|
|
733
|
-
// seg2
|
|
734
|
-
{
|
|
735
|
-
x: x + width,
|
|
736
|
-
y: y + height
|
|
737
|
-
} // seg3
|
|
387
|
+
const { x, y, width, height } = path.getBBox();
|
|
388
|
+
return [
|
|
389
|
+
{ x, y: y + height },
|
|
390
|
+
// seg0
|
|
391
|
+
{ x, y },
|
|
392
|
+
// seg1
|
|
393
|
+
{ x: x + width, y },
|
|
394
|
+
// seg2
|
|
395
|
+
{ x: x + width, y: y + height }
|
|
396
|
+
// seg3
|
|
738
397
|
];
|
|
739
398
|
}
|
|
740
|
-
|
|
741
|
-
/**
|
|
742
|
-
* Get svg bounding path box dimension
|
|
743
|
-
* @param {SVGGraphicsElement} path Target svg element
|
|
744
|
-
* @returns {object}
|
|
745
|
-
* @private
|
|
746
|
-
*/
|
|
747
399
|
function getPathBox(path) {
|
|
748
|
-
const
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
x = items[0].x,
|
|
753
|
-
y = Math.min(items[0].y, items[1].y);
|
|
400
|
+
const { width, height } = path.getBoundingClientRect();
|
|
401
|
+
const items = getRectSegList(path);
|
|
402
|
+
const x = items[0].x;
|
|
403
|
+
const y = Math.min(items[0].y, items[1].y);
|
|
754
404
|
return {
|
|
755
|
-
x
|
|
756
|
-
y
|
|
757
|
-
width
|
|
758
|
-
height
|
|
405
|
+
x,
|
|
406
|
+
y,
|
|
407
|
+
width,
|
|
408
|
+
height
|
|
759
409
|
};
|
|
760
410
|
}
|
|
761
|
-
|
|
762
|
-
/**
|
|
763
|
-
* Get event's current position coordinates
|
|
764
|
-
* @param {object} event Event object
|
|
765
|
-
* @param {SVGElement|HTMLElement} element Target element
|
|
766
|
-
* @returns {Array} [x, y] Coordinates x, y array
|
|
767
|
-
* @private
|
|
768
|
-
*/
|
|
769
411
|
function getPointer(event, element) {
|
|
770
|
-
var
|
|
771
|
-
|
|
772
|
-
const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]);
|
|
412
|
+
var _a;
|
|
413
|
+
const touches = event && ((_a = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _a[0]);
|
|
773
414
|
let pointer = [0, 0];
|
|
774
415
|
try {
|
|
775
416
|
pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
|
|
776
|
-
} catch (e) {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
return isNaN(v) ? 0 : v;
|
|
780
|
-
}.bind(this));
|
|
417
|
+
} catch (e) {
|
|
418
|
+
}
|
|
419
|
+
return pointer.map((v) => isNaN(v) ? 0 : v);
|
|
781
420
|
}
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Return brush selection array
|
|
785
|
-
* @param {object} ctx Current instance
|
|
786
|
-
* @returns {d3.brushSelection}
|
|
787
|
-
* @private
|
|
788
|
-
*/
|
|
789
421
|
function getBrushSelection(ctx) {
|
|
790
|
-
const event = ctx
|
|
791
|
-
|
|
792
|
-
main = $el.subchart.main || $el.main;
|
|
422
|
+
const { event, $el } = ctx;
|
|
423
|
+
const main = $el.subchart.main || $el.main;
|
|
793
424
|
let selection;
|
|
794
|
-
|
|
795
|
-
// check from event
|
|
796
425
|
if (event && event.type === "brush") {
|
|
797
426
|
selection = event.selection;
|
|
798
|
-
// check from brush area selection
|
|
799
427
|
} else if (main && (selection = main.select(".bb-brush").node())) {
|
|
800
428
|
selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
|
|
801
429
|
}
|
|
802
430
|
return selection;
|
|
803
431
|
}
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Get boundingClientRect.
|
|
807
|
-
* Cache the evaluated value once it was called.
|
|
808
|
-
* @param {HTMLElement} node Target element
|
|
809
|
-
* @returns {object}
|
|
810
|
-
* @private
|
|
811
|
-
*/
|
|
812
432
|
function getBoundingRect(node) {
|
|
813
433
|
const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
|
814
434
|
return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
|
815
435
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
* @param {number} min Minimum value
|
|
821
|
-
* @param {number} max Maximum value
|
|
822
|
-
* @returns {number|string}
|
|
823
|
-
* @private
|
|
824
|
-
*/
|
|
825
|
-
function getRandom(asStr, min, max) {
|
|
826
|
-
if (asStr === void 0) {
|
|
827
|
-
asStr = !0;
|
|
828
|
-
}
|
|
829
|
-
if (min === void 0) {
|
|
830
|
-
min = 0;
|
|
831
|
-
}
|
|
832
|
-
if (max === void 0) {
|
|
833
|
-
max = 1e4;
|
|
834
|
-
}
|
|
835
|
-
const crpt = win.crypto || win.msCrypto,
|
|
836
|
-
rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
837
|
-
return asStr ? rand + "" : rand;
|
|
436
|
+
function getRandom(asStr = true, min = 0, max = 1e4) {
|
|
437
|
+
const crpt = win.crypto || win.msCrypto;
|
|
438
|
+
const rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min);
|
|
439
|
+
return asStr ? String(rand) : rand;
|
|
838
440
|
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* Find index based on binary search
|
|
842
|
-
* @param {Array} arr Data array
|
|
843
|
-
* @param {number} v Target number to find
|
|
844
|
-
* @param {number} start Start index of data array
|
|
845
|
-
* @param {number} end End index of data arr
|
|
846
|
-
* @param {boolean} isRotated Weather is roted axis
|
|
847
|
-
* @returns {number} Index number
|
|
848
|
-
* @private
|
|
849
|
-
*/
|
|
850
441
|
function findIndex(arr, v, start, end, isRotated) {
|
|
851
442
|
if (start > end) {
|
|
852
443
|
return -1;
|
|
853
444
|
}
|
|
854
445
|
const mid = Math.floor((start + end) / 2);
|
|
855
|
-
let
|
|
856
|
-
x = _arr$mid.x,
|
|
857
|
-
_arr$mid$w = _arr$mid.w,
|
|
858
|
-
w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
|
446
|
+
let { x, w = 0 } = arr[mid];
|
|
859
447
|
if (isRotated) {
|
|
860
448
|
x = arr[mid].y;
|
|
861
449
|
w = arr[mid].h;
|
|
@@ -865,75 +453,30 @@ function findIndex(arr, v, start, end, isRotated) {
|
|
|
865
453
|
}
|
|
866
454
|
return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
|
|
867
455
|
}
|
|
868
|
-
|
|
869
|
-
/**
|
|
870
|
-
* Check if brush is empty
|
|
871
|
-
* @param {object} ctx Bursh context
|
|
872
|
-
* @returns {boolean}
|
|
873
|
-
* @private
|
|
874
|
-
*/
|
|
875
456
|
function brushEmpty(ctx) {
|
|
876
457
|
const selection = getBrushSelection(ctx);
|
|
877
458
|
if (selection) {
|
|
878
|
-
// brush selected area
|
|
879
|
-
// two-dimensional: [[x0, y0], [x1, y1]]
|
|
880
|
-
// one-dimensional: [x0, x1] or [y0, y1]
|
|
881
459
|
return selection[0] === selection[1];
|
|
882
460
|
}
|
|
883
|
-
return
|
|
461
|
+
return true;
|
|
884
462
|
}
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
* Deep copy object
|
|
888
|
-
* @param {object} objectN Source object
|
|
889
|
-
* @returns {object} Cloned object
|
|
890
|
-
* @private
|
|
891
|
-
*/
|
|
892
|
-
function deepClone() {
|
|
893
|
-
var _this6 = this;
|
|
894
|
-
const _clone = function clone(v) {
|
|
895
|
-
_newArrowCheck(this, _this6);
|
|
463
|
+
function deepClone(...objectN) {
|
|
464
|
+
const clone = (v) => {
|
|
896
465
|
if (isObject(v) && v.constructor) {
|
|
897
466
|
const r = new v.constructor();
|
|
898
467
|
for (const k in v) {
|
|
899
|
-
r[k] =
|
|
468
|
+
r[k] = clone(v[k]);
|
|
900
469
|
}
|
|
901
470
|
return r;
|
|
902
471
|
}
|
|
903
472
|
return v;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
objectN[_key3] = arguments[_key3];
|
|
907
|
-
}
|
|
908
|
-
return objectN.map(function (v) {
|
|
909
|
-
_newArrowCheck(this, _this6);
|
|
910
|
-
return _clone(v);
|
|
911
|
-
}.bind(this)).reduce(function (a, c) {
|
|
912
|
-
_newArrowCheck(this, _this6);
|
|
913
|
-
return util_objectSpread(util_objectSpread({}, a), c);
|
|
914
|
-
}.bind(this));
|
|
473
|
+
};
|
|
474
|
+
return objectN.map((v) => clone(v)).reduce((a, c) => util_spreadValues(util_spreadValues({}, a), c));
|
|
915
475
|
}
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* Extend target from source object
|
|
919
|
-
* @param {object} target Target object
|
|
920
|
-
* @param {object|Array} source Source object
|
|
921
|
-
* @returns {object}
|
|
922
|
-
* @private
|
|
923
|
-
*/
|
|
924
|
-
function extend(target, source) {
|
|
925
|
-
var _this7 = this;
|
|
926
|
-
if (target === void 0) {
|
|
927
|
-
target = {};
|
|
928
|
-
}
|
|
476
|
+
function extend(target = {}, source) {
|
|
929
477
|
if (isArray(source)) {
|
|
930
|
-
source.forEach(
|
|
931
|
-
_newArrowCheck(this, _this7);
|
|
932
|
-
return extend(target, v);
|
|
933
|
-
}.bind(this));
|
|
478
|
+
source.forEach((v) => extend(target, v));
|
|
934
479
|
}
|
|
935
|
-
|
|
936
|
-
// exclude name with only numbers
|
|
937
480
|
for (const p in source) {
|
|
938
481
|
if (/^\d+$/.test(p) || p in target) {
|
|
939
482
|
continue;
|
|
@@ -942,575 +485,355 @@ function extend(target, source) {
|
|
|
942
485
|
}
|
|
943
486
|
return target;
|
|
944
487
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
* @param {string} str Target string
|
|
949
|
-
* @returns {string} capitalized string
|
|
950
|
-
* @private
|
|
951
|
-
*/
|
|
952
|
-
const capitalize = function (str) {
|
|
953
|
-
_newArrowCheck(this, _this);
|
|
954
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
955
|
-
}.bind(undefined);
|
|
956
|
-
|
|
957
|
-
/**
|
|
958
|
-
* Camelize from kebob style string
|
|
959
|
-
* @param {string} str Target string
|
|
960
|
-
* @param {string} separator Separator string
|
|
961
|
-
* @returns {string} camelized string
|
|
962
|
-
* @private
|
|
963
|
-
*/
|
|
964
|
-
function camelize(str, separator) {
|
|
965
|
-
var _this8 = this;
|
|
966
|
-
if (separator === void 0) {
|
|
967
|
-
separator = "-";
|
|
968
|
-
}
|
|
969
|
-
return str.split(separator).map(function (v, i) {
|
|
970
|
-
_newArrowCheck(this, _this8);
|
|
971
|
-
return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
|
|
972
|
-
}.bind(this)).join("");
|
|
488
|
+
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
489
|
+
function camelize(str, separator = "-") {
|
|
490
|
+
return str.split(separator).map((v, i) => i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase()).join("");
|
|
973
491
|
}
|
|
974
|
-
|
|
975
|
-
/**
|
|
976
|
-
* Convert to array
|
|
977
|
-
* @param {object} v Target to be converted
|
|
978
|
-
* @returns {Array}
|
|
979
|
-
* @private
|
|
980
|
-
*/
|
|
981
|
-
const toArray = function (v) {
|
|
982
|
-
_newArrowCheck(this, _this);
|
|
983
|
-
return [].slice.call(v);
|
|
984
|
-
}.bind(undefined);
|
|
985
|
-
|
|
986
|
-
/**
|
|
987
|
-
* Add CSS rules
|
|
988
|
-
* @param {object} style Style object
|
|
989
|
-
* @param {string} selector Selector string
|
|
990
|
-
* @param {Array} prop Prps arrary
|
|
991
|
-
* @returns {number} Newely added rule index
|
|
992
|
-
* @private
|
|
993
|
-
*/
|
|
492
|
+
const toArray = (v) => [].slice.call(v);
|
|
994
493
|
function addCssRules(style, selector, prop) {
|
|
995
|
-
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}.bind(this),
|
|
1003
|
-
rule = rootSelector + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
|
1004
|
-
return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
|
494
|
+
const { rootSelector = "", sheet } = style;
|
|
495
|
+
const getSelector = (s) => s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
|
|
496
|
+
const rule = `${rootSelector} ${getSelector(selector)} {${prop.join(";")}}`;
|
|
497
|
+
return sheet[sheet.insertRule ? "insertRule" : "addRule"](
|
|
498
|
+
rule,
|
|
499
|
+
sheet.cssRules.length
|
|
500
|
+
);
|
|
1005
501
|
}
|
|
1006
|
-
|
|
1007
|
-
/**
|
|
1008
|
-
* Get css rules for specified stylesheets
|
|
1009
|
-
* @param {Array} styleSheets The stylesheets to get the rules from
|
|
1010
|
-
* @returns {Array}
|
|
1011
|
-
* @private
|
|
1012
|
-
*/
|
|
1013
502
|
function getCssRules(styleSheets) {
|
|
1014
|
-
var _this10 = this;
|
|
1015
503
|
let rules = [];
|
|
1016
|
-
styleSheets.forEach(
|
|
1017
|
-
|
|
504
|
+
styleSheets.forEach((sheet) => {
|
|
505
|
+
var _a;
|
|
1018
506
|
try {
|
|
1019
507
|
if (sheet.cssRules && sheet.cssRules.length) {
|
|
1020
508
|
rules = rules.concat(toArray(sheet.cssRules));
|
|
1021
509
|
}
|
|
1022
510
|
} catch (e) {
|
|
1023
|
-
|
|
1024
|
-
(_window$console = win.console) == null || _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString());
|
|
511
|
+
(_a = win.console) == null ? void 0 : _a.warn(`Error while reading rules from ${sheet.href}: ${e.toString()}`);
|
|
1025
512
|
}
|
|
1026
|
-
}
|
|
513
|
+
});
|
|
1027
514
|
return rules;
|
|
1028
515
|
}
|
|
1029
|
-
|
|
1030
|
-
/**
|
|
1031
|
-
* Get current window and container scroll position
|
|
1032
|
-
* @param {HTMLElement} node Target element
|
|
1033
|
-
* @returns {object} window scroll position
|
|
1034
|
-
* @private
|
|
1035
|
-
*/
|
|
1036
516
|
function getScrollPosition(node) {
|
|
1037
|
-
var
|
|
517
|
+
var _a, _b, _c, _d;
|
|
1038
518
|
return {
|
|
1039
|
-
x: (
|
|
1040
|
-
y: (
|
|
519
|
+
x: ((_b = (_a = win.pageXOffset) != null ? _a : win.scrollX) != null ? _b : 0) + node.scrollLeft,
|
|
520
|
+
y: ((_d = (_c = win.pageYOffset) != null ? _c : win.scrollY) != null ? _d : 0) + node.scrollTop
|
|
1041
521
|
};
|
|
1042
522
|
}
|
|
1043
|
-
|
|
1044
|
-
/**
|
|
1045
|
-
* Gets the SVGMatrix of an SVGGElement
|
|
1046
|
-
* @param {SVGElement} node Node element
|
|
1047
|
-
* @returns {SVGMatrix} matrix
|
|
1048
|
-
* @private
|
|
1049
|
-
*/
|
|
1050
523
|
function getTranslation(node) {
|
|
1051
|
-
const transform = node ? node.transform : null
|
|
1052
|
-
|
|
1053
|
-
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
|
1054
|
-
a: 0,
|
|
1055
|
-
b: 0,
|
|
1056
|
-
c: 0,
|
|
1057
|
-
d: 0,
|
|
1058
|
-
e: 0,
|
|
1059
|
-
f: 0
|
|
1060
|
-
};
|
|
524
|
+
const transform = node ? node.transform : null;
|
|
525
|
+
const baseVal = transform && transform.baseVal;
|
|
526
|
+
return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 };
|
|
1061
527
|
}
|
|
1062
|
-
|
|
1063
|
-
/**
|
|
1064
|
-
* Get unique value from array
|
|
1065
|
-
* @param {Array} data Source data
|
|
1066
|
-
* @returns {Array} Unique array value
|
|
1067
|
-
* @private
|
|
1068
|
-
*/
|
|
1069
528
|
function getUnique(data) {
|
|
1070
|
-
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1073
|
-
_newArrowCheck(this, _this11);
|
|
1074
|
-
return self.indexOf(v) === i;
|
|
1075
|
-
}.bind(this));
|
|
1076
|
-
return isDate ? d.map(function (v) {
|
|
1077
|
-
_newArrowCheck(this, _this11);
|
|
1078
|
-
return new Date(v);
|
|
1079
|
-
}.bind(this)) : d;
|
|
529
|
+
const isDate = data[0] instanceof Date;
|
|
530
|
+
const d = (isDate ? data.map(Number) : data).filter((v, i, self) => self.indexOf(v) === i);
|
|
531
|
+
return isDate ? d.map((v) => new Date(v)) : d;
|
|
1080
532
|
}
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* Merge array
|
|
1084
|
-
* @param {Array} arr Source array
|
|
1085
|
-
* @returns {Array}
|
|
1086
|
-
* @private
|
|
1087
|
-
*/
|
|
1088
533
|
function mergeArray(arr) {
|
|
1089
|
-
|
|
1090
|
-
return arr && arr.length ? arr.reduce(function (p, c) {
|
|
1091
|
-
_newArrowCheck(this, _this12);
|
|
1092
|
-
return p.concat(c);
|
|
1093
|
-
}.bind(this)) : [];
|
|
534
|
+
return arr && arr.length ? arr.reduce((p, c) => p.concat(c)) : [];
|
|
1094
535
|
}
|
|
1095
|
-
|
|
1096
|
-
/**
|
|
1097
|
-
* Merge object returning new object
|
|
1098
|
-
* @param {object} target Target object
|
|
1099
|
-
* @param {object} objectN Source object
|
|
1100
|
-
* @returns {object} merged target object
|
|
1101
|
-
* @private
|
|
1102
|
-
*/
|
|
1103
|
-
function mergeObj(target) {
|
|
1104
|
-
for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
1105
|
-
objectN[_key4 - 1] = arguments[_key4];
|
|
1106
|
-
}
|
|
536
|
+
function mergeObj(target, ...objectN) {
|
|
1107
537
|
if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
|
1108
538
|
return target;
|
|
1109
539
|
}
|
|
1110
540
|
const source = objectN.shift();
|
|
1111
541
|
if (isObject(target) && isObject(source)) {
|
|
1112
|
-
Object.keys(source).forEach(
|
|
1113
|
-
_newArrowCheck(this, _this13);
|
|
542
|
+
Object.keys(source).forEach((key) => {
|
|
1114
543
|
const value = source[key];
|
|
1115
544
|
if (isObject(value)) {
|
|
1116
|
-
target[key]
|
|
545
|
+
!target[key] && (target[key] = {});
|
|
1117
546
|
target[key] = mergeObj(target[key], value);
|
|
1118
547
|
} else {
|
|
1119
548
|
target[key] = isArray(value) ? value.concat() : value;
|
|
1120
549
|
}
|
|
1121
|
-
}
|
|
550
|
+
});
|
|
1122
551
|
}
|
|
1123
|
-
return mergeObj
|
|
552
|
+
return mergeObj(target, ...objectN);
|
|
1124
553
|
}
|
|
1125
|
-
|
|
1126
|
-
/**
|
|
1127
|
-
* Sort value
|
|
1128
|
-
* @param {Array} data value to be sorted
|
|
1129
|
-
* @param {boolean} isAsc true: asc, false: desc
|
|
1130
|
-
* @returns {number|string|Date} sorted date
|
|
1131
|
-
* @private
|
|
1132
|
-
*/
|
|
1133
|
-
function sortValue(data, isAsc) {
|
|
1134
|
-
var _this14 = this;
|
|
1135
|
-
if (isAsc === void 0) {
|
|
1136
|
-
isAsc = !0;
|
|
1137
|
-
}
|
|
554
|
+
function sortValue(data, isAsc = true) {
|
|
1138
555
|
let fn;
|
|
1139
556
|
if (data[0] instanceof Date) {
|
|
1140
|
-
fn = isAsc ?
|
|
1141
|
-
_newArrowCheck(this, _this14);
|
|
1142
|
-
return a - b;
|
|
1143
|
-
}.bind(this) : function (a, b) {
|
|
1144
|
-
_newArrowCheck(this, _this14);
|
|
1145
|
-
return b - a;
|
|
1146
|
-
}.bind(this);
|
|
557
|
+
fn = isAsc ? (a, b) => a - b : (a, b) => b - a;
|
|
1147
558
|
} else {
|
|
1148
559
|
if (isAsc && !data.every(isNaN)) {
|
|
1149
|
-
fn =
|
|
1150
|
-
_newArrowCheck(this, _this14);
|
|
1151
|
-
return a - b;
|
|
1152
|
-
}.bind(this);
|
|
560
|
+
fn = (a, b) => a - b;
|
|
1153
561
|
} else if (!isAsc) {
|
|
1154
|
-
fn =
|
|
1155
|
-
_newArrowCheck(this, _this14);
|
|
1156
|
-
return a > b && -1 || a < b && 1 || a === b && 0;
|
|
1157
|
-
}.bind(this);
|
|
562
|
+
fn = (a, b) => a > b && -1 || a < b && 1 || a === b && 0;
|
|
1158
563
|
}
|
|
1159
564
|
}
|
|
1160
565
|
return data.concat().sort(fn);
|
|
1161
566
|
}
|
|
1162
|
-
|
|
1163
|
-
/**
|
|
1164
|
-
* Get min/max value
|
|
1165
|
-
* @param {string} type 'min' or 'max'
|
|
1166
|
-
* @param {Array} data Array data value
|
|
1167
|
-
* @returns {number|Date|undefined}
|
|
1168
|
-
* @private
|
|
1169
|
-
*/
|
|
1170
567
|
function getMinMax(type, data) {
|
|
1171
|
-
|
|
1172
|
-
let res = data.filter(function (v) {
|
|
1173
|
-
_newArrowCheck(this, _this15);
|
|
1174
|
-
return notEmpty(v);
|
|
1175
|
-
}.bind(this));
|
|
568
|
+
let res = data.filter((v) => notEmpty(v));
|
|
1176
569
|
if (res.length) {
|
|
1177
570
|
if (isNumber(res[0])) {
|
|
1178
|
-
res = Math[type]
|
|
571
|
+
res = Math[type](...res);
|
|
1179
572
|
} else if (res[0] instanceof Date) {
|
|
1180
573
|
res = sortValue(res, type === "min")[0];
|
|
1181
574
|
}
|
|
1182
575
|
} else {
|
|
1183
|
-
res =
|
|
576
|
+
res = void 0;
|
|
1184
577
|
}
|
|
1185
578
|
return res;
|
|
1186
579
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
bubbles
|
|
1216
|
-
cancelable
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
clientX: 0,
|
|
1220
|
-
clientY: 0
|
|
1221
|
-
};
|
|
1222
|
-
}.bind(this);
|
|
1223
|
-
try {
|
|
1224
|
-
// eslint-disable-next-line no-new
|
|
1225
|
-
new MouseEvent("t");
|
|
1226
|
-
return function (el, eventType, params) {
|
|
1227
|
-
if (params === void 0) {
|
|
1228
|
-
params = getParams();
|
|
1229
|
-
}
|
|
1230
|
-
_newArrowCheck(this, _this16);
|
|
1231
|
-
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
1232
|
-
}.bind(this);
|
|
1233
|
-
} catch (e) {
|
|
1234
|
-
// Polyfills DOM4 MouseEvent
|
|
1235
|
-
return function (el, eventType, params) {
|
|
1236
|
-
if (params === void 0) {
|
|
1237
|
-
params = getParams();
|
|
1238
|
-
}
|
|
1239
|
-
_newArrowCheck(this, _this16);
|
|
1240
|
-
const mouseEvent = doc.createEvent("MouseEvent");
|
|
1241
|
-
|
|
1242
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
1243
|
-
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
|
580
|
+
const getRange = (start, end, step = 1) => {
|
|
581
|
+
const res = [];
|
|
582
|
+
const n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
|
583
|
+
for (let i = start; i < n; i++) {
|
|
584
|
+
res.push(start + i * step);
|
|
585
|
+
}
|
|
586
|
+
return res;
|
|
587
|
+
};
|
|
588
|
+
const emulateEvent = {
|
|
589
|
+
mouse: (() => {
|
|
590
|
+
const getParams = () => ({
|
|
591
|
+
bubbles: false,
|
|
592
|
+
cancelable: false,
|
|
593
|
+
screenX: 0,
|
|
594
|
+
screenY: 0,
|
|
595
|
+
clientX: 0,
|
|
596
|
+
clientY: 0
|
|
597
|
+
});
|
|
598
|
+
try {
|
|
599
|
+
new MouseEvent("t");
|
|
600
|
+
return (el, eventType, params = getParams()) => {
|
|
601
|
+
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
602
|
+
};
|
|
603
|
+
} catch (e) {
|
|
604
|
+
return (el, eventType, params = getParams()) => {
|
|
605
|
+
const mouseEvent = doc.createEvent("MouseEvent");
|
|
606
|
+
mouseEvent.initMouseEvent(
|
|
607
|
+
eventType,
|
|
608
|
+
params.bubbles,
|
|
609
|
+
params.cancelable,
|
|
610
|
+
win,
|
|
611
|
+
0,
|
|
1244
612
|
// the event's mouse click count
|
|
1245
|
-
params.screenX,
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
613
|
+
params.screenX,
|
|
614
|
+
params.screenY,
|
|
615
|
+
params.clientX,
|
|
616
|
+
params.clientY,
|
|
617
|
+
false,
|
|
618
|
+
false,
|
|
619
|
+
false,
|
|
620
|
+
false,
|
|
621
|
+
0,
|
|
622
|
+
null
|
|
623
|
+
);
|
|
624
|
+
el.dispatchEvent(mouseEvent);
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
})(),
|
|
628
|
+
touch: (el, eventType, params) => {
|
|
629
|
+
const touchObj = new Touch(mergeObj({
|
|
630
|
+
identifier: Date.now(),
|
|
631
|
+
target: el,
|
|
632
|
+
radiusX: 2.5,
|
|
633
|
+
radiusY: 2.5,
|
|
634
|
+
rotationAngle: 10,
|
|
635
|
+
force: 0.5
|
|
636
|
+
}, params));
|
|
637
|
+
el.dispatchEvent(new TouchEvent(eventType, {
|
|
638
|
+
cancelable: true,
|
|
639
|
+
bubbles: true,
|
|
640
|
+
shiftKey: true,
|
|
641
|
+
touches: [touchObj],
|
|
642
|
+
targetTouches: [],
|
|
643
|
+
changedTouches: [touchObj]
|
|
644
|
+
}));
|
|
645
|
+
}
|
|
646
|
+
};
|
|
1277
647
|
function tplProcess(tpl, data) {
|
|
1278
648
|
let res = tpl;
|
|
1279
649
|
for (const x in data) {
|
|
1280
|
-
res = res.replace(new RegExp(
|
|
650
|
+
res = res.replace(new RegExp(`{=${x}}`, "g"), data[x]);
|
|
1281
651
|
}
|
|
1282
652
|
return res;
|
|
1283
653
|
}
|
|
1284
|
-
|
|
1285
|
-
/**
|
|
1286
|
-
* Get parsed date value
|
|
1287
|
-
* (It must be called in 'ChartInternal' context)
|
|
1288
|
-
* @param {Date|string|number} date Value of date to be parsed
|
|
1289
|
-
* @returns {Date}
|
|
1290
|
-
* @private
|
|
1291
|
-
*/
|
|
1292
654
|
function parseDate(date) {
|
|
655
|
+
var _a;
|
|
1293
656
|
let parsedDate;
|
|
1294
657
|
if (date instanceof Date) {
|
|
1295
658
|
parsedDate = date;
|
|
1296
659
|
} else if (isString(date)) {
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
format = this.format;
|
|
1300
|
-
|
|
1301
|
-
// if fails to parse, try by new Date()
|
|
1302
|
-
// https://github.com/naver/billboard.js/issues/1714
|
|
1303
|
-
parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
|
660
|
+
const { config, format } = this;
|
|
661
|
+
parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) != null ? _a : new Date(date);
|
|
1304
662
|
} else if (isNumber(date) && !isNaN(date)) {
|
|
1305
|
-
parsedDate = new Date(+date);
|
|
663
|
+
parsedDate = /* @__PURE__ */ new Date(+date);
|
|
1306
664
|
}
|
|
1307
665
|
if (!parsedDate || isNaN(+parsedDate)) {
|
|
1308
|
-
console && console.error && console.error(
|
|
666
|
+
console && console.error && console.error(`Failed to parse x '${date}' to Date object`);
|
|
1309
667
|
}
|
|
1310
668
|
return parsedDate;
|
|
1311
669
|
}
|
|
1312
|
-
|
|
1313
|
-
/**
|
|
1314
|
-
* Return if the current doc is visible or not
|
|
1315
|
-
* @returns {boolean}
|
|
1316
|
-
* @private
|
|
1317
|
-
*/
|
|
1318
670
|
function isTabVisible() {
|
|
1319
|
-
|
|
671
|
+
var _a, _b;
|
|
672
|
+
return ((_a = doc) == null ? void 0 : _a.hidden) === false || ((_b = doc) == null ? void 0 : _b.visibilityState) === "visible";
|
|
1320
673
|
}
|
|
1321
|
-
|
|
1322
|
-
/**
|
|
1323
|
-
* Get the current input type
|
|
1324
|
-
* @param {boolean} mouse Config value: interaction.inputType.mouse
|
|
1325
|
-
* @param {boolean} touch Config value: interaction.inputType.touch
|
|
1326
|
-
* @returns {string} "mouse" | "touch" | null
|
|
1327
|
-
* @private
|
|
1328
|
-
*/
|
|
1329
674
|
function convertInputType(mouse, touch) {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
matchMedia = win.matchMedia,
|
|
1333
|
-
navigator = win.navigator;
|
|
1334
|
-
let hasTouch = !1;
|
|
675
|
+
const { DocumentTouch, matchMedia, navigator } = win;
|
|
676
|
+
let hasTouch = false;
|
|
1335
677
|
if (touch) {
|
|
1336
|
-
// Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
|
|
1337
678
|
if (navigator && "maxTouchPoints" in navigator) {
|
|
1338
679
|
hasTouch = navigator.maxTouchPoints > 0;
|
|
1339
|
-
|
|
1340
|
-
// Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
|
|
1341
|
-
// On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
|
|
1342
680
|
} else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
|
|
1343
|
-
hasTouch =
|
|
681
|
+
hasTouch = true;
|
|
1344
682
|
} else {
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
hasTouch = !0;
|
|
683
|
+
if (matchMedia == null ? void 0 : matchMedia("(pointer:coarse)").matches) {
|
|
684
|
+
hasTouch = true;
|
|
1348
685
|
} else {
|
|
1349
|
-
// Only as a last resort, fall back to user agent sniffing
|
|
1350
686
|
const UA = navigator.userAgent;
|
|
1351
687
|
hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
|
1352
688
|
}
|
|
1353
689
|
}
|
|
1354
690
|
}
|
|
1355
|
-
|
|
1356
|
-
// 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
|
|
1357
|
-
// https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
|
|
1358
|
-
// Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
|
|
1359
|
-
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
|
1360
|
-
_newArrowCheck(this, _this17);
|
|
1361
|
-
return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
|
1362
|
-
}.bind(this));
|
|
1363
|
-
|
|
1364
|
-
// fallback to 'mouse' if no input type is detected.
|
|
691
|
+
const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some((v) => matchMedia == null ? void 0 : matchMedia(`(${v})`).matches);
|
|
1365
692
|
return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
|
1366
693
|
}
|
|
1367
|
-
|
|
1368
|
-
/**
|
|
1369
|
-
* Run function until given condition function return true
|
|
1370
|
-
* @param {Function} fn Function to be executed when condition is true
|
|
1371
|
-
* @param {Function} conditionFn Condition function to check if condition is true
|
|
1372
|
-
* @private
|
|
1373
|
-
*/
|
|
1374
694
|
function runUntil(fn, conditionFn) {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
requestAnimationFrame(function () {
|
|
1378
|
-
_newArrowCheck(this, _this18);
|
|
1379
|
-
return runUntil(fn, conditionFn);
|
|
1380
|
-
}.bind(this));
|
|
695
|
+
if (conditionFn() === false) {
|
|
696
|
+
requestAnimationFrame(() => runUntil(fn, conditionFn));
|
|
1381
697
|
} else {
|
|
1382
698
|
fn();
|
|
1383
699
|
}
|
|
1384
700
|
}
|
|
1385
|
-
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1386
701
|
|
|
1387
|
-
|
|
1388
|
-
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
1389
|
-
* billboard.js project is licensed under the MIT license
|
|
1390
|
-
*/
|
|
702
|
+
;// CONCATENATED MODULE: ./src/config/config.ts
|
|
1391
703
|
|
|
1392
|
-
/**
|
|
1393
|
-
* Load configuration option
|
|
1394
|
-
* @param {object} config User's generation config value
|
|
1395
|
-
* @private
|
|
1396
|
-
*/
|
|
1397
704
|
function loadConfig(config) {
|
|
1398
|
-
var _this = this;
|
|
1399
705
|
const thisConfig = this.config;
|
|
1400
|
-
let target
|
|
1401
|
-
|
|
1402
|
-
|
|
706
|
+
let target;
|
|
707
|
+
let keys;
|
|
708
|
+
let read;
|
|
709
|
+
const find = () => {
|
|
1403
710
|
const key = keys.shift();
|
|
1404
711
|
if (key && target && isObjectType(target) && key in target) {
|
|
1405
712
|
target = target[key];
|
|
1406
|
-
return
|
|
713
|
+
return find();
|
|
1407
714
|
} else if (!key) {
|
|
1408
715
|
return target;
|
|
1409
716
|
}
|
|
1410
|
-
return
|
|
1411
|
-
}
|
|
1412
|
-
Object.keys(thisConfig).forEach(
|
|
1413
|
-
_newArrowCheck(this, _this);
|
|
717
|
+
return void 0;
|
|
718
|
+
};
|
|
719
|
+
Object.keys(thisConfig).forEach((key) => {
|
|
1414
720
|
target = config;
|
|
1415
721
|
keys = key.split("_");
|
|
1416
|
-
read =
|
|
722
|
+
read = find();
|
|
1417
723
|
if (isDefined(read)) {
|
|
1418
724
|
thisConfig[key] = read;
|
|
1419
725
|
}
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
// only should run in the ChartInternal context
|
|
726
|
+
});
|
|
1423
727
|
if (this.api) {
|
|
1424
728
|
this.state.orgConfig = config;
|
|
1425
729
|
}
|
|
1426
730
|
}
|
|
1427
|
-
;// CONCATENATED MODULE: ./src/Plugin/sparkline/index.ts
|
|
1428
|
-
|
|
1429
731
|
|
|
732
|
+
;// CONCATENATED MODULE: ./src/Plugin/Plugin.ts
|
|
733
|
+
var Plugin_defProp = Object.defineProperty;
|
|
734
|
+
var Plugin_defNormalProp = (obj, key, value) => key in obj ? Plugin_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
735
|
+
var __publicField = (obj, key, value) => {
|
|
736
|
+
Plugin_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
737
|
+
return value;
|
|
738
|
+
};
|
|
739
|
+
class Plugin {
|
|
740
|
+
/**
|
|
741
|
+
* Constructor
|
|
742
|
+
* @param {Any} options config option object
|
|
743
|
+
* @private
|
|
744
|
+
*/
|
|
745
|
+
constructor(options = {}) {
|
|
746
|
+
__publicField(this, "$$");
|
|
747
|
+
__publicField(this, "options");
|
|
748
|
+
this.options = options;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Lifecycle hook for 'beforeInit' phase.
|
|
752
|
+
* @private
|
|
753
|
+
*/
|
|
754
|
+
$beforeInit() {
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Lifecycle hook for 'init' phase.
|
|
758
|
+
* @private
|
|
759
|
+
*/
|
|
760
|
+
$init() {
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Lifecycle hook for 'afterInit' phase.
|
|
764
|
+
* @private
|
|
765
|
+
*/
|
|
766
|
+
$afterInit() {
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Lifecycle hook for 'redraw' phase.
|
|
770
|
+
* @private
|
|
771
|
+
*/
|
|
772
|
+
$redraw() {
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Lifecycle hook for 'willDestroy' phase.
|
|
776
|
+
* @private
|
|
777
|
+
*/
|
|
778
|
+
$willDestroy() {
|
|
779
|
+
Object.keys(this).forEach((key) => {
|
|
780
|
+
this[key] = null;
|
|
781
|
+
delete this[key];
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
__publicField(Plugin, "version", "3.12.0-next.2");
|
|
1430
786
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
787
|
+
;// CONCATENATED MODULE: ./src/Plugin/sparkline/Options.ts
|
|
788
|
+
class Options {
|
|
789
|
+
constructor() {
|
|
790
|
+
return {
|
|
791
|
+
/**
|
|
792
|
+
* Specify sparkline charts holder selector.
|
|
793
|
+
* - **NOTE:** The amount of holder should match with the amount of data. If has less, will append necessaray amount nodes as sibling of main chart.
|
|
794
|
+
* @name selector
|
|
795
|
+
* @memberof plugin-sparkline
|
|
796
|
+
* @type {string}
|
|
797
|
+
* @default undefined
|
|
798
|
+
* @example
|
|
799
|
+
* selector: ".sparkline"
|
|
800
|
+
*/
|
|
801
|
+
selector: void 0
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
}
|
|
1435
805
|
|
|
806
|
+
;// CONCATENATED MODULE: ./src/Plugin/sparkline/index.ts
|
|
807
|
+
var sparkline_defProp = Object.defineProperty;
|
|
808
|
+
var sparkline_defNormalProp = (obj, key, value) => key in obj ? sparkline_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
809
|
+
var sparkline_publicField = (obj, key, value) => {
|
|
810
|
+
sparkline_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
811
|
+
return value;
|
|
812
|
+
};
|
|
1436
813
|
|
|
1437
814
|
|
|
1438
815
|
|
|
1439
816
|
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
* - **Bear in mind:**
|
|
1448
|
-
* - Use this plugin to visualize multiple tiny chart only and chart APIs won't work properly.
|
|
1449
|
-
* - Sparkline chart size will be based on the main chart element size. To control spakrline charts, is highly recommended to set `size` option.
|
|
1450
|
-
* - Bubble, scatter and Arc(pie, donut, ratdar) types aren't supported.
|
|
1451
|
-
* - Some options will be stricted to be:
|
|
1452
|
-
* - `resize.auto = false`
|
|
1453
|
-
* - `axis.x.show = false`
|
|
1454
|
-
* - `axis.y.show = false`
|
|
1455
|
-
* - `axis.y.padding = 10`
|
|
1456
|
-
* - `legend.show = false`
|
|
1457
|
-
*
|
|
1458
|
-
* @class plugin-sparkline
|
|
1459
|
-
* @param {object} options sparkline plugin options
|
|
1460
|
-
* @augments Plugin
|
|
1461
|
-
* @returns {Sparkline}
|
|
1462
|
-
* @example
|
|
1463
|
-
* // Plugin must be loaded before the use.
|
|
1464
|
-
* <script src="$YOUR_PATH/plugin/billboardjs-plugin-sparkline.js"></script>
|
|
1465
|
-
*
|
|
1466
|
-
* var chart = bb.generate({
|
|
1467
|
-
* ...
|
|
1468
|
-
* plugins: [
|
|
1469
|
-
* new bb.plugin.sparkline({
|
|
1470
|
-
* selector: ".sparkline"
|
|
1471
|
-
* }),
|
|
1472
|
-
* ]
|
|
1473
|
-
* });
|
|
1474
|
-
* @example
|
|
1475
|
-
* import {bb} from "billboard.js";
|
|
1476
|
-
* import Sparkline from "billboard.js/dist/billboardjs-plugin-sparkline";
|
|
1477
|
-
*
|
|
1478
|
-
* bb.generate({
|
|
1479
|
-
* ...
|
|
1480
|
-
* plugins: [
|
|
1481
|
-
* new Sparkline({ ... })
|
|
1482
|
-
* ]
|
|
1483
|
-
* })
|
|
1484
|
-
*/
|
|
1485
|
-
let Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
1486
|
-
_inheritsLoose(Sparkline, _Plugin);
|
|
1487
|
-
function Sparkline(options) {
|
|
1488
|
-
var _this = _Plugin.call(this, options) || this;
|
|
1489
|
-
_this.config = void 0;
|
|
1490
|
-
_this.element = void 0;
|
|
1491
|
-
_this.config = new Options();
|
|
1492
|
-
return _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
|
817
|
+
class Sparkline extends Plugin {
|
|
818
|
+
constructor(options) {
|
|
819
|
+
super(options);
|
|
820
|
+
sparkline_publicField(this, "config");
|
|
821
|
+
sparkline_publicField(this, "element");
|
|
822
|
+
this.config = new Options();
|
|
823
|
+
return this;
|
|
1493
824
|
}
|
|
1494
|
-
|
|
1495
|
-
_proto.$beforeInit = function $beforeInit() {
|
|
825
|
+
$beforeInit() {
|
|
1496
826
|
loadConfig.call(this, this.options);
|
|
1497
827
|
this.validate();
|
|
1498
828
|
this.element = [].slice.call(document.querySelectorAll(this.config.selector));
|
|
1499
|
-
|
|
1500
|
-
// override internal methods
|
|
1501
829
|
this.overrideInternals();
|
|
1502
|
-
|
|
1503
|
-
// override options
|
|
1504
830
|
this.overrideOptions();
|
|
1505
|
-
|
|
1506
|
-
// bind event handlers's context
|
|
1507
831
|
this.overHandler = this.overHandler.bind(this);
|
|
1508
832
|
this.moveHandler = this.moveHandler.bind(this);
|
|
1509
833
|
this.outHandler = this.outHandler.bind(this);
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
const
|
|
1513
|
-
config = this.config;
|
|
834
|
+
}
|
|
835
|
+
validate() {
|
|
836
|
+
const { $$, config } = this;
|
|
1514
837
|
let msg = "";
|
|
1515
838
|
if (!config.selector || !document.querySelector(config.selector)) {
|
|
1516
839
|
msg = "No holder elements found from given selector option.";
|
|
@@ -1519,34 +842,26 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1519
842
|
msg = "Contains non supported chart types.";
|
|
1520
843
|
}
|
|
1521
844
|
if (msg) {
|
|
1522
|
-
throw new Error(
|
|
845
|
+
throw new Error(`[Sparkline plugin] ${msg}`);
|
|
1523
846
|
}
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
const $$ = this
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
// override internal methods to positioning bars
|
|
1530
|
-
$$.getIndices = function (indices, d, caller) {
|
|
847
|
+
}
|
|
848
|
+
overrideInternals() {
|
|
849
|
+
const { $$ } = this;
|
|
850
|
+
const { getBarW, getIndices } = $$;
|
|
851
|
+
$$.getIndices = function(indices, d, caller) {
|
|
1531
852
|
return caller === "getShapeX" ? {} : getIndices.call(this, indices, d);
|
|
1532
853
|
};
|
|
1533
|
-
$$.getBarW = function
|
|
854
|
+
$$.getBarW = function(type, axis) {
|
|
1534
855
|
return getBarW.call(this, type, axis, 1);
|
|
1535
856
|
};
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
config.
|
|
1541
|
-
config.
|
|
1542
|
-
config.
|
|
1543
|
-
|
|
1544
|
-
// set default axes padding
|
|
1545
|
-
if (config.padding !== !1) {
|
|
1546
|
-
const hasOption = function (o) {
|
|
1547
|
-
_newArrowCheck(this, _this2);
|
|
1548
|
-
return Object.keys(o || {}).length > 0;
|
|
1549
|
-
}.bind(this);
|
|
857
|
+
}
|
|
858
|
+
overrideOptions() {
|
|
859
|
+
const { config } = this.$$;
|
|
860
|
+
config.legend_show = false;
|
|
861
|
+
config.resize_auto = false;
|
|
862
|
+
config.axis_x_show = false;
|
|
863
|
+
if (config.padding !== false) {
|
|
864
|
+
const hasOption = (o) => Object.keys(o || {}).length > 0;
|
|
1550
865
|
if (hasOption(config.axis_x_padding)) {
|
|
1551
866
|
config.axis_x_padding = {
|
|
1552
867
|
left: 15,
|
|
@@ -1558,97 +873,84 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1558
873
|
config.axis_y_padding = 5;
|
|
1559
874
|
}
|
|
1560
875
|
}
|
|
1561
|
-
config.axis_y_show =
|
|
876
|
+
config.axis_y_show = false;
|
|
1562
877
|
if (!config.tooltip_position) {
|
|
1563
|
-
config.tooltip_position = function
|
|
1564
|
-
const event = this
|
|
1565
|
-
let top = event.pageY - height * 1.35
|
|
1566
|
-
|
|
878
|
+
config.tooltip_position = function(data, width, height) {
|
|
879
|
+
const { internal: { state: { event } } } = this;
|
|
880
|
+
let top = event.pageY - height * 1.35;
|
|
881
|
+
let left = event.pageX - width / 2;
|
|
1567
882
|
if (top < 0) {
|
|
1568
883
|
top = 0;
|
|
1569
884
|
}
|
|
1570
885
|
if (left < 0) {
|
|
1571
886
|
left = 0;
|
|
1572
887
|
}
|
|
1573
|
-
return {
|
|
1574
|
-
top: top,
|
|
1575
|
-
left: left
|
|
1576
|
-
};
|
|
888
|
+
return { top, left };
|
|
1577
889
|
};
|
|
1578
890
|
}
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
var
|
|
1582
|
-
const $el = this
|
|
1583
|
-
|
|
1584
|
-
// make disable-ish main chart element
|
|
891
|
+
}
|
|
892
|
+
$init() {
|
|
893
|
+
var _a;
|
|
894
|
+
const { $$: { $el } } = this;
|
|
1585
895
|
$el.chart.style("width", "0").style("height", "0").style("pointer-events", "none");
|
|
1586
|
-
((
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
const $$ = this
|
|
896
|
+
((_a = $el.tooltip) == null ? void 0 : _a.node()) && document.body.appendChild($el.tooltip.node());
|
|
897
|
+
}
|
|
898
|
+
$afterInit() {
|
|
899
|
+
const { $$ } = this;
|
|
1590
900
|
$$.$el.svg.attr("style", null).style("width", "0").style("height", "0");
|
|
1591
|
-
this.bindEvents(
|
|
901
|
+
this.bindEvents(true);
|
|
1592
902
|
}
|
|
1593
|
-
|
|
1594
903
|
/**
|
|
1595
904
|
* Bind tooltip event handlers for each sparkline elements.
|
|
1596
905
|
* @param {boolean} bind or unbind
|
|
1597
906
|
* @private
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
if (bind === void 0) {
|
|
1602
|
-
bind = !0;
|
|
1603
|
-
}
|
|
1604
|
-
const config = this.$$.config;
|
|
907
|
+
*/
|
|
908
|
+
bindEvents(bind = true) {
|
|
909
|
+
const { $$: { config } } = this;
|
|
1605
910
|
if (config.interaction_enabled && config.tooltip_show) {
|
|
1606
|
-
const method =
|
|
1607
|
-
this.element.forEach(
|
|
1608
|
-
_newArrowCheck(this, _this3);
|
|
911
|
+
const method = `${bind ? "add" : "remove"}EventListener`;
|
|
912
|
+
this.element.forEach((el) => {
|
|
1609
913
|
const svg = el.querySelector("svg");
|
|
1610
914
|
svg[method]("mouseover", this.overHandler);
|
|
1611
915
|
svg[method]("mousemove", this.moveHandler);
|
|
1612
916
|
svg[method]("mouseout", this.outHandler);
|
|
1613
|
-
}
|
|
917
|
+
});
|
|
1614
918
|
}
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
const $$ = this
|
|
1618
|
-
|
|
919
|
+
}
|
|
920
|
+
overHandler(e) {
|
|
921
|
+
const { $$ } = this;
|
|
922
|
+
const { state: { eventReceiver } } = $$;
|
|
1619
923
|
eventReceiver.rect = e.target.getBoundingClientRect();
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
var
|
|
1623
|
-
const $$ = this
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
924
|
+
}
|
|
925
|
+
moveHandler(e) {
|
|
926
|
+
var _a, _b, _c, _d;
|
|
927
|
+
const { $$ } = this;
|
|
928
|
+
const index = $$.getDataIndexFromEvent(e);
|
|
929
|
+
const data = (_a = $$.api.data(e.target.__id)) == null ? void 0 : _a[0];
|
|
930
|
+
const d = (_b = data == null ? void 0 : data.values) == null ? void 0 : _b[index];
|
|
1627
931
|
if (d && !d.name) {
|
|
1628
932
|
d.name = d.id;
|
|
1629
933
|
}
|
|
1630
934
|
$$.state.event = e;
|
|
1631
|
-
if ($$.isPointFocusOnly
|
|
1632
|
-
$$.showCircleFocus == null
|
|
935
|
+
if (((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$)) && d) {
|
|
936
|
+
(_d = $$.showCircleFocus) == null ? void 0 : _d.call($$, [d]);
|
|
1633
937
|
}
|
|
1634
|
-
$$.setExpand(index, data.id,
|
|
938
|
+
$$.setExpand(index, data.id, true);
|
|
1635
939
|
$$.showTooltip([d], e.target);
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
const $$ = this
|
|
940
|
+
}
|
|
941
|
+
outHandler(e) {
|
|
942
|
+
const { $$ } = this;
|
|
1639
943
|
$$.state.event = e;
|
|
1640
944
|
$$.isPointFocusOnly() ? $$.hideCircleFocus() : $$.unexpandCircles();
|
|
1641
945
|
$$.hideTooltip();
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
var
|
|
1645
|
-
|
|
1646
|
-
const
|
|
1647
|
-
$el = $$.$el;
|
|
946
|
+
}
|
|
947
|
+
$redraw() {
|
|
948
|
+
var _a;
|
|
949
|
+
const { $$ } = this;
|
|
950
|
+
const { $el } = $$;
|
|
1648
951
|
let el = this.element;
|
|
1649
|
-
const data = $$.api.data()
|
|
1650
|
-
|
|
1651
|
-
// append sparkline holder if is less than the data length
|
|
952
|
+
const data = $$.api.data();
|
|
953
|
+
const svgWrapper = (_a = $el.chart.html().match(/<svg[^>]*>/)) == null ? void 0 : _a[0];
|
|
1652
954
|
if (el.length < data.length) {
|
|
1653
955
|
const chart = $el.chart.node();
|
|
1654
956
|
for (let i = data.length - el.length; i > 0; i--) {
|
|
@@ -1657,16 +959,12 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1657
959
|
this.element = document.querySelectorAll(this.config.selector);
|
|
1658
960
|
el = this.element;
|
|
1659
961
|
}
|
|
1660
|
-
data.map(
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
}.bind(this)).forEach(function (id, i) {
|
|
1664
|
-
_newArrowCheck(this, _this4);
|
|
1665
|
-
const selector = "." + $COMMON.target + "-" + id,
|
|
1666
|
-
shape = $el.main.selectAll(selector);
|
|
962
|
+
data.map((v) => v.id).forEach((id, i) => {
|
|
963
|
+
const selector = `.${$COMMON.target}-${id}`;
|
|
964
|
+
const shape = $el.main.selectAll(selector);
|
|
1667
965
|
let svg = el[i].querySelector("svg");
|
|
1668
966
|
if (!svg) {
|
|
1669
|
-
el[i].innerHTML = svgWrapper
|
|
967
|
+
el[i].innerHTML = `${svgWrapper}</svg>`;
|
|
1670
968
|
svg = el[i].querySelector("svg");
|
|
1671
969
|
svg.__id = id;
|
|
1672
970
|
}
|
|
@@ -1676,19 +974,16 @@ let Sparkline = /*#__PURE__*/function (_Plugin) {
|
|
|
1676
974
|
shape.style("fill", "none").style("opacity", null);
|
|
1677
975
|
svg.innerHTML = "";
|
|
1678
976
|
svg.appendChild(shape.node());
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
this.
|
|
1684
|
-
this.element.forEach(function (el) {
|
|
1685
|
-
_newArrowCheck(this, _this5);
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
$willDestroy() {
|
|
980
|
+
this.bindEvents(false);
|
|
981
|
+
this.element.forEach((el) => {
|
|
1686
982
|
el.innerHTML = "";
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
Sparkline.version = "0.0.1";
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
sparkline_publicField(Sparkline, "version", `0.0.1`);
|
|
1692
987
|
|
|
1693
988
|
}();
|
|
1694
989
|
__webpack_exports__ = __webpack_exports__["default"];
|