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("bb", ["d3-selection"], factory);
|
17 | else if(typeof exports === 'object')
|
18 | exports["bb"] = 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__1__) {
|
22 | return (function() {
|
23 | "use strict";
|
24 | var __webpack_modules__ = ([
|
25 | ,
|
26 |
|
27 | (function(module) {
|
28 |
|
29 | module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
|
30 |
|
31 | })
|
32 | ]);
|
33 |
|
34 |
|
35 | var __webpack_module_cache__ = {};
|
36 |
|
37 |
|
38 | function __webpack_require__(moduleId) {
|
39 |
|
40 | var cachedModule = __webpack_module_cache__[moduleId];
|
41 | if (cachedModule !== undefined) {
|
42 | return cachedModule.exports;
|
43 | }
|
44 |
|
45 | var module = __webpack_module_cache__[moduleId] = {
|
46 |
|
47 |
|
48 | exports: {}
|
49 | };
|
50 |
|
51 |
|
52 | __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
53 |
|
54 |
|
55 | return module.exports;
|
56 | }
|
57 |
|
58 |
|
59 |
|
60 | !function() {
|
61 |
|
62 | __webpack_require__.d = function(exports, definition) {
|
63 | for(var key in definition) {
|
64 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
65 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
66 | }
|
67 | }
|
68 | };
|
69 | }();
|
70 |
|
71 |
|
72 | !function() {
|
73 | __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
74 | }();
|
75 |
|
76 |
|
77 | var __webpack_exports__ = {};
|
78 |
|
79 | !function() {
|
80 |
|
81 |
|
82 | __webpack_require__.d(__webpack_exports__, {
|
83 | "default": function() { return BubbleCompare; }
|
84 | });
|
85 |
|
86 | ;
|
87 | function _newArrowCheck(innerThis, boundThis) {
|
88 | if (innerThis !== boundThis) {
|
89 | throw new TypeError("Cannot instantiate an arrow function");
|
90 | }
|
91 | }
|
92 | ;
|
93 | function _assertThisInitialized(self) {
|
94 | if (self === void 0) {
|
95 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
96 | }
|
97 | return self;
|
98 | }
|
99 | ;
|
100 | function _setPrototypeOf(o, p) {
|
101 | _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
102 | o.__proto__ = p;
|
103 | return o;
|
104 | };
|
105 | return _setPrototypeOf(o, p);
|
106 | }
|
107 | ;
|
108 |
|
109 | function _inheritsLoose(subClass, superClass) {
|
110 | subClass.prototype = Object.create(superClass.prototype);
|
111 | subClass.prototype.constructor = subClass;
|
112 | _setPrototypeOf(subClass, superClass);
|
113 | }
|
114 |
|
115 | var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
116 | ;
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | var Plugin = function () {
|
136 | |
137 |
|
138 |
|
139 |
|
140 |
|
141 | function Plugin(options) {
|
142 | if (options === void 0) {
|
143 | options = {};
|
144 | }
|
145 | this.$$ = void 0;
|
146 | this.options = void 0;
|
147 | this.options = options;
|
148 | }
|
149 |
|
150 | |
151 |
|
152 |
|
153 |
|
154 | var _proto = Plugin.prototype;
|
155 | _proto.$beforeInit = function $beforeInit() {}
|
156 |
|
157 | |
158 |
|
159 |
|
160 | ;
|
161 | _proto.$init = function $init() {}
|
162 |
|
163 | |
164 |
|
165 |
|
166 | ;
|
167 | _proto.$afterInit = function $afterInit() {}
|
168 |
|
169 | |
170 |
|
171 |
|
172 | ;
|
173 | _proto.$redraw = function $redraw() {}
|
174 |
|
175 | |
176 |
|
177 |
|
178 | ;
|
179 | _proto.$willDestroy = function $willDestroy() {
|
180 | var _this = this;
|
181 | Object.keys(this).forEach(function (key) {
|
182 | _newArrowCheck(this, _this);
|
183 | this[key] = null;
|
184 | delete this[key];
|
185 | }.bind(this));
|
186 | };
|
187 | return Plugin;
|
188 | }();
|
189 | Plugin.version = "3.6.3";
|
190 |
|
191 | ;
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 | var BubbleCompare = function (_Plugin) {
|
240 | _inheritsLoose(BubbleCompare, _Plugin);
|
241 | function BubbleCompare(options) {
|
242 | var _this = _Plugin.call(this, options) || this;
|
243 | _this.$$ = void 0;
|
244 | return _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
245 | }
|
246 | var _proto = BubbleCompare.prototype;
|
247 | _proto.$init = function $init() {
|
248 | var $$ = this.$$;
|
249 | $$.findClosest = this.findClosest.bind(this);
|
250 | $$.getBubbleR = this.getBubbleR.bind(this);
|
251 | $$.pointExpandedR = this.pointExpandedR.bind(this);
|
252 | };
|
253 | _proto.pointExpandedR = function pointExpandedR(d) {
|
254 | var baseR = this.getBubbleR(d),
|
255 | _this$options$expandS = this.options.expandScale,
|
256 | expandScale = _this$options$expandS === void 0 ? 1 : _this$options$expandS;
|
257 | BubbleCompare.raiseFocusedBubbleLayer(d);
|
258 | this.changeCursorPoint();
|
259 | return baseR * expandScale;
|
260 | };
|
261 | BubbleCompare.raiseFocusedBubbleLayer = function raiseFocusedBubbleLayer(d) {
|
262 | d.raise && (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(d.node().parentNode.parentNode).raise();
|
263 | };
|
264 | _proto.changeCursorPoint = function changeCursorPoint() {
|
265 | this.$$.$el.svg.select(".bb-event-rect").style("cursor", "pointer");
|
266 | };
|
267 | _proto.findClosest = function findClosest(values, pos) {
|
268 | var _this2 = this,
|
269 | $$ = this.$$;
|
270 | return values.filter(function (v) {
|
271 | _newArrowCheck(this, _this2);
|
272 | return v && !$$.isBarType(v.id);
|
273 | }.bind(this)).reduce(function (acc, cur) {
|
274 | _newArrowCheck(this, _this2);
|
275 | var d = $$.dist(cur, pos);
|
276 | return d < this.getBubbleR(cur) ? cur : acc;
|
277 | }.bind(this), 0);
|
278 | };
|
279 | _proto.getBubbleR = function getBubbleR(d) {
|
280 | var _this3 = this,
|
281 | _this$options = this.options,
|
282 | minR = _this$options.minR,
|
283 | maxR = _this$options.maxR,
|
284 | curVal = this.getZData(d);
|
285 | if (!curVal) return minR;
|
286 | var _this$$$$data$targets = this.$$.data.targets.reduce(function (_ref, cur) {
|
287 | var accMin = _ref[0],
|
288 | accMax = _ref[1];
|
289 | _newArrowCheck(this, _this3);
|
290 | var val = this.getZData(cur.values[0]);
|
291 | return [Math.min(accMin, val), Math.max(accMax, val)];
|
292 | }.bind(this), [1e4, 0]),
|
293 | min = _this$$$$data$targets[0],
|
294 | max = _this$$$$data$targets[1],
|
295 | size = min > 0 && max === min ? 0 : curVal / max;
|
296 | return Math.abs(size) * (maxR - minR) + minR;
|
297 | };
|
298 | _proto.getZData = function getZData(d) {
|
299 | return this.$$.isBubbleZType(d) ? this.$$.getBubbleZData(d.value, "z") : d.value;
|
300 | };
|
301 | return BubbleCompare;
|
302 | }(Plugin);
|
303 | BubbleCompare.version = "0.0.1";
|
304 |
|
305 | }();
|
306 | __webpack_exports__ = __webpack_exports__["default"];
|
307 | return __webpack_exports__;
|
308 | })()
|
309 | ;
|
310 | }); |
\ | No newline at end of file |