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-interpolate"), require("d3-color"), require("d3-scale"), require("d3-selection"), require("d3-brush"), require("d3-axis"), require("d3-format"));
|
15 | else if(typeof define === 'function' && define.amd)
|
16 | define("bb", ["d3-interpolate", "d3-color", "d3-scale", "d3-selection", "d3-brush", "d3-axis", "d3-format"], factory);
|
17 | else if(typeof exports === 'object')
|
18 | exports["bb"] = factory(require("d3-interpolate"), require("d3-color"), require("d3-scale"), require("d3-selection"), require("d3-brush"), require("d3-axis"), require("d3-format"));
|
19 | else
|
20 | root["bb"] = root["bb"] || {}, root["bb"]["plugin"] = root["bb"]["plugin"] || {}, root["bb"]["plugin"]["stanford"] = factory(root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"], root["d3"]);
|
21 | })(this, function(__WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__) {
|
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 | (function(module) {
|
35 |
|
36 | module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
|
37 |
|
38 | }),
|
39 | ,
|
40 |
|
41 | (function(module) {
|
42 |
|
43 | module.exports = __WEBPACK_EXTERNAL_MODULE__5__;
|
44 |
|
45 | }),
|
46 |
|
47 | (function(module) {
|
48 |
|
49 | module.exports = __WEBPACK_EXTERNAL_MODULE__6__;
|
50 |
|
51 | }),
|
52 |
|
53 | (function(module) {
|
54 |
|
55 | module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
56 |
|
57 | }),
|
58 |
|
59 | (function(module) {
|
60 |
|
61 | module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
|
62 |
|
63 | }),
|
64 |
|
65 | (function(module) {
|
66 |
|
67 | module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
|
68 |
|
69 | })
|
70 | ]);
|
71 |
|
72 |
|
73 | var __webpack_module_cache__ = {};
|
74 |
|
75 |
|
76 | function __webpack_require__(moduleId) {
|
77 |
|
78 | var cachedModule = __webpack_module_cache__[moduleId];
|
79 | if (cachedModule !== undefined) {
|
80 | return cachedModule.exports;
|
81 | }
|
82 |
|
83 | var module = __webpack_module_cache__[moduleId] = {
|
84 |
|
85 |
|
86 | exports: {}
|
87 | };
|
88 |
|
89 |
|
90 | __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
91 |
|
92 |
|
93 | return module.exports;
|
94 | }
|
95 |
|
96 |
|
97 |
|
98 | !function() {
|
99 |
|
100 | __webpack_require__.d = function(exports, definition) {
|
101 | for(var key in definition) {
|
102 | if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
103 | Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
104 | }
|
105 | }
|
106 | };
|
107 | }();
|
108 |
|
109 |
|
110 | !function() {
|
111 | __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
|
112 | }();
|
113 |
|
114 |
|
115 | var __webpack_exports__ = {};
|
116 |
|
117 | !function() {
|
118 |
|
119 |
|
120 | __webpack_require__.d(__webpack_exports__, {
|
121 | "default": function() { return Stanford; }
|
122 | });
|
123 |
|
124 | ;
|
125 | function _newArrowCheck(innerThis, boundThis) {
|
126 | if (innerThis !== boundThis) {
|
127 | throw new TypeError("Cannot instantiate an arrow function");
|
128 | }
|
129 | }
|
130 | ;
|
131 | function _assertThisInitialized(self) {
|
132 | if (self === void 0) {
|
133 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
134 | }
|
135 | return self;
|
136 | }
|
137 | ;
|
138 | function _setPrototypeOf(o, p) {
|
139 | _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
140 | o.__proto__ = p;
|
141 | return o;
|
142 | };
|
143 | return _setPrototypeOf(o, p);
|
144 | }
|
145 | ;
|
146 |
|
147 | function _inheritsLoose(subClass, superClass) {
|
148 | subClass.prototype = Object.create(superClass.prototype);
|
149 | subClass.prototype.constructor = subClass;
|
150 | _setPrototypeOf(subClass, superClass);
|
151 | }
|
152 |
|
153 | var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(5);
|
154 |
|
155 | var external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_ = __webpack_require__(6);
|
156 |
|
157 | var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webpack_require__(7);
|
158 | ;
|
159 | function _defineProperty(obj, key, value) {
|
160 | if (key in obj) {
|
161 | Object.defineProperty(obj, key, {
|
162 | value: value,
|
163 | enumerable: true,
|
164 | configurable: true,
|
165 | writable: true
|
166 | });
|
167 | } else {
|
168 | obj[key] = value;
|
169 | }
|
170 | return obj;
|
171 | }
|
172 | ;
|
173 |
|
174 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
175 | function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 | var $COMMON = {
|
185 | button: "bb-button",
|
186 | chart: "bb-chart",
|
187 | empty: "bb-empty",
|
188 | main: "bb-main",
|
189 | target: "bb-target",
|
190 | EXPANDED: "_expanded_"
|
191 | };
|
192 | var $ARC = {
|
193 | arc: "bb-arc",
|
194 | arcLabelLine: "bb-arc-label-line",
|
195 | arcs: "bb-arcs",
|
196 | chartArc: "bb-chart-arc",
|
197 | chartArcs: "bb-chart-arcs",
|
198 | chartArcsBackground: "bb-chart-arcs-background",
|
199 | chartArcsTitle: "bb-chart-arcs-title"
|
200 | };
|
201 | var $AREA = {
|
202 | area: "bb-area",
|
203 | areas: "bb-areas"
|
204 | };
|
205 | var $AXIS = {
|
206 | axis: "bb-axis",
|
207 | axisX: "bb-axis-x",
|
208 | axisXLabel: "bb-axis-x-label",
|
209 | axisY: "bb-axis-y",
|
210 | axisY2: "bb-axis-y2",
|
211 | axisY2Label: "bb-axis-y2-label",
|
212 | axisYLabel: "bb-axis-y-label"
|
213 | };
|
214 | var $BAR = {
|
215 | bar: "bb-bar",
|
216 | bars: "bb-bars",
|
217 | chartBar: "bb-chart-bar",
|
218 | chartBars: "bb-chart-bars"
|
219 | };
|
220 | var $CANDLESTICK = {
|
221 | candlestick: "bb-candlestick",
|
222 | candlesticks: "bb-candlesticks",
|
223 | chartCandlestick: "bb-chart-candlestick",
|
224 | chartCandlesticks: "bb-chart-candlesticks",
|
225 | valueDown: "bb-value-down",
|
226 | valueUp: "bb-value-up"
|
227 | };
|
228 | var $CIRCLE = {
|
229 | chartCircles: "bb-chart-circles",
|
230 | circle: "bb-circle",
|
231 | circles: "bb-circles"
|
232 | };
|
233 | var $COLOR = {
|
234 | colorPattern: "bb-color-pattern",
|
235 | colorScale: "bb-colorscale"
|
236 | };
|
237 | var $DRAG = {
|
238 | dragarea: "bb-dragarea",
|
239 | INCLUDED: "_included_"
|
240 | };
|
241 | var $GAUGE = {
|
242 | chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
243 | chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
244 | chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
245 | chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
246 | gaugeValue: "bb-gauge-value"
|
247 | };
|
248 | var $LEGEND = {
|
249 | legend: "bb-legend",
|
250 | legendBackground: "bb-legend-background",
|
251 | legendItem: "bb-legend-item",
|
252 | legendItemEvent: "bb-legend-item-event",
|
253 | legendItemHidden: "bb-legend-item-hidden",
|
254 | legendItemPoint: "bb-legend-item-point",
|
255 | legendItemTile: "bb-legend-item-tile"
|
256 | };
|
257 | var $LINE = {
|
258 | chartLine: "bb-chart-line",
|
259 | chartLines: "bb-chart-lines",
|
260 | line: "bb-line",
|
261 | lines: "bb-lines"
|
262 | };
|
263 | var $EVENT = {
|
264 | eventRect: "bb-event-rect",
|
265 | eventRects: "bb-event-rects",
|
266 | eventRectsMultiple: "bb-event-rects-multiple",
|
267 | eventRectsSingle: "bb-event-rects-single"
|
268 | };
|
269 | var $FOCUS = {
|
270 | focused: "bb-focused",
|
271 | defocused: "bb-defocused",
|
272 | legendItemFocused: "bb-legend-item-focused",
|
273 | xgridFocus: "bb-xgrid-focus",
|
274 | ygridFocus: "bb-ygrid-focus"
|
275 | };
|
276 | var $GRID = {
|
277 | grid: "bb-grid",
|
278 | gridLines: "bb-grid-lines",
|
279 | xgrid: "bb-xgrid",
|
280 | xgridLine: "bb-xgrid-line",
|
281 | xgridLines: "bb-xgrid-lines",
|
282 | xgrids: "bb-xgrids",
|
283 | ygrid: "bb-ygrid",
|
284 | ygridLine: "bb-ygrid-line",
|
285 | ygridLines: "bb-ygrid-lines",
|
286 | ygrids: "bb-ygrids"
|
287 | };
|
288 | var $LEVEL = {
|
289 | level: "bb-level",
|
290 | levels: "bb-levels"
|
291 | };
|
292 | var $RADAR = {
|
293 | chartRadar: "bb-chart-radar",
|
294 | chartRadars: "bb-chart-radars"
|
295 | };
|
296 | var $REGION = {
|
297 | region: "bb-region",
|
298 | regions: "bb-regions"
|
299 | };
|
300 | var $SELECT = {
|
301 | selectedCircle: "bb-selected-circle",
|
302 | selectedCircles: "bb-selected-circles",
|
303 | SELECTED: "_selected_"
|
304 | };
|
305 | var $SHAPE = {
|
306 | shape: "bb-shape",
|
307 | shapes: "bb-shapes"
|
308 | };
|
309 | var $SUBCHART = {
|
310 | brush: "bb-brush",
|
311 | subchart: "bb-subchart"
|
312 | };
|
313 | var $TEXT = {
|
314 | chartText: "bb-chart-text",
|
315 | chartTexts: "bb-chart-texts",
|
316 | text: "bb-text",
|
317 | texts: "bb-texts",
|
318 | title: "bb-title",
|
319 | TextOverlapping: "text-overlapping"
|
320 | };
|
321 | var $TOOLTIP = {
|
322 | tooltip: "bb-tooltip",
|
323 | tooltipContainer: "bb-tooltip-container",
|
324 | tooltipName: "bb-tooltip-name"
|
325 | };
|
326 | var $ZOOM = {
|
327 | buttonZoomReset: "bb-zoom-reset",
|
328 | zoomBrush: "bb-zoom-brush"
|
329 | };
|
330 | var classes = (_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $ZOOM));
|
331 |
|
332 | var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(1);
|
333 |
|
334 | var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(3);
|
335 | ;
|
336 |
|
337 | var _this = undefined;
|
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 |
|
348 | var win = function () {
|
349 | _newArrowCheck(this, _this);
|
350 | var root = 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;
|
351 | return root || Function("return this")();
|
352 | }.bind(undefined)();
|
353 |
|
354 |
|
355 |
|
356 | win.requestIdleCallback = win.requestIdleCallback || function (cb) {
|
357 | _newArrowCheck(this, _this);
|
358 | return setTimeout(cb, 1);
|
359 | }.bind(undefined);
|
360 |
|
361 | win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
|
362 | _newArrowCheck(this, _this);
|
363 | return setTimeout(cb, 1);
|
364 | }.bind(undefined);
|
365 | var doc = win == null ? void 0 : win.document;
|
366 | ;
|
367 |
|
368 |
|
369 | var util_this = undefined;
|
370 | function util_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
371 | function util_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? util_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : util_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 | var isValue = function (v) {
|
382 | _newArrowCheck(this, util_this);
|
383 | return v || v === 0;
|
384 | }.bind(undefined),
|
385 | isFunction = function (v) {
|
386 | _newArrowCheck(this, util_this);
|
387 | return typeof v === "function";
|
388 | }.bind(undefined),
|
389 | isString = function (v) {
|
390 | _newArrowCheck(this, util_this);
|
391 | return typeof v === "string";
|
392 | }.bind(undefined),
|
393 | isNumber = function (v) {
|
394 | _newArrowCheck(this, util_this);
|
395 | return typeof v === "number";
|
396 | }.bind(undefined),
|
397 | isUndefined = function (v) {
|
398 | _newArrowCheck(this, util_this);
|
399 | return typeof v === "undefined";
|
400 | }.bind(undefined),
|
401 | isDefined = function (v) {
|
402 | _newArrowCheck(this, util_this);
|
403 | return typeof v !== "undefined";
|
404 | }.bind(undefined),
|
405 | isboolean = function (v) {
|
406 | _newArrowCheck(this, util_this);
|
407 | return typeof v === "boolean";
|
408 | }.bind(undefined),
|
409 | ceil10 = function (v) {
|
410 | _newArrowCheck(this, util_this);
|
411 | return Math.ceil(v / 10) * 10;
|
412 | }.bind(undefined),
|
413 | asHalfPixel = function (n) {
|
414 | _newArrowCheck(this, util_this);
|
415 | return Math.ceil(n) + .5;
|
416 | }.bind(undefined),
|
417 | diffDomain = function (d) {
|
418 | _newArrowCheck(this, util_this);
|
419 | return d[1] - d[0];
|
420 | }.bind(undefined),
|
421 | isObjectType = function (v) {
|
422 | _newArrowCheck(this, util_this);
|
423 | return typeof v === "object";
|
424 | }.bind(undefined),
|
425 | isEmpty = function (o) {
|
426 | _newArrowCheck(this, util_this);
|
427 | return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
428 | }.bind(undefined),
|
429 | notEmpty = function (o) {
|
430 | _newArrowCheck(this, util_this);
|
431 | return !isEmpty(o);
|
432 | }.bind(undefined),
|
433 | isArray = function (arr) {
|
434 | _newArrowCheck(this, util_this);
|
435 | return Array.isArray(arr);
|
436 | }.bind(undefined),
|
437 | isObject = function (obj) {
|
438 | _newArrowCheck(this, util_this);
|
439 | return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
|
440 | }.bind(undefined);
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 | function getOption(options, key, defaultValue) {
|
451 | return isDefined(options[key]) ? options[key] : defaultValue;
|
452 | }
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 | function hasValue(dict, value) {
|
462 | var _this2 = this,
|
463 | found = !1;
|
464 | Object.keys(dict).forEach(function (key) {
|
465 | _newArrowCheck(this, _this2);
|
466 | return dict[key] === value && (found = !0);
|
467 | }.bind(this));
|
468 | return found;
|
469 | }
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 | function callFn(fn, thisArg) {
|
480 | for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
481 | args[_key - 2] = arguments[_key];
|
482 | }
|
483 | isFn && fn.call.apply(fn, [thisArg].concat(args));
|
484 | return isFn;
|
485 | }
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 | function endall(transition, cb) {
|
494 | var _this3 = this,
|
495 | n = 0,
|
496 | end = function () {
|
497 | for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
498 | args[_key2] = arguments[_key2];
|
499 | }
|
500 | --n || cb.apply.apply(cb, [this].concat(args));
|
501 | };
|
502 |
|
503 | if ("duration" in transition) {
|
504 | transition.each(function () {
|
505 | _newArrowCheck(this, _this3);
|
506 | return ++n;
|
507 | }.bind(this)).on("end", end);
|
508 | } else {
|
509 | ++n;
|
510 | transition.call(end);
|
511 | }
|
512 | }
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 | function sanitise(str) {
|
521 | return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
522 | }
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 | function setTextValue(node, text, dy, toMiddle) {
|
533 | var _this4 = this;
|
534 | if (dy === void 0) {
|
535 | dy = [-1, 1];
|
536 | }
|
537 | if (toMiddle === void 0) {
|
538 | toMiddle = !1;
|
539 | }
|
540 | if (!node || !isString(text)) {
|
541 | return;
|
542 | }
|
543 | if (text.indexOf("\n") === -1) {
|
544 | node.text(text);
|
545 | } else {
|
546 | var diff = [node.text(), text].map(function (v) {
|
547 | _newArrowCheck(this, _this4);
|
548 | return v.replace(/[\s\n]/g, "");
|
549 | }.bind(this));
|
550 | if (diff[0] !== diff[1]) {
|
551 | var multiline = text.split("\n"),
|
552 | len = toMiddle ? multiline.length - 1 : 1;
|
553 |
|
554 | node.html("");
|
555 | multiline.forEach(function (v, i) {
|
556 | _newArrowCheck(this, _this4);
|
557 | node.append("tspan").attr("x", 0).attr("dy", (i === 0 ? dy[0] * len : dy[1]) + "em").text(v);
|
558 | }.bind(this));
|
559 | }
|
560 | }
|
561 | }
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 | function getRectSegList(path) {
|
570 | |
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 | var _path$getBBox = path.getBBox(),
|
578 | x = _path$getBBox.x,
|
579 | y = _path$getBBox.y,
|
580 | width = _path$getBBox.width,
|
581 | height = _path$getBBox.height;
|
582 | return [{
|
583 | x: x,
|
584 | y: y + height
|
585 | },
|
586 |
|
587 | {
|
588 | x: x,
|
589 | y: y
|
590 | },
|
591 |
|
592 | {
|
593 | x: x + width,
|
594 | y: y
|
595 | },
|
596 |
|
597 | {
|
598 | x: x + width,
|
599 | y: y + height
|
600 | }
|
601 | ];
|
602 | }
|
603 |
|
604 |
|
605 |
|
606 |
|
607 |
|
608 |
|
609 |
|
610 | function getPathBox(path) {
|
611 | var _path$getBoundingClie = path.getBoundingClientRect(),
|
612 | width = _path$getBoundingClie.width,
|
613 | height = _path$getBoundingClie.height,
|
614 | items = getRectSegList(path),
|
615 | x = items[0].x,
|
616 | y = Math.min(items[0].y, items[1].y);
|
617 | return {
|
618 | x: x,
|
619 | y: y,
|
620 | width: width,
|
621 | height: height
|
622 | };
|
623 | }
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 | function getPointer(event, element) {
|
633 | var _ref,
|
634 | touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
|
635 | pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element),
|
636 | _this5 = this;
|
637 | return pointer.map(function (v) {
|
638 | _newArrowCheck(this, _this5);
|
639 | return isNaN(v) ? 0 : v;
|
640 | }.bind(this));
|
641 | }
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 | function getBrushSelection(ctx) {
|
650 | var event = ctx.event,
|
651 | $el = ctx.$el,
|
652 | main = $el.subchart.main || $el.main,
|
653 | selection;
|
654 |
|
655 | if (event && event.type === "brush") {
|
656 | selection = event.selection;
|
657 |
|
658 | } else if (main && (selection = main.select(".bb-brush").node())) {
|
659 | selection = (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection);
|
660 | }
|
661 | return selection;
|
662 | }
|
663 |
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 | function getBoundingRect(node) {
|
672 | var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width");
|
673 | return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect;
|
674 | }
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 | function getRandom(asStr, min, max) {
|
685 | if (asStr === void 0) {
|
686 | asStr = !0;
|
687 | }
|
688 | if (min === void 0) {
|
689 | min = 0;
|
690 | }
|
691 | if (max === void 0) {
|
692 | max = 1e4;
|
693 | }
|
694 | var rand = Math.floor(Math.random() * (max - min) + min);
|
695 | return asStr ? rand + "" : rand;
|
696 | }
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 | function findIndex(arr, v, start, end, isRotated) {
|
709 | if (start > end) {
|
710 | return -1;
|
711 | }
|
712 | var mid = Math.floor((start + end) / 2),
|
713 | _arr$mid = arr[mid],
|
714 | x = _arr$mid.x,
|
715 | _arr$mid$w = _arr$mid.w,
|
716 | w = _arr$mid$w === void 0 ? 0 : _arr$mid$w;
|
717 | if (isRotated) {
|
718 | x = arr[mid].y;
|
719 | w = arr[mid].h;
|
720 | }
|
721 | if (v >= x && v <= x + w) {
|
722 | return mid;
|
723 | }
|
724 | return v < x ? findIndex(arr, v, start, mid - 1, isRotated) : findIndex(arr, v, mid + 1, end, isRotated);
|
725 | }
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 | function brushEmpty(ctx) {
|
734 | var selection = getBrushSelection(ctx);
|
735 | if (selection) {
|
736 |
|
737 |
|
738 |
|
739 | return selection[0] === selection[1];
|
740 | }
|
741 | return !0;
|
742 | }
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 | function deepClone() {
|
751 | for (var _this6 = this, clone = function (v) {
|
752 | _newArrowCheck(this, _this6);
|
753 | if (isObject(v) && v.constructor) {
|
754 | var r = new v.constructor();
|
755 | for (var k in v) {
|
756 | r[k] = clone(v[k]);
|
757 | }
|
758 | return r;
|
759 | }
|
760 | return v;
|
761 | }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
762 | objectN[_key3] = arguments[_key3];
|
763 | }
|
764 | return objectN.map(function (v) {
|
765 | _newArrowCheck(this, _this6);
|
766 | return clone(v);
|
767 | }.bind(this)).reduce(function (a, c) {
|
768 | _newArrowCheck(this, _this6);
|
769 | return util_objectSpread(util_objectSpread({}, a), c);
|
770 | }.bind(this));
|
771 | }
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 | function extend(target, source) {
|
781 | var _this7 = this;
|
782 | if (target === void 0) {
|
783 | target = {};
|
784 | }
|
785 | if (isArray(source)) {
|
786 | source.forEach(function (v) {
|
787 | _newArrowCheck(this, _this7);
|
788 | return extend(target, v);
|
789 | }.bind(this));
|
790 | }
|
791 |
|
792 |
|
793 | for (var p in source) {
|
794 | if (/^\d+$/.test(p) || p in target) {
|
795 | continue;
|
796 | }
|
797 | target[p] = source[p];
|
798 | }
|
799 | return target;
|
800 | }
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 | var capitalize = function (str) {
|
809 | _newArrowCheck(this, util_this);
|
810 | return str.charAt(0).toUpperCase() + str.slice(1);
|
811 | }.bind(undefined);
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 |
|
819 |
|
820 | function camelize(str, separator) {
|
821 | var _this8 = this;
|
822 | if (separator === void 0) {
|
823 | separator = "-";
|
824 | }
|
825 | return str.split(separator).map(function (v, i) {
|
826 | _newArrowCheck(this, _this8);
|
827 | return i ? v.charAt(0).toUpperCase() + v.slice(1).toLowerCase() : v.toLowerCase();
|
828 | }.bind(this)).join("");
|
829 | }
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 | var toArray = function (v) {
|
838 | _newArrowCheck(this, util_this);
|
839 | return [].slice.call(v);
|
840 | }.bind(undefined);
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 |
|
850 | function addCssRules(style, selector, prop) {
|
851 | var _this9 = this,
|
852 | rootSelctor = style.rootSelctor,
|
853 | sheet = style.sheet,
|
854 | getSelector = function (s) {
|
855 | _newArrowCheck(this, _this9);
|
856 | return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
|
857 | }.bind(this),
|
858 | rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
859 | return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
860 | }
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 | function getCssRules(styleSheets) {
|
869 | var _this10 = this,
|
870 | rules = [];
|
871 | styleSheets.forEach(function (sheet) {
|
872 | _newArrowCheck(this, _this10);
|
873 | try {
|
874 | if (sheet.cssRules && sheet.cssRules.length) {
|
875 | rules = rules.concat(toArray(sheet.cssRules));
|
876 | }
|
877 | } catch (e) {
|
878 | console.error("Error while reading rules from " + sheet.href + ": " + e.toString());
|
879 | }
|
880 | }.bind(this));
|
881 | return rules;
|
882 | }
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 | function getTranslation(node) {
|
891 | var transform = node ? node.transform : null,
|
892 | baseVal = transform && transform.baseVal;
|
893 | return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : {
|
894 | a: 0,
|
895 | b: 0,
|
896 | c: 0,
|
897 | d: 0,
|
898 | e: 0,
|
899 | f: 0
|
900 | };
|
901 | }
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 | function getUnique(data) {
|
910 | var _this11 = this,
|
911 | isDate = data[0] instanceof Date,
|
912 | d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
913 | _newArrowCheck(this, _this11);
|
914 | return self.indexOf(v) === i;
|
915 | }.bind(this));
|
916 | return isDate ? d.map(function (v) {
|
917 | _newArrowCheck(this, _this11);
|
918 | return new Date(v);
|
919 | }.bind(this)) : d;
|
920 | }
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 | function mergeArray(arr) {
|
929 | var _this12 = this;
|
930 | return arr && arr.length ? arr.reduce(function (p, c) {
|
931 | _newArrowCheck(this, _this12);
|
932 | return p.concat(c);
|
933 | }.bind(this)) : [];
|
934 | }
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 | function mergeObj(target) {
|
944 | for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
945 | objectN[_key4 - 1] = arguments[_key4];
|
946 | }
|
947 | if (!objectN.length || objectN.length === 1 && !objectN[0]) {
|
948 | return target;
|
949 | }
|
950 | var source = objectN.shift();
|
951 | if (isObject(target) && isObject(source)) {
|
952 | Object.keys(source).forEach(function (key) {
|
953 | _newArrowCheck(this, _this13);
|
954 | var value = source[key];
|
955 | if (isObject(value)) {
|
956 | target[key] || (target[key] = {});
|
957 | target[key] = mergeObj(target[key], value);
|
958 | } else {
|
959 | target[key] = isArray(value) ? value.concat() : value;
|
960 | }
|
961 | }.bind(this));
|
962 | }
|
963 | return mergeObj.apply(void 0, [target].concat(objectN));
|
964 | }
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 | function sortValue(data, isAsc) {
|
974 | var _this14 = this;
|
975 | if (isAsc === void 0) {
|
976 | isAsc = !0;
|
977 | }
|
978 | var fn;
|
979 | if (data[0] instanceof Date) {
|
980 | fn = isAsc ? function (a, b) {
|
981 | _newArrowCheck(this, _this14);
|
982 | return a - b;
|
983 | }.bind(this) : function (a, b) {
|
984 | _newArrowCheck(this, _this14);
|
985 | return b - a;
|
986 | }.bind(this);
|
987 | } else {
|
988 | if (isAsc && !data.every(isNaN)) {
|
989 | fn = function (a, b) {
|
990 | _newArrowCheck(this, _this14);
|
991 | return a - b;
|
992 | }.bind(this);
|
993 | } else if (!isAsc) {
|
994 | fn = function (a, b) {
|
995 | _newArrowCheck(this, _this14);
|
996 | return a > b && -1 || a < b && 1 || a === b && 0;
|
997 | }.bind(this);
|
998 | }
|
999 | }
|
1000 | return data.concat().sort(fn);
|
1001 | }
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 | function getMinMax(type, data) {
|
1011 | var _this15 = this,
|
1012 | res = data.filter(function (v) {
|
1013 | _newArrowCheck(this, _this15);
|
1014 | return notEmpty(v);
|
1015 | }.bind(this));
|
1016 | if (res.length) {
|
1017 | if (isNumber(res[0])) {
|
1018 | res = Math[type].apply(Math, res);
|
1019 | } else if (res[0] instanceof Date) {
|
1020 | res = sortValue(res, type === "min")[0];
|
1021 | }
|
1022 | } else {
|
1023 | res = undefined;
|
1024 | }
|
1025 | return res;
|
1026 | }
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 | var getRange = function (start, end, step) {
|
1037 | if (step === void 0) {
|
1038 | step = 1;
|
1039 | }
|
1040 | _newArrowCheck(this, util_this);
|
1041 | var res = [],
|
1042 | n = Math.max(0, Math.ceil((end - start) / step)) | 0;
|
1043 | for (var i = start; i < n; i++) {
|
1044 | res.push(start + i * step);
|
1045 | }
|
1046 | return res;
|
1047 | }.bind(undefined),
|
1048 | emulateEvent = {
|
1049 | mouse: function () {
|
1050 | var _this16 = this;
|
1051 | _newArrowCheck(this, util_this);
|
1052 | var getParams = function () {
|
1053 | _newArrowCheck(this, _this16);
|
1054 | return {
|
1055 | bubbles: !1,
|
1056 | cancelable: !1,
|
1057 | screenX: 0,
|
1058 | screenY: 0,
|
1059 | clientX: 0,
|
1060 | clientY: 0
|
1061 | };
|
1062 | }.bind(this);
|
1063 | try {
|
1064 |
|
1065 | new MouseEvent("t");
|
1066 | return function (el, eventType, params) {
|
1067 | if (params === void 0) {
|
1068 | params = getParams();
|
1069 | }
|
1070 | _newArrowCheck(this, _this16);
|
1071 | el.dispatchEvent(new MouseEvent(eventType, params));
|
1072 | }.bind(this);
|
1073 | } catch (e) {
|
1074 |
|
1075 | return function (el, eventType, params) {
|
1076 | if (params === void 0) {
|
1077 | params = getParams();
|
1078 | }
|
1079 | _newArrowCheck(this, _this16);
|
1080 | var mouseEvent = doc.createEvent("MouseEvent");
|
1081 |
|
1082 |
|
1083 | mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
1084 |
|
1085 | params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null);
|
1086 | el.dispatchEvent(mouseEvent);
|
1087 | }.bind(this);
|
1088 | }
|
1089 | }.bind(undefined)(),
|
1090 | touch: function touch(el, eventType, params) {
|
1091 | _newArrowCheck(this, util_this);
|
1092 | var touchObj = new Touch(mergeObj({
|
1093 | identifier: Date.now(),
|
1094 | target: el,
|
1095 | radiusX: 2.5,
|
1096 | radiusY: 2.5,
|
1097 | rotationAngle: 10,
|
1098 | force: .5
|
1099 | }, params));
|
1100 | el.dispatchEvent(new TouchEvent(eventType, {
|
1101 | cancelable: !0,
|
1102 | bubbles: !0,
|
1103 | shiftKey: !0,
|
1104 | touches: [touchObj],
|
1105 | targetTouches: [],
|
1106 | changedTouches: [touchObj]
|
1107 | }));
|
1108 | }.bind(undefined)
|
1109 | };
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 | function tplProcess(tpl, data) {
|
1118 | var res = tpl;
|
1119 | for (var x in data) {
|
1120 | res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
|
1121 | }
|
1122 | return res;
|
1123 | }
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 | function parseDate(date) {
|
1133 | var parsedDate;
|
1134 | if (date instanceof Date) {
|
1135 | parsedDate = date;
|
1136 | } else if (isString(date)) {
|
1137 | var _format$dataTime,
|
1138 | config = this.config,
|
1139 | format = this.format;
|
1140 |
|
1141 |
|
1142 | parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
|
1143 | } else if (isNumber(date) && !isNaN(date)) {
|
1144 | parsedDate = new Date(+date);
|
1145 | }
|
1146 | if (!parsedDate || isNaN(+parsedDate)) {
|
1147 | console && console.error && console.error("Failed to parse x '" + date + "' to Date object");
|
1148 | }
|
1149 | return parsedDate;
|
1150 | }
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 | function isTabVisible() {
|
1158 | return (doc == null ? void 0 : doc.hidden) === !1 || (doc == null ? void 0 : doc.visibilityState) === "visible";
|
1159 | }
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | function convertInputType(mouse, touch) {
|
1169 | var _this17 = this,
|
1170 | DocumentTouch = win.DocumentTouch,
|
1171 | matchMedia = win.matchMedia,
|
1172 | navigator = win.navigator,
|
1173 | hasTouch = !1;
|
1174 | if (touch) {
|
1175 |
|
1176 | if (navigator && "maxTouchPoints" in navigator) {
|
1177 | hasTouch = navigator.maxTouchPoints > 0;
|
1178 |
|
1179 |
|
1180 |
|
1181 | } else if ("ontouchmove" in win || DocumentTouch && doc instanceof DocumentTouch) {
|
1182 | hasTouch = !0;
|
1183 | } else {
|
1184 |
|
1185 | if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
|
1186 | hasTouch = !0;
|
1187 | } else {
|
1188 |
|
1189 | var UA = navigator.userAgent;
|
1190 | hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
|
1191 | }
|
1192 | }
|
1193 | }
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 | var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
|
1199 | _newArrowCheck(this, _this17);
|
1200 | return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
|
1201 | }.bind(this));
|
1202 |
|
1203 |
|
1204 | return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
|
1205 | }
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 | function runUntil(fn, conditionFn) {
|
1214 | var _this18 = this;
|
1215 | if (conditionFn() === !1) {
|
1216 | win.requestAnimationFrame(function () {
|
1217 | _newArrowCheck(this, _this18);
|
1218 | return runUntil(fn, conditionFn);
|
1219 | }.bind(this));
|
1220 | } else {
|
1221 | fn();
|
1222 | }
|
1223 | }
|
1224 | ;
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 | function loadConfig(config) {
|
1237 | var _this = this,
|
1238 | thisConfig = this.config,
|
1239 | target,
|
1240 | keys,
|
1241 | read,
|
1242 | find = function () {
|
1243 | _newArrowCheck(this, _this);
|
1244 | var key = keys.shift();
|
1245 | if (key && target && isObjectType(target) && key in target) {
|
1246 | target = target[key];
|
1247 | return find();
|
1248 | } else if (!key) {
|
1249 | return target;
|
1250 | }
|
1251 | return undefined;
|
1252 | }.bind(this);
|
1253 | Object.keys(thisConfig).forEach(function (key) {
|
1254 | _newArrowCheck(this, _this);
|
1255 | target = config;
|
1256 | keys = key.split("_");
|
1257 | read = find();
|
1258 | if (isDefined(read)) {
|
1259 | thisConfig[key] = read;
|
1260 | }
|
1261 | }.bind(this));
|
1262 |
|
1263 |
|
1264 | if (this.api) {
|
1265 | this.state.orgConfig = config;
|
1266 | }
|
1267 | }
|
1268 | ;
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 | var Plugin = function () {
|
1288 | |
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 | function Plugin(options) {
|
1294 | if (options === void 0) {
|
1295 | options = {};
|
1296 | }
|
1297 | this.$$ = void 0;
|
1298 | this.options = void 0;
|
1299 | this.options = options;
|
1300 | }
|
1301 |
|
1302 | |
1303 |
|
1304 |
|
1305 |
|
1306 | var _proto = Plugin.prototype;
|
1307 | _proto.$beforeInit = function $beforeInit() {}
|
1308 |
|
1309 | |
1310 |
|
1311 |
|
1312 | ;
|
1313 | _proto.$init = function $init() {}
|
1314 |
|
1315 | |
1316 |
|
1317 |
|
1318 | ;
|
1319 | _proto.$afterInit = function $afterInit() {}
|
1320 |
|
1321 | |
1322 |
|
1323 |
|
1324 | ;
|
1325 | _proto.$redraw = function $redraw() {}
|
1326 |
|
1327 | |
1328 |
|
1329 |
|
1330 | ;
|
1331 | _proto.$willDestroy = function $willDestroy() {
|
1332 | var _this = this;
|
1333 | Object.keys(this).forEach(function (key) {
|
1334 | _newArrowCheck(this, _this);
|
1335 | this[key] = null;
|
1336 | delete this[key];
|
1337 | }.bind(this));
|
1338 | };
|
1339 | return Plugin;
|
1340 | }();
|
1341 | Plugin.version = "3.6.3";
|
1342 |
|
1343 | ;
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 | var Options = function () {
|
1357 | return {
|
1358 | |
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 | colors: undefined,
|
1370 | |
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 | epochs: [],
|
1380 | |
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 | lines: [],
|
1401 | |
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 | scale_min: undefined,
|
1427 | scale_max: undefined,
|
1428 | scale_width: 20,
|
1429 | scale_format: undefined,
|
1430 | |
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 | padding_top: 0,
|
1449 | padding_right: 0,
|
1450 | padding_bottom: 0,
|
1451 | padding_left: 0,
|
1452 | |
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 |
|
1483 | regions: []
|
1484 | };
|
1485 | };
|
1486 |
|
1487 | ;
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 |
|
1496 | var stanford_classes = ({
|
1497 | colorScale: "bb-colorscale",
|
1498 | stanfordElements: "bb-stanford-elements",
|
1499 | stanfordLine: "bb-stanford-line",
|
1500 | stanfordLines: "bb-stanford-lines",
|
1501 | stanfordRegion: "bb-stanford-region",
|
1502 | stanfordRegions: "bb-stanford-regions"
|
1503 | });
|
1504 | ;
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 | function pointInRegion(point, region) {
|
1520 |
|
1521 |
|
1522 |
|
1523 | var x = point.x,
|
1524 | y = point.value,
|
1525 | inside = !1;
|
1526 | for (var i = 0, j = region.length - 1; i < region.length; j = i++) {
|
1527 | var xi = region[i].x,
|
1528 | yi = region[i].y,
|
1529 | xj = region[j].x,
|
1530 | yj = region[j].y,
|
1531 | intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
|
1532 | if (intersect) {
|
1533 | inside = !inside;
|
1534 | }
|
1535 | }
|
1536 | return inside;
|
1537 | }
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 | function compareEpochs(a, b) {
|
1547 | if (a.epochs < b.epochs) {
|
1548 | return -1;
|
1549 | }
|
1550 | if (a.epochs > b.epochs) {
|
1551 | return 1;
|
1552 | }
|
1553 | return 0;
|
1554 | }
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 | function getRegionArea(points) {
|
1563 |
|
1564 | var area = 0,
|
1565 | point1,
|
1566 | point2;
|
1567 | for (var i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
1568 | point1 = points[i];
|
1569 | point2 = points[j];
|
1570 | area += point1.x * point2.y;
|
1571 | area -= point1.y * point2.x;
|
1572 | }
|
1573 | area /= 2;
|
1574 | return area;
|
1575 | }
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 | function getCentroid(points) {
|
1584 | var area = getRegionArea(points),
|
1585 | x = 0,
|
1586 | y = 0,
|
1587 | f;
|
1588 | for (var i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
1589 | var point1 = points[i],
|
1590 | point2 = points[j];
|
1591 | f = point1.x * point2.y - point2.x * point1.y;
|
1592 | x += (point1.x + point2.x) * f;
|
1593 | y += (point1.y + point2.y) * f;
|
1594 | }
|
1595 | f = area * 6;
|
1596 | return {
|
1597 | x: x / f,
|
1598 | y: y / f
|
1599 | };
|
1600 | }
|
1601 |
|
1602 | ;
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 |
|
1616 |
|
1617 |
|
1618 | var Elements = function () {
|
1619 | function Elements(owner) {
|
1620 | this.owner = void 0;
|
1621 | this.owner = owner;
|
1622 |
|
1623 |
|
1624 | var elements = owner.$$.$el.main.select(".bb-chart").append("g").attr("class", stanford_classes.stanfordElements);
|
1625 | elements.append("g").attr("class", stanford_classes.stanfordLines);
|
1626 | elements.append("g").attr("class", stanford_classes.stanfordRegions);
|
1627 | }
|
1628 | var _proto = Elements.prototype;
|
1629 | _proto.updateStanfordLines = function updateStanfordLines(duration) {
|
1630 | var _this = this,
|
1631 | $$ = this.owner.$$,
|
1632 | config = $$.config,
|
1633 | main = $$.$el.main,
|
1634 | isRotated = config.axis_rotated,
|
1635 | xvCustom = this.xvCustom.bind($$),
|
1636 | yvCustom = this.yvCustom.bind($$),
|
1637 | stanfordLine = main.select("." + stanford_classes.stanfordLines).style("shape-rendering", "geometricprecision").selectAll("." + stanford_classes.stanfordLine).data(this.owner.config.lines);
|
1638 |
|
1639 | stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove();
|
1640 |
|
1641 |
|
1642 | var stanfordLineEnter = stanfordLine.enter().append("g");
|
1643 | stanfordLineEnter.append("line").style("opacity", "0");
|
1644 | stanfordLineEnter.merge(stanfordLine).attr("class", function (d) {
|
1645 | _newArrowCheck(this, _this);
|
1646 | return stanford_classes.stanfordLine + (d.class ? " " + d.class : "");
|
1647 | }.bind(this)).select("line").transition().duration(duration).attr("x1", function (d) {
|
1648 | _newArrowCheck(this, _this);
|
1649 | return isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
|
1650 | }.bind(this)).attr("x2", function (d) {
|
1651 | _newArrowCheck(this, _this);
|
1652 | return isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2");
|
1653 | }.bind(this)).attr("y1", function (d) {
|
1654 | _newArrowCheck(this, _this);
|
1655 | return isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
|
1656 | }.bind(this)).attr("y2", function (d) {
|
1657 | _newArrowCheck(this, _this);
|
1658 | return isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2");
|
1659 | }.bind(this)).transition().style("opacity", null);
|
1660 | };
|
1661 | _proto.updateStanfordRegions = function updateStanfordRegions(duration) {
|
1662 | var _this2 = this,
|
1663 | $$ = this.owner.$$,
|
1664 | config = $$.config,
|
1665 | main = $$.$el.main,
|
1666 | isRotated = config.axis_rotated,
|
1667 | xvCustom = this.xvCustom.bind($$),
|
1668 | yvCustom = this.yvCustom.bind($$),
|
1669 | countPointsInRegion = this.owner.countEpochsInRegion.bind($$),
|
1670 | stanfordRegion = main.select("." + stanford_classes.stanfordRegions).selectAll("." + stanford_classes.stanfordRegion).data(this.owner.config.regions);
|
1671 |
|
1672 | stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove();
|
1673 |
|
1674 |
|
1675 | var stanfordRegionEnter = stanfordRegion.enter().append("g");
|
1676 | stanfordRegionEnter.append("polygon").style("opacity", "0");
|
1677 | stanfordRegionEnter.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0");
|
1678 | stanfordRegion = stanfordRegionEnter.merge(stanfordRegion);
|
1679 |
|
1680 |
|
1681 | stanfordRegion.attr("class", function (d) {
|
1682 | _newArrowCheck(this, _this2);
|
1683 | return stanford_classes.stanfordRegion + (d.class ? " " + d.class : "");
|
1684 | }.bind(this)).select("polygon").transition().duration(duration).attr("points", function (d) {
|
1685 | var _this3 = this;
|
1686 | _newArrowCheck(this, _this2);
|
1687 | return d.points.map(function (value) {
|
1688 | _newArrowCheck(this, _this3);
|
1689 | return [isRotated ? yvCustom(value, "y") : xvCustom(value, "x"), isRotated ? xvCustom(value, "x") : yvCustom(value, "y")].join(",");
|
1690 | }.bind(this)).join(" ");
|
1691 | }.bind(this)).transition().style("opacity", function (d) {
|
1692 | _newArrowCheck(this, _this2);
|
1693 | return (d.opacity ? d.opacity : .2) + "";
|
1694 | }.bind(this));
|
1695 | stanfordRegion.select("text").transition().duration(duration).attr("x", function (d) {
|
1696 | _newArrowCheck(this, _this2);
|
1697 | return isRotated ? yvCustom(getCentroid(d.points), "y") : xvCustom(getCentroid(d.points), "x");
|
1698 | }.bind(this)).attr("y", function (d) {
|
1699 | _newArrowCheck(this, _this2);
|
1700 | return isRotated ? xvCustom(getCentroid(d.points), "x") : yvCustom(getCentroid(d.points), "y");
|
1701 | }.bind(this)).text(function (d) {
|
1702 | _newArrowCheck(this, _this2);
|
1703 | if (d.text) {
|
1704 | var _countPointsInRegion = countPointsInRegion(d.points),
|
1705 | value = _countPointsInRegion.value,
|
1706 | percentage = _countPointsInRegion.percentage;
|
1707 | return d.text(value, percentage);
|
1708 | }
|
1709 | return "";
|
1710 | }.bind(this)).attr("text-anchor", "middle").attr("dominant-baseline", "middle").transition().style("opacity", null);
|
1711 | };
|
1712 | _proto.updateStanfordElements = function updateStanfordElements(duration) {
|
1713 | if (duration === void 0) {
|
1714 | duration = 0;
|
1715 | }
|
1716 | this.updateStanfordLines(duration);
|
1717 | this.updateStanfordRegions(duration);
|
1718 | };
|
1719 | _proto.xvCustom = function xvCustom(d, xyValue) {
|
1720 | var $$ = this,
|
1721 | axis = $$.axis,
|
1722 | config = $$.config,
|
1723 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
1724 | if (axis.isTimeSeries()) {
|
1725 | value = parseDate.call($$, value);
|
1726 | } else if (axis.isCategorized() && isString(value)) {
|
1727 | value = config.axis_x_categories.indexOf(d.value);
|
1728 | }
|
1729 | return Math.ceil($$.scale.x(value));
|
1730 | };
|
1731 | _proto.yvCustom = function yvCustom(d, xyValue) {
|
1732 | var $$ = this,
|
1733 | yScale = d.axis && d.axis === "y2" ? $$.scale.y2 : $$.scale.y,
|
1734 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
1735 | return Math.ceil(yScale(value));
|
1736 | };
|
1737 | return Elements;
|
1738 | }();
|
1739 |
|
1740 |
|
1741 | var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(8);
|
1742 |
|
1743 | var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __webpack_require__(9);
|
1744 | ;
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 | var ColorScale = function () {
|
1763 | function ColorScale(owner) {
|
1764 | this.owner = void 0;
|
1765 | this.colorScale = void 0;
|
1766 | this.owner = owner;
|
1767 | }
|
1768 | var _proto = ColorScale.prototype;
|
1769 | _proto.drawColorScale = function drawColorScale() {
|
1770 | var _this = this,
|
1771 | _this$owner = this.owner,
|
1772 | $$ = _this$owner.$$,
|
1773 | config = _this$owner.config,
|
1774 | target = $$.data.targets[0],
|
1775 | height = $$.state.height - config.padding_bottom - config.padding_top,
|
1776 | barWidth = config.scale_width,
|
1777 | points = getRange(config.padding_bottom, height, 5),
|
1778 | inverseScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequential)(target.colors).domain([points[points.length - 1], points[0]]);
|
1779 | if (this.colorScale) {
|
1780 | this.colorScale.remove();
|
1781 | }
|
1782 | this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale);
|
1783 | this.colorScale.append("g").attr("transform", "translate(0, " + config.padding_top + ")").selectAll("bars").data(points).enter().append("rect").attr("y", function (d, i) {
|
1784 | _newArrowCheck(this, _this);
|
1785 | return i * 5;
|
1786 | }.bind(this)).attr("x", 0).attr("width", barWidth).attr("height", 5).attr("fill", function (d) {
|
1787 | _newArrowCheck(this, _this);
|
1788 | return inverseScale(d);
|
1789 | }.bind(this));
|
1790 |
|
1791 |
|
1792 | var axisScale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLog)().domain([target.minEpochs, target.maxEpochs]).range([points[0] + config.padding_top + points[points.length - 1] + 5 - 1, points[0] + config.padding_top]),
|
1793 | legendAxis = (0,external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisRight)(axisScale),
|
1794 | scaleFormat = config.scale_format;
|
1795 | if (scaleFormat === "pow10") {
|
1796 | legendAxis.tickValues([1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7]);
|
1797 | } else if (isFunction(scaleFormat)) {
|
1798 | legendAxis.tickFormat(scaleFormat);
|
1799 | } else {
|
1800 | legendAxis.tickFormat((0,external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_.format)("d"));
|
1801 | }
|
1802 |
|
1803 |
|
1804 | var axis = this.colorScale.append("g").attr("class", "legend axis").attr("transform", "translate(" + barWidth + ",0)").call(legendAxis);
|
1805 | if (scaleFormat === "pow10") {
|
1806 | axis.selectAll(".tick text").text(null).filter(function (d) {
|
1807 | _newArrowCheck(this, _this);
|
1808 | return d / Math.pow(10, Math.ceil(Math.log(d) / Math.LN10 - 1e-12)) === 1;
|
1809 | }.bind(this))
|
1810 | .text(10).append("tspan").attr("dy", "-.7em")
|
1811 | .text(function (d) {
|
1812 | _newArrowCheck(this, _this);
|
1813 | return Math.round(Math.log(d) / Math.LN10);
|
1814 | }.bind(this));
|
1815 | }
|
1816 | this.colorScale.attr("transform", "translate(" + ($$.state.current.width - this.xForColorScale()) + ", 0)");
|
1817 | };
|
1818 | _proto.xForColorScale = function xForColorScale() {
|
1819 | return this.owner.config.padding_right + this.colorScale.node().getBBox().width;
|
1820 | };
|
1821 | _proto.getColorScalePadding = function getColorScalePadding() {
|
1822 | return this.xForColorScale() + this.owner.config.padding_left + 20;
|
1823 | };
|
1824 | return ColorScale;
|
1825 | }();
|
1826 |
|
1827 | ;
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 | var Stanford = function (_Plugin) {
|
1933 | _inheritsLoose(Stanford, _Plugin);
|
1934 | function Stanford(options) {
|
1935 | var _this = _Plugin.call(this, options) || this;
|
1936 | _this.config = void 0;
|
1937 | _this.colorScale = void 0;
|
1938 | _this.elements = void 0;
|
1939 | _this.config = new Options();
|
1940 | return _assertThisInitialized(_this) || _assertThisInitialized(_this);
|
1941 | }
|
1942 | var _proto = Stanford.prototype;
|
1943 | _proto.$beforeInit = function $beforeInit() {
|
1944 | var _this2 = this,
|
1945 | $$ = this.$$;
|
1946 |
|
1947 | $$.config.data_xSort = !1;
|
1948 | $$.isMultipleX = function () {
|
1949 | _newArrowCheck(this, _this2);
|
1950 | return !0;
|
1951 | }.bind(this);
|
1952 | $$.showGridFocus = function () {
|
1953 | _newArrowCheck(this, _this2);
|
1954 | }.bind(this);
|
1955 | $$.labelishData = function (d) {
|
1956 | _newArrowCheck(this, _this2);
|
1957 | return d.values;
|
1958 | }.bind(this);
|
1959 | $$.opacityForCircle = function () {
|
1960 | _newArrowCheck(this, _this2);
|
1961 | return 1;
|
1962 | }.bind(this);
|
1963 | var getCurrentPaddingRight = $$.getCurrentPaddingRight.bind($$);
|
1964 | $$.getCurrentPaddingRight = function () {
|
1965 | _newArrowCheck(this, _this2);
|
1966 | return getCurrentPaddingRight() + (this.colorScale ? this.colorScale.getColorScalePadding() : 0);
|
1967 | }.bind(this);
|
1968 | };
|
1969 | _proto.$init = function $init() {
|
1970 | var $$ = this.$$;
|
1971 | loadConfig.call(this, this.options);
|
1972 | $$.color = this.getStanfordPointColor.bind($$);
|
1973 | this.colorScale = new ColorScale(this);
|
1974 | this.elements = new Elements(this);
|
1975 | this.convertData();
|
1976 | this.initStanfordData();
|
1977 | this.setStanfordTooltip();
|
1978 | this.colorScale.drawColorScale();
|
1979 | this.$redraw();
|
1980 | };
|
1981 | _proto.$redraw = function $redraw(duration) {
|
1982 | var _this$colorScale, _this$elements;
|
1983 | (_this$colorScale = this.colorScale) == null ? void 0 : _this$colorScale.drawColorScale();
|
1984 | (_this$elements = this.elements) == null ? void 0 : _this$elements.updateStanfordElements(duration);
|
1985 | };
|
1986 | _proto.getOptions = function getOptions() {
|
1987 | return new Options();
|
1988 | };
|
1989 | _proto.convertData = function convertData() {
|
1990 | var _this3 = this,
|
1991 | data = this.$$.data.targets,
|
1992 | epochs = this.options.epochs;
|
1993 | data.forEach(function (d) {
|
1994 | var _this4 = this;
|
1995 | _newArrowCheck(this, _this3);
|
1996 | d.values.forEach(function (v, i) {
|
1997 | _newArrowCheck(this, _this4);
|
1998 | v.epochs = epochs[i];
|
1999 | }.bind(this));
|
2000 | d.minEpochs = undefined;
|
2001 | d.maxEpochs = undefined;
|
2002 | d.colors = undefined;
|
2003 | d.colorscale = undefined;
|
2004 | }.bind(this));
|
2005 | };
|
2006 | _proto.xvCustom = function xvCustom(d, xyValue) {
|
2007 | var $$ = this,
|
2008 | axis = $$.axis,
|
2009 | config = $$.config,
|
2010 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
2011 | if (axis.isTimeSeries()) {
|
2012 | value = parseDate.call($$, value);
|
2013 | } else if (axis.isCategorized() && isString(value)) {
|
2014 | value = config.axis_x_categories.indexOf(d.value);
|
2015 | }
|
2016 | return Math.ceil($$.scale.x(value));
|
2017 | };
|
2018 | _proto.yvCustom = function yvCustom(d, xyValue) {
|
2019 | var $$ = this,
|
2020 | scale = $$.scale,
|
2021 | yScale = d.axis && d.axis === "y2" ? scale.y2 : scale.y,
|
2022 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
2023 | return Math.ceil(yScale(value));
|
2024 | };
|
2025 | _proto.initStanfordData = function initStanfordData() {
|
2026 | var _this5 = this,
|
2027 | config = this.config,
|
2028 | target = this.$$.data.targets[0];
|
2029 |
|
2030 |
|
2031 | target.values.sort(compareEpochs);
|
2032 |
|
2033 |
|
2034 | var epochs = target.values.map(function (a) {
|
2035 | _newArrowCheck(this, _this5);
|
2036 | return a.epochs;
|
2037 | }.bind(this));
|
2038 | target.minEpochs = !isNaN(config.scale_min) ? config.scale_min : Math.min.apply(Math, epochs);
|
2039 | target.maxEpochs = !isNaN(config.scale_max) ? config.scale_max : Math.max.apply(Math, epochs);
|
2040 | target.colors = isFunction(config.colors) ? config.colors : (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolateHslLong)((0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(250, 1, .5), (0,external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_.hsl)(0, 1, .5));
|
2041 | target.colorscale = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSequentialLog)(target.colors).domain([target.minEpochs, target.maxEpochs]);
|
2042 | };
|
2043 | _proto.getStanfordPointColor = function getStanfordPointColor(d) {
|
2044 | var target = this.data.targets[0];
|
2045 | return target.colorscale(d.epochs);
|
2046 | };
|
2047 | _proto.setStanfordTooltip = function setStanfordTooltip() {
|
2048 | var config = this.$$.config;
|
2049 | if (isEmpty(config.tooltip_contents)) {
|
2050 | config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
|
2051 | var _this6 = this,
|
2052 | data_x = config.data_x,
|
2053 | html = "<table class=\"" + $TOOLTIP.tooltip + "\"><tbody>";
|
2054 | d.forEach(function (v) {
|
2055 | _newArrowCheck(this, _this6);
|
2056 | var _v$id = v.id,
|
2057 | id = _v$id === void 0 ? "" : _v$id,
|
2058 | _v$value = v.value,
|
2059 | value = _v$value === void 0 ? 0 : _v$value,
|
2060 | _v$epochs = v.epochs,
|
2061 | epochs = _v$epochs === void 0 ? 0 : _v$epochs,
|
2062 | _v$x = v.x,
|
2063 | x = _v$x === void 0 ? "" : _v$x;
|
2064 | html += "<tr>\n\t\t\t\t\t\t\t<th>" + (data_x || "") + "</th>\n\t\t\t\t\t\t\t<th class=\"value\">" + defaultTitleFormat(x) + "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>" + v.id + "</th>\n\t\t\t\t\t\t\t<th class=\"value\">" + defaultValueFormat(value) + "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"" + $TOOLTIP.tooltipName + "-" + id + "\">\n\t\t\t\t\t\t\t<td class=\"name\"><span style=\"background-color:" + color(v) + "\"></span>Epochs</td>\n\t\t\t\t\t\t\t<td class=\"value\">" + defaultValueFormat(epochs) + "</td>\n\t\t\t\t\t\t</tr>";
|
2065 | }.bind(this));
|
2066 | return html + "</tbody></table>";
|
2067 | };
|
2068 | }
|
2069 | };
|
2070 | _proto.countEpochsInRegion = function countEpochsInRegion(region) {
|
2071 | var _this7 = this,
|
2072 | $$ = this,
|
2073 | target = $$.data.targets[0],
|
2074 | total = target.values.reduce(function (accumulator, currentValue) {
|
2075 | _newArrowCheck(this, _this7);
|
2076 | return accumulator + +currentValue.epochs;
|
2077 | }.bind(this), 0),
|
2078 | value = target.values.reduce(function (accumulator, currentValue) {
|
2079 | _newArrowCheck(this, _this7);
|
2080 | if (pointInRegion(currentValue, region)) {
|
2081 | return accumulator + +currentValue.epochs;
|
2082 | }
|
2083 | return accumulator;
|
2084 | }.bind(this), 0);
|
2085 | return {
|
2086 | value: value,
|
2087 | percentage: value !== 0 ? +(value / total * 100).toFixed(1) : 0
|
2088 | };
|
2089 | };
|
2090 | return Stanford;
|
2091 | }(Plugin);
|
2092 |
|
2093 | }();
|
2094 | __webpack_exports__ = __webpack_exports__["default"];
|
2095 | return __webpack_exports__;
|
2096 | })()
|
2097 | ;
|
2098 | }); |
\ | No newline at end of file |