@senx/discovery-plugin-marauder
Version:
Discovery plugin - Marauder's map
639 lines (635 loc) • 32.1 kB
JavaScript
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
import { a as DataModel } from './types.js';
import { P as Param, G as GTSLib, l as lodash, L as Logger, U as Utils, _ } from './utils.js';
import { i as init } from './index3.js';
import { C as ColorLib } from './color-lib.js';
import { d as defineCustomElement$1 } from './discovery-spinner2.js';
const discoveryBarPolarCss = "/*!\n * Copyright 2022 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 */:host>div{width:100%;height:100%}:host>div>div{width:100%;height:100%}:host .wv-tooltip{max-width:300px}:host .wv-tooltip div{word-wrap:anywhere}";
const DiscoveryBarPolarStyle0 = discoveryBarPolarCss;
const DiscoveryBarPolarComponent = /*@__PURE__*/ proxyCustomElement(class DiscoveryBarPolarComponent extends HTMLElement {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
this.draw = createEvent(this, "draw", 7);
this.dataZoom = createEvent(this, "dataZoom", 7);
this.leftMarginComputed = createEvent(this, "leftMarginComputed", 7);
this.dataPointOver = createEvent(this, "dataPointOver", 7);
this.dataPointSelected = createEvent(this, "dataPointSelected", 7);
this.timeBounds = createEvent(this, "timeBounds", 7);
this.defOptions = Object.assign(Object.assign({}, new Param()), { timeMode: 'date' });
this.divider = 1000;
this.hasFocus = false;
this.isGTS = false;
this.result = undefined;
this.type = undefined;
this.options = Object.assign(Object.assign({}, new Param()), { timeMode: 'date' });
this.width = undefined;
this.height = undefined;
this.debug = false;
this.unit = undefined;
this.parsing = false;
this.rendering = false;
this.innerOptions = undefined;
}
updateRes() {
this.chartOpts = this.convert(GTSLib.getData(this.result));
this.setOpts(true);
}
optionsUpdate(newValue, oldValue) {
var _a, _b;
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['optionsUpdate'], newValue, oldValue);
let opts = newValue;
if (!!newValue && typeof newValue === 'string') {
opts = JSON.parse(newValue);
}
if (!lodash.exports.isEqual(opts, this.innerOptions)) {
this.innerOptions = Object.assign({}, opts);
if (!!this.myChart) {
this.chartOpts = this.convert(this.result || new DataModel());
this.setOpts(true);
}
(_b = this.LOG) === null || _b === void 0 ? void 0 : _b.debug(['optionsUpdate 2'], { options: this.innerOptions, newValue, oldValue }, this.chartOpts);
}
}
async resize() {
if (this.myChart) {
this.myChart.resize();
}
return Promise.resolve();
}
async setZoom(dataZoom) {
var _a, _b;
if (!!this.myChart) {
dataZoom.start = dataZoom.start || 0;
if (((_a = this.zoom) === null || _a === void 0 ? void 0 : _a.start) !== dataZoom.start || ((_b = this.zoom) === null || _b === void 0 ? void 0 : _b.end) !== dataZoom.end) {
this.zoom = dataZoom;
this.myChart.dispatchAction(Object.assign(Object.assign({ type: 'dataZoom' }, dataZoom), { dataZoomIndex: 0 }));
}
}
return Promise.resolve();
}
componentWillLoad() {
var _a, _b;
this.parsing = true;
this.LOG = new Logger(DiscoveryBarPolarComponent, this.debug);
if (typeof this.options === 'string') {
this.innerOptions = JSON.parse(this.options);
}
else {
this.innerOptions = this.options;
}
this.result = GTSLib.getData(this.result);
this.divider = GTSLib.getDivider(this.options.timeUnit || 'us');
this.chartOpts = this.convert(this.result || new DataModel());
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['componentWillLoad'], {
type: this.type,
options: this.innerOptions,
chartOpts: this.chartOpts,
});
(_b = this.LOG) === null || _b === void 0 ? void 0 : _b.debug(['componentWillLoad'], this.el.parentElement.parentElement);
this.setOpts();
}
setOpts(notMerge = false) {
var _a;
if ((((_a = this.chartOpts) === null || _a === void 0 ? void 0 : _a.series) || []).length === 0) {
this.chartOpts.title = {
show: true,
textStyle: { color: Utils.getLabelColor(this.el), fontSize: 20 },
text: this.innerOptions.noDataLabel || '',
left: 'center',
top: 'center',
};
this.chartOpts.xAxis = { show: false };
this.chartOpts.yAxis = { show: false };
this.chartOpts.tooltip = { show: false };
}
else {
this.chartOpts.title = Object.assign(Object.assign({}, this.chartOpts.title || {}), { show: false });
}
setTimeout(() => {
if (this.myChart) {
this.myChart.setOption(this.chartOpts || {}, notMerge, true);
}
});
}
getCommonSeriesParam(color) {
var _a, _b;
const datasetNoAlpha = this.innerOptions.datasetNoAlpha;
return {
coordinateSystem: 'polar',
animation: !!((_b = (_a = this.innerOptions) === null || _a === void 0 ? void 0 : _a.bar) === null || _b === void 0 ? void 0 : _b.animate),
large: true,
clip: false,
emphasis: {
focus: 'series',
itemStyle: {
opacity: 1,
borderColor: color,
color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.8),
},
},
blur: {
lineStyle: { color },
itemStyle: {
opacity: 0.8,
borderColor: color,
color: {
type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
colorStops: [
{ offset: 0, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.7) },
{ offset: 1, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.3) },
],
},
},
},
label: {
show: !!this.innerOptions.showValues,
position: 'top',
textStyle: { color: Utils.getLabelColor(this.el), fontSize: 14 },
},
lineStyle: { color },
itemStyle: {
opacity: 0.8,
borderColor: color,
color: {
type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
colorStops: [
{ offset: 0, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.7) },
{ offset: 1, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.3) },
],
},
},
};
}
convert(data) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
let options = Utils.mergeDeep(this.defOptions, this.innerOptions || {});
options = Utils.mergeDeep(options || {}, data.globalParams);
this.innerOptions = Object.assign({}, options);
const series = [];
let gtsList;
if (GTSLib.isArray(data.data)) {
data.data = GTSLib.flatDeep(data.data);
(_a = this.LOG) === null || _a === void 0 ? void 0 : _a.debug(['convert', 'isArray']);
if (data.data.length > 0 && GTSLib.isGts(data.data[0])) {
(_b = this.LOG) === null || _b === void 0 ? void 0 : _b.debug(['convert', 'isArray 2']);
gtsList = GTSLib.flattenGtsIdArray(data.data, 0).res;
}
else {
(_c = this.LOG) === null || _c === void 0 ? void 0 : _c.debug(['convert', 'isArray 3']);
gtsList = data.data;
}
}
else {
(_d = this.LOG) === null || _d === void 0 ? void 0 : _d.debug(['convert', 'not array']);
gtsList = [data.data];
}
(_e = this.LOG) === null || _e === void 0 ? void 0 : _e.debug(['convert'], { options: this.innerOptions, gtsList });
const gtsCount = gtsList.length;
let min = Number.MAX_SAFE_INTEGER;
let max = Number.MIN_SAFE_INTEGER;
let hasTimeBounds = false;
for (let i = 0; i < gtsCount; i++) {
const gts = gtsList[i];
if (GTSLib.isGtsToPlot(gts) && !!gts.v) {
this.isGTS = true;
const c = ColorLib.getColor(gts.id || i, this.innerOptions.scheme);
const color = ((data.params || [])[i] || { datasetColor: c }).datasetColor || c;
min = Math.min(min, ...gts.v.map(v => v[0]));
max = Math.max(max, ...gts.v.map(v => v[0]));
hasTimeBounds = true;
let type = ((data.params || [])[i] || { type: 'bar' }).type || 'bar';
const datasetNoAlpha = (_h = (_g = ((_f = data.params) !== null && _f !== void 0 ? _f : [])[i]) === null || _g === void 0 ? void 0 : _g.datasetNoAlpha) !== null && _h !== void 0 ? _h : this.innerOptions.datasetNoAlpha;
let areaStyle;
if (type === 'area') {
type = 'line';
areaStyle = {
opacity: 0.8,
color: {
type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
colorStops: [
{ offset: 0, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.7) },
{ offset: 1, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.1) },
],
global: false, // false by default
},
};
}
const sortedGTS = gts.v.sort((a, b) => a[0] < b[0] ? -1 : 1);
const s = Object.assign(Object.assign({}, this.getCommonSeriesParam(color)), { type, areaStyle, id: gts.id, name: GTSLib.setName(gts.id, ((_k = ((_j = (data.params || [])[i]) !== null && _j !== void 0 ? _j : { key: undefined }).key) !== null && _k !== void 0 ? _k : GTSLib.serializeGtsMetadata(gts))), data: sortedGTS.map(d => {
const ts = this.innerOptions.timeMode === 'date'
? GTSLib.utcToZonedTime(d[0], this.divider, this.innerOptions.timeZone)
: d[0];
return [d[d.length - 1], ts];
}) });
const isStacked = ((_l = (data.params || [])[i]) === null || _l === void 0 ? void 0 : _l.stacked) !== undefined
? (_m = (data.params || [])[i]) === null || _m === void 0 ? void 0 : _m.stacked
: (_q = (_p = (_o = this.innerOptions) === null || _o === void 0 ? void 0 : _o.bar) === null || _p === void 0 ? void 0 : _p.stacked) !== null && _q !== void 0 ? _q : (_r = this.innerOptions) === null || _r === void 0 ? void 0 : _r.stacked;
if (type === 'bar' && isStacked) {
s.stack = 'a';
s.stackStrategy = 'all';
}
if (type === 'line' && ((_s = this.innerOptions.bar) === null || _s === void 0 ? void 0 : _s.fillGap)) {
s.data.push(s.data[0]);
}
series.push(s);
}
else if (!gts.v) {
this.innerOptions.timeMode = 'custom';
(_t = this.LOG) === null || _t === void 0 ? void 0 : _t.debug(['convert', 'gts'], gts);
this.categories = gts.columns;
(gts.rows || []).forEach((row, index) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
const c = ColorLib.getColor(gts.id || index, this.innerOptions.scheme);
const color = ((data.params || [])[index] || { datasetColor: c }).datasetColor || c;
let type = ((data.params || [])[index] || { type: 'bar' }).type || 'bar';
const datasetNoAlpha = (_c = (_b = ((_a = data.params) !== null && _a !== void 0 ? _a : [])[index]) === null || _b === void 0 ? void 0 : _b.datasetNoAlpha) !== null && _c !== void 0 ? _c : this.innerOptions.datasetNoAlpha;
let areaStyle;
if (type === 'area') {
type = 'line';
areaStyle = {
opacity: 0.8,
color: {
type: 'linear', x: 0, y: 0, x2: 0, y2: 1,
colorStops: [
{ offset: 0, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.7) },
{ offset: 1, color: ColorLib.transparentize(color, datasetNoAlpha ? 1 : 0.1) },
],
global: false, // false by default
},
};
}
const s = Object.assign(Object.assign({}, this.getCommonSeriesParam(color)), { type, areaStyle, name: row[0], data: row.splice(1) });
const isStacked = ((_d = (data.params || [])[index]) === null || _d === void 0 ? void 0 : _d.stacked) !== undefined
? (_e = (data.params || [])[index]) === null || _e === void 0 ? void 0 : _e.stacked
: (_h = (_g = (_f = this.innerOptions) === null || _f === void 0 ? void 0 : _f.bar) === null || _g === void 0 ? void 0 : _g.stacked) !== null && _h !== void 0 ? _h : (_j = this.innerOptions) === null || _j === void 0 ? void 0 : _j.stacked;
if (type === 'bar' && isStacked) {
s.stack = 'a';
s.stackStrategy = 'all';
}
if (type === 'line') {
s.data.push(s.data[0]);
}
series.push(s);
});
}
}
if (hasTimeBounds) {
this.timeBounds.emit({ min, max });
this.bounds = { min, max };
}
(_u = this.LOG) === null || _u === void 0 ? void 0 : _u.debug(['convert', 'series'], series);
const opts = Object.assign({ animation: !!((_w = (_v = this.innerOptions) === null || _v === void 0 ? void 0 : _v.bar) === null || _w === void 0 ? void 0 : _w.animate), grid: {
left: (!!this.innerOptions.leftMargin && this.innerOptions.leftMargin > this.leftMargin)
? this.innerOptions.leftMargin - this.leftMargin + 10
: 10,
top: !!(this.unit || this.innerOptions.unit) ? 30 : 10,
bottom: !!this.innerOptions.showLegend ? 30 : 10,
right: 10,
containLabel: true,
}, polar: {}, angleAxis: {
startAngle: !!((_x = this.innerOptions.bar) === null || _x === void 0 ? void 0 : _x.startAngle) ? (_y = this.innerOptions.bar) === null || _y === void 0 ? void 0 : _y.startAngle : this.isGTS ? 0 : (360 / Math.max((this.categories || []).length, 1)) * -1.5 + 180,
type: this.isGTS ? this.innerOptions.timeMode === 'date' ? 'time' : 'value' : 'category',
data: this.isGTS ? undefined : this.categories,
axisLine: {
lineStyle: {
color: Utils.getGridColor(this.el),
},
},
axisLabel: {
show: !this.innerOptions.hideXAxis,
color: Utils.getLabelColor(this.el),
formatter: this.innerOptions.timeMode === 'date'
? this.innerOptions.fullDateDisplay ? value => GTSLib.toISOString(GTSLib.zonedTimeToUtc(value, 1, this.innerOptions.timeZone), 1, this.innerOptions.timeZone, this.innerOptions.timeFormat)
.replace('T', '\n').replace(/\+[0-9]{2}:[0-9]{2}$/gi, '')
: undefined
: undefined,
},
axisTick: {
lineStyle: {
color: Utils.getGridColor(this.el),
},
},
emphasis: {
focus: 'series',
},
min: ((_z = this.innerOptions.bounds) === null || _z === void 0 ? void 0 : _z.minDate) !== undefined
? this.innerOptions.timeMode === 'date'
? GTSLib.utcToZonedTime(this.innerOptions.bounds.minDate, this.divider, this.innerOptions.timeZone)
: this.innerOptions.bounds.minDate
: undefined,
max: ((_0 = this.innerOptions.bounds) === null || _0 === void 0 ? void 0 : _0.maxDate) !== undefined
? this.innerOptions.timeMode === 'date'
? GTSLib.utcToZonedTime(this.innerOptions.bounds.maxDate, this.divider, this.innerOptions.timeZone)
: this.innerOptions.bounds.maxDate
: undefined,
}, tooltip: {
trigger: 'axis',
transitionDuration: 0,
axisPointer: {
type: !!this.innerOptions.yCursor && !!this.innerOptions.xCursor ? 'cross' : !!this.innerOptions.yCursor || !!this.innerOptions.xCursor ? 'line' : 'none',
axis: !!this.innerOptions.yAxisFocus ? 'y' : 'x',
animation: false,
lineStyle: !this.innerOptions.yCursor && !this.innerOptions.xCursor
? undefined
: {
color: Utils.getCSSColor(this.el, '--warp-view-bar-color', 'red'),
},
crossStyle: !!this.innerOptions.yCursor
? {
color: Utils.getCSSColor(this.el, '--warp-view-bar-color', 'red'),
}
: undefined,
},
backgroundColor: Utils.getCSSColor(this.el, '--warp-view-tooltip-bg-color', 'white'),
hideDelay: this.innerOptions.tooltipDelay || 100,
formatter: (params) => {
return `<div style="font-size:14px;color:#666;font-weight:400;line-height:1;">${this.innerOptions.timeMode !== 'date'
? params[0].axisValue
: (GTSLib.toISOString(GTSLib.zonedTimeToUtc(params[0].axisValue, 1, this.innerOptions.timeZone), 1, this.innerOptions.timeZone, this.innerOptions.fullDateDisplay ? this.innerOptions.timeFormat : undefined) || '')
.replace('T', ' ').replace(/\+[0-9]{2}:[0-9]{2}$/gi, '')}</div>
${params.map(s => `${s.marker} <span style="font-size:14px;color:#666;font-weight:400;margin-left:2px">${GTSLib.getName(s.seriesName)}</span>
<span style="float:right;margin-left:20px;font-size:14px;color:#666;font-weight:900">${s.value}</span>`).join('<br>')}`;
},
}, toolbox: {
show: this.innerOptions.showControls,
feature: {
saveAsImage: { type: 'png', excludeComponents: ['toolbox'] },
},
}, legend: {
bottom: 0, left: 'center', show: !!this.innerOptions.showLegend, height: 30, type: 'scroll',
textStyle: { color: Utils.getLabelColor(this.el) },
}, radiusAxis: {
name: this.unit || this.innerOptions.unit,
show: !this.innerOptions.hideYAxis,
type: 'value',
nameTextStyle: { color: Utils.getLabelColor(this.el) },
splitLine: {
lineStyle: {
color: Utils.getGridColor(this.el),
},
},
axisLine: {
lineStyle: {
color: Utils.getGridColor(this.el),
},
},
axisLabel: {
color: Utils.getLabelColor(this.el),
},
axisTick: {
lineStyle: {
color: Utils.getGridColor(this.el),
},
},
}, series }, ((_2 = (_1 = this.innerOptions) === null || _1 === void 0 ? void 0 : _1.extra) === null || _2 === void 0 ? void 0 : _2.chartOpts) || {});
this.parsing = false;
return opts;
}
zoomHandler(start, end) {
var _a, _b, _c, _d;
this.dataZoom.emit({
start,
end,
min: ((_a = this.innerOptions.bounds) === null || _a === void 0 ? void 0 : _a.minDate) || ((_b = this.bounds) === null || _b === void 0 ? void 0 : _b.min),
max: ((_c = this.innerOptions.bounds) === null || _c === void 0 ? void 0 : _c.maxDate) || ((_d = this.bounds) === null || _d === void 0 ? void 0 : _d.max),
});
}
componentDidLoad() {
const zoomHandler = _.throttle((start, end) => this.zoomHandler(start, end), 16, { leading: true, trailing: true });
const focusHandler = _.throttle((type, event) => {
if (this.hasFocus) {
switch (type) {
case 'mouseover':
const c = event.data.coord || event.data;
this.dataPointOver.emit({ date: c[0], name: GTSLib.getName(event.seriesName), value: c[1], meta: {} });
break;
case 'highlight':
let ts;
(event.batch || []).forEach(b => {
const s = this.myChart.getOption().series[b.seriesIndex];
ts = s.data[b.dataIndex][0];
ts = this.innerOptions.timeMode === 'date'
? GTSLib.zonedTimeToUtc(ts * this.divider, this.divider, this.innerOptions.timeZone || 'UTC') * this.divider
: ts;
});
if (ts !== undefined) {
this.dataPointSelected.emit({ date: ts, name: '.*', meta: {} });
}
break;
}
}
}, 100, { leading: true, trailing: true });
setTimeout(() => {
this.height = Utils.getContentBounds(this.el.parentElement).h;
this.parsing = false;
this.rendering = true;
let initial = false;
this.myChart = init(this.graph);
this.myChart.on('rendered', () => {
this.rendering = false;
let found = false;
let x = 0;
setTimeout(() => {
while (!found && x < 1024) {
found = this.myChart.containPixel({ gridIndex: 0 }, [x, this.myChart.getHeight() / 2]);
x++;
}
if (this.leftMargin !== x && x < 1024) {
setTimeout(() => {
this.leftMarginComputed.emit(x);
this.leftMargin = x;
});
}
if (initial)
setTimeout(() => this.draw.emit());
initial = false;
});
});
this.myChart.on('dataZoom', (event) => {
let start;
let end;
if (!!event.batch) {
const batch = (event.batch || [])[0] || {};
start = batch.start || batch.startValue;
end = batch.end || batch.endValue;
this.zoomHandler(start, end);
}
else if (event.start !== undefined && event.end !== undefined) {
start = event.start;
end = event.end;
zoomHandler(start, end);
}
});
this.myChart.on('restore', () => {
this.dataZoom.emit({ type: 'restore', start: 0, end: 100 });
});
this.el.addEventListener('dblclick', () => this.myChart.dispatchAction({
type: 'dataZoom',
start: 0,
end: 100,
}));
this.el.addEventListener('mouseover', () => this.hasFocus = true);
this.el.addEventListener('mouseout', () => {
this.hasFocus = false;
this.dataPointOver.emit({});
});
this.myChart.on('mouseout', () => {
this.dataPointOver.emit({});
});
this.myChart.on('mouseover', (event) => focusHandler('mouseover', event));
this.myChart.on('highlight', (event) => focusHandler('highlight', event));
this.myChart.on('click', (event) => {
this.dataPointSelected.emit({
date: event.value[0],
name: GTSLib.getName(event.seriesName),
value: event.value[1],
meta: {},
});
});
this.setOpts();
initial = true;
});
}
async export(type = 'png') {
return Promise.resolve(this.myChart ? this.myChart.getDataURL({
type,
excludeComponents: ['toolbox'],
}) : undefined);
}
async show(regexp) {
this.myChart.dispatchAction({
type: 'legendSelect',
batch: this.myChart.getOption().series.filter(s => new RegExp(regexp).test(GTSLib.getName(s.name))),
});
return Promise.resolve();
}
async hide(regexp) {
this.myChart.dispatchAction({
type: 'legendUnSelect',
batch: this.myChart.getOption().series.filter(s => new RegExp(regexp).test(GTSLib.getName(s.name))),
});
return Promise.resolve();
}
async hideById(id) {
if (this.myChart) {
this.myChart.dispatchAction({
type: 'legendUnSelect',
batch: this.myChart.getOption().series
.filter((s, i) => new RegExp(id.toString()).test((s.id || i).toString())),
});
}
return Promise.resolve();
}
async showById(id) {
if (this.myChart) {
this.myChart.dispatchAction({
type: 'legendSelect',
batch: this.myChart.getOption().series
.filter((s, i) => new RegExp(id.toString()).test((s.id || i).toString())),
});
}
return Promise.resolve();
}
async setFocus(regexp, ts, value) {
if (!this.myChart || this.hasFocus)
return;
const date = this.innerOptions.timeMode === 'date'
? GTSLib.utcToZonedTime(ts || 0, this.divider, this.innerOptions.timeZone)
: ts || 0;
let seriesIndex = 0;
let dataIndex = 0;
if (!!regexp) {
this.chartOpts.series
.filter(s => new RegExp(regexp).test(s.name))
.forEach(s => {
const data = s.data.filter(d => d[0] === date);
if (data && data.length > 0 && data[0]) {
seriesIndex = this.chartOpts.series.indexOf(s);
dataIndex = s.data.indexOf(data[0]);
}
});
}
if (GTSLib.isArray(this.chartOpts.angleAxis)) {
this.chartOpts.angleAxis
.forEach(a => a.axisPointer = Object.assign(Object.assign({}, a.axisPointer || {}), { value: date, status: 'show' }));
}
else {
this.chartOpts.angleAxis.axisPointer = Object.assign(Object.assign({}, this.chartOpts.angleAxis.axisPointer || {}), { value: date, status: 'show' });
}
if (GTSLib.isArray(this.chartOpts.radiusAxis)) {
this.chartOpts.radiusAxis
.forEach(a => a.axisPointer = Object.assign(Object.assign({}, a.axisPointer || {}), { value: value || 0, status: 'show' }));
}
else {
this.chartOpts.radiusAxis.axisPointer = Object.assign(Object.assign({}, this.chartOpts.radiusAxis.axisPointer || {}), { value: value || 0, status: 'show' });
}
this.chartOpts.tooltip.show = true;
this.myChart.dispatchAction({ type: 'showTip', seriesIndex, dataIndex });
this.setOpts();
return Promise.resolve();
}
async unFocus() {
if (!this.myChart || this.hasFocus)
return;
this.chartOpts.series.forEach(s => s.markPoint = undefined);
this.chartOpts.angleAxis.axisPointer = Object.assign(Object.assign({}, this.chartOpts.angleAxis.axisPointer || {}), { status: 'hide' });
this.chartOpts.radiusAxis.axisPointer = Object.assign(Object.assign({}, this.chartOpts.radiusAxis.axisPointer || {}), { status: 'hide' });
this.myChart.dispatchAction({ type: 'hideTip' });
this.setOpts();
return Promise.resolve();
}
render() {
return h("div", { key: 'd9422c8aa89832ad33178e737339f4b6d195c8e8', style: { width: '100%', height: '100%' } }, this.parsing ? h("discovery-spinner", null, "Parsing data...") : '', this.rendering ? h("discovery-spinner", null, "Rendering data...") : '', h("div", { key: '449a8a249b70cf4810affc219e88c95841eab2b1', ref: (el) => this.graph = el }));
}
get el() { return this; }
static get watchers() { return {
"result": ["updateRes"],
"options": ["optionsUpdate"]
}; }
static get style() { return DiscoveryBarPolarStyle0; }
}, [1, "discovery-bar-polar", {
"result": [1025],
"type": [1],
"options": [1],
"width": [2],
"height": [1026],
"debug": [4],
"unit": [1],
"parsing": [32],
"rendering": [32],
"innerOptions": [32],
"resize": [64],
"setZoom": [64],
"export": [64],
"show": [64],
"hide": [64],
"hideById": [64],
"showById": [64],
"setFocus": [64],
"unFocus": [64]
}, undefined, {
"result": ["updateRes"],
"options": ["optionsUpdate"]
}]);
function defineCustomElement() {
if (typeof customElements === "undefined") {
return;
}
const components = ["discovery-bar-polar", "discovery-spinner"];
components.forEach(tagName => { switch (tagName) {
case "discovery-bar-polar":
if (!customElements.get(tagName)) {
customElements.define(tagName, DiscoveryBarPolarComponent);
}
break;
case "discovery-spinner":
if (!customElements.get(tagName)) {
defineCustomElement$1();
}
break;
} });
}
export { DiscoveryBarPolarComponent as D, defineCustomElement as d };
//# sourceMappingURL=discovery-bar-polar2.js.map