@senx/warpview
Version:
WarpView Elements
925 lines (812 loc) • 16.7 MB
JavaScript
/*
* Copyright 2021 SenX S.A.S.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
window['global'] = window;
/**
@license @nocompile
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
(function () {
'use strict';
(function(){if(void 0===window.Reflect||void 0===window.customElements||window.customElements.polyfillWrapFlushCallback)return;const a=HTMLElement;window.HTMLElement={HTMLElement:function HTMLElement(){return Reflect.construct(a,[],this.constructor)}}.HTMLElement,HTMLElement.prototype=a.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,a);})();
}());
/*
* Copyright 2021 SenX S.A.S.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
window.addEventListener('DOMContentLoaded', function() {
const scriptPath = function () {
let scripts = document.getElementsByTagName('SCRIPT');
let path = '';
if (scripts && scripts.length > 0) {
for (let i in scripts) {
if (scripts[i].src && scripts[i].src.match(/\/warpview-elements\.js$/)) {
path = scripts[i].src.replace(/(.*)\/warpview-elements\.js$/, '$1');
break;
}
}
}
return path;
};
const css = document.createElement('link');
css.setAttribute('rel', 'stylesheet');
css.setAttribute('href', scriptPath() + '/warpview-elements.css');
document.head.prepend(css);
});
/******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 75882:
/*!************************************************************************************************!*\
!*** ./projects/warpview-ng/src/lib/elements/warp-view-3d-line/warp-view-3d-line.component.ts ***!
\************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "WarpView3dLineComponent": function() { return /* binding */ WarpView3dLineComponent; }
/* harmony export */ });
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */ 15671);
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/createClass.js */ 43144);
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_inherits_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/inherits.js */ 60136);
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createSuper_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/createSuper.js */ 29388);
/* harmony import */ var _warp_view_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../warp-view-component */ 39571);
/* harmony import */ var _services_resize_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../services/resize.service */ 82942);
/* harmony import */ var _utils_logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils/logger */ 41391);
/* harmony import */ var _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils/gts.lib */ 80958);
/* harmony import */ var _utils_color_lib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/color-lib */ 47476);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @angular/core */ 5000);
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @angular/common */ 69808);
/* harmony import */ var _warp_view_spinner_warp_view_spinner_component__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../warp-view-spinner/warp-view-spinner.component */ 61896);
/* harmony import */ var _plotly_plotly_component__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../plotly/plotly.component */ 58995);
/*
* Copyright 2021 SenX S.A.S.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
function WarpView3dLineComponent_warpview_spinner_2_Template(rf, ctx) {
if (rf & 1) {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelement"](0, "warpview-spinner", 7);
}
}
function WarpView3dLineComponent_p_3_Template(rf, ctx) {
if (rf & 1) {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementStart"](0, "p", 8);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵtext"](1, "No data to display");
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementEnd"]();
}
}
var _c0 = function _c0() {
return {
position: "relative",
width: "100%",
height: "100%"
};
};
function WarpView3dLineComponent_div_4_warpview_plotly_1_Template(rf, ctx) {
if (rf & 1) {
var _r8 = _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵgetCurrentView"]();
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementStart"](0, "warpview-plotly", 10, 11);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵlistener"]("afterPlot", function WarpView3dLineComponent_div_4_warpview_plotly_1_Template_warpview_plotly_afterPlot_0_listener() {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵrestoreView"](_r8);
var ctx_r7 = _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵnextContext"](2);
return ctx_r7.afterPlot();
})("hover", function WarpView3dLineComponent_div_4_warpview_plotly_1_Template_warpview_plotly_hover_0_listener($event) {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵrestoreView"](_r8);
var ctx_r9 = _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵnextContext"](2);
return ctx_r9.hover($event);
})("unhover", function WarpView3dLineComponent_div_4_warpview_plotly_1_Template_warpview_plotly_unhover_0_listener($event) {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵrestoreView"](_r8);
var ctx_r10 = _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵnextContext"](2);
return ctx_r10.unhover($event);
});
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementEnd"]();
}
if (rf & 2) {
var ctx_r5 = _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵnextContext"](2);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵstyleMap"](_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵpureFunction0"](8, _c0));
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵproperty"]("data", ctx_r5.plotlyData)("layout", ctx_r5.layout)("config", ctx_r5.plotlyConfig)("updateOnLayoutChange", true)("updateOnDataChange", true)("debug", ctx_r5.debug);
}
}
function WarpView3dLineComponent_div_4_Template(rf, ctx) {
if (rf & 1) {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementStart"](0, "div");
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵtemplate"](1, WarpView3dLineComponent_div_4_warpview_plotly_1_Template, 2, 9, "warpview-plotly", 9);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementEnd"]();
}
if (rf & 2) {
var ctx_r3 = _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵnextContext"]();
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵadvance"](1);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵproperty"]("ngIf", (ctx_r3.plotlyData == null ? null : ctx_r3.plotlyData.length) > 0);
}
}
var WarpView3dLineComponent = /*#__PURE__*/function (_WarpViewComponent) {
(0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_inherits_js__WEBPACK_IMPORTED_MODULE_2__["default"])(WarpView3dLineComponent, _WarpViewComponent);
var _super = (0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createSuper_js__WEBPACK_IMPORTED_MODULE_3__["default"])(WarpView3dLineComponent);
function WarpView3dLineComponent(el, renderer, sizeService, ngZone) {
var _this;
(0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this, WarpView3dLineComponent);
_this = _super.call(this, el, renderer, sizeService, ngZone);
_this.el = el;
_this.renderer = renderer;
_this.sizeService = sizeService;
_this.ngZone = ngZone;
_this.layout = {
showlegend: false,
xaxis: {},
yaxis: {},
zaxis: {},
margin: {
t: 10,
b: 25,
r: 10,
l: 10
}
};
_this._type = 'line3d';
_this.LOG = new _utils_logger__WEBPACK_IMPORTED_MODULE_6__.Logger(WarpView3dLineComponent, _this._debug);
return _this;
}
(0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_1__["default"])(WarpView3dLineComponent, [{
key: "type",
set: function set(type) {
this._type = type;
this.drawChart();
}
}, {
key: "ngOnInit",
value: function ngOnInit() {
this.drawChart();
}
}, {
key: "update",
value: function update(options) {
this.drawChart();
}
}, {
key: "drawChart",
value: function drawChart() {
if (!this.initChart(this.el)) {
return;
}
this.plotlyConfig.scrollZoom = true;
this.buildGraph();
}
}, {
key: "convert",
value: function convert(data) {
var _this2 = this;
var dataset = [];
this.LOG.debug(['convert'], data, this._options, this._type);
_utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.flatDeep(_utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.flattenGtsIdArray(data.data, 0).res).filter(function (g) {
return g.v && _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.isGts(g);
}).forEach(function (gts, i) {
if (gts.v) {
var label = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.serializeGtsMetadata(gts);
var c = _utils_color_lib__WEBPACK_IMPORTED_MODULE_8__.ColorLib.getColor(gts.id, _this2._options.scheme);
var color = ((data.params || [])[i] || {
datasetColor: c
}).datasetColor || c;
var series = {
mode: 'line',
type: 'scatter3d',
marker: {
color: _utils_color_lib__WEBPACK_IMPORTED_MODULE_8__.ColorLib.transparentize(color),
size: 3,
symbol: 'circle',
line: {
color: color,
width: 0
}
},
line: {
color: color,
width: 1
},
name: label,
x: [],
y: [],
z: [] // hoverinfo: 'none',
};
gts.v.forEach(function (value) {
if (value.length > 2) {
// lat lon
series.x.push(value[1]);
series.y.push(value[2]);
series.z.push(value[3]);
} else {
// time value
series.y.push(value[0]);
series.z.push(value[1]);
series.x.push(i);
}
});
dataset.push(series);
}
});
return dataset;
}
}, {
key: "buildGraph",
value: function buildGraph() {
this.LOG.debug(['drawChart', 'this.layout'], this.responsive);
this.LOG.debug(['drawChart', 'this.layout'], this.layout);
this.LOG.debug(['drawChart', 'this.plotlyConfig'], this.plotlyConfig);
this.layout.yaxis.color = this.getGridColor(this.el.nativeElement);
this.layout.xaxis.color = this.getGridColor(this.el.nativeElement);
this.layout.zaxis.color = this.getGridColor(this.el.nativeElement);
this.loading = false;
}
}, {
key: "resize",
value: function resize(layout) {//
}
}]);
return WarpView3dLineComponent;
}(_warp_view_component__WEBPACK_IMPORTED_MODULE_4__.WarpViewComponent);
WarpView3dLineComponent.ɵfac = function WarpView3dLineComponent_Factory(t) {
return new (t || WarpView3dLineComponent)(_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_11__.ElementRef), _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_11__.Renderer2), _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵdirectiveInject"](_services_resize_service__WEBPACK_IMPORTED_MODULE_5__.SizeService), _angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_11__.NgZone));
};
WarpView3dLineComponent.ɵcmp = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵdefineComponent"]({
type: WarpView3dLineComponent,
selectors: [["warpview-3d-line"]],
inputs: {
type: "type"
},
features: [_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵInheritDefinitionFeature"]],
decls: 7,
vars: 4,
consts: [["id", "chartContainer"], ["chartContainer", ""], ["message", "Parsing data", 4, "ngIf"], ["class", "noData", 4, "ngIf"], [4, "ngIf"], [1, "wv-tooltip", 3, "ngStyle"], ["toolTip", ""], ["message", "Parsing data"], [1, "noData"], ["className", "chart", 3, "data", "layout", "config", "updateOnLayoutChange", "updateOnDataChange", "debug", "style", "afterPlot", "hover", "unhover", 4, "ngIf"], ["className", "chart", 3, "data", "layout", "config", "updateOnLayoutChange", "updateOnDataChange", "debug", "afterPlot", "hover", "unhover"], ["graph", ""]],
template: function WarpView3dLineComponent_Template(rf, ctx) {
if (rf & 1) {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementStart"](0, "div", 0, 1);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵtemplate"](2, WarpView3dLineComponent_warpview_spinner_2_Template, 1, 0, "warpview-spinner", 2);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵtemplate"](3, WarpView3dLineComponent_p_3_Template, 2, 0, "p", 3);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵtemplate"](4, WarpView3dLineComponent_div_4_Template, 2, 1, "div", 4);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelement"](5, "div", 5, 6);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵelementEnd"]();
}
if (rf & 2) {
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵadvance"](2);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵproperty"]("ngIf", ctx.loading);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵadvance"](1);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵproperty"]("ngIf", ctx.noData);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵadvance"](1);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵproperty"]("ngIf", !ctx.loading && !ctx.noData);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵadvance"](1);
_angular_core__WEBPACK_IMPORTED_MODULE_11__["ɵɵproperty"]("ngStyle", ctx.getTooltipPosition());
}
},
directives: [_angular_common__WEBPACK_IMPORTED_MODULE_12__.NgIf, _warp_view_spinner_warp_view_spinner_component__WEBPACK_IMPORTED_MODULE_9__.WarpViewSpinnerComponent, _plotly_plotly_component__WEBPACK_IMPORTED_MODULE_10__.PlotlyComponent, _angular_common__WEBPACK_IMPORTED_MODULE_12__.NgStyle],
styles: ["/*!\n * Copyright 2021 SenX S.A.S.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n/*!\n * Copyright 2021 SenX S.A.S.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n:root {\n --warp-view-chart-width: 100%;\n --warp-view-chart-height: 100%;\n --warp-view-datagrid-cell-padding: 5px;\n --warp-view-map-margin: 0;\n --warp-view-switch-height: 30px;\n --warp-view-switch-width: 100px;\n --warp-view-switch-radius: 18px;\n --warp-view-plot-chart-height: 100%;\n --warp-view-slider-pointer-size: 65px;\n --warp-view-resize-handle-height: 10px;\n --warp-view-tile-width: 100%;\n --warp-view-tile-height: 100%;\n --warp-view-font-color: #000000;\n --warp-view-bar-color: #dc3545;\n --warp-view-datagrid-odd-bg-color: #ffffff;\n --warp-view-datagrid-odd-color: #404040;\n --warp-view-datagrid-even-bg-color: #c0c0c0;\n --warp-view-datagrid-even-color: #000000;\n --warp-view-pagination-border-color: #c0c0c0;\n --warp-view-pagination-bg-color: #ffffff;\n --warp-view-pagination-active-bg-color: #4CAF50;\n --warp-view-pagination-active-color: #ffffff;\n --warp-view-pagination-active-border-color: #4CAF50;\n --warp-view-pagination-hover-bg-color: #c0c0c0;\n --warp-view-pagination-hover-color: #000000;\n --warp-view-pagination-hover-border-color: #c0c0c0;\n --warp-view-pagination-disabled-color: #c0c0c0;\n --warp-view-switch-inset-color: #c0c0c0;\n --warp-view-switch-inset-checked-color: #00cd00;\n --warp-view-switch-handle-color: radial-gradient(#ffffff 15%, #c0c0c0 100%);\n --warp-view-switch-handle-checked-color: radial-gradient(#ffffff 15%, #00cd00 100%);\n --warp-view-resize-handle-color: #c0c0c0;\n --warp-view-chart-legend-bg: #ffffff;\n --warp-view-chart-legend-color: #404040;\n --gts-classname-font-color: #004eff;\n --gts-labelname-font-color: #19A979;\n --gts-attrname-font-color: #ED4A7B;\n --gts-separator-font-color: #a0a0a0;\n --gts-labelvalue-font-color: #000000;\n --gts-attrvalue-font-color: #000000;\n --gts-stack-font-color: #000000;\n --gts-tree-expanded-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA7klEQVQ4T82TMW7CQBBF/0g+QOpINEkVCmpaLoBm5COk5QYoaeAY3MDSei2LGu4QKakiBA1tCpTK8kS2sLVe2xSh8XSrnf9m/s4s4c6gO/UYGEBEXlT1bK396bFGIjIJguA7iqJLkVNbYOZXItoQ0QHAzBhz9CCFeAVgCeAjy7Jpmqa/NUBEEgDzktqGuOKKO47j+KsGhGH4lOf5HsDIg5ycyqVYVd+steuGheLAzM9EtPMgW1VdVGWJ6N0YU1gpozVGH+K+gy/uBHR1crXUqNzbQXXhduJ69sd7cxOZ+UFVH5Mk+exb+YGt8n9+5h8up1sReYC0WAAAAABJRU5ErkJggg==);\n --gts-tree-collapsed-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA0UlEQVQ4T6WTUW7CQAxEPQdozxYb9Qb94Aj9gQSoVCp6lMr21doDZFCQiFCU3YDY//d2PeOFPHnwJC+zAlVdA/jp+/6YmZ+1S0qCPxF5HUAAO3fvSpKS4ENEvm6gfUS0c5JiBma2Ibm/QiQPmbmdSqohquoA7GqSxRaapmkBjBkAeHP336t0UWBmHcnb+VcR4XcJpjDJLjPHkS4tleqZubmNiDHU6gumDQDYuvvh7hpV9V9EXgaA5Ka2jbMjmNk7yZOIfEfE8eFVfuSDLda4JDsD3FNdEckTC0YAAAAASUVORK5CYII=);\n --warp-view-popup-bg-color: #ffffff;\n --warp-view-popup-border-color: rgba(0, 0, 0, .2);\n --warp-view-popup-header-bg-color: #c0c0c0;\n --warp-view-popup-title-color: #404040;\n --warp-view-popup-close-color: #404040;\n --warp-view-popup-body-bg-color: #ffffff;\n --warp-view-popup-body-color: #000000;\n --warp-view-annotationtooltip-value-font-color: #004eff;\n --warp-view-annotationtooltip-font-color: #404040;\n --warp-view-spinner-color: #ff9900;\n --warp-view-tooltip-bg: #ffffff;\n --warp-view-tooltip-color: #000000;\n --warp-slider-connect-color: #ff9900;\n --warp-slider-handle-bg-color: #ffffff;\n --warp-slider-handle-color: #004eff;\n --warp-slider-handle-shadow: inset 0 0 1px #ffffff, inset 0 1px 7px #c0c0c0, 0 3px 6px -3px #a0a0a0;\n}\n.noData {\n width: 100%;\n text-align: center;\n color: var(--warp-view-chart-legend-color);\n position: relative;\n}\n.js-plotly-plot .plotly .cursor-ew-resize {\n cursor: default !important;\n}\n/*!\n * Copyright 2021 SenX S.A.S.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n/*!\n * Copyright 2021 SenX S.A.S.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n.gts-classname {\n color: var(--gts-classname-font-color);\n}\n.gts-labelname {\n color: var(--gts-labelname-font-color);\n}\n.gts-attrname {\n color: var(--gts-attrname-font-color);\n}\n.gts-separator {\n color: var(--gts-separator-font-color);\n}\n.gts-labelvalue {\n color: var(--gts-labelvalue-font-color);\n font-style: italic;\n}\n.gts-attrvalue {\n color: var(--gts-attrvalue-font-color);\n font-style: italic;\n}\n.wv-tooltip {\n background-color: var(--warp-view-tooltip-bg) !important;\n color: var(--warp-view-tooltip-color) !important;\n text-align: left;\n position: absolute;\n display: none;\n padding: 10px;\n border: 1px solid grey;\n border-radius: 5px;\n box-shadow: none;\n pointer-events: none;\n font-size: 10px;\n min-width: 100px;\n width: auto;\n max-width: 50%;\n z-index: 999;\n height: auto !important;\n left: -1000px;\n}\n.wv-tooltip .chip {\n border-radius: 50%;\n background-color: #bbbbbb;\n display: inline-block;\n width: 5px;\n height: 5px;\n border: 2px solid #454545;\n margin-top: auto;\n margin-bottom: auto;\n vertical-align: middle;\n cursor: pointer;\n}\n:host {\n display: block;\n height: 100%;\n}\n:host #chartContainer {\n height: 100%;\n}\n:host #chartContainer div {\n height: 100%;\n}\n:host div.chart {\n width: var(--warp-view-chart-width);\n height: var(--warp-view-chart-height);\n}"],
encapsulation: 3
});
/***/ }),
/***/ 77407:
/*!******************************************************************************************************!*\
!*** ./projects/warpview-ng/src/lib/elements/warp-view-annotation/warp-view-annotation.component.ts ***!
\******************************************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "WarpViewAnnotationComponent": function() { return /* binding */ WarpViewAnnotationComponent; }
/* harmony export */ });
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */ 15671);
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/createClass.js */ 43144);
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_inherits_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/inherits.js */ 60136);
/* harmony import */ var _home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createSuper_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/createSuper.js */ 29388);
/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @angular/core */ 5000);
/* harmony import */ var _warp_view_component__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../warp-view-component */ 39571);
/* harmony import */ var _utils_chart_lib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils/chart-lib */ 51616);
/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! moment-timezone */ 31158);
/* harmony import */ var moment_timezone__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(moment_timezone__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils/gts.lib */ 80958);
/* harmony import */ var _utils_color_lib__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils/color-lib */ 47476);
/* harmony import */ var _services_resize_service__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../services/resize.service */ 82942);
/* harmony import */ var _utils_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../utils/logger */ 41391);
/* harmony import */ var _model_chartBounds__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../model/chartBounds */ 75608);
/* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @angular/common */ 69808);
/* harmony import */ var _warp_view_spinner_warp_view_spinner_component__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../warp-view-spinner/warp-view-spinner.component */ 61896);
/* harmony import */ var _plotly_plotly_component__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../plotly/plotly.component */ 58995);
/*
* Copyright 2021 SenX S.A.S.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
function WarpViewAnnotationComponent_button_2_Template(rf, ctx) {
if (rf & 1) {
var _r6 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵgetCurrentView"]();
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelementStart"](0, "button", 7);
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵlistener"]("click", function WarpViewAnnotationComponent_button_2_Template_button_click_0_listener() {
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵrestoreView"](_r6);
var ctx_r5 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵnextContext"]();
return ctx_r5.toggle();
});
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵtext"](1, "+/- ");
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelementEnd"]();
}
}
function WarpViewAnnotationComponent_warpview_spinner_5_Template(rf, ctx) {
if (rf & 1) {
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelement"](0, "warpview-spinner", 8);
}
}
var _c0 = function _c0(a0) {
return {
left: a0
};
};
var _c1 = function _c1() {
return {
position: "relative",
width: "100%",
height: "100%"
};
};
function WarpViewAnnotationComponent_div_6_Template(rf, ctx) {
if (rf & 1) {
var _r9 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵgetCurrentView"]();
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelementStart"](0, "div", 9);
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelement"](1, "div", 10);
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelementStart"](2, "warpview-plotly", 11, 12);
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵlistener"]("afterPlot", function WarpViewAnnotationComponent_div_6_Template_warpview_plotly_afterPlot_2_listener($event) {
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵrestoreView"](_r9);
var ctx_r8 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵnextContext"]();
return ctx_r8.afterPlot($event);
})("relayout", function WarpViewAnnotationComponent_div_6_Template_warpview_plotly_relayout_2_listener($event) {
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵrestoreView"](_r9);
var ctx_r10 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵnextContext"]();
return ctx_r10.relayout($event);
})("hover", function WarpViewAnnotationComponent_div_6_Template_warpview_plotly_hover_2_listener($event) {
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵrestoreView"](_r9);
var ctx_r11 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵnextContext"]();
return ctx_r11.hover($event);
})("unhover", function WarpViewAnnotationComponent_div_6_Template_warpview_plotly_unhover_2_listener() {
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵrestoreView"](_r9);
var ctx_r12 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵnextContext"]();
return ctx_r12.unhover();
});
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelementEnd"]();
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵelementEnd"]();
}
if (rf & 2) {
var ctx_r4 = _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵnextContext"]();
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵadvance"](1);
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵproperty"]("ngStyle", _angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵpureFunction1"](9, _c0, ctx_r4.standalone ? "10px" : ctx_r4.marginLeft + "px"));
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵadvance"](1);
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵstyleMap"](_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵpureFunction0"](11, _c1));
_angular_core__WEBPACK_IMPORTED_MODULE_14__["ɵɵproperty"]("data", ctx_r4.plotlyData)("layout", ctx_r4.layout)("config", ctx_r4.plotlyConfig)("updateOnLayoutChange", true)("updateOnDataChange", true)("debug", ctx_r4.debug);
}
}
var WarpViewAnnotationComponent = /*#__PURE__*/function (_WarpViewComponent) {
(0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_inherits_js__WEBPACK_IMPORTED_MODULE_2__["default"])(WarpViewAnnotationComponent, _WarpViewComponent);
var _super = (0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createSuper_js__WEBPACK_IMPORTED_MODULE_3__["default"])(WarpViewAnnotationComponent);
function WarpViewAnnotationComponent(el, renderer, sizeService, ngZone) {
var _this;
(0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_classCallCheck_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this, WarpViewAnnotationComponent);
_this = _super.call(this, el, renderer, sizeService, ngZone);
_this.el = el;
_this.renderer = renderer;
_this.sizeService = sizeService;
_this.ngZone = ngZone;
_this.height = 0;
_this.pointHover = new _angular_core__WEBPACK_IMPORTED_MODULE_14__.EventEmitter();
_this.chartDraw = new _angular_core__WEBPACK_IMPORTED_MODULE_14__.EventEmitter();
_this.boundsDidChange = new _angular_core__WEBPACK_IMPORTED_MODULE_14__.EventEmitter();
_this.displayExpander = true;
_this.layout = {
showlegend: false,
hovermode: 'closest',
xaxis: {
gridwidth: 1,
fixedrange: false,
autorange: false,
automargin: false,
showticklabels: true,
showgrid: false
},
autosize: false,
autoexpand: false,
yaxis: {
showticklabels: false,
fixedrange: true,
dtick: 1,
gridwidth: 1,
tick0: 0,
nticks: 1,
rangemode: 'tozero',
tickson: 'boundaries',
automargin: false,
autorange: false,
showline: false,
zeroline: true
},
margin: {
t: 2,
b: 50,
r: 10,
l: 10
}
};
_this.marginLeft = 50;
_this.expanded = false; // tslint:disable-next-line:variable-name
_this._type = 'annotation';
_this.visibility = [];
_this._standalone = true;
_this.maxTick = Number.MIN_VALUE;
_this.minTick = Number.MAX_VALUE;
_this.visibleGtsId = [];
_this.gtsId = [];
_this.dataHashset = {};
_this.lineHeight = 30;
_this.chartBounds = new _model_chartBounds__WEBPACK_IMPORTED_MODULE_11__.ChartBounds();
_this.afterBoundsUpdate = false;
_this.firstDraw = true;
_this._autoResize = false;
_this.LOG = new _utils_logger__WEBPACK_IMPORTED_MODULE_10__.Logger(WarpViewAnnotationComponent, _this._debug);
return _this;
}
(0,_home_pierre_WARP10src_warpview_node_modules_babel_runtime_helpers_esm_createClass_js__WEBPACK_IMPORTED_MODULE_1__["default"])(WarpViewAnnotationComponent, [{
key: "type",
set: function set(type) {
this.LOG.debug(['type'], type);
this._type = type;
this.drawChart();
}
}, {
key: "hiddenData",
set: function set(hiddenData) {
var _this2 = this;
var previousVisibility = JSON.stringify(this.visibility);
this.LOG.debug(['hiddenData', 'previousVisibility'], previousVisibility);
this._hiddenData = hiddenData;
this.visibility = [];
this.visibleGtsId.forEach(function (id) {
return _this2.visibility.push(hiddenData.indexOf(id) < 0 && id !== -1);
});
this.LOG.debug(['hiddenData', 'hiddendygraphfullv'], this.visibility);
var newVisibility = JSON.stringify(this.visibility);
this.LOG.debug(['hiddenData', 'json'], previousVisibility, newVisibility);
if (previousVisibility !== newVisibility) {
var visible = [];
var hidden = [];
this.gtsId.forEach(function (id, i) {
if (_this2._hiddenData.indexOf(id) > -1) {
hidden.push(i);
} else {
visible.push(i);
}
});
if (visible.length > 0) {
this.graph.restyleChart({
visible: true
}, visible);
}
if (hidden.length > 0) {
this.graph.restyleChart({
visible: false
}, hidden);
}
this.LOG.debug(['hiddendygraphtrig', 'destroy'], 'redraw by visibility change');
}
}
}, {
key: "standalone",
get: function get() {
return this._standalone;
},
set: function set(isStandalone) {
this.LOG.debug(['standalone'], isStandalone);
if (this._standalone !== isStandalone) {
this._standalone = isStandalone;
this.drawChart();
}
}
}, {
key: "handleKeyDown",
value: function handleKeyDown($event) {
var _this3 = this;
if ($event.key === 'Control') {
this.trimmed = setInterval(function () {
if (!!_this3.toolTip.nativeElement.querySelector('#tooltip-body')) {
_this3.toolTip.nativeElement.querySelector('#tooltip-body').classList.add('full');
}
}, 100);
}
}
}, {
key: "handleKeyup",
value: function handleKeyup($event) {
this.LOG.debug(['document:keyup'], $event);
if ($event.key === 'Control') {
if (!!this.toolTip.nativeElement.querySelector('#tooltip-body')) {
if (this.trimmed) {
clearInterval(this.trimmed);
}
this.toolTip.nativeElement.querySelector('#tooltip-body').classList.remove('full');
}
}
}
}, {
key: "update",
value: function update(options, refresh) {
this.drawChart(refresh);
}
}, {
key: "updateBounds",
value: function updateBounds(min, max, marginLeft) {
this.LOG.debug(['updateBounds'], min, max, this._options);
this._options.bounds = this._options.bounds || {};
this._options.bounds.minDate = min;
this._options.bounds.maxDate = max;
this.layout.xaxis.autorange = false;
this.LOG.debug(['updateBounds'], _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(min, this.divider, this._options.timeZone), _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(max, this.divider, this._options.timeZone));
this.minTick = min;
this.maxTick = max;
if (this._options.timeMode && this._options.timeMode === 'timestamp') {
this.layout.xaxis.tick0 = min;
this.layout.xaxis.range = [min, max];
} else {
this.layout.xaxis.tick0 = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(min, this.divider, this._options.timeZone);
this.layout.xaxis.range = [_utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(min, this.divider, this._options.timeZone), _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(max, this.divider, this._options.timeZone)];
}
this.layout.margin.l = marginLeft;
this.marginLeft = marginLeft;
this.layout = Object.assign({}, this.layout);
this.LOG.debug(['updateBounds'], Object.assign({}, this.layout.xaxis.range));
this.afterBoundsUpdate = true;
}
}, {
key: "drawChart",
value: function drawChart() {
var _this4 = this;
var reparseNewData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
this.loading = true;
this.layout.margin.l = !!this._standalone ? 10 : 50;
this.layout.margin.b = !!this._standalone ? 50 : 2;
this.height = this.lineHeight * (this.expanded ? this.gtsId.length : 1) + this.layout.margin.t + this.layout.margin.b;
this.LOG.debug(['drawChart', 'this.height'], this.height, this.expanded);
if (this.firstDraw && reparseNewData) {
this.expanded = !!this._options.expandAnnotation;
}
this.layout.height = this.height;
if (!this.initChart(this.el)) {
return;
}
this.el.nativeElement.style.display = 'block';
this.LOG.debug(['drawChart', 'this.plotlyData'], this.plotlyData);
this.LOG.debug(['drawChart', 'hiddenData'], this._hiddenData);
this.LOG.debug(['drawChart', 'this._options.bounds'], this._options.bounds, this._options.timeMode);
this.layout.yaxis.color = this.getGridColor(this.el.nativeElement);
this.layout.yaxis.gridcolor = this.getGridColor(this.el.nativeElement);
this.layout.yaxis.showline = !!this._standalone;
this.layout.yaxis.zerolinecolor = this.getGridColor(this.el.nativeElement);
this.layout.xaxis.color = this.getGridColor(this.el.nativeElement);
this.layout.xaxis.gridcolor = this.getGridColor(this.el.nativeElement);
this.layout.xaxis.autorange = !!this._standalone;
this.layout.xaxis.showticklabels = !!this._standalone;
this.displayExpander = this.plotlyData.length > 1;
var count = this.plotlyData.filter(function (d) {
return d.y.length > 0;
}).length;
var calculatedHeight = this.lineHeight * (this.expanded ? count : 1) + this.layout.margin.t + this.layout.margin.b;
this.el.nativeElement.style.height = calculatedHeight + 30 + 'px';
this.height = calculatedHeight;
this.layout.height = this.height;
this.LOG.debug(['drawChart', 'height'], this.lineHeight, this.height, count, calculatedHeight, this.expanded, this.layout.margin);
this.layout.yaxis.range = [0, this.expanded ? count : 1];
this.LOG.debug(['drawChart', 'this.layout'], this.layout, this.expanded);
if (this._options.timeMode && this._options.timeMode === 'timestamp') {
this.layout.xaxis.tick0 = this.minTick;
this.layout.xaxis.range = [this.minTick, this.maxTick];
this.layout.xaxis.type = 'linear';
} else {
this.layout.xaxis.tick0 = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(this.minTick, this.divider, this._options.timeZone);
this.layout.xaxis.range = [_utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(this.minTick, this.divider, this._options.timeZone), _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toISOString(this.maxTick, this.divider, this._options.timeZone)];
this.layout.xaxis.type = 'date';
}
this.plotlyConfig.scrollZoom = true;
this.layout.xaxis.showgrid = false;
setTimeout(function () {
_this4.plotlyConfig = Object.assign({}, _this4.plotlyConfig);
_this4.layout = Object.assign({}, _this4.layout);
_this4.firstDraw = false;
});
this.LOG.debug(['drawChart', 'this.plotlyConfig'], this.plotlyConfig, this.plotlyData, this.layout);
}
}, {
key: "relayout",
value: function relayout(data) {
var change = false;
this.LOG.debug(['relayout', 'updateBounds'], data);
if (data['xaxis.range'] && data['xaxis.range'].length === 2) {
if (this.chartBounds.msmin !== data['xaxis.range'][0] || this.chartBounds.msmax !== data['xaxis.range'][1]) {
this.LOG.debug(['relayout', 'updateBounds', 'xaxis.range'], data['xaxis.range']);
change = true;
this.chartBounds.msmin = data['xaxis.range'][0];
this.chartBounds.msmax = data['xaxis.range'][1];
this.chartBounds.tsmin = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toTimestamp(this.chartBounds.msmin, this.divider, this._options.timeZone);
this.chartBounds.tsmax = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toTimestamp(this.chartBounds.msmax, this.divider, this._options.timeZone);
}
} else if (data['xaxis.range[0]'] && data['xaxis.range[1]']) {
if (this.chartBounds.msmin !== data['xaxis.range[0]'] || this.chartBounds.msmax !== data['xaxis.range[1]']) {
this.LOG.debug(['relayout', 'updateBounds', 'xaxis.range[x]'], data['xaxis.range[0]'], data['xaxis.range[1]']);
change = true;
this.chartBounds.msmin = data['xaxis.range[0]'];
this.chartBounds.msmax = data['xaxis.range[1]'];
this.chartBounds.tsmin = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toTimestamp(this.chartBounds.msmin, this.divider, this._options.timeZone);
this.chartBounds.tsmax = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.toTimestamp(this.chartBounds.msmax, this.divider, this._options.timeZone);
}
} else if (data['xaxis.autorange']) {
if (this.chartBounds.tsmin !== this.minTick || this.chartBounds.tsmax !== this.maxTick) {
this.LOG.debug(['relayout', 'updateBounds', 'autorange'], data, this.minTick, this.maxTick);
change = true;
this.chartBounds.tsmin = this.minTick;
this.chartBounds.tsmax = this.maxTick;
}
}
if (change) {
this.LOG.debug(['relayout', 'updateBounds'], this.minTick, this.maxTick);
this.LOG.debug(['relayout', 'updateBounds'], this.chartBounds);
if (this._options.timeMode && this._options.timeMode === 'timestamp') {
this.emitNewBounds(this.chartBounds.msmin, this.chartBounds.msmax);
} else {
this.emitNewBounds(this.chartBounds.tsmin, this.chartBounds.tsmax);
}
}
this.loading = false;
this.afterBoundsUpdate = false;
this.chartDraw.emit();
}
}, {
key: "hover",
value: function hover(data) {
this.LOG.debug(['hover'], data);
var tooltip = this.toolTip.nativeElement;
var color = data.points[0].fullData.marker.color;
this.pointHover.emit({
x: data.event.offsetX,
y: data.event.offsetY
});
var x = data.xvals[0];
if (!!data.points[0]) {
x = data.points[0].x;
}
var layout = this.el.nativeElement.getBoundingClientRect();
var count = this.plotlyData.filter(function (d) {
return d.y.length > 0;
}).length;
tooltip.style.opacity = '1';
tooltip.style.display = 'block';
tooltip.style.paddingLeft = (this._standalone ? 0 : 40) + 'px';
tooltip.style.top = (this.expanded ? count - data.points[0].y : 0.5) * this.lineHeight + this.layout.margin.t + 'px';
tooltip.classList.remove('right', 'left');
tooltip.innerHTML = "<div class=\"tooltip-body trimmed\" id=\"tooltip-body\">\n<span class=\"tooltip-date\">".concat(this._options.timeMode === 'timestamp' ? x : moment_timezone__WEBPACK_IMPORTED_MODULE_6___default().utc(x).toISOString().replace('Z', this._options.timeZone === 'UTC' ? 'Z' : '') || '', "</span>\n<i class=\"chip\" style=\"background-color: ").concat(color, ";border: 2px solid ").concat(color, ";\"></i> ").concat(_utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.formatLabel(data.points[0].data.name), ": <span class=\"value\">").concat(data.points[0].text, "</span>\n </div>");
if (data.event.offsetX > layout.width / 2) {
tooltip.classList.add('left');
} else {
tooltip.classList.add('right');
}
tooltip.style.pointerEvents = 'none';
}
}, {
key: "unhover",
value: function unhover() {
this.toolTip.nativeElement.style.display = 'none';
}
}, {
key: "afterPlot",
value: function afterPlot(div) {
this.loading = false;
this.chartBounds.tsmin = this.minTick;
this.chartBounds.tsmax = this.maxTick;
this.LOG.debug(['afterPlot'], 'div', div);
this.chartDraw.emit(this.chartBounds);
if (this.afterBoundsUpdate || this._standalone) {
this.chartDraw.emit(this.chartBounds);
this.LOG.debug(['afterPlot'], 'chartBounds', this.chartBounds, div);
this.afterBoundsUpdate = false;
}
}
}, {
key: "emitNewBounds",
value: function emitNewBounds(min, max) {
this.LOG.debug(['emitNewBounds'], min, max);
if (this._options.timeMode && this._options.timeMode === 'timestamp') {
this.boundsDidChange.emit({
bounds: {
min: min,
max: max
},
source: 'annotation'
});
} else {
this.boundsDidChange.emit({
bounds: {
min: moment_timezone__WEBPACK_IMPORTED_MODULE_6___default().tz(min, this._options.timeZone).valueOf(),
max: moment_timezone__WEBPACK_IMPORTED_MODULE_6___default().tz(max, this._options.timeZone).valueOf()
},
source: 'annotation'
});
}
}
}, {
key: "convert",
value: function convert(data) {
var _this5 = this;
var firstDraw = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
this.loading = true;
this.noData = true;
var dataset = [];
var gtsList = _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.flatDeep(_utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.flattenGtsIdArray(data.data, 0).res);
this.maxTick = Number.NEGATIVE_INFINITY;
this.minTick = Number.POSITIVE_INFINITY;
this.visibleGtsId = [];
this.gtsId = [];
var nonPlottable = gtsList.filter(function (g) {
return g.v && _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.isGtsToPlot(g);
});
gtsList = gtsList.filter(function (g) {
return g.v && !_utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.isGtsToPlot(g);
});
var timestampMode = firstDraw;
if (firstDraw) {
var tsLimit = 100 * _utils_gts_lib__WEBPACK_IMPORTED_MODULE_7__.GTSLib.getDivider(this._options.timeUnit);
gtsList.forEach(function (gts) {
var ticks = gts.v.map(function (t) {
return t[0];
});
var size = gts.v.length;
timestampMode = timestampMode && ticks[0] > -tsLimit && ticks[0] < t