dcim-topology2d 2.0.6 → 2.0.7
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.
- package/chart-diagram/src/echarts/index.js +6 -4
- package/chart-diagram/src/utils/changeOptions.js +2 -0
- package/chart-diagram/src/utils/conversion.js +75 -18
- package/chart-diagram/src/utils/formatter.d.ts +1 -0
- package/chart-diagram/src/utils/formatter.js +129 -0
- package/chart-diagram/src/utils/index.d.ts +1 -0
- package/chart-diagram/src/utils/index.js +1 -0
- package/chart-diagram/src/utils/render.d.ts +3 -1
- package/chart-diagram/src/utils/render.js +76 -8
- package/core/src/common.js +12 -0
- package/core/src/element/common.js +4 -2
- package/core/src/element/select.js +1 -0
- package/core/src/healps/changeData.js +1 -1
- package/core/src/preview.js +28 -1
- package/core/src/store/data.d.ts +3 -0
- package/core/src/store/data.js +2 -0
- package/package.json +1 -1
- package/static/echartsDefaultData.js +11 -3
@@ -61,14 +61,17 @@ export function echarts(ctx, node) {
|
|
61
61
|
setTimeout(function () {
|
62
62
|
let option = node.data.echarts.option;
|
63
63
|
if(!(echartsData && echartsData.chart)) return;
|
64
|
+
const pageZoom = currentStore.data.pageZoom;
|
65
|
+
echartsData.div.style.transform = `scale(${pageZoom})`;
|
66
|
+
echartsData.div.style.transformOrigin = '0 0';
|
64
67
|
if(node.data.params) node.data.params.tabCorrelationType = echartsData.tabCorrelationType || ''; // 统计图与Tab关联
|
65
68
|
const isLocked = currentStore.data.locked;
|
66
69
|
if (!isLocked || !currentStore.echartsOptionsPool[node.id]) {
|
67
70
|
const tabData = initBindTabSetting(node); // 初始化Tabs数据配置
|
68
71
|
// 【未锁定(编辑)状态, options未初始化的状态】
|
69
72
|
if (!appearance.type) appearance.type = echartsTypeMap[`type_${option.displayMode}`]; // 兼容旧数据配置
|
70
|
-
// 公共配置 Top
|
71
|
-
if (option.displayMode !== 4) setMapGlobalOptions(option, node);
|
73
|
+
// 公共配置 Top排行榜散点图跳过公共属性配置
|
74
|
+
if (option.displayMode !== 4 && option.displayMode !== 7) setMapGlobalOptions(option, node);
|
72
75
|
// 折线图和柱状图
|
73
76
|
if (['line', 'bar'].includes(appearance.type)) setMapLineBarOptions(option, node);
|
74
77
|
// 仪表盘
|
@@ -78,7 +81,7 @@ export function echarts(ctx, node) {
|
|
78
81
|
// 3d 柱状图
|
79
82
|
if (appearance.type === '3dBar') setMap3dBarOptions(option, node);
|
80
83
|
// Top排行榜
|
81
|
-
if (appearance.type
|
84
|
+
if (appearance.type.includes('TOP')) setMapTopOptions(option, node);
|
82
85
|
//option.title = appearance.title;
|
83
86
|
option.backgroundColor = appearance.backgroundColor;
|
84
87
|
currentStore.echartsOptionsPool[node.id] = {
|
@@ -95,7 +98,6 @@ export function echarts(ctx, node) {
|
|
95
98
|
}
|
96
99
|
// echarts 数据渲染更新
|
97
100
|
setMapDataOptions(option, currentStore.echartsOptionsPool[node.id].data);
|
98
|
-
|
99
101
|
node.elementRendered = true;
|
100
102
|
})
|
101
103
|
}
|
@@ -96,9 +96,11 @@ export function setChartYAxisData(yAxis, appearance) {
|
|
96
96
|
}
|
97
97
|
for (let i = 0; i < yAxis.length; i++) {
|
98
98
|
const item = yAxis[i];
|
99
|
+
if(!item.axisLabel) item.axisLabel = {};
|
99
100
|
if (!item.axisLabel.textStyle) {
|
100
101
|
item.axisLabel.textStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['y1axisLabelTextStyle']));
|
101
102
|
}
|
103
|
+
if(!item.splitLine) item.splitLine = {};
|
102
104
|
if (!item.splitLine.lineStyle) {
|
103
105
|
item.splitLine.lineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
|
104
106
|
}
|
@@ -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
|
|
@@ -133,13 +136,13 @@ export function setMapRingOptions(option, node) {
|
|
133
136
|
//const chartOption = JSON.parse(JSON.stringify(option));
|
134
137
|
const appearance = node.appearance;
|
135
138
|
if(appearance.type === 'ringPre'){
|
136
|
-
|
139
|
+
|
137
140
|
setRingPreSeriesOptions(option, appearance);
|
138
|
-
|
141
|
+
|
139
142
|
}else if(appearance.type === 'ringPro'){
|
140
|
-
|
143
|
+
|
141
144
|
setRingProSeriesOptions(option, appearance);
|
142
|
-
|
145
|
+
|
143
146
|
}else {
|
144
147
|
const seriesNode = option.series[0];
|
145
148
|
if ((!appearance.label || typeof appearance.label.showValue !== 'boolean')) {
|
@@ -151,16 +154,41 @@ export function setMapRingOptions(option, node) {
|
|
151
154
|
seriesNode.label = {
|
152
155
|
normal: {
|
153
156
|
show: true,
|
154
|
-
position: 'outside'
|
157
|
+
position: 'outside',
|
158
|
+
color: appearance.label.color || '',
|
159
|
+
fontSize: appearance.label.fontSize || '12'
|
155
160
|
}
|
156
161
|
};
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
+
|
163
|
+
seriesNode.labelLine = appearance.labelLine && {...appearance.labelLine} || {};
|
164
|
+
|
165
|
+
if(seriesNode.labelLine.lineStyle && !seriesNode.labelLine.lineStyle.color) {
|
166
|
+
delete seriesNode.labelLine.lineStyle['color'];
|
167
|
+
}
|
168
|
+
|
169
|
+
const rich = {};
|
170
|
+
|
171
|
+
if(appearance.cir && appearance.cir.show) {
|
172
|
+
rich.cir = {...appearance.cir};
|
173
|
+
if(!rich.cir.borderColor) rich.cir.borderColor = 'auto';
|
174
|
+
if(!rich.cir.backgroundColor) rich.cir.backgroundColor = 'transparent';
|
175
|
+
}
|
176
|
+
|
177
|
+
if(appearance.labelDetail && appearance.labelDetail.length) {
|
178
|
+
// 环形明细展示配置,线条样式配置
|
179
|
+
rich.a = {
|
180
|
+
color: appearance.label.color || '',
|
181
|
+
fontSize: appearance.label.fontSize || '12'
|
182
|
+
};
|
183
|
+
for (let i = 0; i < appearance.labelDetail.length; i++) {
|
184
|
+
const detail = appearance.labelDetail[i];
|
185
|
+
rich[`b${i+1}`] = {
|
186
|
+
color: detail.color,
|
187
|
+
fontSize: detail.fontSize || '12'
|
188
|
+
};
|
162
189
|
}
|
163
190
|
}
|
191
|
+
seriesNode.label.normal.rich = rich;
|
164
192
|
}
|
165
193
|
}
|
166
194
|
|
@@ -199,6 +227,21 @@ export function setMapTopOptions(option, node) {
|
|
199
227
|
//const chartOption = JSON.parse(JSON.stringify(option));
|
200
228
|
const appearance = node.appearance;
|
201
229
|
Object.assign(option.grid, appearance.grid);
|
230
|
+
if(!appearance.type.includes('TOPRanking')) return;
|
231
|
+
const yNode = option.yAxis[0];
|
232
|
+
if(yNode.axisLabel.rich['a1']) return;
|
233
|
+
for (let i = 0, length = yNode.data.length; i < length; i++) {
|
234
|
+
const order = i + 1;
|
235
|
+
yNode.axisLabel.rich[`a${order}`] = {
|
236
|
+
width: 30,
|
237
|
+
height: 17,
|
238
|
+
lineHeight: 22,
|
239
|
+
verticalAlign: 'bottom',
|
240
|
+
backgroundColor: {
|
241
|
+
image: `../../../images/TOP/NO-${order}-${rankingTopImageName[i]}.png`
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
202
245
|
}
|
203
246
|
|
204
247
|
/**
|
@@ -220,7 +263,7 @@ export function setMapGlobalOptions(option, node) {
|
|
220
263
|
// 图表Y轴数据
|
221
264
|
if (option.yAxis) setChartYAxisData(option.yAxis, appearance);
|
222
265
|
// 图表图例数据
|
223
|
-
if (option.legend) setChartLegendData(option.legend, appearance);
|
266
|
+
//if (option.legend) setChartLegendData(option.legend, appearance);
|
224
267
|
// 曲线样式数据
|
225
268
|
if (appearance.type.includes('line')) setLineSeriesStyleData(option.series, appearance);
|
226
269
|
}
|
@@ -254,12 +297,25 @@ export function setMapDataOptions(option, node) {
|
|
254
297
|
|
255
298
|
if(node.tabData && node.tabData.data.state && optionNode.yAxis[0].max) Object.assign(optionNode.yAxis[0], node.tabData.data); //若Tabs切换配置了数据,则修改Y轴原有配置
|
256
299
|
|
257
|
-
|
300
|
+
if(appearance.type === 'barPileStatic') {
|
301
|
+
|
302
|
+
barPileStaticDataAuto(optionNode, staticTypeData, appearance);
|
303
|
+
|
304
|
+
}else {
|
305
|
+
|
306
|
+
lineBarDataAuto(optionNode, params, staticTypeData);
|
307
|
+
|
308
|
+
}
|
309
|
+
|
310
|
+
}
|
311
|
+
if(displayMode === 4) { // top排行榜-电量仪
|
312
|
+
|
313
|
+
topRankingListAuto(optionNode, staticTypeData, appearance);
|
258
314
|
|
259
315
|
}
|
260
|
-
if(displayMode ===
|
316
|
+
if(displayMode === 7) { // 散点图
|
261
317
|
|
262
|
-
|
318
|
+
scatterDataAuto(optionNode, staticTypeData);
|
263
319
|
|
264
320
|
}
|
265
321
|
if (displayMode === 5 || displayMode === 3) { // 饼图/环形图
|
@@ -305,7 +361,6 @@ export function setMapDataOptions(option, node) {
|
|
305
361
|
if (item.data) {
|
306
362
|
optionNode.yAxis[i].data = item.data;
|
307
363
|
}
|
308
|
-
;
|
309
364
|
}
|
310
365
|
}
|
311
366
|
if (option.series) {
|
@@ -317,6 +372,8 @@ export function setMapDataOptions(option, node) {
|
|
317
372
|
}
|
318
373
|
}
|
319
374
|
|
375
|
+
mapFormatterSet(appearance, optionNode, staticTypeData);
|
376
|
+
|
320
377
|
const currentChartNode = commonStore[node.TID].echartsDataPool[node.id];
|
321
378
|
const mapChart = currentChartNode.chart;
|
322
379
|
clearInterval(currentChartNode.timeTicket);
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function mapFormatterSet(appearance: object, option: any, data: any): void;
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import {rankingTopImageName, 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('lineTwins')) setMapLineTwinsFormatter(appearance, options);
|
11
|
+
if(appearance.type.includes('scatter')) setMapScatterFormatter(options);
|
12
|
+
if(appearance.type.includes('TOPRanking')) setMapTopScoreFormatter(options, data, appearance);
|
13
|
+
if(appearance.type.includes('barPileStatic')) setMapBarPileStaticFormatter(appearance, options);
|
14
|
+
}
|
15
|
+
function setMapLineTwinsFormatter(appearance, options) {
|
16
|
+
if(!options.tooltip.formatter && appearance.tooltipUnit) {
|
17
|
+
options.tooltip.formatter = function (params) {
|
18
|
+
let relVal = params[0].name;
|
19
|
+
for (var i = 0, l = params.length; i < l; i++) {
|
20
|
+
const unit = appearance.tooltipUnit[i] || '';
|
21
|
+
relVal +=
|
22
|
+
"<br/>" +
|
23
|
+
params[i].marker +
|
24
|
+
params[i].seriesName +
|
25
|
+
" : " +
|
26
|
+
params[i].value +
|
27
|
+
unit;
|
28
|
+
}
|
29
|
+
return relVal;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
// 堆叠统计
|
34
|
+
function setMapBarPileStaticFormatter(appearance, options) {
|
35
|
+
if(!options.tooltip.formatter){
|
36
|
+
options.tooltip.formatter = function(param) {
|
37
|
+
return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;margin-bottom: 5px;">${param[0].name}</div>${param[0].seriesName}:${param[0].value}<br>${param[1].seriesName}:${appearance.total[param[1].dataIndex]}`;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
if(!options.series[1].label.formatter){
|
41
|
+
options.series[1].label.formatter = function(param) {
|
42
|
+
if(!param.value) return '';
|
43
|
+
let value = '';
|
44
|
+
if(appearance.totalStyle) {
|
45
|
+
value = `${appearance.totalStyle.label ? appearance.total[param.dataIndex] : ''}${appearance.totalStyle.unit}`;
|
46
|
+
}else {
|
47
|
+
value = `${appearance.total[param.dataIndex]}`;
|
48
|
+
}
|
49
|
+
return value;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
// Top排行榜自定义展示配置
|
54
|
+
function setMapTopScoreFormatter(options, data, appearance) {
|
55
|
+
const yNode = options.yAxis[0];
|
56
|
+
if(!yNode.axisLabel.formatter) {
|
57
|
+
yNode.axisLabel.formatter = function(value, i) {
|
58
|
+
return `{a${i+1}|}{b|${value}}`;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
const seriesNode = options.series[0];
|
62
|
+
if(appearance.total && appearance.total.length) {
|
63
|
+
const realData = data && data.seriesData && data.seriesData[0] && data.seriesData[0].data;
|
64
|
+
if(realData && realData.length) {
|
65
|
+
seriesNode.data = appearance.total;
|
66
|
+
seriesNode.itemStyle.normal.label.formatter = function(param) {
|
67
|
+
return `${realData[param.dataIndex]}${appearance.unit}`;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
if(seriesNode.itemStyle.normal.color) return;
|
72
|
+
for (let i = 0; i < options.series.length; i++) {
|
73
|
+
const node = options.series[i];
|
74
|
+
node.itemStyle.normal.color = function(params) {
|
75
|
+
return rankingTopColorList[params.dataIndex];
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
// 散点图series自定义展示配置
|
80
|
+
function setMapScatterFormatter(options) {
|
81
|
+
const seriesNode = options.series[0];
|
82
|
+
if(!options.tooltip.formatter) {
|
83
|
+
options.tooltip.formatter = function(param) {
|
84
|
+
const value = param.value;
|
85
|
+
// prettier-ignore
|
86
|
+
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]}`;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
if(!options.yAxis[0].axisLabel.formatter) {
|
90
|
+
options.yAxis[0].axisLabel.formatter = function (value, index) {
|
91
|
+
return `{f${index+1}|${value}}`;
|
92
|
+
}
|
93
|
+
}
|
94
|
+
if(seriesNode.symbolSize) return;
|
95
|
+
for (let i = 0; i < options.series.length; i++) {
|
96
|
+
const node = options.series[i];
|
97
|
+
node.symbolSize = function(d) {
|
98
|
+
let markSize = Math.sqrt(d[2]) * 2;
|
99
|
+
if(markSize < 6) markSize = 6;
|
100
|
+
if(markSize > 20) markSize = 20;
|
101
|
+
//if(!markSize) markSize = 1;
|
102
|
+
return markSize;
|
103
|
+
}
|
104
|
+
node.label.emphasis.formatter = function(param) {
|
105
|
+
return param.data[0];
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
// 环形图自定义展示配置
|
110
|
+
function setMapRingOptionsFormatter(appearance, seriesNode) {
|
111
|
+
if(appearance.labelDetail && appearance.labelDetail.length) {
|
112
|
+
seriesNode.label.normal.formatter = (data) => {
|
113
|
+
let result = `{a|${data.name}}\n{cir|}`;
|
114
|
+
for (let i = 0; i < appearance.labelDetail.length; i++) {
|
115
|
+
const detail = appearance.labelDetail[i];
|
116
|
+
result += '\n'+`{b${i+1}|${detail.title}${i === 0 ? data.value : data[`value${i+1}`]}${detail.unit}}`;
|
117
|
+
}
|
118
|
+
return result;
|
119
|
+
}
|
120
|
+
}else {
|
121
|
+
seriesNode.label.normal.formatter = (data) => {
|
122
|
+
if (appearance.label.showValue === true) {
|
123
|
+
return `${data.name}:${data.value}${appearance.label.unit}`;
|
124
|
+
} else {
|
125
|
+
return `${data.name}`;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
export declare function lineBarDataAuto(option: any, params: {}, data: {}): void;
|
2
|
-
export declare function
|
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;
|
@@ -46,21 +46,89 @@ export function lineBarDataAuto(option, params, data) {
|
|
46
46
|
}
|
47
47
|
}
|
48
48
|
|
49
|
+
export function barPileStaticDataAuto(option, data, appearance) {
|
50
|
+
if(data && data.XData) option.yAxis[0].data = data.XData;
|
51
|
+
if(!(data && data.seriesData && data.seriesData.length)) return;
|
52
|
+
const seriesData = data.seriesData[0].data;
|
53
|
+
option.series[0].data = seriesData;
|
54
|
+
const data2 = [];
|
55
|
+
for (let i = 0; i < seriesData.length; i++) {
|
56
|
+
const dr = appearance.total[i] - Number(seriesData[i]);
|
57
|
+
data2.push(dr);
|
58
|
+
}
|
59
|
+
option.series[1].data = data2;
|
60
|
+
}
|
61
|
+
|
49
62
|
/**
|
50
|
-
* TOP
|
63
|
+
* TOP排行-电量仪实时数据
|
51
64
|
* @param option 图表配置数据
|
52
65
|
* @param data 实时图表数据
|
66
|
+
* @param appearance 自定义配置数据
|
53
67
|
*/
|
54
|
-
export function topRankingListAuto(option, data) {
|
68
|
+
export function topRankingListAuto(option, data, appearance) {
|
55
69
|
if(data && data.XData) option.yAxis[0].data = data.XData;
|
56
70
|
if(!(data && data.seriesData && data.seriesData.length)) return;
|
57
|
-
|
58
|
-
|
71
|
+
if(appearance.type === 'TOPRanking') {
|
72
|
+
if(appearance.total && appearance.total.length) return;
|
73
|
+
option.series[0].data = data.seriesData[0].data;
|
74
|
+
}else {
|
75
|
+
const seriesData = data.seriesData[0].data;
|
76
|
+
option.yAxis[1].data = seriesData;
|
77
|
+
for (let i = 0; i < option.series.length; i++) {
|
78
|
+
const node = option.series[i];
|
79
|
+
node.symbolBoundingData = data.total;
|
80
|
+
node.data = seriesData;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
/**
|
85
|
+
* 散点图-分数实时数据
|
86
|
+
* @param option 图表配置数据
|
87
|
+
* @param data 实时图表数据
|
88
|
+
*/
|
89
|
+
export function scatterDataAuto(option, data) {
|
90
|
+
if(data && data.XData) option.xAxis[0].data = data.XData;
|
91
|
+
if(!(data && data.seriesData && data.seriesData.length)) return;
|
92
|
+
const { scatterData, legend, yData } = convertScatter3DTo2D(data);
|
93
|
+
option.legend.data = [...legend];
|
94
|
+
option.yAxis[0].data = [...yData];
|
59
95
|
for (let i = 0; i < option.series.length; i++) {
|
60
|
-
const
|
61
|
-
|
62
|
-
|
96
|
+
const seriesNode = option.series[i];
|
97
|
+
const name = option.legend.data[i];
|
98
|
+
seriesNode.name = name;
|
99
|
+
seriesNode.data = scatterData[name];
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
function convertScatter3DTo2D(arr3d) {
|
104
|
+
const { XData, seriesData } = arr3d;
|
105
|
+
const scatterData = {};
|
106
|
+
const legend = [];
|
107
|
+
const yData = new Set();
|
108
|
+
// 第一层遍历
|
109
|
+
for (let d = 0, depth = seriesData.length; d < depth; d++) {
|
110
|
+
const areaData = seriesData[d];
|
111
|
+
const areaName = areaData.name;
|
112
|
+
if(!scatterData[areaName]) scatterData[areaName] = [];
|
113
|
+
legend.push(areaData.name);
|
114
|
+
// 第二层遍历
|
115
|
+
const statusData = areaData.data;
|
116
|
+
for (let h = 0, height = statusData.length; h < height; h++) {
|
117
|
+
const issues = statusData[h];
|
118
|
+
const statusName = XData[h];
|
119
|
+
// 第三层遍历
|
120
|
+
for (let w = 0, width = issues.length; w < width; w++) {
|
121
|
+
const { name, value } = issues[w];
|
122
|
+
yData.add(name);
|
123
|
+
if(value) scatterData[areaName].push([statusName, name, Number(value)]);
|
124
|
+
}
|
125
|
+
}
|
63
126
|
}
|
127
|
+
return {
|
128
|
+
scatterData,
|
129
|
+
legend,
|
130
|
+
yData
|
131
|
+
};
|
64
132
|
}
|
65
133
|
|
66
134
|
/**
|
@@ -89,7 +157,7 @@ export function pieRingAssetTotalAuto(option, data, total, count) {
|
|
89
157
|
*/
|
90
158
|
export function pieRingProportionAuto(option, data, proportion) {
|
91
159
|
if(data && data.length) {
|
92
|
-
proportion = Number(data[0].value)
|
160
|
+
proportion = Number(data[0].value);
|
93
161
|
}
|
94
162
|
if(!option.series[0].data[0].label.normal.formatter) option.series[0].data[0].label.normal.formatter = function(params){
|
95
163
|
return params.value ? `{v|${params.value}}{unit|%}` : `{v|${params.value}}`;
|
package/core/src/common.js
CHANGED
@@ -40,6 +40,8 @@ var Common = /** @class */ (function () {
|
|
40
40
|
this.mouseDown = null;
|
41
41
|
this.renderTimer = 0;
|
42
42
|
this.lastRender = 0;
|
43
|
+
this.pageResizeTim = null;
|
44
|
+
this.isResize = false;
|
43
45
|
this.id = s8();
|
44
46
|
this.store = useStore(this.id);
|
45
47
|
if (typeof parent === 'string') {
|
@@ -248,6 +250,16 @@ var Common = /** @class */ (function () {
|
|
248
250
|
}
|
249
251
|
let data = JSON.parse(JSON.stringify(obj));
|
250
252
|
Object.assign(this.store.data, data);
|
253
|
+
// pageZoomOnly 表示topology页面只全局缩放,不对局部缩放进行调整
|
254
|
+
if(this.store.options.type !== 'topology' && this.store.options.type !== 'pageZoomOnly') {
|
255
|
+
const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
|
256
|
+
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
257
|
+
this.store.data.pageZoom = zoom;
|
258
|
+
this.store.parentElem.style.transform = `scale(${1/zoom})`;
|
259
|
+
this.store.parentElem.style.transformOrigin = '0 0';
|
260
|
+
this.store.parentElem.parentElement.style.overflow = 'hidden';
|
261
|
+
Store.set('PAGE:zoom', zoom);
|
262
|
+
};
|
251
263
|
this.store.data.pens = [];
|
252
264
|
this.openCount = 0
|
253
265
|
const type = this.store.options.type;
|
@@ -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)) {
|
@@ -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;
|
package/core/src/preview.js
CHANGED
@@ -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 ||
|
@@ -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) {
|
package/core/src/store/data.d.ts
CHANGED
@@ -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;
|
@@ -81,6 +82,7 @@ export const createStore = () => {
|
|
81
82
|
fromArrowType: '',
|
82
83
|
toArrowType: 'triangleSolid',
|
83
84
|
scale: 1,
|
85
|
+
pageZoom: 1,
|
84
86
|
locked: Lock.None,
|
85
87
|
bkImageRect: null,
|
86
88
|
mqttOptions: {
|
@@ -151,6 +153,7 @@ export const clearStore = (store: visualization2DStore, del: string) => {
|
|
151
153
|
fromArrowType: '',
|
152
154
|
toArrowType: 'triangleSolid',
|
153
155
|
scale: 1,
|
156
|
+
pageZoom: 1,
|
154
157
|
locked: Lock.None,
|
155
158
|
bkImageRect: null,
|
156
159
|
mqttOptions: {
|
package/core/src/store/data.js
CHANGED
@@ -27,6 +27,7 @@ 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
|
},
|
@@ -128,6 +129,7 @@ export var clearStore = function (store, del) {
|
|
128
129
|
fromArrowType: '',
|
129
130
|
toArrowType: 'triangleSolid',
|
130
131
|
scale: 1,
|
132
|
+
pageZoom: 1,
|
131
133
|
locked: Lock.None,
|
132
134
|
dataResize: 1, // 数据是否加载,1是,0否
|
133
135
|
bkImageRect: null,
|
package/package.json
CHANGED
@@ -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, // 图例之间的间隔
|
6
|
+
itemGap: 8, // 图例之间的间隔
|
7
7
|
top: '0%', // 图例距离容器上边位置
|
8
8
|
right: 'auto', // 图例距离容器右边位置
|
9
9
|
bottom: 'auto', // 图例距离容器下边位置
|
@@ -155,5 +155,13 @@ export const echartsColorData = [
|
|
155
155
|
'rgb(68, 237, 146)',
|
156
156
|
'rgb(251, 94, 45)',
|
157
157
|
'rgb(18, 255, 113)',
|
158
|
-
'rgb(18, 255, 113)']
|
159
|
-
|
158
|
+
'rgb(18, 255, 113)'];
|
159
|
+
// TOP排行榜默认颜色
|
160
|
+
export const rankingTopColorList = [
|
161
|
+
'rgba(239, 120, 66, .6)',
|
162
|
+
'rgba(255, 225, 65, .5)',
|
163
|
+
'rgba(55, 240, 151, .5)',
|
164
|
+
'rgba(72, 211, 255, .6)',
|
165
|
+
'rgba(67, 153, 255, .5)'
|
166
|
+
];
|
167
|
+
export const rankingTopImageName = ['orange', 'yellow', 'ching', 'lightBlue', 'blue'];
|