dcim-topology2d 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/chart-diagram/index.d.ts +2 -0
- package/chart-diagram/index.js +1 -0
- package/chart-diagram/src/echarts/index.d.ts +0 -1
- package/chart-diagram/src/echarts/index.js +106 -107
- package/chart-diagram/src/register.js +4 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +4 -0
- package/chart-diagram/src/utils/changeOptions.js +163 -0
- package/chart-diagram/src/utils/conversion.d.ts +17 -0
- package/chart-diagram/src/utils/conversion.js +179 -0
- package/chart-diagram/src/utils/drawGraphic.d.ts +3 -0
- package/chart-diagram/src/utils/drawGraphic.js +97 -0
- package/chart-diagram/src/utils/index.d.ts +3 -0
- package/chart-diagram/src/utils/index.js +3 -0
- package/core/src/common.js +27 -30
- package/core/src/core.js +84 -59
- package/core/src/divLayer.d.ts +0 -26
- package/core/src/divLayer.js +22 -276
- package/core/src/healps/changeData.js +45 -22
- package/core/src/middles/arrows/index.d.ts +4 -0
- package/core/src/middles/arrows/index.js +5 -0
- package/core/src/middles/default.d.ts +1 -3
- package/core/src/middles/default.js +51 -51
- package/core/src/middles/index.js +3 -2
- package/core/src/middles/lines/index.d.ts +4 -0
- package/core/src/middles/lines/index.js +5 -0
- package/core/src/middles/nodes/iframe.d.ts +2 -0
- package/core/src/middles/nodes/iframe.js +12 -0
- package/core/src/middles/nodes/index.d.ts +46 -0
- package/core/src/middles/nodes/index.js +47 -0
- package/core/src/middles/nodes/pentagon.rect.js +1 -1
- package/core/src/middles/nodes/rectangle.rect.js +1 -1
- package/core/src/models/node.d.ts +6 -0
- package/core/src/models/node.js +16 -6
- package/core/src/preview.js +14 -0
- package/core/src/store/data.js +2 -0
- package/core/src/utils/dom.d.ts +2 -0
- package/core/src/utils/dom.js +66 -32
- package/package.json +1 -1
- package/static/echartsDefaultData.js +239 -95
- package/static/echartsStore.js +14 -0
- package/static/index.js +2 -1
- package/style/index.css +3 -0
package/core/src/divLayer.js
CHANGED
@@ -20,42 +20,25 @@ var __extends = (this && this.__extends) || (function () {
|
|
20
20
|
};
|
21
21
|
})();
|
22
22
|
import {Store} from 'le5le-store';
|
23
|
-
import {Node, images} from './models
|
24
|
-
import {Lock} from './models/status';
|
25
|
-
import {PenType} from './models/pen';
|
23
|
+
import {Node, PenType, images, defaultImages} from './models';
|
26
24
|
import {Layer} from './layer';
|
27
|
-
import { setStyleForElementIdDiv, DomElements } from './utils'
|
28
|
-
import { commonStore } from './store'
|
25
|
+
import { setStyleForElementIdDiv, createIframeElement, DomElements, DomIframes } from './utils';
|
26
|
+
import { commonStore } from './store';
|
29
27
|
var DivLayer = /** @class */ (function (_super) {
|
30
28
|
__extends(DivLayer, _super);
|
31
|
-
|
32
29
|
function DivLayer(TID) {
|
33
30
|
var _this = _super.call(this, TID) || this;
|
34
31
|
_this.canvas = document.createElement('div');
|
35
|
-
// _this.player = document.createElement('div');
|
36
|
-
// _this.videos = {};
|
37
|
-
// _this.audios = {};
|
38
32
|
_this.iframes = {};
|
39
33
|
_this.elements = {};
|
40
34
|
_this.gifs = {};
|
41
35
|
_this.addDiv = function (node) {
|
42
|
-
// if (node.audio) {
|
43
|
-
// if (_this.audios[node.id] && _this.audios[node.id].media.src !== node.audio) {
|
44
|
-
// _this.audios[node.id].media.src = node.audio;
|
45
|
-
// }
|
46
|
-
// _this.setElemPosition(node, (_this.audios[node.id] && _this.audios[node.id].player) || _this.addMedia(node, 'audio'));
|
47
|
-
// }
|
48
|
-
// if (node.video) {
|
49
|
-
// if (_this.videos[node.id] && _this.videos[node.id].media.src !== node.video) {
|
50
|
-
// _this.videos[node.id].media.src = node.video;
|
51
|
-
// }
|
52
|
-
// _this.setElemPosition(node, (_this.videos[node.id] && _this.videos[node.id].player) || _this.addMedia(node, 'video'));
|
53
|
-
// }
|
54
36
|
if (node.iframe) {
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
37
|
+
Object.assign(_this.iframes, DomIframes);
|
38
|
+
if (_this.iframes[node.id] && _this.iframes[node.id].src !== node.iframe) {
|
39
|
+
_this.iframes[node.id].src = node.iframe;
|
40
|
+
}
|
41
|
+
_this.setElemPosition(node, _this.iframes[node.id] || _this.addIframe(node));
|
59
42
|
}
|
60
43
|
if (node.elementId) {
|
61
44
|
Object.assign(_this.elements, DomElements);
|
@@ -91,18 +74,6 @@ var DivLayer = /** @class */ (function (_super) {
|
|
91
74
|
}
|
92
75
|
}
|
93
76
|
};
|
94
|
-
// if (!_this.options.playIcon) {
|
95
|
-
// _this.options.playIcon = 'iconfont icon-play';
|
96
|
-
// }
|
97
|
-
// if (!_this.options.pauseIcon) {
|
98
|
-
// _this.options.pauseIcon = 'iconfont icon-pause';
|
99
|
-
// }
|
100
|
-
// if (!_this.options.fullScreenIcon) {
|
101
|
-
// _this.options.fullScreenIcon = 'iconfont icon-full-screen';
|
102
|
-
// }
|
103
|
-
// if (!_this.options.loopIcon) {
|
104
|
-
// _this.options.loopIcon = 'iconfont icon-loop';
|
105
|
-
// }
|
106
77
|
_this.canvas.style.position = 'absolute';
|
107
78
|
_this.canvas.style.left = '0';
|
108
79
|
_this.canvas.style.top = '0';
|
@@ -110,230 +81,13 @@ var DivLayer = /** @class */ (function (_super) {
|
|
110
81
|
_this.canvas.style.background = 'transparent';
|
111
82
|
_this.canvas.setAttribute('class', 'canvas-point');
|
112
83
|
commonStore[TID].parentElem.appendChild(_this.canvas);
|
113
|
-
// parentElem.appendChild(_this.player);
|
114
|
-
//_this.createPlayer();
|
115
84
|
_this.subcribe = Store.subscribe(_this.generateStoreKey('LT:addDiv'), _this.addDiv);
|
116
|
-
// _this.subcribeNode = Store.subscribe(_this.generateStoreKey('LT:activeNode'), function (node) {
|
117
|
-
// if (!node || (!node.video && !node.audio)) {
|
118
|
-
// _this.player.style.top = '-99999px';
|
119
|
-
// return;
|
120
|
-
// }
|
121
|
-
// if (node.audio && _this.audios[node.id]) {
|
122
|
-
// _this.media = _this.audios[node.id].media;
|
123
|
-
// }
|
124
|
-
// else if (node.video && _this.videos[node.id]) {
|
125
|
-
// _this.media = _this.videos[node.id].media;
|
126
|
-
// }
|
127
|
-
// else {
|
128
|
-
// return;
|
129
|
-
// }
|
130
|
-
// _this.curNode = node;
|
131
|
-
// _this.player.style.top = _this.parentElem.offsetTop + _this.parentElem.clientHeight + 'px';
|
132
|
-
// _this.player.style.left = _this.parentElem.getBoundingClientRect().left + 'px';
|
133
|
-
// _this.player.style.width = _this.parentElem.clientWidth + 'px';
|
134
|
-
// _this.getMediaCurrent();
|
135
|
-
// if (_this.media.paused) {
|
136
|
-
// _this.playBtn.className = _this.options.playIcon;
|
137
|
-
// }
|
138
|
-
// else {
|
139
|
-
// _this.playBtn.className = _this.options.pauseIcon;
|
140
|
-
// }
|
141
|
-
// });
|
142
|
-
// document.addEventListener('fullscreenchange', function (e) {
|
143
|
-
// if (!_this.media) {
|
144
|
-
// return;
|
145
|
-
// }
|
146
|
-
// if (document.fullscreen) {
|
147
|
-
// _this.media.controls = true;
|
148
|
-
// _this.media.style.userSelect = 'initial';
|
149
|
-
// _this.media.style.pointerEvents = 'initial';
|
150
|
-
// }
|
151
|
-
// else {
|
152
|
-
// _this.media.style.userSelect = 'none';
|
153
|
-
// _this.media.style.pointerEvents = 'none';
|
154
|
-
// _this.media.controls = false;
|
155
|
-
// }
|
156
|
-
// });
|
157
85
|
return _this;
|
158
86
|
}
|
159
|
-
|
160
|
-
DivLayer.prototype.createPlayer = function () {
|
161
|
-
var _this = this;
|
162
|
-
let options = commonStore[_this.TID].options;
|
163
|
-
this.player.style.position = 'fixed';
|
164
|
-
this.player.style.outline = 'none';
|
165
|
-
this.player.style.top = '-99999px';
|
166
|
-
this.player.style.height = '40px';
|
167
|
-
this.player.style.padding = '10px 15px';
|
168
|
-
this.player.style.background = 'rgba(200,200,200,.1)';
|
169
|
-
this.player.style.display = 'flex';
|
170
|
-
this.player.style.alignItems = 'center';
|
171
|
-
this.player.style.userSelect = 'initial';
|
172
|
-
this.player.style.pointerEvents = 'initial';
|
173
|
-
this.player.style.zIndex = '1';
|
174
|
-
this.playBtn = document.createElement('i');
|
175
|
-
this.currentTime = document.createElement('span');
|
176
|
-
this.progress = document.createElement('div');
|
177
|
-
this.progressCurrent = document.createElement('div');
|
178
|
-
this.loop = document.createElement('i');
|
179
|
-
var fullScreen = document.createElement('i');
|
180
|
-
this.playBtn.className = options.playIcon;
|
181
|
-
this.playBtn.style.fontSize = '18px';
|
182
|
-
this.playBtn.style.lineHeight = '20px';
|
183
|
-
this.playBtn.style.cursor = 'pointer';
|
184
|
-
this.currentTime.style.padding = '0 10px';
|
185
|
-
this.currentTime.innerText = '0 / 0';
|
186
|
-
this.progress.style.position = 'relative';
|
187
|
-
this.progress.style.flexGrow = '1';
|
188
|
-
this.progress.style.top = '0';
|
189
|
-
this.progress.style.height = '4px';
|
190
|
-
this.progress.style.background = '#ccc';
|
191
|
-
this.progress.style.borderRadius = '2px';
|
192
|
-
this.progress.style.overflow = 'hidden';
|
193
|
-
this.progress.style.cursor = 'pointer';
|
194
|
-
this.progressCurrent.style.position = 'absolute';
|
195
|
-
this.progressCurrent.style.left = '0';
|
196
|
-
this.progressCurrent.style.top = '0';
|
197
|
-
this.progressCurrent.style.bottom = '0';
|
198
|
-
this.progressCurrent.style.width = '0';
|
199
|
-
this.progressCurrent.style.background = '#52c41a';
|
200
|
-
this.loop.style.margin = '0 10px';
|
201
|
-
this.loop.style.padding = '2px 5px';
|
202
|
-
this.loop.style.borderRadius = '2px';
|
203
|
-
this.loop.className = options.loopIcon;
|
204
|
-
this.loop.style.fontSize = '18px';
|
205
|
-
this.loop.style.lineHeight = '20px';
|
206
|
-
this.loop.style.cursor = 'pointer';
|
207
|
-
fullScreen.className = options.fullScreenIcon;
|
208
|
-
fullScreen.style.fontSize = '17px';
|
209
|
-
fullScreen.style.lineHeight = '20px';
|
210
|
-
fullScreen.style.cursor = 'pointer';
|
211
|
-
this.player.appendChild(this.playBtn);
|
212
|
-
this.player.appendChild(this.currentTime);
|
213
|
-
this.player.appendChild(this.progress);
|
214
|
-
this.progress.appendChild(this.progressCurrent);
|
215
|
-
this.player.appendChild(this.loop);
|
216
|
-
this.player.appendChild(fullScreen);
|
217
|
-
this.playBtn.onclick = function () {
|
218
|
-
if (_this.media.paused) {
|
219
|
-
_this.media.play();
|
220
|
-
_this.playBtn.className = options.pauseIcon;
|
221
|
-
} else {
|
222
|
-
_this.media.pause();
|
223
|
-
_this.playBtn.className = options.playIcon;
|
224
|
-
}
|
225
|
-
};
|
226
|
-
this.progress.onclick = function (e) {
|
227
|
-
_this.media.currentTime = (e.offsetX / _this.progress.clientWidth) * _this.media.duration;
|
228
|
-
};
|
229
|
-
this.loop.onclick = function () {
|
230
|
-
_this.media.loop = !_this.media.loop;
|
231
|
-
_this.curNode.playLoop = _this.media.loop;
|
232
|
-
if (_this.media.loop) {
|
233
|
-
_this.loop.style.background = '#ddd';
|
234
|
-
} else {
|
235
|
-
_this.loop.style.background = 'none';
|
236
|
-
}
|
237
|
-
};
|
238
|
-
fullScreen.onclick = function () {
|
239
|
-
_this.media.requestFullscreen();
|
240
|
-
};
|
241
|
-
options = null;
|
242
|
-
};
|
243
|
-
DivLayer.prototype.getMediaCurrent = function () {
|
244
|
-
if (!this.media) {
|
245
|
-
return;
|
246
|
-
}
|
247
|
-
this.currentTime.innerText =
|
248
|
-
this.formatSeconds(this.media.currentTime) + ' / ' + this.formatSeconds(this.media.duration);
|
249
|
-
this.progressCurrent.style.width =
|
250
|
-
(this.media.currentTime / this.media.duration) * this.progress.clientWidth + 'px';
|
251
|
-
};
|
252
|
-
DivLayer.prototype.addMedia = function (node, type) {
|
253
|
-
var _this = this;
|
254
|
-
var player = document.createElement('div');
|
255
|
-
var current = document.createElement('div');
|
256
|
-
var media = document.createElement(type);
|
257
|
-
current.style.position = 'absolute';
|
258
|
-
current.style.outline = 'none';
|
259
|
-
current.style.left = '0';
|
260
|
-
current.style.bottom = '0';
|
261
|
-
current.style.height = '2px';
|
262
|
-
current.style.background = '#52c41a';
|
263
|
-
media.style.position = 'absolute';
|
264
|
-
media.style.outline = 'none';
|
265
|
-
media.style.left = '0';
|
266
|
-
media.style.right = '0';
|
267
|
-
media.style.top = '0';
|
268
|
-
media.style.bottom = '0';
|
269
|
-
if (type === 'video') {
|
270
|
-
media.style.width = node.rect.width + 'px';
|
271
|
-
media.style.height = node.rect.height + 'px';
|
272
|
-
}
|
273
|
-
player.style.background = 'transparent';
|
274
|
-
if (node.play === 1) {
|
275
|
-
media.autoplay = true;
|
276
|
-
}
|
277
|
-
media.loop = node.playLoop;
|
278
|
-
media.ontimeupdate = function () {
|
279
|
-
current.style.width = (media.currentTime / media.duration) * node.rect.width + 'px';
|
280
|
-
_this.getMediaCurrent();
|
281
|
-
if (_this.media === media) {
|
282
|
-
if (node.playLoop) {
|
283
|
-
media.loop = true;
|
284
|
-
_this.loop.style.background = '#ddd';
|
285
|
-
} else {
|
286
|
-
media.loop = false;
|
287
|
-
_this.loop.style.background = 'none';
|
288
|
-
}
|
289
|
-
}
|
290
|
-
};
|
291
|
-
media.onended = function () {
|
292
|
-
Store.set(_this.generateStoreKey('mediaEnd'), node);
|
293
|
-
if (_this.media === media) {
|
294
|
-
_this.playBtn.className = commonStore[_this.TID].options.playIcon;
|
295
|
-
}
|
296
|
-
_this.playNext(node.nextPlay);
|
297
|
-
};
|
298
|
-
media.onloadedmetadata = function () {
|
299
|
-
_this.getMediaCurrent();
|
300
|
-
};
|
301
|
-
media.src = node[type];
|
302
|
-
player.appendChild(media);
|
303
|
-
player.appendChild(current);
|
304
|
-
this[type + 's'][node.id] = {
|
305
|
-
player: player,
|
306
|
-
current: current,
|
307
|
-
media: media
|
308
|
-
};
|
309
|
-
this.canvas.appendChild(player);
|
310
|
-
return player;
|
311
|
-
};
|
312
|
-
DivLayer.prototype.playNext = function (next) {
|
313
|
-
if (!next) {
|
314
|
-
return;
|
315
|
-
}
|
316
|
-
for (var _i = 0, _a = commonStore[this.TID].data.pens; _i < _a.length; _i++) {
|
317
|
-
var item = _a[_i];
|
318
|
-
if (!(item instanceof Node)) {
|
319
|
-
continue;
|
320
|
-
}
|
321
|
-
if (item.tags.indexOf(next) > -1) {
|
322
|
-
if (item.audio && this.audios[item.id] && this.audios[item.id].media && this.audios[item.id].media.paused) {
|
323
|
-
this.audios[item.id].media.play();
|
324
|
-
} else if (item.video && this.videos[item.id].media && this.videos[item.id].media.paused) {
|
325
|
-
this.videos[item.id].media.play();
|
326
|
-
}
|
327
|
-
}
|
328
|
-
}
|
329
|
-
};
|
330
87
|
DivLayer.prototype.addIframe = function (node) {
|
331
|
-
|
332
|
-
iframe.scrolling = 'no';
|
333
|
-
iframe.frameBorder = '0';
|
334
|
-
iframe.src = node.iframe;
|
88
|
+
const iframe = createIframeElement(node);
|
335
89
|
this.iframes[node.id] = iframe;
|
336
|
-
|
90
|
+
commonStore[node.TID].parentElem.appendChild(iframe);
|
337
91
|
return iframe;
|
338
92
|
};
|
339
93
|
DivLayer.prototype.addGif = function (node) {
|
@@ -347,25 +101,16 @@ var DivLayer = /** @class */ (function (_super) {
|
|
347
101
|
DivLayer.prototype.removeDiv = function (item) {
|
348
102
|
if (this.curNode && item.id === this.curNode.id) {
|
349
103
|
this.curNode = null;
|
350
|
-
// this.media = null;
|
351
|
-
// this.player.style.top = '-99999px';
|
352
104
|
}
|
353
|
-
// if (item.audio) {
|
354
|
-
// this.canvas.removeChild(this.audios[item.id].player);
|
355
|
-
// this.audios[item.id] = null;
|
356
|
-
// }
|
357
|
-
// if (item.video) {
|
358
|
-
// this.canvas.removeChild(this.videos[item.id].player);
|
359
|
-
// this.videos[item.id] = null;
|
360
|
-
// }
|
361
105
|
if (item.iframe) {
|
362
|
-
|
363
|
-
|
106
|
+
const iframesNode = this.iframes[item.id] || DomIframes[item.id];
|
107
|
+
commonStore[item.TID].parentElem.removeChild(iframesNode);
|
108
|
+
this.iframes[item.id] ? this.iframes[item.id] = null : DomIframes[item.id] = null;
|
364
109
|
}
|
365
110
|
if (item.elementId) {
|
366
111
|
const elementNode = this.elements[item.id] || DomElements[item.id];
|
367
112
|
this.canvas.removeChild(elementNode);
|
368
|
-
this.elements[item.id] = null;
|
113
|
+
this.elements[item.id] ? this.elements[item.id] = null : DomElements[item.id] = null;
|
369
114
|
}
|
370
115
|
if (item.gif) {
|
371
116
|
this.canvas.removeChild(this.gifs[item.id]);
|
@@ -383,19 +128,22 @@ var DivLayer = /** @class */ (function (_super) {
|
|
383
128
|
};
|
384
129
|
DivLayer.prototype.clear = function () {
|
385
130
|
this.canvas.innerHTML = '';
|
386
|
-
//this.audios = {};
|
387
|
-
//this.videos = {};
|
388
131
|
this.iframes = {};
|
389
132
|
this.elements = {};
|
390
133
|
this.gifs = {};
|
391
|
-
for (
|
134
|
+
for (let key in DomIframes) {
|
135
|
+
delete DomIframes[key];
|
136
|
+
}
|
137
|
+
for (let key in DomElements) {
|
392
138
|
delete DomElements[key];
|
393
139
|
}
|
394
140
|
// tslint:disable-next-line:forin
|
395
|
-
for (
|
141
|
+
for (let key in images) {
|
396
142
|
delete images[key];
|
397
143
|
}
|
398
|
-
|
144
|
+
for (let key in defaultImages) {
|
145
|
+
delete defaultImages[key];
|
146
|
+
}
|
399
147
|
};
|
400
148
|
DivLayer.prototype.formatSeconds = function (seconds) {
|
401
149
|
var h = Math.floor(seconds / 3600);
|
@@ -447,8 +195,6 @@ var DivLayer = /** @class */ (function (_super) {
|
|
447
195
|
DivLayer.prototype.destroy = function () {
|
448
196
|
this.clear();
|
449
197
|
this.subcribe.unsubscribe();
|
450
|
-
//this.subcribeNode.unsubscribe();
|
451
|
-
|
452
198
|
//优化
|
453
199
|
this.canvas.onmousemove = null;
|
454
200
|
this.canvas.onmousedown = null
|
@@ -1,7 +1,9 @@
|
|
1
1
|
//let DETAILDATA = null;
|
2
|
-
import { echartsDefaultDataMap } from '../../../static
|
2
|
+
import { echartsDefaultDataMap } from '../../../static';
|
3
|
+
import { commonStore } from '../store'
|
3
4
|
export function setConfItemNode(pen, syn_synata) {
|
4
5
|
if (!pen.data) return
|
6
|
+
commonStore[pen.TID].data.dataResize = 1;
|
5
7
|
if(pen.data instanceof Array) {
|
6
8
|
let _syn = ''
|
7
9
|
let isResetVal = false
|
@@ -113,52 +115,73 @@ export function setConfItemNode(pen, syn_synata) {
|
|
113
115
|
export function setStatisticalData(pen, dataType, staticForType, chartData) {
|
114
116
|
const node = JSON.parse(JSON.stringify(pen));
|
115
117
|
const echartsOption = node.data.echarts.option;
|
116
|
-
const
|
117
|
-
|
118
|
+
const optionDisplayMode = echartsOption.displayMode;
|
119
|
+
let displayMode = 0;
|
120
|
+
if(typeof optionDisplayMode === 'string') {
|
121
|
+
|
122
|
+
const displayType = optionDisplayMode.split('_')[0];
|
123
|
+
|
124
|
+
displayMode = parseInt(displayType);
|
125
|
+
|
126
|
+
}else {
|
127
|
+
displayMode = parseInt(optionDisplayMode);
|
128
|
+
}
|
129
|
+
const defaultData = echartsDefaultDataMap[`displayMode_${optionDisplayMode}`];
|
118
130
|
const staticTypeData = chartData && chartData[`${staticForType}_Data`];
|
119
131
|
const chartRealData = staticForType ? staticTypeData || defaultData : chartData || defaultData;
|
120
|
-
dataType = staticForType && staticTypeData ? '' : 'def';
|
121
132
|
if (displayMode === 1 || displayMode === 2){ // 折线图,柱状图
|
122
133
|
//const xData = [], seriesData = [];
|
123
|
-
|
134
|
+
dataType = staticForType && staticTypeData || chartData && chartData.seriesData.length ? '' : 'def';
|
124
135
|
const seriesNodes = echartsOption.series;
|
136
|
+
const isBaseLineBar = ['line', 'bar'].includes(node.appearance.type);
|
125
137
|
// 双轴曲线
|
126
138
|
if(seriesNodes.length > 1 || node.data.params && node.data.params.curveNum > 1){
|
127
139
|
const legendData = [];
|
140
|
+
let legendChange = false;
|
128
141
|
echartsOption.xAxis[0].data = chartRealData.XData;
|
142
|
+
let order = 0;
|
129
143
|
//循环给每条统计数据赋值
|
130
144
|
seriesNodes.map((item, index) => {
|
145
|
+
let seriesItem = null;
|
146
|
+
// 执行类型为恢复默认
|
131
147
|
if(dataType === 'def') {
|
148
|
+
let defaultSeriesItem = defaultData.seriesData[order];
|
149
|
+
if(!defaultSeriesItem) defaultSeriesItem = defaultData.seriesData[0]; // 默认数据只有一个时,只取第一个
|
150
|
+
seriesItem = JSON.parse(JSON.stringify(defaultSeriesItem));
|
151
|
+
if(['line', 'bar'].includes(item.type)) order++; // 此判断为过滤series中的图表柱子或折线节点样式
|
152
|
+
if(!isBaseLineBar) return item.data = seriesItem.data; // 曲线或柱状图模板一般会走这个逻辑
|
132
153
|
if(!index) {
|
133
|
-
|
154
|
+
seriesItem.name = '标注1';
|
155
|
+
item.data = seriesItem.data;
|
134
156
|
}else {
|
135
|
-
|
136
|
-
|
157
|
+
// 自动生成series数据计算
|
158
|
+
for(let i = 0, sdl = seriesItem.data.length; i < sdl; i++){
|
159
|
+
displayMode === 1 ? seriesItem.data[i] -= 400 : seriesItem.data[i] += 100;
|
137
160
|
}
|
138
|
-
|
161
|
+
seriesItem.name = `标注${index + 1}`;
|
162
|
+
item.data = seriesItem.data;
|
139
163
|
}
|
140
164
|
}else {
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
165
|
+
// 执行类型为实时数据
|
166
|
+
seriesItem = chartRealData.seriesData[index];
|
167
|
+
if(!seriesItem) return item.data = [];
|
168
|
+
item.data = seriesItem.data;
|
169
|
+
}
|
170
|
+
// 获取角标数据
|
171
|
+
if(seriesItem.name) {
|
172
|
+
item.name = seriesItem.name;
|
173
|
+
legendData.push(seriesItem.name);
|
174
|
+
legendChange = true;
|
147
175
|
}
|
148
176
|
});
|
149
|
-
if(echartsOption.legend &&
|
177
|
+
if(echartsOption.legend && legendChange) echartsOption.legend.data = legendData; // 为角标数据赋值
|
150
178
|
}else {
|
179
|
+
// 单曲线或柱状的执行逻辑
|
151
180
|
echartsOption.xAxis[0].data = chartRealData.XData;
|
152
181
|
const { name, data } = chartRealData.seriesData[0];
|
153
182
|
if(name) seriesNodes[0].name = name;
|
154
183
|
seriesNodes[0].data = data;
|
155
184
|
}
|
156
|
-
if(echartsOption.legend && echartsOption.legend.data.length) {
|
157
|
-
echartsOption.legend.data = [];
|
158
|
-
for(let i=0, legLeng=echartsOption.legend.data.length; i<legLeng; i++){
|
159
|
-
echartsOption.legend.data.push(`标注${i+1}`);
|
160
|
-
}
|
161
|
-
}
|
162
185
|
}
|
163
186
|
if(displayMode === 4) { // top排行榜
|
164
187
|
echartsOption.yAxis[0].data = chartRealData.XData;
|
@@ -1,6 +1,4 @@
|
|
1
|
-
import { Point } from '../models';
|
2
|
-
import { Node } from '../models';
|
3
|
-
import { Line } from '../models';
|
1
|
+
import { Point, Node, Line } from '../models';
|
4
2
|
export declare const drawNodeFns: any;
|
5
3
|
export declare const iconRectFns: any;
|
6
4
|
export declare const textRectFns: any;
|
@@ -1,54 +1,52 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
import {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
import {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
import { formtable } from './nodes/formtable';
|
51
|
-
import { tablePagination } from './nodes/tablePagination';
|
1
|
+
import {
|
2
|
+
arrowAnchors,
|
3
|
+
leftArrow, leftArrowIconRect, leftArrowTextRect,
|
4
|
+
rightArrow, rightArrowIconRect, rightArrowTextRect,
|
5
|
+
twowayArrow, twowayArrowIconRect, twowayArrowTextRect,
|
6
|
+
rectangle, rectangleIconRect, rectangleTextRect,
|
7
|
+
diamond, diamondIconRect, diamondTextRect,
|
8
|
+
text, file, formtable, tablePagination, iframePrimeval,
|
9
|
+
line as nodeLine, lineAnchors, lineIconRect, lineTextRect,
|
10
|
+
circle, circleIconRect, circleTextRect, circleAnchors,
|
11
|
+
triangle, triangleIconRect, triangleTextRect, triangleAnchors,
|
12
|
+
pentagon, pentagonIconRect, pentagonTextRect, pentagonAnchors,
|
13
|
+
hexagon, hexagonAnchors, hexagonIconRect, hexagonTextRect,
|
14
|
+
pentagram, pentagramAnchors, pentagramIconRect, pentagramTextRect,
|
15
|
+
cloud, cloudAnchors, cloudIconRect, cloudTextRect,
|
16
|
+
message, messageIconRect, messageTextRect, messageAnchors,
|
17
|
+
imageIconRect, imageTextRect,
|
18
|
+
cube, cubeAnchors, cubeIconRect, cubeTextRect,
|
19
|
+
people, peopleIconRect, peopleTextRect,
|
20
|
+
arbitraryGraph, arbitraryGraphAnchors,
|
21
|
+
} from './nodes';
|
22
|
+
import {
|
23
|
+
line,
|
24
|
+
lineControlPoints,
|
25
|
+
calcLineControlPoints,
|
26
|
+
polyline,
|
27
|
+
polylineControlPoints,
|
28
|
+
pointInPolyline,
|
29
|
+
calcPolylineControlPoints,
|
30
|
+
dockPolylineControlPoint,
|
31
|
+
curve,
|
32
|
+
curveControlPoints,
|
33
|
+
pointInCurve,
|
34
|
+
calcCurveControlPoints,
|
35
|
+
mind,
|
36
|
+
calcMindControlPoints,
|
37
|
+
mindControlPoints,
|
38
|
+
pointInMind
|
39
|
+
} from './lines';
|
40
|
+
import {
|
41
|
+
triangleSolid,
|
42
|
+
triangle as arrowTriangle,
|
43
|
+
diamondSolid,
|
44
|
+
diamond as arrowDiamond,
|
45
|
+
circleSolid, circle as arrowCircle,
|
46
|
+
lineUp,
|
47
|
+
lineDown,
|
48
|
+
line as arrowLine
|
49
|
+
} from './arrows';
|
52
50
|
// Functions of drawing a node.
|
53
51
|
export var drawNodeFns = {};
|
54
52
|
// Calc the occupy rect of icon.
|
@@ -64,6 +62,8 @@ export var drawArrowFns = {};
|
|
64
62
|
function init() {
|
65
63
|
console.log('Init middles.');
|
66
64
|
// ********Default nodes.*******
|
65
|
+
// iframe
|
66
|
+
drawNodeFns.iframe = iframePrimeval;
|
67
67
|
// tablePagination
|
68
68
|
drawNodeFns.tablePagination = tablePagination;
|
69
69
|
// formtable
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import {rectangle} from 'dcim-topology2d/core'
|
2
|
+
|
3
|
+
export function iframePrimeval(ctx, node) {
|
4
|
+
//console.log('iframePrimeval############', node)
|
5
|
+
// 绘制一个底图,类似于占位符。
|
6
|
+
rectangle(ctx, node);
|
7
|
+
if (!node.elementLoaded) {
|
8
|
+
// 添加当前节点到div层
|
9
|
+
node.addToDiv('init')
|
10
|
+
node.elementRendered = false
|
11
|
+
}
|
12
|
+
}
|