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"), require("d3-array"), require("d3-interpolate"), require("d3-color"), require("d3-scale"), require("d3-brush"), require("d3-axis"), require("d3-format"));
|
15 | else if(typeof define === 'function' && define.amd)
|
16 | define("stanford", ["d3-selection", "d3-array", "d3-interpolate", "d3-color", "d3-scale", "d3-brush", "d3-axis", "d3-format"], factory);
|
17 | else if(typeof exports === 'object')
|
18 | exports["stanford"] = factory(require("d3-selection"), require("d3-array"), require("d3-interpolate"), require("d3-color"), require("d3-scale"), 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"], root["d3"]);
|
21 | })(this, function(__WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__11__, __WEBPACK_EXTERNAL_MODULE__12__, __WEBPACK_EXTERNAL_MODULE__13__, __WEBPACK_EXTERNAL_MODULE__14__, __WEBPACK_EXTERNAL_MODULE__15__, __WEBPACK_EXTERNAL_MODULE__16__) {
|
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 = 19);
|
106 | })
|
107 |
|
108 | ([
|
109 | ,
|
110 |
|
111 | (function(module, __webpack_exports__, __webpack_require__) {
|
112 |
|
113 | "use strict";
|
114 | __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
|
115 | function _classCallCheck(instance, Constructor) {
|
116 | if (!(instance instanceof Constructor)) {
|
117 | throw new TypeError("Cannot call a class as a function");
|
118 | }
|
119 | }
|
120 |
|
121 | }),
|
122 |
|
123 | (function(module, __webpack_exports__, __webpack_require__) {
|
124 |
|
125 | "use strict";
|
126 | __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
|
127 | function _defineProperties(target, props) {
|
128 | for (var i = 0; i < props.length; i++) {
|
129 | var descriptor = props[i];
|
130 | descriptor.enumerable = descriptor.enumerable || false;
|
131 | descriptor.configurable = true;
|
132 | if ("value" in descriptor) descriptor.writable = true;
|
133 | Object.defineProperty(target, descriptor.key, descriptor);
|
134 | }
|
135 | }
|
136 |
|
137 | function _createClass(Constructor, protoProps, staticProps) {
|
138 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
139 | if (staticProps) _defineProperties(Constructor, staticProps);
|
140 | return Constructor;
|
141 | }
|
142 |
|
143 | }),
|
144 |
|
145 | (function(module, __webpack_exports__, __webpack_require__) {
|
146 |
|
147 | "use strict";
|
148 | __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
|
149 | var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
|
150 | var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
151 |
|
152 |
|
153 | function _possibleConstructorReturn(self, call) {
|
154 | if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[ "a"])(call) === "object" || typeof call === "function")) {
|
155 | return call;
|
156 | }
|
157 |
|
158 | return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[ "a"])(self);
|
159 | }
|
160 |
|
161 | }),
|
162 |
|
163 | (function(module, __webpack_exports__, __webpack_require__) {
|
164 |
|
165 | "use strict";
|
166 | __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
|
167 | function _typeof(obj) {
|
168 | "@babel/helpers - typeof";
|
169 |
|
170 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
171 | _typeof = function _typeof(obj) {
|
172 | return typeof obj;
|
173 | };
|
174 | } else {
|
175 | _typeof = function _typeof(obj) {
|
176 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
177 | };
|
178 | }
|
179 |
|
180 | return _typeof(obj);
|
181 | }
|
182 |
|
183 | }),
|
184 |
|
185 | (function(module, __webpack_exports__, __webpack_require__) {
|
186 |
|
187 | "use strict";
|
188 | __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
|
189 | function _assertThisInitialized(self) {
|
190 | if (self === void 0) {
|
191 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
192 | }
|
193 |
|
194 | return self;
|
195 | }
|
196 |
|
197 | }),
|
198 |
|
199 | (function(module, __webpack_exports__, __webpack_require__) {
|
200 |
|
201 | "use strict";
|
202 | __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
|
203 | function _getPrototypeOf(o) {
|
204 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
205 | return o.__proto__ || Object.getPrototypeOf(o);
|
206 | };
|
207 | return _getPrototypeOf(o);
|
208 | }
|
209 |
|
210 | }),
|
211 |
|
212 | (function(module, __webpack_exports__, __webpack_require__) {
|
213 |
|
214 | "use strict";
|
215 | __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
|
216 | function _defineProperty(obj, key, value) {
|
217 | if (key in obj) {
|
218 | Object.defineProperty(obj, key, {
|
219 | value: value,
|
220 | enumerable: true,
|
221 | configurable: true,
|
222 | writable: true
|
223 | });
|
224 | } else {
|
225 | obj[key] = value;
|
226 | }
|
227 |
|
228 | return obj;
|
229 | }
|
230 |
|
231 | }),
|
232 |
|
233 | (function(module, exports) {
|
234 |
|
235 | module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
|
236 |
|
237 | }),
|
238 |
|
239 | (function(module, __webpack_exports__, __webpack_require__) {
|
240 |
|
241 | "use strict";
|
242 | __webpack_require__.d(__webpack_exports__, "a", function() { return Plugin; });
|
243 | var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
244 | var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
245 | var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7);
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 | var Plugin = function () {
|
260 | |
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 | |
271 |
|
272 |
|
273 |
|
274 |
|
275 | function Plugin() {
|
276 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
277 | Object(_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[ "a"])(this, Plugin), this.options = options;
|
278 | }
|
279 | |
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 | return Object(_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[ "a"])(Plugin, [{
|
286 | key: "$beforeInit",
|
287 | value: function $beforeInit() {}
|
288 | |
289 |
|
290 |
|
291 |
|
292 |
|
293 | }, {
|
294 | key: "$init",
|
295 | value: function $init() {}
|
296 | |
297 |
|
298 |
|
299 |
|
300 |
|
301 | }, {
|
302 | key: "$afterInit",
|
303 | value: function $afterInit() {}
|
304 | |
305 |
|
306 |
|
307 |
|
308 |
|
309 | }, {
|
310 | key: "$redraw",
|
311 | value: function $redraw() {}
|
312 | |
313 |
|
314 |
|
315 |
|
316 |
|
317 | }, {
|
318 | key: "$willDestroy",
|
319 | value: function $willDestroy() {
|
320 | var _this = this;
|
321 |
|
322 | Object.keys(this).forEach(function (key) {
|
323 | _this[key] = null, delete _this[key];
|
324 | });
|
325 | }
|
326 | }]), Plugin;
|
327 | }();
|
328 |
|
329 | Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__[ "a"])(Plugin, "version", "1.12.1");
|
330 |
|
331 |
|
332 |
|
333 | }),
|
334 |
|
335 | (function(module, exports) {
|
336 |
|
337 | module.exports = __WEBPACK_EXTERNAL_MODULE__10__;
|
338 |
|
339 | }),
|
340 |
|
341 | (function(module, exports) {
|
342 |
|
343 | module.exports = __WEBPACK_EXTERNAL_MODULE__11__;
|
344 |
|
345 | }),
|
346 |
|
347 | (function(module, exports) {
|
348 |
|
349 | module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
|
350 |
|
351 | }),
|
352 |
|
353 | (function(module, exports) {
|
354 |
|
355 | module.exports = __WEBPACK_EXTERNAL_MODULE__13__;
|
356 |
|
357 | }),
|
358 |
|
359 | (function(module, exports) {
|
360 |
|
361 | module.exports = __WEBPACK_EXTERNAL_MODULE__14__;
|
362 |
|
363 | }),
|
364 |
|
365 | (function(module, exports) {
|
366 |
|
367 | module.exports = __WEBPACK_EXTERNAL_MODULE__15__;
|
368 |
|
369 | }),
|
370 |
|
371 | (function(module, exports) {
|
372 |
|
373 | module.exports = __WEBPACK_EXTERNAL_MODULE__16__;
|
374 |
|
375 | }),
|
376 | ,
|
377 | ,
|
378 |
|
379 | (function(module, __webpack_exports__, __webpack_require__) {
|
380 |
|
381 | "use strict";
|
382 |
|
383 | __webpack_require__.r(__webpack_exports__);
|
384 |
|
385 |
|
386 | __webpack_require__.d(__webpack_exports__, "default", function() { return stanford_Stanford; });
|
387 |
|
388 |
|
389 | var classCallCheck = __webpack_require__(1);
|
390 |
|
391 |
|
392 | var createClass = __webpack_require__(2);
|
393 |
|
394 |
|
395 | var possibleConstructorReturn = __webpack_require__(3);
|
396 |
|
397 |
|
398 | var getPrototypeOf = __webpack_require__(6);
|
399 |
|
400 |
|
401 | var assertThisInitialized = __webpack_require__(5);
|
402 |
|
403 |
|
404 | var inherits = __webpack_require__(22);
|
405 |
|
406 |
|
407 | var external_commonjs_d3_array_commonjs2_d3_array_amd_d3_array_root_d3_ = __webpack_require__(10);
|
408 |
|
409 |
|
410 | var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(11);
|
411 |
|
412 |
|
413 | var external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_ = __webpack_require__(12);
|
414 |
|
415 |
|
416 | var external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_ = __webpack_require__(13);
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 | var classes = ({
|
429 | arc: "bb-arc",
|
430 | arcLabelLine: "bb-arc-label-line",
|
431 | arcs: "bb-arcs",
|
432 | area: "bb-area",
|
433 | areas: "bb-areas",
|
434 | axis: "bb-axis",
|
435 | axisX: "bb-axis-x",
|
436 | axisXLabel: "bb-axis-x-label",
|
437 | axisY: "bb-axis-y",
|
438 | axisY2: "bb-axis-y2",
|
439 | axisY2Label: "bb-axis-y2-label",
|
440 | axisYLabel: "bb-axis-y-label",
|
441 | bar: "bb-bar",
|
442 | bars: "bb-bars",
|
443 | brush: "bb-brush",
|
444 | button: "bb-button",
|
445 | buttonZoomReset: "bb-zoom-reset",
|
446 | chart: "bb-chart",
|
447 | chartArc: "bb-chart-arc",
|
448 | chartArcs: "bb-chart-arcs",
|
449 | chartArcsBackground: "bb-chart-arcs-background",
|
450 | chartArcsGaugeMax: "bb-chart-arcs-gauge-max",
|
451 | chartArcsGaugeMin: "bb-chart-arcs-gauge-min",
|
452 | chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit",
|
453 | chartArcsTitle: "bb-chart-arcs-title",
|
454 | chartArcsGaugeTitle: "bb-chart-arcs-gauge-title",
|
455 | chartBar: "bb-chart-bar",
|
456 | chartBars: "bb-chart-bars",
|
457 | chartLine: "bb-chart-line",
|
458 | chartLines: "bb-chart-lines",
|
459 | chartRadar: "bb-chart-radar",
|
460 | chartRadars: "bb-chart-radars",
|
461 | chartText: "bb-chart-text",
|
462 | chartTexts: "bb-chart-texts",
|
463 | circle: "bb-circle",
|
464 | circles: "bb-circles",
|
465 | colorPattern: "bb-color-pattern",
|
466 | colorScale: "bb-colorscale",
|
467 | defocused: "bb-defocused",
|
468 | dragarea: "bb-dragarea",
|
469 | empty: "bb-empty",
|
470 | eventRect: "bb-event-rect",
|
471 | eventRects: "bb-event-rects",
|
472 | eventRectsMultiple: "bb-event-rects-multiple",
|
473 | eventRectsSingle: "bb-event-rects-single",
|
474 | focused: "bb-focused",
|
475 | gaugeValue: "bb-gauge-value",
|
476 | grid: "bb-grid",
|
477 | gridLines: "bb-grid-lines",
|
478 | legendBackground: "bb-legend-background",
|
479 | legendItem: "bb-legend-item",
|
480 | legendItemEvent: "bb-legend-item-event",
|
481 | legendItemFocused: "bb-legend-item-focused",
|
482 | legendItemHidden: "bb-legend-item-hidden",
|
483 | legendItemPoint: "bb-legend-item-point",
|
484 | legendItemTile: "bb-legend-item-tile",
|
485 | level: "bb-level",
|
486 | levels: "bb-levels",
|
487 | line: "bb-line",
|
488 | lines: "bb-lines",
|
489 | region: "bb-region",
|
490 | regions: "bb-regions",
|
491 | selectedCircle: "bb-selected-circle",
|
492 | selectedCircles: "bb-selected-circles",
|
493 | shape: "bb-shape",
|
494 | shapes: "bb-shapes",
|
495 | stanfordElements: "bb-stanford-elements",
|
496 | stanfordLine: "bb-stanford-line",
|
497 | stanfordLines: "bb-stanford-lines",
|
498 | stanfordRegion: "bb-stanford-region",
|
499 | stanfordRegions: "bb-stanford-regions",
|
500 | target: "bb-target",
|
501 | text: "bb-text",
|
502 | texts: "bb-texts",
|
503 | title: "bb-title",
|
504 | tooltip: "bb-tooltip",
|
505 | tooltipContainer: "bb-tooltip-container",
|
506 | tooltipName: "bb-tooltip-name",
|
507 | xgrid: "bb-xgrid",
|
508 | xgridFocus: "bb-xgrid-focus",
|
509 | xgridLine: "bb-xgrid-line",
|
510 | xgridLines: "bb-xgrid-lines",
|
511 | xgrids: "bb-xgrids",
|
512 | ygrid: "bb-ygrid",
|
513 | ygridFocus: "bb-ygrid-focus",
|
514 | ygridLine: "bb-ygrid-line",
|
515 | ygridLines: "bb-ygrid-lines",
|
516 | ygrids: "bb-ygrids",
|
517 | zoomBrush: "bb-zoom-brush",
|
518 | zoomRect: "bb-zoom-rect",
|
519 | EXPANDED: "_expanded_",
|
520 | SELECTED: "_selected_",
|
521 | INCLUDED: "_included_",
|
522 | TextOverlapping: "text-overlapping"
|
523 | });
|
524 |
|
525 | function _arrayWithoutHoles(arr) {
|
526 | if (Array.isArray(arr)) {
|
527 | for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
528 | arr2[i] = arr[i];
|
529 | }
|
530 |
|
531 | return arr2;
|
532 | }
|
533 | }
|
534 |
|
535 | function _iterableToArray(iter) {
|
536 | if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
537 | }
|
538 |
|
539 | function _nonIterableSpread() {
|
540 | throw new TypeError("Invalid attempt to spread non-iterable instance");
|
541 | }
|
542 |
|
543 |
|
544 |
|
545 |
|
546 | function _toConsumableArray(arr) {
|
547 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
548 | }
|
549 |
|
550 | var esm_typeof = __webpack_require__(4);
|
551 |
|
552 |
|
553 | var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(8);
|
554 |
|
555 |
|
556 | var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webpack_require__(14);
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 | var win = function () {
|
572 | var def = function (o) {
|
573 | return typeof o !== "undefined" && o;
|
574 | };
|
575 |
|
576 | return def(self) || def(window) || def(global) || def(globalThis) || Function("return this")();
|
577 | }(),
|
578 | doc = win && win.document;
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 | var isValue = function (v) {
|
598 | return v || v === 0;
|
599 | },
|
600 | isFunction = function (v) {
|
601 | return typeof v === "function";
|
602 | },
|
603 | isString = function (v) {
|
604 | return typeof v === "string";
|
605 | },
|
606 | isNumber = function (v) {
|
607 | return typeof v === "number";
|
608 | },
|
609 | isUndefined = function (v) {
|
610 | return typeof v === "undefined";
|
611 | },
|
612 | isDefined = function (v) {
|
613 | return typeof v !== "undefined";
|
614 | },
|
615 | isBoolean = function (v) {
|
616 | return typeof v === "boolean";
|
617 | },
|
618 | ceil10 = function (v) {
|
619 | return Math.ceil(v / 10) * 10;
|
620 | },
|
621 | asHalfPixel = function (n) {
|
622 | return Math.ceil(n) + .5;
|
623 | },
|
624 | diffDomain = function (d) {
|
625 | return d[1] - d[0];
|
626 | },
|
627 | isObjectType = function (v) {
|
628 | return Object(esm_typeof["a" ])(v) === "object";
|
629 | },
|
630 | isEmpty = function (o) {
|
631 | return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o);
|
632 | },
|
633 | notEmpty = function (o) {
|
634 | return !isEmpty(o);
|
635 | },
|
636 | isArray = function (arr) {
|
637 | return arr && arr.constructor === Array;
|
638 | },
|
639 | isObject = function (obj) {
|
640 | return obj && !obj.nodeType && isObjectType(obj) && !isArray(obj);
|
641 | },
|
642 | getOption = function (options, key, defaultValue) {
|
643 | return isDefined(options[key]) ? options[key] : defaultValue;
|
644 | },
|
645 | hasValue = function (dict, value) {
|
646 | var found = !1;
|
647 | return Object.keys(dict).forEach(function (key) {
|
648 | return dict[key] === value && (found = !0);
|
649 | }), found;
|
650 | },
|
651 | callFn = function (fn) {
|
652 | for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
|
653 |
|
654 | return isFn && fn.call.apply(fn, args), isFn;
|
655 | },
|
656 | sanitise = function (str) {
|
657 | return isString(str) ? str.replace(/</g, "<").replace(/>/g, ">") : str;
|
658 | },
|
659 | setTextValue = function (node, text) {
|
660 | var dy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [-1, 1],
|
661 | toMiddle = !!(arguments.length > 3 && arguments[3] !== undefined) && arguments[3];
|
662 | if (node && isString(text)) if (text.indexOf("\n") === -1) node.text(text);else {
|
663 | var diff = [node.text(), text].map(function (v) {
|
664 | return v.replace(/[\s\n]/g, "");
|
665 | });
|
666 |
|
667 | if (diff[0] !== diff[1]) {
|
668 | var multiline = text.split("\n"),
|
669 | len = toMiddle ? multiline.length - 1 : 1;
|
670 | node.html(""), multiline.forEach(function (v, i) {
|
671 | node.append("tspan").attr("x", 0).attr("dy", "".concat(i === 0 ? dy[0] * len : dy[1], "em")).text(v);
|
672 | });
|
673 | }
|
674 | }
|
675 | },
|
676 | getRectSegList = function (path) {
|
677 | |
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 |
|
684 | var _path$getBBox = path.getBBox(),
|
685 | x = _path$getBBox.x,
|
686 | y = _path$getBBox.y,
|
687 | width = _path$getBBox.width,
|
688 | height = _path$getBBox.height;
|
689 |
|
690 | return [{
|
691 | x: x,
|
692 | y: y + height
|
693 | },
|
694 | {
|
695 | x: x,
|
696 | y: y
|
697 | },
|
698 | {
|
699 | x: x + width,
|
700 | y: y
|
701 | },
|
702 | {
|
703 | x: x + width,
|
704 | y: y + height
|
705 | }
|
706 | ];
|
707 | },
|
708 | getPathBox = function (path) {
|
709 | var _path$getBoundingClie = path.getBoundingClientRect(),
|
710 | width = _path$getBoundingClie.width,
|
711 | height = _path$getBoundingClie.height,
|
712 | items = getRectSegList(path),
|
713 | x = items[0].x,
|
714 | y = Math.min(items[0].y, items[1].y);
|
715 |
|
716 | return {
|
717 | x: x,
|
718 | y: y,
|
719 | width: width,
|
720 | height: height
|
721 | };
|
722 | },
|
723 | getBrushSelection = function (ctx) {
|
724 | var selection = null,
|
725 | event = external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_["event"],
|
726 | main = ctx.context || ctx.main;
|
727 | return event && event.constructor.name === "BrushEvent" ? selection = event.selection : main && (selection = main.select(".".concat(classes.brush)).node()) && (selection = Object(external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_["brushSelection"])(selection)), selection;
|
728 | },
|
729 | getBoundingRect = function (node) {
|
730 | return node.rect || (node.rect = node.getBoundingClientRect());
|
731 | },
|
732 | getRandom = function () {
|
733 | var asStr = !(arguments.length > 0 && arguments[0] !== undefined) || arguments[0];
|
734 | return Math.random() + (asStr ? "" : 0);
|
735 | },
|
736 | brushEmpty = function (ctx) {
|
737 | var selection = getBrushSelection(ctx);
|
738 | return !selection || selection[0] === selection[1];
|
739 | },
|
740 | extend = function () {
|
741 | var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
742 | source = arguments.length > 1 ? arguments[1] : undefined;
|
743 |
|
744 | for (var p in source) target[p] = source[p];
|
745 |
|
746 | return target;
|
747 | },
|
748 | capitalize = function (str) {
|
749 | return str.charAt(0).toUpperCase() + str.slice(1);
|
750 | },
|
751 | toArray = function (v) {
|
752 | return [].slice.call(v);
|
753 | },
|
754 | getCssRules = function (styleSheets) {
|
755 | var rules = [];
|
756 | return styleSheets.forEach(function (sheet) {
|
757 | try {
|
758 | sheet.cssRules && sheet.cssRules.length && (rules = rules.concat(toArray(sheet.cssRules)));
|
759 | } catch (e) {
|
760 | console.error("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString()));
|
761 | }
|
762 | }), rules;
|
763 | },
|
764 | getTranslation = function (node) {
|
765 | var transform = node ? node.transform : null,
|
766 | baseVal = transform ? transform.baseVal : [];
|
767 | return baseVal.length ? baseVal.getItem(0).matrix : {
|
768 | a: 0,
|
769 | b: 0,
|
770 | c: 0,
|
771 | d: 0,
|
772 | e: 0,
|
773 | f: 0
|
774 | };
|
775 | },
|
776 | getUnique = function (data) {
|
777 | var isDate = data[0] instanceof Date,
|
778 | d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
|
779 | return self.indexOf(v) === i;
|
780 | });
|
781 | return isDate ? d.map(function (v) {
|
782 | return new Date(v);
|
783 | }) : d;
|
784 | },
|
785 | mergeArray = function (arr) {
|
786 | return arr && arr.length ? arr.reduce(function (p, c) {
|
787 | return p.concat(c);
|
788 | }) : [];
|
789 | },
|
790 | mergeObj = function (_mergeObj) {
|
791 | function mergeObj() {
|
792 | return _mergeObj.apply(this, arguments);
|
793 | }
|
794 |
|
795 | return mergeObj.toString = function () {
|
796 | return _mergeObj.toString();
|
797 | }, mergeObj;
|
798 | }(function (target) {
|
799 | for (var _len2 = arguments.length, objectN = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) objectN[_key2 - 1] = arguments[_key2];
|
800 |
|
801 | if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
|
802 | var source = objectN.shift();
|
803 | return isObject(target) && isObject(source) && Object.keys(source).forEach(function (key) {
|
804 | var value = source[key];
|
805 | isObject(value) ? (!target[key] && (target[key] = {}), target[key] = mergeObj(target[key], value)) : target[key] = isArray(value) ? value.concat() : value;
|
806 | }), mergeObj.apply(void 0, [target].concat(objectN));
|
807 | }),
|
808 | sortValue = function (data) {
|
809 | var fn,
|
810 | isAsc = !(arguments.length > 1 && arguments[1] !== undefined) || arguments[1];
|
811 | return data[0] instanceof Date ? fn = isAsc ? function (a, b) {
|
812 | return a - b;
|
813 | } : function (a, b) {
|
814 | return b - a;
|
815 | } : isAsc && !data.every(isNaN) ? fn = function (a, b) {
|
816 | return a - b;
|
817 | } : !isAsc && (fn = function (a, b) {
|
818 | return a > b && -1 || a < b && 1 || a === b && 0;
|
819 | }), data.concat().sort(fn);
|
820 | },
|
821 | getMinMax = function (type, data) {
|
822 | var res = data.filter(function (v) {
|
823 | return notEmpty(v);
|
824 | });
|
825 | return res.length ? isNumber(res[0]) ? res = Math[type].apply(Math, _toConsumableArray(res)) : res[0] instanceof Date && (res = sortValue(res, type === "min")[0]) : res = undefined, res;
|
826 | },
|
827 | getRange = function (start, end) {
|
828 | var res = [];
|
829 |
|
830 | for (var i = start; i < end; i++) res.push(i);
|
831 |
|
832 | return res;
|
833 | },
|
834 | emulateEvent = {
|
835 | mouse: function () {
|
836 | var getParams = function () {
|
837 | return {
|
838 | bubbles: !1,
|
839 | cancelable: !1,
|
840 | screenX: 0,
|
841 | screenY: 0,
|
842 | clientX: 0,
|
843 | clientY: 0
|
844 | };
|
845 | };
|
846 |
|
847 | try {
|
848 | return new MouseEvent("t"), function (el, eventType) {
|
849 | var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams();
|
850 | el.dispatchEvent(new MouseEvent(eventType, params));
|
851 | };
|
852 | } catch (e) {
|
853 |
|
854 | return function (el, eventType) {
|
855 | var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getParams(),
|
856 | mouseEvent = doc.createEvent("MouseEvent");
|
857 | mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0,
|
858 | params.screenX, params.screenY, params.clientX, params.clientY, !1, !1, !1, !1, 0, null), el.dispatchEvent(mouseEvent);
|
859 | };
|
860 | }
|
861 | }(),
|
862 | touch: function touch(el, eventType, params) {
|
863 | var touchObj = new Touch(mergeObj({
|
864 | identifier: Date.now(),
|
865 | target: el,
|
866 | radiusX: 2.5,
|
867 | radiusY: 2.5,
|
868 | rotationAngle: 10,
|
869 | force: .5
|
870 | }, params));
|
871 | el.dispatchEvent(new TouchEvent(eventType, {
|
872 | cancelable: !0,
|
873 | bubbles: !0,
|
874 | shiftKey: !0,
|
875 | touches: [touchObj],
|
876 | targetTouches: [],
|
877 | changedTouches: [touchObj]
|
878 | }));
|
879 | }
|
880 | },
|
881 | tplProcess = function (tpl, data) {
|
882 | var res = tpl;
|
883 |
|
884 | for (var x in data) res = res.replace(new RegExp("{=".concat(x, "}"), "g"), data[x]);
|
885 |
|
886 | return res;
|
887 | };
|
888 |
|
889 |
|
890 |
|
891 | var Plugin = __webpack_require__(9);
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 | var Options_Options = function Options() {
|
910 | return Object(classCallCheck["a" ])(this, Options), {
|
911 | |
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 | colors: undefined,
|
923 |
|
924 | |
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 | epochs: [],
|
934 |
|
935 | |
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 | lines: [],
|
956 |
|
957 | |
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 | scale_min: undefined,
|
982 | scale_max: undefined,
|
983 | scale_width: 20,
|
984 | scale_format: undefined,
|
985 |
|
986 | |
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 | padding_top: 0,
|
1004 | padding_right: 0,
|
1005 | padding_bottom: 0,
|
1006 | padding_left: 0,
|
1007 |
|
1008 | |
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 | regions: []
|
1040 | };
|
1041 | };
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 | var stanford_classes = ({
|
1055 | colorScale: "bb-colorscale",
|
1056 | stanfordElements: "bb-stanford-elements",
|
1057 | stanfordLine: "bb-stanford-line",
|
1058 | stanfordLines: "bb-stanford-lines",
|
1059 | stanfordRegion: "bb-stanford-region",
|
1060 | stanfordRegions: "bb-stanford-regions"
|
1061 | });
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 | function pointInRegion(point, region) {
|
1069 |
|
1070 |
|
1071 |
|
1072 | var x = point.x,
|
1073 | y = point.value,
|
1074 | inside = !1;
|
1075 |
|
1076 | for (var i = 0, j = region.length - 1; i < region.length; j = i++) {
|
1077 | var xi = region[i].x,
|
1078 | yi = region[i].y,
|
1079 | xj = region[j].x,
|
1080 | yj = region[j].y;
|
1081 | yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi && (inside = !inside);
|
1082 | }
|
1083 |
|
1084 | return inside;
|
1085 | }
|
1086 |
|
1087 | function compareEpochs(a, b) {
|
1088 | return a.epochs < b.epochs ? -1 : a.epochs > b.epochs ? 1 : 0;
|
1089 | }
|
1090 |
|
1091 | function getRegionArea(points) {
|
1092 |
|
1093 | for (var point1, point2, area = 0, i = 0, l = points.length, j = l - 1; i < l; j = i, i++) point1 = points[i], point2 = points[j], area += point1.x * point2.y, area -= point1.y * point2.x;
|
1094 |
|
1095 | return area /= 2, area;
|
1096 | }
|
1097 |
|
1098 | function getCentroid(points) {
|
1099 | for (var f, area = getRegionArea(points), x = 0, y = 0, i = 0, l = points.length, j = l - 1; i < l; j = i, i++) {
|
1100 | var _point = points[i],
|
1101 | _point2 = points[j];
|
1102 | f = _point.x * _point2.y - _point2.x * _point.y, x += (_point.x + _point2.x) * f, y += (_point.y + _point2.y) * f;
|
1103 | }
|
1104 |
|
1105 | return f = area * 6, {
|
1106 | x: x / f,
|
1107 | y: y / f
|
1108 | };
|
1109 | }
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 | var Elements_Elements = function () {
|
1131 | function Elements(owner) {
|
1132 | Object(classCallCheck["a" ])(this, Elements), this.owner = owner;
|
1133 |
|
1134 | var elements = owner.$$.main.select(".bb-chart").append("g").attr("class", stanford_classes.stanfordElements);
|
1135 | elements.append("g").attr("class", stanford_classes.stanfordLines), elements.append("g").attr("class", stanford_classes.stanfordRegions);
|
1136 | }
|
1137 |
|
1138 | return Object(createClass["a" ])(Elements, [{
|
1139 | key: "updateStanfordLines",
|
1140 | value: function updateStanfordLines(duration) {
|
1141 | var $$ = this.owner.$$,
|
1142 | main = $$.main,
|
1143 | config = $$.config,
|
1144 | isRotated = config.axis_rotated,
|
1145 | xvCustom = this.xvCustom.bind($$),
|
1146 | yvCustom = this.yvCustom.bind($$),
|
1147 | stanfordLine = main.select(".".concat(stanford_classes.stanfordLines)).style("shape-rendering", "geometricprecision").selectAll(".".concat(stanford_classes.stanfordLine)).data(this.owner.config.lines);
|
1148 | stanfordLine.exit().transition().duration(duration).style("opacity", "0").remove();
|
1149 |
|
1150 | var stanfordLineEnter = stanfordLine.enter().append("g");
|
1151 | stanfordLineEnter.append("line").style("opacity", "0"), stanfordLineEnter.merge(stanfordLine).attr("class", function (d) {
|
1152 | return stanford_classes.stanfordLine + (d["class"] ? " ".concat(d["class"]) : "");
|
1153 | }).select("line").transition().duration(duration).attr("x1", function (d) {
|
1154 | return isRotated ? yvCustom(d, "y1") : xvCustom(d, "x1");
|
1155 | }).attr("x2", function (d) {
|
1156 | return isRotated ? yvCustom(d, "y2") : xvCustom(d, "x2");
|
1157 | }).attr("y1", function (d) {
|
1158 | return isRotated ? xvCustom(d, "x1") : yvCustom(d, "y1");
|
1159 | }).attr("y2", function (d) {
|
1160 | return isRotated ? xvCustom(d, "x2") : yvCustom(d, "y2");
|
1161 | }).transition().style("opacity", "1");
|
1162 | }
|
1163 | }, {
|
1164 | key: "updateStanfordRegions",
|
1165 | value: function updateStanfordRegions(duration) {
|
1166 | var $$ = this.owner.$$,
|
1167 | main = $$.main,
|
1168 | config = $$.config,
|
1169 | isRotated = config.axis_rotated,
|
1170 | xvCustom = this.xvCustom.bind($$),
|
1171 | yvCustom = this.yvCustom.bind($$),
|
1172 | countPointsInRegion = this.owner.countEpochsInRegion.bind($$),
|
1173 | stanfordRegion = main.select(".".concat(stanford_classes.stanfordRegions)).selectAll(".".concat(stanford_classes.stanfordRegion)).data(this.owner.config.regions);
|
1174 | stanfordRegion.exit().transition().duration(duration).style("opacity", "0").remove();
|
1175 |
|
1176 | var stanfordRegionEnter = stanfordRegion.enter().append("g");
|
1177 | stanfordRegionEnter.append("polygon").style("opacity", "0"), stanfordRegionEnter.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0"), stanfordRegion = stanfordRegionEnter.merge(stanfordRegion), stanfordRegion.attr("class", function (d) {
|
1178 | return stanford_classes.stanfordRegion + (d["class"] ? " ".concat(d["class"]) : "");
|
1179 | }).select("polygon").transition().duration(duration).attr("points", function (d) {
|
1180 | return d.points.map(function (value) {
|
1181 | return [isRotated ? yvCustom(value, "y") : xvCustom(value, "x"), isRotated ? xvCustom(value, "x") : yvCustom(value, "y")].join(",");
|
1182 | }).join(" ");
|
1183 | }).transition().style("opacity", function (d) {
|
1184 | return (d.opacity ? d.opacity : .2) + "";
|
1185 | }), stanfordRegion.select("text").transition().duration(duration).attr("x", function (d) {
|
1186 | return isRotated ? yvCustom(getCentroid(d.points), "y") : xvCustom(getCentroid(d.points), "x");
|
1187 | }).attr("y", function (d) {
|
1188 | return isRotated ? xvCustom(getCentroid(d.points), "x") : yvCustom(getCentroid(d.points), "y");
|
1189 | }).text(function (d) {
|
1190 | if (d.text) {
|
1191 | var _countPointsInRegion = countPointsInRegion(d.points),
|
1192 | value = _countPointsInRegion.value,
|
1193 | percentage = _countPointsInRegion.percentage;
|
1194 |
|
1195 | return d.text(value, percentage);
|
1196 | }
|
1197 |
|
1198 | return "";
|
1199 | }).attr("text-anchor", "middle").attr("dominant-baseline", "middle").transition().style("opacity", "1");
|
1200 | }
|
1201 | }, {
|
1202 | key: "updateStanfordElements",
|
1203 | value: function updateStanfordElements() {
|
1204 | var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
1205 | this.updateStanfordLines(duration), this.updateStanfordRegions(duration);
|
1206 | }
|
1207 | }, {
|
1208 | key: "xvCustom",
|
1209 | value: function xvCustom(d, xyValue) {
|
1210 | var $$ = this,
|
1211 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
1212 | return $$.isTimeSeries() ? value = $$.parseDate(value) : $$.isCategorized() && isString(value) && (value = $$.config.axis_x_categories.indexOf(d.value)), Math.ceil($$.x(value));
|
1213 | }
|
1214 | }, {
|
1215 | key: "yvCustom",
|
1216 | value: function yvCustom(d, xyValue) {
|
1217 | var $$ = this,
|
1218 | yScale = d.axis && d.axis === "y2" ? $$.y2 : $$.y,
|
1219 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
1220 | return Math.ceil(yScale(value));
|
1221 | }
|
1222 | }]), Elements;
|
1223 | }();
|
1224 |
|
1225 |
|
1226 |
|
1227 | var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack_require__(15);
|
1228 |
|
1229 |
|
1230 | var external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_ = __webpack_require__(16);
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 | var ColorScale_ColorScale = function () {
|
1254 | function ColorScale(owner) {
|
1255 | Object(classCallCheck["a" ])(this, ColorScale), this.owner = owner;
|
1256 | }
|
1257 |
|
1258 | return Object(createClass["a" ])(ColorScale, [{
|
1259 | key: "drawColorScale",
|
1260 | value: function drawColorScale() {
|
1261 | var $$ = this.owner.$$,
|
1262 | config = this.owner.config,
|
1263 | target = $$.data.targets[0],
|
1264 | height = $$.height - config.padding_bottom - config.padding_top,
|
1265 | barWidth = config.scale_width,
|
1266 | barHeight = 5,
|
1267 | points = Object(external_commonjs_d3_array_commonjs2_d3_array_amd_d3_array_root_d3_["range"])(config.padding_bottom, height, barHeight),
|
1268 | inverseScale = Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleSequential"])(target.colors).domain([points[points.length - 1], points[0]]);
|
1269 | this.colorScale && this.colorScale.remove(), this.colorScale = $$.svg.append("g").attr("width", 50).attr("height", height).attr("class", stanford_classes.colorScale), this.colorScale.append("g").attr("transform", "translate(0, ".concat(config.padding_top, ")")).selectAll("bars").data(points).enter().append("rect").attr("y", function (d, i) {
|
1270 | return i * barHeight;
|
1271 | }).attr("x", 0).attr("width", barWidth).attr("height", barHeight).attr("fill", function (d) {
|
1272 | return inverseScale(d);
|
1273 | });
|
1274 |
|
1275 | var axisScale = Object(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] + barHeight - 1, points[0] + config.padding_top]),
|
1276 | legendAxis = Object(external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_["axisRight"])(axisScale),
|
1277 | scaleFormat = config.scale_format;
|
1278 | scaleFormat === "pow10" ? legendAxis.tickValues([1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7]) : isFunction(scaleFormat) ? legendAxis.tickFormat(scaleFormat) : legendAxis.tickFormat(Object(external_commonjs_d3_format_commonjs2_d3_format_amd_d3_format_root_d3_["format"])("d"));
|
1279 |
|
1280 | var axis = this.colorScale.append("g").attr("class", "legend axis").attr("transform", "translate(".concat(barWidth, ",0)")).call(legendAxis);
|
1281 | scaleFormat === "pow10" && axis.selectAll(".tick text").text(null).filter(function (d) {
|
1282 | return d / Math.pow(10, Math.ceil(Math.log(d) / Math.LN10 - 1e-12)) === 1;
|
1283 | })
|
1284 | .text(10).append("tspan").attr("dy", "-.7em")
|
1285 | .text(function (d) {
|
1286 | return Math.round(Math.log(d) / Math.LN10);
|
1287 | }), this.colorScale.attr("transform", "translate(".concat($$.currentWidth - this.xForColorScale(), ", 0)"));
|
1288 | }
|
1289 | }, {
|
1290 | key: "xForColorScale",
|
1291 | value: function xForColorScale() {
|
1292 | return this.owner.config.padding_right + this.colorScale.node().getBBox().width;
|
1293 | }
|
1294 | }, {
|
1295 | key: "getColorScalePadding",
|
1296 | value: function getColorScalePadding() {
|
1297 | return this.xForColorScale() + this.owner.config.padding_left + 20;
|
1298 | }
|
1299 | }]), ColorScale;
|
1300 | }();
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 | var stanford_Stanford = function (_Plugin) {
|
1412 | function Stanford(options) {
|
1413 | var _this;
|
1414 |
|
1415 | return Object(classCallCheck["a" ])(this, Stanford), _this = Object(possibleConstructorReturn["a" ])(this, Object(getPrototypeOf["a" ])(Stanford).call(this, options)), _this.config = new Options_Options(), Object(possibleConstructorReturn["a" ])(_this, Object(assertThisInitialized["a" ])(_this));
|
1416 | }
|
1417 |
|
1418 | return Object(inherits["a" ])(Stanford, _Plugin), Object(createClass["a" ])(Stanford, [{
|
1419 | key: "$beforeInit",
|
1420 | value: function $beforeInit() {
|
1421 | var _this2 = this,
|
1422 | $$ = this.$$;
|
1423 |
|
1424 | $$.config.data_xSort = !1, $$.isMultipleX = function () {
|
1425 | return !0;
|
1426 | }, $$.showGridFocus = function () {}, $$.labelishData = function (d) {
|
1427 | return d.values;
|
1428 | }, $$.opacityForCircle = function () {
|
1429 | return 1;
|
1430 | };
|
1431 | var getCurrentPaddingRight = $$.getCurrentPaddingRight.bind($$);
|
1432 |
|
1433 | $$.getCurrentPaddingRight = function () {
|
1434 | return getCurrentPaddingRight() + (_this2.colorScale ? _this2.colorScale.getColorScalePadding() : 0);
|
1435 | };
|
1436 | }
|
1437 | }, {
|
1438 | key: "$init",
|
1439 | value: function $init() {
|
1440 | var $$ = this.$$;
|
1441 | $$.loadConfig.bind(this)(this.options), $$.color = this.getStanfordPointColor.bind($$), this.colorScale = new ColorScale_ColorScale(this), this.elements = new Elements_Elements(this), this.convertData(), this.initStanfordData(), this.setStanfordTooltip(), this.colorScale.drawColorScale(), this.$redraw();
|
1442 | }
|
1443 | }, {
|
1444 | key: "$redraw",
|
1445 | value: function $redraw(duration) {
|
1446 | this.colorScale && this.colorScale.drawColorScale(), this.elements && this.elements.updateStanfordElements(duration);
|
1447 | }
|
1448 | }, {
|
1449 | key: "getOptions",
|
1450 | value: function getOptions() {
|
1451 | return new Options_Options();
|
1452 | }
|
1453 | }, {
|
1454 | key: "convertData",
|
1455 | value: function convertData() {
|
1456 | var data = this.$$.data.targets,
|
1457 | epochs = this.options.epochs;
|
1458 | data.forEach(function (d) {
|
1459 | d.values.forEach(function (v, i) {
|
1460 | v.epochs = epochs[i];
|
1461 | }), d.minEpochs = undefined, d.maxEpochs = undefined, d.colors = undefined, d.colorscale = undefined;
|
1462 | });
|
1463 | }
|
1464 | }, {
|
1465 | key: "xvCustom",
|
1466 | value: function xvCustom(d, xyValue) {
|
1467 | var $$ = this,
|
1468 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
1469 | return $$.isTimeSeries() ? value = $$.parseDate(value) : $$.isCategorized() && isString(value) && (value = $$.config.axis_x_categories.indexOf(d.value)), Math.ceil($$.x(value));
|
1470 | }
|
1471 | }, {
|
1472 | key: "yvCustom",
|
1473 | value: function yvCustom(d, xyValue) {
|
1474 | var $$ = this,
|
1475 | yScale = d.axis && d.axis === "y2" ? $$.y2 : $$.y,
|
1476 | value = xyValue ? d[xyValue] : $$.getBaseValue(d);
|
1477 | return Math.ceil(yScale(value));
|
1478 | }
|
1479 | }, {
|
1480 | key: "initStanfordData",
|
1481 | value: function initStanfordData() {
|
1482 | var config = this.config,
|
1483 | target = this.$$.data.targets[0];
|
1484 | target.values.sort(compareEpochs);
|
1485 |
|
1486 | var epochs = target.values.map(function (a) {
|
1487 | return a.epochs;
|
1488 | });
|
1489 | target.minEpochs = isNaN(config.scale_min) ? Object(external_commonjs_d3_array_commonjs2_d3_array_amd_d3_array_root_d3_["min"])(epochs) : config.scale_min, target.maxEpochs = isNaN(config.scale_max) ? Object(external_commonjs_d3_array_commonjs2_d3_array_amd_d3_array_root_d3_["max"])(epochs) : config.scale_max, target.colors = isFunction(config.colors) ? config.colors : Object(external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_["interpolateHslLong"])(Object(external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_["hsl"])(250, 1, .5), Object(external_commonjs_d3_color_commonjs2_d3_color_amd_d3_color_root_d3_["hsl"])(0, 1, .5)), target.colorscale = Object(external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_["scaleSequentialLog"])(target.colors).domain([target.minEpochs, target.maxEpochs]);
|
1490 | }
|
1491 | }, {
|
1492 | key: "getStanfordPointColor",
|
1493 | value: function getStanfordPointColor(d) {
|
1494 | var target = this.data.targets[0];
|
1495 | return target.colorscale(d.epochs);
|
1496 | }
|
1497 | }, {
|
1498 | key: "setStanfordTooltip",
|
1499 | value: function setStanfordTooltip() {
|
1500 | var config = this.$$.config;
|
1501 | isEmpty(config.tooltip_contents) && (config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
|
1502 | var _this3 = this,
|
1503 | html = "<table class=\"".concat(classes.tooltip, "\"><tbody>");
|
1504 |
|
1505 | return d.forEach(function (v) {
|
1506 | html += "<tr>\n\t\t\t\t\t\t\t<th>".concat(defaultTitleFormat(_this3.config.data_x), "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultValueFormat(v.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>").concat(defaultTitleFormat(v.id), "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultValueFormat(v.value), "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"").concat(classes.tooltipName, "-").concat(v.id, "\">\n\t\t\t\t\t\t\t<td class=\"name\"><span style=\"background-color:").concat(color(v), "\"></span>").concat(defaultTitleFormat("Epochs"), "</td>\n\t\t\t\t\t\t\t<td class=\"value\">").concat(defaultValueFormat(v.epochs), "</td>\n\t\t\t\t\t\t</tr>");
|
1507 | }), "".concat(html, "</tbody></table>");
|
1508 | });
|
1509 | }
|
1510 | }, {
|
1511 | key: "countEpochsInRegion",
|
1512 | value: function countEpochsInRegion(region) {
|
1513 | var $$ = this,
|
1514 | target = $$.data.targets[0],
|
1515 | total = target.values.reduce(function (accumulator, currentValue) {
|
1516 | return accumulator + +currentValue.epochs;
|
1517 | }, 0),
|
1518 | value = target.values.reduce(function (accumulator, currentValue) {
|
1519 | return pointInRegion(currentValue, region) ? accumulator + +currentValue.epochs : accumulator;
|
1520 | }, 0);
|
1521 | return {
|
1522 | value: value,
|
1523 | percentage: value === 0 ? 0 : +(value / total * 100).toFixed(1)
|
1524 | };
|
1525 | }
|
1526 | }]), Stanford;
|
1527 | }(Plugin["a" ]);
|
1528 |
|
1529 |
|
1530 |
|
1531 | }),
|
1532 | ,
|
1533 | ,
|
1534 |
|
1535 | (function(module, __webpack_exports__, __webpack_require__) {
|
1536 |
|
1537 | "use strict";
|
1538 |
|
1539 |
|
1540 | __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
|
1541 |
|
1542 |
|
1543 | function _setPrototypeOf(o, p) {
|
1544 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
1545 | o.__proto__ = p;
|
1546 | return o;
|
1547 | };
|
1548 |
|
1549 | return _setPrototypeOf(o, p);
|
1550 | }
|
1551 |
|
1552 |
|
1553 | function _inherits(subClass, superClass) {
|
1554 | if (typeof superClass !== "function" && superClass !== null) {
|
1555 | throw new TypeError("Super expression must either be null or a function");
|
1556 | }
|
1557 |
|
1558 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
1559 | constructor: {
|
1560 | value: subClass,
|
1561 | writable: true,
|
1562 | configurable: true
|
1563 | }
|
1564 | });
|
1565 | if (superClass) _setPrototypeOf(subClass, superClass);
|
1566 | }
|
1567 |
|
1568 | })
|
1569 | ])["default"];
|
1570 | }); |
\ | No newline at end of file |