dcim-topology2d 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import {s8, createDiv, rectangle, commonStore} from '../../../core';
2
2
  import {plugsPool} from '../../../store';
3
3
  import {
4
+ setMapScatterOptions,
4
5
  setMapLineBarOptions,
5
6
  setMapGaugeOptions,
6
7
  setMapRingOptions,
@@ -61,16 +62,21 @@ export function echarts(ctx, node) {
61
62
  setTimeout(function () {
62
63
  let option = node.data.echarts.option;
63
64
  if(!(echartsData && echartsData.chart)) return;
65
+ const pageZoom = currentStore.data.pageZoom;
66
+ echartsData.div.style.transform = `scale(${pageZoom})`;
67
+ echartsData.div.style.transformOrigin = '0 0';
64
68
  if(node.data.params) node.data.params.tabCorrelationType = echartsData.tabCorrelationType || ''; // 统计图与Tab关联
65
69
  const isLocked = currentStore.data.locked;
66
70
  if (!isLocked || !currentStore.echartsOptionsPool[node.id]) {
67
71
  const tabData = initBindTabSetting(node); // 初始化Tabs数据配置
68
72
  // 【未锁定(编辑)状态, options未初始化的状态】
69
73
  if (!appearance.type) appearance.type = echartsTypeMap[`type_${option.displayMode}`]; // 兼容旧数据配置
70
- // 公共配置 Top排行榜跳过公共属性配置
71
- if (option.displayMode !== 4) setMapGlobalOptions(option, node);
74
+ // 公共配置 Top排行榜散点图跳过公共属性配置
75
+ if (option.displayMode !== 4 && option.displayMode !== 7) setMapGlobalOptions(option, node);
76
+ // 散点图
77
+ if (appearance.type.includes('scatter')) setMapScatterOptions(option, node);
72
78
  // 折线图和柱状图
73
- if (['line', 'bar'].includes(appearance.type)) setMapLineBarOptions(option, node);
79
+ if (appearance.type.includes('line') || appearance.type.includes('bar')) setMapLineBarOptions(option, node);
74
80
  // 仪表盘
75
81
  if (appearance.type === 'gauge') setMapGaugeOptions(option, node);
76
82
  // 环形图 || 饼图
@@ -78,7 +84,7 @@ export function echarts(ctx, node) {
78
84
  // 3d 柱状图
79
85
  if (appearance.type === '3dBar') setMap3dBarOptions(option, node);
80
86
  // Top排行榜
81
- if (appearance.type === 'TOP') setMapTopOptions(option, node);
87
+ if (appearance.type.includes('TOP')) setMapTopOptions(option, node);
82
88
  //option.title = appearance.title;
83
89
  option.backgroundColor = appearance.backgroundColor;
84
90
  currentStore.echartsOptionsPool[node.id] = {
@@ -95,7 +101,6 @@ export function echarts(ctx, node) {
95
101
  }
96
102
  // echarts 数据渲染更新
97
103
  setMapDataOptions(option, currentStore.echartsOptionsPool[node.id].data);
98
-
99
104
  node.elementRendered = true;
100
105
  })
101
106
  }
@@ -94,11 +94,21 @@ export function setChartYAxisData(yAxis, appearance) {
94
94
  if (!appearance.ysplitLineLineStyle && yAxis[0].splitLine.show) {
95
95
  appearance.ysplitLineLineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
96
96
  }
97
+ if(appearance.total && appearance.total.length && appearance.totalLabelSynchroYData) {
98
+ const newYAxisData = [];
99
+ for (let i = 0; i < appearance.total.length; i++) {
100
+ const item = appearance.total[i];
101
+ if(item.value) newYAxisData.push(item.label);
102
+ }
103
+ yAxis[0].data = newYAxisData;
104
+ }
97
105
  for (let i = 0; i < yAxis.length; i++) {
98
106
  const item = yAxis[i];
107
+ if(!item.axisLabel) item.axisLabel = {};
99
108
  if (!item.axisLabel.textStyle) {
100
109
  item.axisLabel.textStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['y1axisLabelTextStyle']));
101
110
  }
111
+ if(!item.splitLine) item.splitLine = {};
102
112
  if (!item.splitLine.lineStyle) {
103
113
  item.splitLine.lineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
104
114
  }
@@ -7,6 +7,7 @@ interface echartsOptions {
7
7
  }
8
8
  export declare function getXYAxisLabelVal(index: number, intervalNum: number, value: any): string;
9
9
  export declare function initBindTabSetting(node: any): string;
10
+ export declare function setMapScatterOptions(option: echartsOptions, node: any): void;
10
11
  export declare function setMapLineBarOptions(option: echartsOptions, node: any): void;
11
12
  export declare function setMapGaugeOptions(option: echartsOptions, node: any): void;
12
13
  export declare function setMapRingOptions(option: echartsOptions, node: any): void;
@@ -1,4 +1,4 @@
1
- import {echartsDataRoom, echartsColorData} from '../../../static';
1
+ import {echartsDataRoom, echartsColorData, rankingTopImageName} from '../../../static';
2
2
  import {
3
3
  setSeriesRenderGroup,
4
4
  drawGraphicShape,
@@ -7,7 +7,8 @@ import {
7
7
  setChartYAxisData,
8
8
  setLineSeriesStyleData,
9
9
  setRingPreSeriesOptions,
10
- setRingProSeriesOptions
10
+ setRingProSeriesOptions,
11
+ mapFormatterSet
11
12
  } from '../utils';
12
13
  import {
13
14
  gaugeNormalAuto,
@@ -15,7 +16,9 @@ import {
15
16
  pieRingAssetTotalAuto,
16
17
  pieRingProportionAuto,
17
18
  pieRingNormalAuto,
18
- topRankingListAuto
19
+ topRankingListAuto,
20
+ scatterDataAuto,
21
+ barPileStaticDataAuto
19
22
  } from './render';
20
23
  import {commonStore, echartsStaticType} from "../../../core";
21
24
 
@@ -76,6 +79,33 @@ export function setMapStopAutoMoveOptions(chartNode) {
76
79
 
77
80
  }
78
81
 
82
+ // 自动配置散点图的节点数据
83
+ export function setMapScatterOptions(option, node) {
84
+ if(node.appearance.series) {
85
+ for (let i = 0; i < option.series.length; i++) {
86
+ const series = option.series[i];
87
+ const setSeries = node.appearance.series[i];
88
+ if(setSeries) {
89
+ series.itemStyle.color = setSeries.itemColor;
90
+ series.itemStyle.borderColor = setSeries.itemBorderColor;
91
+ }
92
+ }
93
+ }
94
+ if(node.appearance.yAxis && node.appearance.yAxis.axisLabel && node.appearance.yAxis.axisLabel.length) {
95
+ const yAxisAxisLabelRich = option.yAxis[0].axisLabel.rich;
96
+ const yAxisAxisLabel = node.appearance.yAxis.axisLabel;
97
+ const yAxisData = [];
98
+ for (let i = 0; i < yAxisAxisLabel.length; i++) {
99
+ const axisLabel = yAxisAxisLabel[i];
100
+ yAxisAxisLabelRich[`f${i+1}`] = {
101
+ color: axisLabel.color
102
+ };
103
+ if(axisLabel.label) yAxisData.push(axisLabel.label);
104
+ }
105
+ option.yAxis[0].data = yAxisData;
106
+ }
107
+ }
108
+
79
109
  // 自动配置折线和柱状图的节点数据
80
110
  export function setMapLineBarOptions(option, node) {
81
111
  option.color = node.appearance.color;
@@ -85,11 +115,17 @@ export function setMapLineBarOptions(option, node) {
85
115
  option.yAxis[0].axisLabel.formatter = function (value, index) {
86
116
  return getXYAxisLabelVal(index, node.appearance.intervalNumY, value);
87
117
  }
88
- if (option.series.length < 2) {
89
- option.tooltip.formatter = function (params) {
90
- const item = params[0];
91
- return item.name + ' : ' + item.value;
118
+ if(option.series.length < 2) return;
119
+ const total = node.appearance.total;
120
+ if(total && total.length) {
121
+ const seriesData = option.series[0].data;
122
+ if(seriesData.length < total.length && total[total.length - 1].value) seriesData.push(20);
123
+ const data2 = [];
124
+ for (let i = 0; i < seriesData.length; i++) {
125
+ const dr = node.appearance.total[i] ? node.appearance.total[i].value - Number(seriesData[i]) : option.series[1].data[i];
126
+ data2.push(dr);
92
127
  }
128
+ option.series[1].data = data2;
93
129
  }else {
94
130
  option.series.map((item, index) => {
95
131
  if(!(item.itemStyle && item.itemStyle.normal && item.itemStyle.normal.color)) {
@@ -133,13 +169,13 @@ export function setMapRingOptions(option, node) {
133
169
  //const chartOption = JSON.parse(JSON.stringify(option));
134
170
  const appearance = node.appearance;
135
171
  if(appearance.type === 'ringPre'){
136
-
172
+
137
173
  setRingPreSeriesOptions(option, appearance);
138
-
174
+
139
175
  }else if(appearance.type === 'ringPro'){
140
-
176
+
141
177
  setRingProSeriesOptions(option, appearance);
142
-
178
+
143
179
  }else {
144
180
  const seriesNode = option.series[0];
145
181
  if ((!appearance.label || typeof appearance.label.showValue !== 'boolean')) {
@@ -151,16 +187,41 @@ export function setMapRingOptions(option, node) {
151
187
  seriesNode.label = {
152
188
  normal: {
153
189
  show: true,
154
- position: 'outside'
190
+ position: 'outside',
191
+ color: appearance.label.color || '',
192
+ fontSize: appearance.label.fontSize || '12'
155
193
  }
156
194
  };
157
- seriesNode.label.normal.formatter = (data) => {
158
- if (appearance.label.showValue === true) {
159
- return `${data.name}:${data.value}${appearance.label.unit}`;
160
- } else {
161
- return `${data.name}`;
195
+
196
+ seriesNode.labelLine = appearance.labelLine && {...appearance.labelLine} || {};
197
+
198
+ if(seriesNode.labelLine.lineStyle && !seriesNode.labelLine.lineStyle.color) {
199
+ delete seriesNode.labelLine.lineStyle['color'];
200
+ }
201
+
202
+ const rich = {};
203
+
204
+ if(appearance.cir && appearance.cir.show) {
205
+ rich.cir = {...appearance.cir};
206
+ if(!rich.cir.borderColor) rich.cir.borderColor = 'auto';
207
+ if(!rich.cir.backgroundColor) rich.cir.backgroundColor = 'transparent';
208
+ }
209
+
210
+ if(appearance.labelDetail && appearance.labelDetail.length) {
211
+ // 环形明细展示配置,线条样式配置
212
+ rich.a = {
213
+ color: appearance.label.color || '',
214
+ fontSize: appearance.label.fontSize || '12'
215
+ };
216
+ for (let i = 0; i < appearance.labelDetail.length; i++) {
217
+ const detail = appearance.labelDetail[i];
218
+ rich[`b${i+1}`] = {
219
+ color: detail.color,
220
+ fontSize: detail.fontSize || '12'
221
+ };
162
222
  }
163
223
  }
224
+ seriesNode.label.normal.rich = rich;
164
225
  }
165
226
  }
166
227
 
@@ -199,6 +260,21 @@ export function setMapTopOptions(option, node) {
199
260
  //const chartOption = JSON.parse(JSON.stringify(option));
200
261
  const appearance = node.appearance;
201
262
  Object.assign(option.grid, appearance.grid);
263
+ if(!appearance.type.includes('TOPRanking')) return;
264
+ const yNode = option.yAxis[0];
265
+ if(yNode.axisLabel.rich['a1']) return;
266
+ for (let i = 0, length = yNode.data.length; i < length; i++) {
267
+ const order = i + 1;
268
+ yNode.axisLabel.rich[`a${order}`] = {
269
+ width: 30,
270
+ height: 17,
271
+ lineHeight: 22,
272
+ verticalAlign: 'bottom',
273
+ backgroundColor: {
274
+ image: `../../../images/TOP/NO-${order}-${rankingTopImageName[i]}.png`
275
+ }
276
+ }
277
+ }
202
278
  }
203
279
 
204
280
  /**
@@ -220,7 +296,7 @@ export function setMapGlobalOptions(option, node) {
220
296
  // 图表Y轴数据
221
297
  if (option.yAxis) setChartYAxisData(option.yAxis, appearance);
222
298
  // 图表图例数据
223
- if (option.legend) setChartLegendData(option.legend, appearance);
299
+ //if (option.legend) setChartLegendData(option.legend, appearance);
224
300
  // 曲线样式数据
225
301
  if (appearance.type.includes('line')) setLineSeriesStyleData(option.series, appearance);
226
302
  }
@@ -254,12 +330,25 @@ export function setMapDataOptions(option, node) {
254
330
 
255
331
  if(node.tabData && node.tabData.data.state && optionNode.yAxis[0].max) Object.assign(optionNode.yAxis[0], node.tabData.data); //若Tabs切换配置了数据,则修改Y轴原有配置
256
332
 
257
- lineBarDataAuto(optionNode, params, staticTypeData);
333
+ if(appearance.type === 'barPileStatic') {
334
+
335
+ barPileStaticDataAuto(optionNode, staticTypeData, appearance);
336
+
337
+ }else {
338
+
339
+ lineBarDataAuto(optionNode, params, staticTypeData, appearance);
340
+
341
+ }
258
342
 
259
343
  }
260
- if(displayMode === 4) { // top排行榜
344
+ if(displayMode === 4) { // top排行榜-电量仪
261
345
 
262
- topRankingListAuto(optionNode, staticTypeData);
346
+ topRankingListAuto(optionNode, staticTypeData, appearance);
347
+
348
+ }
349
+ if(displayMode === 7) { // 散点图
350
+
351
+ scatterDataAuto(optionNode, staticTypeData);
263
352
 
264
353
  }
265
354
  if (displayMode === 5 || displayMode === 3) { // 饼图/环形图
@@ -305,7 +394,6 @@ export function setMapDataOptions(option, node) {
305
394
  if (item.data) {
306
395
  optionNode.yAxis[i].data = item.data;
307
396
  }
308
- ;
309
397
  }
310
398
  }
311
399
  if (option.series) {
@@ -317,6 +405,8 @@ export function setMapDataOptions(option, node) {
317
405
  }
318
406
  }
319
407
 
408
+ mapFormatterSet(appearance, optionNode, staticTypeData);
409
+
320
410
  const currentChartNode = commonStore[node.TID].echartsDataPool[node.id];
321
411
  const mapChart = currentChartNode.chart;
322
412
  clearInterval(currentChartNode.timeTicket);
@@ -0,0 +1 @@
1
+ export declare function mapFormatterSet(appearance: object, option: any, data: any): void;
@@ -0,0 +1,170 @@
1
+ import {rankingTopColorList} from '../../../static';
2
+
3
+ export function mapFormatterSet(appearance, options, data) {
4
+ if(appearance.type.includes('ring') || appearance.type.includes('pie')) {
5
+ const seriesNode = options.series[0];
6
+ if(seriesNode.label && seriesNode.label.normal &&!seriesNode.label.normal.formatter) {
7
+ setMapRingOptionsFormatter(appearance, seriesNode);
8
+ }
9
+ }
10
+ if(appearance.type.includes('line') || appearance.type.includes('bar')) setMapLineBarFormatter(appearance, options);
11
+ if(appearance.type.includes('lineTwins')) setMapLineTwinsFormatter(appearance, options);
12
+ if(appearance.type.includes('scatter')) setMapScatterFormatter(options);
13
+ if(appearance.type.includes('TOPRanking')) setMapTopScoreFormatter(options, data, appearance);
14
+ if(appearance.type.includes('barPileStatic')) setMapBarPileStaticFormatter(appearance, options);
15
+ }
16
+ function setMapLineTwinsFormatter(appearance, options) {
17
+ if(!options.tooltip.formatter && appearance.tooltipUnit) {
18
+ options.tooltip.formatter = function (params) {
19
+ let relVal = params[0].name;
20
+ for (var i = 0, l = params.length; i < l; i++) {
21
+ const unit = appearance.tooltipUnit[i] || '';
22
+ relVal +=
23
+ "<br/>" +
24
+ params[i].marker +
25
+ params[i].seriesName +
26
+ " : " +
27
+ params[i].value +
28
+ unit;
29
+ }
30
+ return relVal;
31
+ }
32
+ }
33
+ }
34
+ // 折线 || 柱状图
35
+ function setMapLineBarFormatter(appearance, options){
36
+ if(!options.tooltip.formatter){
37
+ options.tooltip.formatter = function(param) {
38
+ const firstUnit = getTooltipUnit(0, appearance);
39
+ const firstDott = getTooltipDott(param[0].color);
40
+ let data = `${firstDott}${param[0].seriesName}:${param[0].value} ${firstUnit}`;
41
+ for (let i = 1; i < param.length; i++){
42
+ const item = param[i];
43
+ const unit = getTooltipUnit(i, appearance);
44
+ const dott = getTooltipDott(param[i].color);
45
+ data += `<br>${dott}${item.seriesName}:${item.value} ${unit}`;
46
+ }
47
+ return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;margin-bottom: 5px;">${param[0].name}</div>${data}`;
48
+ }
49
+ }
50
+ }
51
+ function getTooltipUnit(index, appearance) {
52
+ if(!(appearance.tooltipUnit && appearance.tooltipUnit[index])) return '';
53
+ return appearance.tooltipUnit[index];
54
+ }
55
+ function getTooltipDott(color) {
56
+ return `<span style="display: inline-block;margin-right: 8px;border: 5px solid ${color};border-radius: 100%"></span>`;
57
+ }
58
+ // 堆叠统计
59
+ function setMapBarPileStaticFormatter(appearance, options) {
60
+ if(!options.tooltip.formatter){
61
+ options.tooltip.formatter = function(param) {
62
+ let data = `${param[0].seriesName}:${param[0].value} ${appearance.series[0] && appearance.series[0].labelUnit || ''}`;
63
+ for (let i = 1; i < param.length; i++){
64
+ const item = param[i];
65
+ const series = appearance.series[i];
66
+ data += `<br>${item.seriesName}:${appearance.total && appearance.total[item.dataIndex].value || item.value} ${series && series.labelUnit || ''}`;
67
+ }
68
+ return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;margin-bottom: 5px;">${param[0].name}</div>${data}`;
69
+ }
70
+ }
71
+ for (let i = 0; i < options.series.length; i++) {
72
+ const item = options.series[i];
73
+ const setItem = appearance.series[i];
74
+ if(setItem) {
75
+ item.itemStyle.normal.color = setItem.itemColor;
76
+ item.label.color = setItem.labelColor;
77
+ item.label.fontSize = setItem.labelSize;
78
+ item.label.padding[0] = setItem.labelTop;
79
+ }
80
+ item.label.formatter = `{c}${setItem ? setItem.labelUnit : ''}`;
81
+ }
82
+ if(appearance.total && appearance.total.length) {
83
+ options.series[1].label.formatter = function(param) {
84
+ if(!param.value) return '';
85
+ const val = appearance.totalLabel ? appearance.total[param.dataIndex].value || options.series[1].data[param.dataIndex] : '';
86
+ return `${val}${appearance.series[1].labelUnit}`;
87
+ }
88
+ }
89
+ }
90
+ // Top排行榜自定义展示配置
91
+ function setMapTopScoreFormatter(options, data, appearance) {
92
+ const yNode = options.yAxis[0];
93
+ if(!yNode.axisLabel.formatter) {
94
+ yNode.axisLabel.formatter = function(value, i) {
95
+ return `{a${i+1}|}{b|${value}}`;
96
+ }
97
+ }
98
+ const seriesNode = options.series[0];
99
+ if(appearance.total && appearance.total.length) {
100
+ const realData = data && data.seriesData && data.seriesData[0] && data.seriesData[0].data;
101
+ const normalData = [28.7, 24.2, 20.3, 19.8, 19.3];
102
+ const resultData = realData && realData.length ? realData : normalData;
103
+ seriesNode.itemStyle.normal.label.formatter = function(param) {
104
+ return `${resultData[param.dataIndex]}${appearance.unit}`;
105
+ }
106
+ for(let i = 0; i < appearance.total.length; i++) {
107
+ const value = appearance.total[i].value;
108
+ seriesNode.data[i] = value ? parseInt(value) : normalData[i];
109
+ }
110
+ }
111
+ if(seriesNode.itemStyle.normal.color) return;
112
+ const colorList = appearance.barColor || rankingTopColorList;
113
+ for (let i = 0; i < options.series.length; i++) {
114
+ const node = options.series[i];
115
+ node.itemStyle.normal.color = function(params) {
116
+ return colorList[params.dataIndex];
117
+ }
118
+ }
119
+ }
120
+ // 散点图series自定义展示配置
121
+ function setMapScatterFormatter(options) {
122
+ const seriesNode = options.series[0];
123
+ if(!options.tooltip.formatter) {
124
+ options.tooltip.formatter = function(param) {
125
+ const value = param.value;
126
+ // prettier-ignore
127
+ return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;padding-bottom: 5px;margin-bottom: 5px;">${param.seriesName}告警</div>告警等级:${value[1]}<br>告警数量:${value[2]}`;
128
+ }
129
+ }
130
+ if(!options.yAxis[0].axisLabel.formatter) {
131
+ options.yAxis[0].axisLabel.formatter = function (value, index) {
132
+ return `{f${index+1}|${value}}`;
133
+ }
134
+ }
135
+ if(seriesNode.symbolSize) return;
136
+ for (let i = 0; i < options.series.length; i++) {
137
+ const node = options.series[i];
138
+ node.symbolSize = function(d) {
139
+ let markSize = Math.sqrt(d[2]) * 2;
140
+ if(markSize < 6) markSize = 6;
141
+ if(markSize > 20) markSize = 20;
142
+ //if(!markSize) markSize = 1;
143
+ return markSize;
144
+ }
145
+ node.label.emphasis.formatter = function(param) {
146
+ return param.data[0];
147
+ }
148
+ }
149
+ }
150
+ // 环形图自定义展示配置
151
+ function setMapRingOptionsFormatter(appearance, seriesNode) {
152
+ if(appearance.labelDetail && appearance.labelDetail.length) {
153
+ seriesNode.label.normal.formatter = (data) => {
154
+ let result = `{a|${data.name}}\n{cir|}`;
155
+ for (let i = 0; i < appearance.labelDetail.length; i++) {
156
+ const detail = appearance.labelDetail[i];
157
+ result += '\n'+`{b${i+1}|${detail.title}${i === 0 ? data.value : data[`value${i+1}`]}${detail.unit}}`;
158
+ }
159
+ return result;
160
+ }
161
+ }else {
162
+ seriesNode.label.normal.formatter = (data) => {
163
+ if (appearance.label.showValue === true) {
164
+ return `${data.name}:${data.value}${appearance.label.unit}`;
165
+ } else {
166
+ return `${data.name}`;
167
+ }
168
+ }
169
+ }
170
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './conversion';
2
2
  export * from './drawGraphic';
3
3
  export * from './changeOptions';
4
+ export * from './formatter';
@@ -1,3 +1,4 @@
1
1
  export * from './conversion';
2
2
  export * from './drawGraphic';
3
3
  export * from './changeOptions';
4
+ export * from './formatter';
@@ -1,5 +1,7 @@
1
- export declare function lineBarDataAuto(option: any, params: {}, data: {}): void;
2
- export declare function topRankingListAuto(option: any, data: {}): void;
1
+ export declare function lineBarDataAuto(option: any, params: {}, data: {}, appearance: {}): void;
2
+ export declare function barPileStaticDataAuto(option: any, data: {}, appearance: {}): void;
3
+ export declare function topRankingListAuto(option: any, data: {}, appearance: {}): void;
4
+ export declare function scatterDataAuto(option: any, data: {}): void;
3
5
  export declare function pieRingAssetTotalAuto(option: any, data: {}, total: number, count: number): void;
4
6
  export declare function pieRingProportionAuto(option: any, data: {}, proportion: number): void;
5
7
  export declare function pieRingNormalAuto(option: any, data: {}): void;
@@ -5,8 +5,9 @@ import {echartsColorData} from "../../../static";
5
5
  * @param option 图表配置数据
6
6
  * @param params 绑定的图表参数
7
7
  * @param data 实时图表数据
8
+ * @param appearance 配置参数
8
9
  */
9
- export function lineBarDataAuto(option, params, data) {
10
+ export function lineBarDataAuto(option, params, data, appearance) {
10
11
  const seriesNodes = option.series;
11
12
  if(data && data.XData) option.xAxis[0].data = data.XData;
12
13
  if(!(data && data.seriesData && data.seriesData.length)) return;
@@ -19,6 +20,25 @@ export function lineBarDataAuto(option, params, data) {
19
20
  }
20
21
  if(seriesNodes.length > 1 || params && params.curveNum > 1){
21
22
  // 双曲线|柱状
23
+ if(option.yAxis.length > 1 && appearance.yAxisValueAuto) {
24
+ if(!appearance.yAxisMaxIntervalue) appearance.yAxisMaxIntervalue = 1;
25
+ // 双轴曲线,且曲线值为自适应
26
+ const dataGroup = {
27
+ data1: data.seriesData[0] && data.seriesData[0].data || [],
28
+ data2: data.seriesData[1] && data.seriesData[1].data || []
29
+ };
30
+ const newData = [...dataGroup.data1, ...dataGroup.data2];
31
+ let min = Math.min(...newData);
32
+ let max = Math.max(...newData);
33
+ const power = Math.floor(Math.log10(min));
34
+ for (let i = 0; i < option.yAxis.length; i++) {
35
+ const currentData = dataGroup[`data${i + 1}`];
36
+ if(min < 0 && Math.max(...currentData) < max) max *= appearance.yAxisMaxIntervalue;
37
+ if(min > 0 && Math.max(...currentData) < max) min = Math.pow(10, power);
38
+ option.yAxis[i].min = Math.ceil(min);
39
+ option.yAxis[i].max = Math.ceil(max);
40
+ }
41
+ }
22
42
  const legendData = [];
23
43
  let legendChange = false;
24
44
  seriesNodes.map((item, index) => {
@@ -37,7 +57,16 @@ export function lineBarDataAuto(option, params, data) {
37
57
  let seriesData = [];
38
58
  for (let i = 0; i < data.seriesData.length; i++){
39
59
  const realSeriesNode = data.seriesData[i];
40
- const currSeriesNode = seriesNodes[i] ? seriesNodes[i] : JSON.parse(JSON.stringify(seriesNodes[0]));
60
+ let currSeriesNode = {};
61
+ const seriesItem = seriesNodes[i];
62
+ if(seriesItem) {
63
+ currSeriesNode = seriesItem;
64
+ }else {
65
+ const newSeriesItem = JSON.parse(JSON.stringify(seriesNodes[0]));
66
+ newSeriesItem.itemStyle.normal.lineStyle.color = echartsColorData[i];
67
+ newSeriesItem.itemStyle.normal.color = echartsColorData[i];
68
+ currSeriesNode = newSeriesItem;
69
+ }
41
70
  if(realSeriesNode.name) currSeriesNode.name = realSeriesNode.name;
42
71
  currSeriesNode.data = realSeriesNode.data;
43
72
  seriesData.push(currSeriesNode);
@@ -46,21 +75,89 @@ export function lineBarDataAuto(option, params, data) {
46
75
  }
47
76
  }
48
77
 
78
+ export function barPileStaticDataAuto(option, data, appearance) {
79
+ if(data && data.XData) option.yAxis[0].data = data.XData;
80
+ if(!(data && data.seriesData && data.seriesData.length)) return;
81
+ const seriesData = data.seriesData[0].data;
82
+ option.series[0].data = seriesData;
83
+ const data2 = [];
84
+ for (let i = 0; i < seriesData.length; i++) {
85
+ const dr = appearance.total[i] ? appearance.total[i].value - Number(seriesData[i]) : data.seriesData[1].data[i];
86
+ data2.push(dr);
87
+ }
88
+ option.series[1].data = data2;
89
+ }
90
+
49
91
  /**
50
- * TOP排行榜实时数据
92
+ * TOP排行-电量仪实时数据
51
93
  * @param option 图表配置数据
52
94
  * @param data 实时图表数据
95
+ * @param appearance 自定义配置数据
53
96
  */
54
- export function topRankingListAuto(option, data) {
97
+ export function topRankingListAuto(option, data, appearance) {
55
98
  if(data && data.XData) option.yAxis[0].data = data.XData;
56
99
  if(!(data && data.seriesData && data.seriesData.length)) return;
57
- const seriesData = data.seriesData[0].data;
58
- option.yAxis[1].data = seriesData;
100
+ if(appearance.type === 'TOPRanking') {
101
+ if(appearance.total && appearance.total.length) return;
102
+ option.series[0].data = data.seriesData[0].data;
103
+ }else {
104
+ const seriesData = data.seriesData[0].data;
105
+ option.yAxis[1].data = seriesData;
106
+ for (let i = 0; i < option.series.length; i++) {
107
+ const node = option.series[i];
108
+ node.symbolBoundingData = data.total;
109
+ node.data = seriesData;
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * 散点图-分数实时数据
115
+ * @param option 图表配置数据
116
+ * @param data 实时图表数据
117
+ */
118
+ export function scatterDataAuto(option, data) {
119
+ if(data && data.XData) option.xAxis[0].data = data.XData;
120
+ if(!(data && data.seriesData && data.seriesData.length)) return;
121
+ const { scatterData, legend, yData } = convertScatter3DTo2D(data);
122
+ option.legend.data = [...legend];
123
+ option.yAxis[0].data = [...yData];
59
124
  for (let i = 0; i < option.series.length; i++) {
60
- const node = option.series[i];
61
- node.symbolBoundingData = data.total;
62
- node.data = seriesData;
125
+ const seriesNode = option.series[i];
126
+ const name = option.legend.data[i];
127
+ seriesNode.name = name;
128
+ seriesNode.data = scatterData[name];
129
+ }
130
+ }
131
+
132
+ function convertScatter3DTo2D(arr3d) {
133
+ const { XData, seriesData } = arr3d;
134
+ const scatterData = {};
135
+ const legend = [];
136
+ const yData = new Set();
137
+ // 第一层遍历
138
+ for (let d = 0, depth = seriesData.length; d < depth; d++) {
139
+ const areaData = seriesData[d];
140
+ const areaName = areaData.name;
141
+ if(!scatterData[areaName]) scatterData[areaName] = [];
142
+ legend.push(areaData.name);
143
+ // 第二层遍历
144
+ const statusData = areaData.data;
145
+ for (let h = 0, height = statusData.length; h < height; h++) {
146
+ const issues = statusData[h];
147
+ const statusName = XData[h];
148
+ // 第三层遍历
149
+ for (let w = 0, width = issues.length; w < width; w++) {
150
+ const { name, value } = issues[w];
151
+ yData.add(name);
152
+ if(value) scatterData[areaName].push([statusName, name, Number(value)]);
153
+ }
154
+ }
63
155
  }
156
+ return {
157
+ scatterData,
158
+ legend,
159
+ yData
160
+ };
64
161
  }
65
162
 
66
163
  /**
@@ -89,7 +186,7 @@ export function pieRingAssetTotalAuto(option, data, total, count) {
89
186
  */
90
187
  export function pieRingProportionAuto(option, data, proportion) {
91
188
  if(data && data.length) {
92
- proportion = Number(data[0].value) * 100;
189
+ proportion = Number(data[0].value);
93
190
  }
94
191
  if(!option.series[0].data[0].label.normal.formatter) option.series[0].data[0].label.normal.formatter = function(params){
95
192
  return params.value ? `{v|${params.value}}{unit|%}` : `{v|${params.value}}`;
@@ -62,9 +62,10 @@ var Canvas = /** @class */ (function (_super) {
62
62
  }
63
63
  this.canvas.style.width = this.width + 'px';
64
64
  this.canvas.style.height = this.height + 'px';
65
- this.canvas.width = (this.width * Canvas.dpiRatio) | 0;
66
- this.canvas.height = (this.height * Canvas.dpiRatio) | 0;
67
- this.canvas.getContext('2d').scale(Canvas.dpiRatio, Canvas.dpiRatio);
65
+ const dpr = window.devicePixelRatio || 1;
66
+ this.canvas.width = (this.width * dpr) | 0;
67
+ this.canvas.height = (this.height * dpr) | 0;
68
+ this.canvas.getContext('2d').scale(dpr, dpr);
68
69
  Store.set(this.generateStoreKey('LT:size'), { width: this.canvas.width, height: this.canvas.height });
69
70
  };
70
71
  Canvas.prototype.render = function () {
@@ -14,12 +14,10 @@ import {
14
14
  setInitConfData,
15
15
  getParams,
16
16
  tabHideShowOperation,
17
- tabStaticOperation,
18
- echartsStaticType
17
+ tabStaticOperation
19
18
  } from './utils';
20
19
  import {useStore, clearStore, commonStore} from './store'
21
20
  import * as mqtt from './mqtt.min';
22
- import {setElementSwitchTabState} from './element';
23
21
  var MoveInType;
24
22
  (function (MoveInType) {
25
23
  MoveInType[MoveInType["None"] = 0] = "None";
@@ -40,6 +38,8 @@ var Common = /** @class */ (function () {
40
38
  this.mouseDown = null;
41
39
  this.renderTimer = 0;
42
40
  this.lastRender = 0;
41
+ this.pageResizeTim = null;
42
+ this.isResize = false;
43
43
  this.id = s8();
44
44
  this.store = useStore(this.id);
45
45
  if (typeof parent === 'string') {
@@ -248,6 +248,16 @@ var Common = /** @class */ (function () {
248
248
  }
249
249
  let data = JSON.parse(JSON.stringify(obj));
250
250
  Object.assign(this.store.data, data);
251
+ // pageZoomOnly 表示topology页面只全局缩放,不对局部缩放进行调整
252
+ if(this.store.options.type !== 'topology' && this.store.options.type !== 'pageZoomOnly') {
253
+ const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
254
+ const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
255
+ this.store.data.pageZoom = zoom;
256
+ this.store.parentElem.style.transform = `scale(${1/zoom})`;
257
+ this.store.parentElem.style.transformOrigin = '0 0';
258
+ this.store.parentElem.parentElement.style.overflow = 'hidden';
259
+ Store.set('PAGE:zoom', zoom);
260
+ }
251
261
  this.store.data.pens = [];
252
262
  this.openCount = 0
253
263
  const type = this.store.options.type;
@@ -492,7 +502,7 @@ var Common = /** @class */ (function () {
492
502
  }
493
503
  penNode.activeImgeIndex = isActive;
494
504
  tabIndex++;
495
- if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData); // 对显示隐藏的功能进行交互处理
505
+ if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData, isActive); // 对显示隐藏的功能进行交互处理
496
506
  }
497
507
  // 对绑定的图表进行数据处理
498
508
  tabStaticOperation(staticType, node, tabAreaData, visitParams);
@@ -1,12 +1,14 @@
1
1
  import {Lock} from '../models';
2
+ import {commonStore} from '../store';
2
3
  export function setStyleForElementIdDiv(node, elem, data) {
3
4
  if (!elem) return;
5
+ const store = commonStore[node.TID].data;
4
6
  elem.style.position = 'absolute';
5
7
  elem.style.outline = 'none';
6
8
  elem.style.left = node.rect.x + 'px';
7
9
  elem.style.top = node.rect.y + 'px';
8
- elem.style.width = node.rect.width + 'px';
9
- elem.style.height = node.rect.height + 'px';
10
+ elem.style.width = node.rect.width / store.pageZoom + 'px';
11
+ elem.style.height = node.rect.height / store.pageZoom + 'px';
10
12
  if (node.rotate || node.offsetRotate) {
11
13
  elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
12
14
  }
@@ -70,6 +70,7 @@ export function setSelectInteractiveState(selected, node) {
70
70
  }
71
71
  // 重置下拉状态
72
72
  export function resetSelectInteractiveState(node) {
73
+ if(!node || !node.TID) return;
73
74
  const currentStore = commonStore[node.TID];
74
75
  if(!Object.keys(currentStore.selectDataPool).length) return;
75
76
  for (let data of Object.values(currentStore.selectDataPool)) {
@@ -2,7 +2,13 @@ import {jsonLength} from '../utils';
2
2
  import {commonStore} from "../store";
3
3
  // 设置tab切换显示隐藏时的 Dom元件状态
4
4
  export function setElementSwitchTabState(node) {
5
- if(node.name !== 'echarts' && (!node.children || !node.children.length)) return;
5
+ if(node.children && node.children.length) {
6
+ node.children.map((ch) => {
7
+ ch.visible = node.visible;
8
+ setElementSwitchTabState(ch);
9
+ })
10
+ }
11
+ if(!(node.name === 'echarts' || node.name === 'select')) return;
6
12
  if(typeof commonStore[node.TID].elementInteractivePoor.elementDataLength !== 'number') {
7
13
  commonStore[node.TID].elementInteractivePoor.elementDataLength = jsonLength(commonStore[node.TID].echartsDataPool) || jsonLength(commonStore[node.TID].selectDataPool);
8
14
  }
@@ -14,10 +20,4 @@ export function setElementSwitchTabState(node) {
14
20
  }else {
15
21
  commonStore[node.TID].data.dataResize = 1;
16
22
  }
17
- if(node.children && node.children.length) {
18
- node.children.map((ch) => {
19
- ch.visible = node.visible;
20
- setElementSwitchTabState(ch);
21
- })
22
- }
23
23
  }
@@ -110,7 +110,7 @@ export function setConfItemNode(pen, syn_synata) {
110
110
  const {echartDataValue} = syn_synata;
111
111
  const seriesData = echartDataValue;
112
112
  const realData = pen.data.params && seriesData && Object.keys(seriesData).length && seriesData[pen.data.params.id];
113
- if (Array.isArray(realData)) {
113
+ if (Array.isArray(realData) && pen.data.params && pen.data.params.displayMode !== 7) {
114
114
  getEchartsRealData(pen, realData);
115
115
  } else {
116
116
  commonStore[pen.TID].echartsRealDataPool[pen.id] = realData;
@@ -657,10 +657,21 @@ var Node = /** @class */ (function (_super) {
657
657
  if (item.linear) {
658
658
  // 线条左右流动动画
659
659
  if([animateType.LeftFlow, animateType.RightFlow].includes(this.animateType) && item.state.lineDashOffset){
660
- const lineDashOffset = item.state.lineDashOffset;
661
- if (lineDashOffset > 100) item.state.lineDashOffset = 1;
662
- if (lineDashOffset < -100) item.state.lineDashOffset = -1;
663
- lineDashOffset > 0 ? item.state.lineDashOffset++ : item.state.lineDashOffset--;
660
+ let o = item.state.lineDashOffset;
661
+ switch (this.animateType) {
662
+ case animateType.LeftFlow:
663
+ o = Math.abs(o)
664
+ if (o > 100) o = 1;
665
+ o++
666
+
667
+ break;
668
+ case animateType.RightFlow:
669
+ o = Math.abs(o)*-1
670
+ if (o < -100) o = -1;
671
+ o--
672
+ break;
673
+ }
674
+ item.state.lineDashOffset = o
664
675
  this.lineDashOffset = item.state.lineDashOffset;
665
676
  }else if(([animateType.Show, animateType.Rotate].includes(this.animateType) || this.name === 'electricFan') && item.state.rotate !== item.initState.rotate) {
666
677
  // 旋转动画,判断逻辑先这么写,日后将所有动画统一在编辑器中配置,再做优化
@@ -1,3 +1,5 @@
1
+ import {Store} from "le5le-store";
2
+
1
3
  var __extends = (this && this.__extends) || (function () {
2
4
  var extendStatics = function (d, b) {
3
5
  extendStatics = Object.setPrototypeOf ||
@@ -103,7 +105,7 @@ var Preview = (function (_super) {
103
105
  if (visibleRange == '1') {
104
106
  _this.openCount++
105
107
  }
106
- this.render();
108
+ _this.render();
107
109
  break;
108
110
  case downDataType.Tabswitch:
109
111
  _this.switchStaticsCheckType(_this.moveIn.hoverNode, _this.moveIn.eventNode);
@@ -184,6 +186,27 @@ var Preview = (function (_super) {
184
186
  _this.moveIn.hoverNode.text = '全屏';
185
187
  _this.fitViewPreview(_this.isFullScreen);
186
188
  _this.isFullScreen = false;
189
+ }else {
190
+ // pageZoomOnly 表示topology页面只全局缩放,不对局部缩放进行调整,不执行render重绘。通常用于无任何操作事件的topology驾驶舱
191
+ if(_this.store.options.type === 'topology' || _this.store.options.type === 'pageZoomOnly') return;
192
+ const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
193
+ const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
194
+ _this.isResize = true;
195
+ clearTimeout(_this.pageResizeTim);
196
+ _this.pageResizeTim = setTimeout(() => {
197
+ if(_this.isResize){
198
+ const pageZoom = 1/zoom;
199
+ _this.store.data.pageZoom = zoom;
200
+ _this.store.parentElem.style.transform = `scale(${pageZoom})`;
201
+ _this.store.parentElem.style.transformOrigin = '0 0';
202
+ _this.store.parentElem.parentElement.style.overflow = 'hidden';
203
+ _this.store.data.dataResize = 1;
204
+ _this.isResize = false;
205
+ Store.set('PAGE:zoom', zoom);
206
+ _this.fitView();
207
+ _this.render();
208
+ }
209
+ }, 1000);
187
210
  }
188
211
  };
189
212
  return _this;
@@ -227,6 +250,8 @@ var Preview = (function (_super) {
227
250
  for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
228
251
  var item = _a[_i];
229
252
  item.scale(scale, center, w, h);
253
+ // 驾驶舱底部区域元件,用于控制底部区域Dom宽高等元素自由变换,后期会删除
254
+ if(item.tags && item.tags[0] && item.tags[0].includes('contromRoomBottom')) this.store.pens['contromRoomBottom'] = item;
230
255
  }
231
256
  };
232
257
  Preview.prototype.scaleTo = function (scale) {
@@ -245,6 +270,8 @@ var Preview = (function (_super) {
245
270
  width = this.store.options.width;
246
271
  height = this.store.options.height;
247
272
  }
273
+ width *= this.store.data.pageZoom;
274
+ height *= this.store.data.pageZoom;
248
275
  this.canvasResize({
249
276
  width: width,
250
277
  height: height,
@@ -261,7 +288,7 @@ var Preview = (function (_super) {
261
288
  rect.height = bkImageRect && bkImageRect.height ? bkImageRect.height : height;
262
289
  }
263
290
  // 6. 计算缩放比
264
- var w = (width - padding[1] - padding[3]) / rect.width;
291
+ var w = (width - padding[1] - padding[3]) / rect.width ;
265
292
  var h = (height - padding[0] - padding[2]) / rect.height;
266
293
  var ratio = w;
267
294
  if (w > h) {
@@ -93,7 +93,7 @@ var RenderLayer = /** @class */ (function (_super) {
93
93
  this.bkImg.src = bkImage;
94
94
  this.bkImg.onload = function () {
95
95
  if(pixi && !_this.bkImgRect) {
96
- _this.bkImgRectResize({width: _this.canvas.width, height: _this.canvas.height});
96
+ _this.bkImgRectResize({width: _this.width, height: _this.height});
97
97
  _this.scale(_this.ratio, undefined, _this.scaleX, _this.scaleY);
98
98
  }else {
99
99
  //_this.bkImgRect = _this.coverRect(_this.canvas.width, _this.canvas.height, _this.bkImg.width, _this.bkImg.height);
@@ -137,10 +137,10 @@ var RenderLayer = /** @class */ (function (_super) {
137
137
  RenderLayer.prototype.bkImgRectResize = function (size) {
138
138
  const bkImageRect = commonStore[this.TID].data.bkImageRect;
139
139
  if(!size) return;
140
+ const { width, height } = size;
140
141
  if(bkImageRect) {
141
142
  let x = bkImageRect.x ? Number(bkImageRect.x) : 0;
142
143
  let y = bkImageRect.y ? Number(bkImageRect.y) : 0;
143
- const { width, height } = size;
144
144
  let bkWidth = bkImageRect.width ? Number(bkImageRect.width) : width;
145
145
  let bkHeight = bkImageRect.height ? Number(bkImageRect.height) : height;
146
146
  this.bkImgRect = {
@@ -157,6 +157,17 @@ var RenderLayer = /** @class */ (function (_super) {
157
157
  x,
158
158
  y
159
159
  };
160
+ }else {
161
+ this.bkImgRect = {
162
+ center: {
163
+ x: width / 2,
164
+ y: height / 2
165
+ },
166
+ x: 0,
167
+ y: 0,
168
+ width,
169
+ height
170
+ };
160
171
  }
161
172
  };
162
173
 
@@ -11,6 +11,7 @@ export interface visualization2DData {
11
11
  fromArrowType: string;
12
12
  toArrowType: string;
13
13
  scale: number;
14
+ pageZoom: number,
14
15
  locked: Lock;
15
16
  bkImage: string;
16
17
  bkColor: string;
@@ -25,6 +26,7 @@ export interface visualization2DData {
25
26
  mqttTopics?: string;
26
27
  manualCps?: boolean;
27
28
  dataConstruct?: any;
29
+ bindDataTooltipVisible?: boolean;
28
30
  data?: any;
29
31
  bkImageRect?: any;
30
32
  }
@@ -81,12 +83,14 @@ export const createStore = () => {
81
83
  fromArrowType: '',
82
84
  toArrowType: 'triangleSolid',
83
85
  scale: 1,
86
+ pageZoom: 1,
84
87
  locked: Lock.None,
85
88
  bkImageRect: null,
86
89
  mqttOptions: {
87
90
  clientId: s8()
88
91
  },
89
- dataConstruct: {}
92
+ dataConstruct: {},
93
+ bindDataTooltipVisible: true
90
94
  },
91
95
  mqttData: null,
92
96
  initConfNode: {},
@@ -151,12 +155,14 @@ export const clearStore = (store: visualization2DStore, del: string) => {
151
155
  fromArrowType: '',
152
156
  toArrowType: 'triangleSolid',
153
157
  scale: 1,
158
+ pageZoom: 1,
154
159
  locked: Lock.None,
155
160
  bkImageRect: null,
156
161
  mqttOptions: {
157
162
  clientId: s8()
158
163
  },
159
- dataConstruct: {}
164
+ dataConstruct: {},
165
+ bindDataTooltipVisible: true
160
166
  };
161
167
  store.mqttData = null;
162
168
  store.initConfNode = {};
@@ -13,7 +13,7 @@ import { default as mitt } from 'mitt';
13
13
  import { Lock } from '../models';
14
14
  import {DefalutOptions} from '../options';
15
15
  import {s8} from '../utils';
16
- import {commonStore} from './common'
16
+ import {commonStore} from './common';
17
17
  import {removeAllElement} from '../../../store';
18
18
  export var createStore = function () {
19
19
  return {
@@ -27,10 +27,12 @@ export var createStore = function () {
27
27
  locked: Lock.None,
28
28
  dataResize: 1, // 数据是否加载,1是,0否
29
29
  bkImageRect: null,
30
+ pageZoom: 1,
30
31
  mqttOptions: {
31
32
  clientId: s8()
32
33
  },
33
- dataConstruct: {}
34
+ dataConstruct: {},
35
+ bindDataTooltipVisible: true
34
36
  },
35
37
  mqttData: null,
36
38
  initConfNode: {},
@@ -128,13 +130,15 @@ export var clearStore = function (store, del) {
128
130
  fromArrowType: '',
129
131
  toArrowType: 'triangleSolid',
130
132
  scale: 1,
133
+ pageZoom: 1,
131
134
  locked: Lock.None,
132
135
  dataResize: 1, // 数据是否加载,1是,0否
133
136
  bkImageRect: null,
134
137
  mqttOptions: {
135
138
  clientId: s8()
136
139
  },
137
- dataConstruct: {}
140
+ dataConstruct: {},
141
+ bindDataTooltipVisible: true
138
142
  };
139
143
  store.initConfNode = {};
140
144
  store.mqttParams = {
@@ -16,7 +16,12 @@ export function setInitNodeDataValidat(node, TID, type, order) {
16
16
 
17
17
  node.TID = TID;
18
18
 
19
- node.visibleSwitch = type === 'topology' && node.visibleSwitch;
19
+ if(typeof node.visibleSwitch !== 'boolean') {
20
+ // 兼容旧版显示隐藏属性值设置
21
+ node.visibleSwitch = type === 'topology';
22
+ }else {
23
+ node.visibleSwitch = type === 'topology' && node.visibleSwitch;
24
+ }
20
25
 
21
26
  if(typeof order === "number") node.order = order;
22
27
  if(type !== 'topology') node.selectDropdown = false;
@@ -1,6 +1,6 @@
1
1
  import {Node} from "../models";
2
2
  export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
3
- export declare function tabHideShowOperation(node: any, areaData: any): void;
3
+ export declare function tabHideShowOperation(node: any, areaData: any, visible: boolean): void;
4
4
  export declare function getEchartsRealData(node: {}, data: []): void;
5
5
  export declare function setInitConfData(id: string, data: object): void;
6
6
  export declare function setTagIdData(data: any): [];
@@ -38,8 +38,9 @@ export function tabStaticOperation(type, node, areaData, params) {
38
38
  * Tab 显示/隐藏切换
39
39
  * @param node tab页签数据
40
40
  * @param areaData // tab展示区域数据
41
+ * @param isActive
41
42
  */
42
- export function tabHideShowOperation(node, areaData) {
43
+ export function tabHideShowOperation(node, areaData, isActive) {
43
44
  const confIds = node.bindStaticId && node.bindStaticId.split(',') || [];
44
45
  const pens = commonStore[node.TID].data.pens;
45
46
  for (let i = 0; i < confIds.length; i++) {
@@ -47,7 +48,7 @@ export function tabHideShowOperation(node, areaData) {
47
48
  const areaNode = areaData[confid];
48
49
  if(!(areaNode && pens[areaNode.order])) return;
49
50
  const tagNode = pens[areaNode.order];
50
- tagNode.visible = !(node.id !== node.id);
51
+ tagNode.visible = !isActive;
51
52
  setElementSwitchTabState(tagNode);
52
53
  }
53
54
  }
@@ -34,18 +34,20 @@ export function mousMoveFun(type, pos, data) {
34
34
 
35
35
  for (var _i = 0, _a = data; _i < _a.length; _i++) {
36
36
  var item = _a[_i];
37
- //const isPoint = ptInPolyXY(pos, item.rotatedAnchors);
38
- let isInPointNode = null;
39
- if(item.name === 'arbitraryGraph') {
40
- // 任意多边形通过点获取区域
41
- isInPointNode = ptInPolyXY(pos, item.rotatedAnchors);
42
- }else {
43
- if(!(item instanceof Node)) item = new Node(item);
44
- isInPointNode = item.hit(pos);
45
- }
46
- if(isInPointNode) {
47
- params.hoverNode = item;
48
- params.order = _i;
37
+ if(item.visible) {
38
+ //const isPoint = ptInPolyXY(pos, item.rotatedAnchors);
39
+ let isInPointNode = null;
40
+ if(item.name === 'arbitraryGraph') {
41
+ // 任意多边形通过点获取区域
42
+ isInPointNode = ptInPolyXY(pos, item.rotatedAnchors);
43
+ }else {
44
+ if(!(item instanceof Node)) item = new Node(item);
45
+ isInPointNode = item.hit(pos);
46
+ }
47
+ if(isInPointNode) {
48
+ params.hoverNode = item;
49
+ params.order = _i;
50
+ }
49
51
  }
50
52
  }
51
53
  // 不在此节点上停留
@@ -63,6 +65,7 @@ export function mousMoveFun(type, pos, data) {
63
65
  }
64
66
  export function mousDownFun(type, eventNode) {
65
67
  let params = {};
68
+ if(eventNode === null) return params;
66
69
  const action = eventNode ? parseInt(eventNode.action) : 0;
67
70
  if(action === 3) {
68
71
  params.eventType = downDataType.Window; // 打开会话窗口
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcim-topology2d",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "",
5
5
  "main": "-",
6
6
  "scripts": {
@@ -3,7 +3,7 @@ export const echartsLegendDefaultData = {
3
3
  icon: 'rect', // 图标类型:'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
4
4
  itemWidth: 12, // 图标宽
5
5
  itemHeight: 12, // 图标高
6
- itemGap: 8, // 图例之间的间隔 number
6
+ itemGap: 8, // 图例之间的间隔
7
7
  top: '0%', // 图例距离容器上边位置
8
8
  right: 'auto', // 图例距离容器右边位置
9
9
  bottom: 'auto', // 图例距离容器下边位置
@@ -140,20 +140,39 @@ export const echartsTypeMap = {
140
140
  };
141
141
  // 图表颜色
142
142
  export const echartsColorData = [
143
+ '#2648E9',
144
+ '#E513F7',
145
+ '#79E10E',
146
+ '#0D9BE7',
147
+ '#23CEE2',
148
+ '#E5B903',
149
+ '#2BDB8E',
150
+ '#CAD804',
151
+ '#117BEE',
152
+ '#DB8407',
153
+ '#E72B2B',
154
+ '#E96812',
155
+ '#7612D6',
156
+ '#A117B8',
157
+ 'rgb(21, 151, 224)',
143
158
  'rgb(36, 220, 132)',
144
159
  'rgb(154, 77, 251)',
145
160
  'rgb(226, 182, 56)',
146
161
  'rgb(253, 92, 71)',
147
- 'rgb(26, 117, 255)',
148
162
  'rgb(175, 215, 14)',
149
163
  'rgb(214, 154, 37)',
150
164
  'rgb(66, 251, 251)',
151
165
  'rgb(255, 158, 4)',
152
- 'rgb(30, 107, 222)',
153
- 'rgb(21, 151, 224)',
154
166
  'rgb(19, 236, 236)',
155
167
  'rgb(68, 237, 146)',
156
168
  'rgb(251, 94, 45)',
157
- 'rgb(18, 255, 113)',
158
- 'rgb(18, 255, 113)']
159
-
169
+ 'rgb(18, 255, 113)'];
170
+ // TOP排行榜默认颜色
171
+ export const rankingTopColorList = [
172
+ 'rgba(239, 120, 66, .6)',
173
+ 'rgba(255, 225, 65, .5)',
174
+ 'rgba(55, 240, 151, .5)',
175
+ 'rgba(72, 211, 255, .6)',
176
+ 'rgba(67, 153, 255, .5)'
177
+ ];
178
+ export const rankingTopImageName = ['orange', 'yellow', 'ching', 'lightBlue', 'blue'];