1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | (function webpackUniversalModuleDefinition(root, factory) {
|
13 | if(typeof exports === 'object' && typeof module === 'object')
|
14 | module.exports = factory(require("d3-selection"));
|
15 | else if(typeof define === 'function' && define.amd)
|
16 | define("bubblecompare", ["d3-selection"], factory);
|
17 | else if(typeof exports === 'object')
|
18 | exports["bubblecompare"] = factory(require("d3-selection"));
|
19 | else
|
20 | root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["bubblecompare"] = factory(root["d3"]);
|
21 | })(this, function(__WEBPACK_EXTERNAL_MODULE__8__) {
|
22 | return (function(modules) {
|
23 |
|
24 | var installedModules = {};
|
25 |
|
26 |
|
27 | function __webpack_require__(moduleId) {
|
28 |
|
29 |
|
30 | if(installedModules[moduleId]) {
|
31 | return installedModules[moduleId].exports;
|
32 | }
|
33 |
|
34 | var module = installedModules[moduleId] = {
|
35 | i: moduleId,
|
36 | l: false,
|
37 | exports: {}
|
38 | };
|
39 |
|
40 |
|
41 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
42 |
|
43 |
|
44 | module.l = true;
|
45 |
|
46 |
|
47 | return module.exports;
|
48 | }
|
49 |
|
50 |
|
51 |
|
52 | __webpack_require__.m = modules;
|
53 |
|
54 |
|
55 | __webpack_require__.c = installedModules;
|
56 |
|
57 |
|
58 | __webpack_require__.d = function(exports, name, getter) {
|
59 | if(!__webpack_require__.o(exports, name)) {
|
60 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
61 | }
|
62 | };
|
63 |
|
64 |
|
65 | __webpack_require__.r = function(exports) {
|
66 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
67 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
68 | }
|
69 | Object.defineProperty(exports, '__esModule', { value: true });
|
70 | };
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | __webpack_require__.t = function(value, mode) {
|
78 | if(mode & 1) value = __webpack_require__(value);
|
79 | if(mode & 8) return value;
|
80 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
81 | var ns = Object.create(null);
|
82 | __webpack_require__.r(ns);
|
83 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
84 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
85 | return ns;
|
86 | };
|
87 |
|
88 |
|
89 | __webpack_require__.n = function(module) {
|
90 | var getter = module && module.__esModule ?
|
91 | function getDefault() { return module['default']; } :
|
92 | function getModuleExports() { return module; };
|
93 | __webpack_require__.d(getter, 'a', getter);
|
94 | return getter;
|
95 | };
|
96 |
|
97 |
|
98 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
99 |
|
100 |
|
101 | __webpack_require__.p = "";
|
102 |
|
103 |
|
104 |
|
105 | return __webpack_require__(__webpack_require__.s = 0);
|
106 | })
|
107 |
|
108 | ([
|
109 |
|
110 | (function(module, __webpack_exports__, __webpack_require__) {
|
111 |
|
112 | "use strict";
|
113 | __webpack_require__.r(__webpack_exports__);
|
114 | __webpack_require__.d(__webpack_exports__, "default", function() { return BubbleCompare; });
|
115 | var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
|
116 | var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
117 | var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
118 | var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3);
|
119 | var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6);
|
120 | var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5);
|
121 | var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(22);
|
122 | var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(7);
|
123 | var d3_selection__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(8);
|
124 | var d3_selection__WEBPACK_IMPORTED_MODULE_8___default = __webpack_require__.n(d3_selection__WEBPACK_IMPORTED_MODULE_8__);
|
125 | var _Plugin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(9);
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 | var BubbleCompare = function (_Plugin) {
|
176 | function BubbleCompare(options) {
|
177 | var _this;
|
178 |
|
179 | return Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_1__[ "a"])(this, BubbleCompare), _this = Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__[ "a"])(this, Object(_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_4__[ "a"])(BubbleCompare).call(this, options)), Object(_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__[ "a"])(_this, Object(_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_5__[ "a"])(_this));
|
180 | }
|
181 |
|
182 | return Object(_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_6__[ "a"])(BubbleCompare, _Plugin), Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_2__[ "a"])(BubbleCompare, [{
|
183 | key: "$init",
|
184 | value: function $init() {
|
185 | var $$ = this.$$;
|
186 | $$.findClosest = this.findClosest.bind(this), $$.getBubbleR = this.getBubbleR.bind(this), $$.pointExpandedR = this.pointExpandedR.bind(this);
|
187 | }
|
188 | }, {
|
189 | key: "pointExpandedR",
|
190 | value: function pointExpandedR(d) {
|
191 | var baseR = this.getBubbleR(d),
|
192 | _this$options$expandS = this.options.expandScale,
|
193 | expandScale = _this$options$expandS === void 0 ? 1 : _this$options$expandS;
|
194 | return BubbleCompare.raiseFocusedBubbleLayer(d), this.changeCursorPoint(), baseR * expandScale;
|
195 | }
|
196 | }, {
|
197 | key: "changeCursorPoint",
|
198 | value: function changeCursorPoint() {
|
199 | this.$$.svg.select(".bb-event-rect").style("cursor", "pointer");
|
200 | }
|
201 | }, {
|
202 | key: "findClosest",
|
203 | value: function findClosest(values, pos) {
|
204 | var _this2 = this,
|
205 | $$ = this.$$;
|
206 |
|
207 | return values.filter(function (v) {
|
208 | return v && !$$.isBarType(v.id);
|
209 | }).reduce(function (acc, cur) {
|
210 | var d = $$.dist(cur, pos);
|
211 | return d < _this2.getBubbleR(cur) ? cur : acc;
|
212 | }, 0);
|
213 | }
|
214 | }, {
|
215 | key: "getBubbleR",
|
216 | value: function getBubbleR(d) {
|
217 | var _this3 = this,
|
218 | _this$options = this.options,
|
219 | minR = _this$options.minR,
|
220 | maxR = _this$options.maxR,
|
221 | curVal = this.getZData(d);
|
222 |
|
223 | if (!curVal) return minR;
|
224 |
|
225 | var _this$$$$data$targets = this.$$.data.targets.reduce(function (_ref, cur) {
|
226 | var _ref2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[ "a"])(_ref, 2),
|
227 | accMin = _ref2[0],
|
228 | accMax = _ref2[1],
|
229 | val = _this3.getZData(cur.values[0]);
|
230 |
|
231 | return [Math.min(accMin, val), Math.max(accMax, val)];
|
232 | }, [1e4, 0]),
|
233 | _this$$$$data$targets2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__[ "a"])(_this$$$$data$targets, 2),
|
234 | min = _this$$$$data$targets2[0],
|
235 | max = _this$$$$data$targets2[1],
|
236 | size = min > 0 && max === min ? 0 : curVal / max;
|
237 |
|
238 | return Math.abs(size) * (maxR - minR) + minR;
|
239 | }
|
240 | }, {
|
241 | key: "getZData",
|
242 | value: function getZData(d) {
|
243 | return this.$$.isBubbleZType(d) ? this.$$.getBubbleZData(d.value, "z") : d.value;
|
244 | }
|
245 | }], [{
|
246 | key: "raiseFocusedBubbleLayer",
|
247 | value: function raiseFocusedBubbleLayer(d) {
|
248 | d.raise && Object(d3_selection__WEBPACK_IMPORTED_MODULE_8__["select"])(d.node().parentNode.parentNode).raise();
|
249 | }
|
250 | }]), BubbleCompare;
|
251 | }(_Plugin__WEBPACK_IMPORTED_MODULE_9__[ "a"]);
|
252 |
|
253 | Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_7__[ "a"])(BubbleCompare, "version", "0.0.1");
|
254 |
|
255 |
|
256 |
|
257 | }),
|
258 |
|
259 | (function(module, __webpack_exports__, __webpack_require__) {
|
260 |
|
261 | "use strict";
|
262 | __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
|
263 | function _classCallCheck(instance, Constructor) {
|
264 | if (!(instance instanceof Constructor)) {
|
265 | throw new TypeError("Cannot call a class as a function");
|
266 | }
|
267 | }
|
268 |
|
269 | }),
|
270 |
|
271 | (function(module, __webpack_exports__, __webpack_require__) {
|
272 |
|
273 | "use strict";
|
274 | __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
|
275 | function _defineProperties(target, props) {
|
276 | for (var i = 0; i < props.length; i++) {
|
277 | var descriptor = props[i];
|
278 | descriptor.enumerable = descriptor.enumerable || false;
|
279 | descriptor.configurable = true;
|
280 | if ("value" in descriptor) descriptor.writable = true;
|
281 | Object.defineProperty(target, descriptor.key, descriptor);
|
282 | }
|
283 | }
|
284 |
|
285 | function _createClass(Constructor, protoProps, staticProps) {
|
286 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
287 | if (staticProps) _defineProperties(Constructor, staticProps);
|
288 | return Constructor;
|
289 | }
|
290 |
|
291 | }),
|
292 |
|
293 | (function(module, __webpack_exports__, __webpack_require__) {
|
294 |
|
295 | "use strict";
|
296 | __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
|
297 | var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
298 | var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
299 |
|
300 |
|
301 | function _possibleConstructorReturn(self, call) {
|
302 | if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[ "a"])(call) === "object" || typeof call === "function")) {
|
303 | return call;
|
304 | }
|
305 |
|
306 | return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[ "a"])(self);
|
307 | }
|
308 |
|
309 | }),
|
310 |
|
311 | (function(module, __webpack_exports__, __webpack_require__) {
|
312 |
|
313 | "use strict";
|
314 | __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
|
315 | function _typeof(obj) {
|
316 | "@babel/helpers - typeof";
|
317 |
|
318 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
319 | _typeof = function _typeof(obj) {
|
320 | return typeof obj;
|
321 | };
|
322 | } else {
|
323 | _typeof = function _typeof(obj) {
|
324 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
325 | };
|
326 | }
|
327 |
|
328 | return _typeof(obj);
|
329 | }
|
330 |
|
331 | }),
|
332 |
|
333 | (function(module, __webpack_exports__, __webpack_require__) {
|
334 |
|
335 | "use strict";
|
336 | __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
|
337 | function _assertThisInitialized(self) {
|
338 | if (self === void 0) {
|
339 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
340 | }
|
341 |
|
342 | return self;
|
343 | }
|
344 |
|
345 | }),
|
346 |
|
347 | (function(module, __webpack_exports__, __webpack_require__) {
|
348 |
|
349 | "use strict";
|
350 | __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
|
351 | function _getPrototypeOf(o) {
|
352 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
353 | return o.__proto__ || Object.getPrototypeOf(o);
|
354 | };
|
355 | return _getPrototypeOf(o);
|
356 | }
|
357 |
|
358 | }),
|
359 |
|
360 | (function(module, __webpack_exports__, __webpack_require__) {
|
361 |
|
362 | "use strict";
|
363 | __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
|
364 | function _defineProperty(obj, key, value) {
|
365 | if (key in obj) {
|
366 | Object.defineProperty(obj, key, {
|
367 | value: value,
|
368 | enumerable: true,
|
369 | configurable: true,
|
370 | writable: true
|
371 | });
|
372 | } else {
|
373 | obj[key] = value;
|
374 | }
|
375 |
|
376 | return obj;
|
377 | }
|
378 |
|
379 | }),
|
380 |
|
381 | (function(module, exports) {
|
382 |
|
383 | module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
|
384 |
|
385 | }),
|
386 |
|
387 | (function(module, __webpack_exports__, __webpack_require__) {
|
388 |
|
389 | "use strict";
|
390 | __webpack_require__.d(__webpack_exports__, "a", function() { return Plugin; });
|
391 | var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
392 | var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
393 | var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 | var Plugin = function () {
|
408 | |
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 | |
419 |
|
420 |
|
421 |
|
422 |
|
423 | function Plugin() {
|
424 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
425 | Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[ "a"])(this, Plugin), this.options = options;
|
426 | }
|
427 | |
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 | return Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[ "a"])(Plugin, [{
|
434 | key: "$beforeInit",
|
435 | value: function $beforeInit() {}
|
436 | |
437 |
|
438 |
|
439 |
|
440 |
|
441 | }, {
|
442 | key: "$init",
|
443 | value: function $init() {}
|
444 | |
445 |
|
446 |
|
447 |
|
448 |
|
449 | }, {
|
450 | key: "$afterInit",
|
451 | value: function $afterInit() {}
|
452 | |
453 |
|
454 |
|
455 |
|
456 |
|
457 | }, {
|
458 | key: "$redraw",
|
459 | value: function $redraw() {}
|
460 | |
461 |
|
462 |
|
463 |
|
464 |
|
465 | }, {
|
466 | key: "$willDestroy",
|
467 | value: function $willDestroy() {
|
468 | var _this = this;
|
469 |
|
470 | Object.keys(this).forEach(function (key) {
|
471 | _this[key] = null, delete _this[key];
|
472 | });
|
473 | }
|
474 | }]), Plugin;
|
475 | }();
|
476 |
|
477 | Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__[ "a"])(Plugin, "version", "1.12.1");
|
478 |
|
479 |
|
480 |
|
481 | }),
|
482 | ,
|
483 | ,
|
484 | ,
|
485 | ,
|
486 | ,
|
487 | ,
|
488 | ,
|
489 | ,
|
490 | ,
|
491 | ,
|
492 |
|
493 | (function(module, __webpack_exports__, __webpack_require__) {
|
494 |
|
495 | "use strict";
|
496 |
|
497 |
|
498 | __webpack_require__.d(__webpack_exports__, "a", function() { return _slicedToArray; });
|
499 |
|
500 |
|
501 | function _arrayWithHoles(arr) {
|
502 | if (Array.isArray(arr)) return arr;
|
503 | }
|
504 |
|
505 | function _iterableToArrayLimit(arr, i) {
|
506 | if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
507 | return;
|
508 | }
|
509 |
|
510 | var _arr = [];
|
511 | var _n = true;
|
512 | var _d = false;
|
513 | var _e = undefined;
|
514 |
|
515 | try {
|
516 | for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
517 | _arr.push(_s.value);
|
518 |
|
519 | if (i && _arr.length === i) break;
|
520 | }
|
521 | } catch (err) {
|
522 | _d = true;
|
523 | _e = err;
|
524 | } finally {
|
525 | try {
|
526 | if (!_n && _i["return"] != null) _i["return"]();
|
527 | } finally {
|
528 | if (_d) throw _e;
|
529 | }
|
530 | }
|
531 |
|
532 | return _arr;
|
533 | }
|
534 |
|
535 | function _nonIterableRest() {
|
536 | throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
537 | }
|
538 |
|
539 |
|
540 |
|
541 |
|
542 | function _slicedToArray(arr, i) {
|
543 | return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
544 | }
|
545 |
|
546 | }),
|
547 | ,
|
548 |
|
549 | (function(module, __webpack_exports__, __webpack_require__) {
|
550 |
|
551 | "use strict";
|
552 |
|
553 |
|
554 | __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
|
555 |
|
556 |
|
557 | function _setPrototypeOf(o, p) {
|
558 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
559 | o.__proto__ = p;
|
560 | return o;
|
561 | };
|
562 |
|
563 | return _setPrototypeOf(o, p);
|
564 | }
|
565 |
|
566 |
|
567 | function _inherits(subClass, superClass) {
|
568 | if (typeof superClass !== "function" && superClass !== null) {
|
569 | throw new TypeError("Super expression must either be null or a function");
|
570 | }
|
571 |
|
572 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
573 | constructor: {
|
574 | value: subClass,
|
575 | writable: true,
|
576 | configurable: true
|
577 | }
|
578 | });
|
579 | if (superClass) _setPrototypeOf(subClass, superClass);
|
580 | }
|
581 |
|
582 | })
|
583 | ])["default"];
|
584 | }); |
\ | No newline at end of file |