dcim-topology2d 1.1.6 → 2.0.2
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 +88 -96
- package/chart-diagram/src/register.js +3 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +4 -4
- package/chart-diagram/src/utils/changeOptions.js +172 -144
- package/chart-diagram/src/utils/conversion.d.ts +12 -12
- package/chart-diagram/src/utils/conversion.js +278 -137
- package/chart-diagram/src/utils/render.d.ts +5 -0
- package/chart-diagram/src/utils/render.js +107 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/src/activeLayer.js +0 -6
- package/core/src/canvas.js +1 -0
- package/core/src/common.d.ts +1 -2
- package/core/src/common.js +123 -540
- package/core/src/core.js +61 -46
- package/core/src/divLayer.d.ts +0 -3
- package/core/src/divLayer.js +13 -34
- package/core/src/element/common.d.ts +5 -0
- package/core/src/element/common.js +52 -0
- package/core/src/element/iframe.d.ts +3 -0
- package/core/src/element/iframe.js +12 -0
- package/core/src/element/index.d.ts +4 -0
- package/core/src/element/index.js +4 -0
- package/core/src/element/select.d.ts +11 -0
- package/core/src/element/select.js +199 -0
- package/core/src/element/tab.d.ts +1 -0
- package/core/src/element/tab.js +22 -0
- package/core/src/healps/changeData.d.ts +1 -2
- package/core/src/healps/changeData.js +16 -122
- package/core/src/middles/default.js +3 -1
- package/core/src/middles/nodes/arbitrarygraph.js +11 -9
- package/core/src/middles/nodes/formselect.d.ts +2 -0
- package/core/src/middles/nodes/formselect.js +73 -0
- package/core/src/middles/nodes/iframe.js +21 -4
- package/core/src/middles/nodes/index.d.ts +1 -0
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/models/node.d.ts +4 -0
- package/core/src/models/node.js +24 -22
- package/core/src/models/pen.js +1 -2
- package/core/src/models/rect.js +2 -2
- package/core/src/options.d.ts +1 -0
- package/core/src/preview.js +45 -31
- package/core/src/renderLayer.d.ts +10 -6
- package/core/src/renderLayer.js +36 -43
- package/core/src/store/data.d.ts +16 -17
- package/core/src/store/data.js +36 -14
- package/core/src/utils/assignment.d.ts +6 -3
- package/core/src/utils/assignment.js +84 -15
- package/core/src/utils/construction.d.ts +9 -3
- package/core/src/utils/construction.js +6 -1
- package/core/src/utils/conversion.d.ts +3 -0
- package/core/src/utils/conversion.js +67 -0
- package/core/src/utils/index.d.ts +1 -1
- package/core/src/utils/index.js +1 -1
- package/core/src/utils/math.d.ts +1 -0
- package/core/src/utils/math.js +3 -0
- package/core/src/utils/onmousevent.d.ts +3 -0
- package/core/src/utils/onmousevent.js +28 -7
- package/core/src/utils/params.d.ts +7 -0
- package/core/src/utils/params.js +125 -0
- package/package.json +1 -1
- package/static/echartsDefaultData.js +27 -107
- package/static/element.js +14 -0
- package/static/form.js +11 -0
- package/static/index.js +2 -1
- package/store/actions.js +17 -0
- package/store/clear.js +72 -0
- package/store/index.js +2 -0
- package/style/common.css +18 -0
- package/style/editor.css +13 -0
- package/style/index.css +3 -12
- package/style/select.css +143 -0
- package/core/src/utils/dom.d.ts +0 -9
- package/core/src/utils/dom.js +0 -103
- package/core/src/utils/dom.js.map +0 -1
- package/static/echartsStore.js +0 -14
@@ -1,179 +1,320 @@
|
|
1
|
-
import {
|
1
|
+
import {echartsDataRoom, echartsColorData} from '../../../static';
|
2
|
+
import {echartsOptionsPool, echartsDataPool, echartsRealDataPool} from '../../../store';
|
2
3
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
setSeriesRenderGroup,
|
5
|
+
drawGraphicShape,
|
6
|
+
setChartLegendData,
|
7
|
+
setChartXAxisData,
|
8
|
+
setChartYAxisData,
|
9
|
+
setLineSeriesStyleData
|
9
10
|
} from '../utils';
|
11
|
+
import {
|
12
|
+
gaugeNormalAuto,
|
13
|
+
lineBarDataAuto,
|
14
|
+
pieRingAssetTotalAuto,
|
15
|
+
pieRingNormalAuto,
|
16
|
+
topRankingListAuto
|
17
|
+
} from './render';
|
10
18
|
|
11
19
|
export function getXYAxisLabelVal(index, intervalNum, value) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
if (index === 0 || index % intervalNum === 0) {
|
21
|
+
return value;
|
22
|
+
} else {
|
23
|
+
return '';
|
24
|
+
}
|
17
25
|
}
|
26
|
+
|
18
27
|
// 自动滑动展示数据
|
19
28
|
export function setMapAutoMoveOptions(option, chartNode, node, callback) {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
option.dataZoom = echartsDataRoom;
|
30
|
+
const dataZoomNode = option.dataZoom[0];
|
31
|
+
const {start, end, time} = node.appearance.zoomParams;
|
32
|
+
const zoomStart = Number(start);
|
33
|
+
const zoomEnd = Number(end);
|
34
|
+
const zoomTime = Number(time);
|
35
|
+
dataZoomNode.start = zoomStart;
|
36
|
+
dataZoomNode.end = zoomEnd;
|
37
|
+
chartNode.timeTicket = setInterval(() => {
|
38
|
+
if (Number(dataZoomNode.end) > 100) {
|
39
|
+
dataZoomNode.end = zoomEnd;
|
40
|
+
dataZoomNode.start = zoomStart;
|
41
|
+
} else {
|
42
|
+
dataZoomNode.end = dataZoomNode.end + 1 * (100 / option.series[0].data.length);
|
43
|
+
dataZoomNode.start = dataZoomNode.start + 1 * (100 / option.series[0].data.length);
|
44
|
+
}
|
45
|
+
callback(option);
|
46
|
+
}, zoomTime * 1000);
|
38
47
|
}
|
48
|
+
|
39
49
|
// 停止自动滑动展示数据
|
40
50
|
export function setMapStopAutoMoveOptions(chartNode) {
|
41
51
|
|
42
|
-
|
52
|
+
clearInterval(chartNode.timeTicket);
|
43
53
|
|
44
54
|
}
|
55
|
+
|
45
56
|
// 自动配置折线和柱状图的节点数据
|
46
57
|
export function setMapLineBarOptions(option, node) {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
return getXYAxisLabelVal(index, node.appearance.intervalNumY, value);
|
54
|
-
}
|
55
|
-
if (chartOption.series.length < 2) {
|
56
|
-
chartOption.tooltip.formatter = function(params) {
|
57
|
-
const item = params[0];
|
58
|
-
return item.name + ' : ' + item.value;
|
58
|
+
option.color = node.appearance.color;
|
59
|
+
option.xAxis[0].axisLabel.formatter = function (value, index) {
|
60
|
+
return getXYAxisLabelVal(index, node.appearance.intervalNumX, value);
|
61
|
+
}
|
62
|
+
option.yAxis[0].axisLabel.formatter = function (value, index) {
|
63
|
+
return getXYAxisLabelVal(index, node.appearance.intervalNumY, value);
|
59
64
|
}
|
60
|
-
|
61
|
-
|
62
|
-
|
65
|
+
if (option.series.length < 2) {
|
66
|
+
option.tooltip.formatter = function (params) {
|
67
|
+
const item = params[0];
|
68
|
+
return item.name + ' : ' + item.value;
|
69
|
+
}
|
70
|
+
}else {
|
71
|
+
option.series.map((item, index) => {
|
72
|
+
if(!(item.itemStyle && item.itemStyle.normal && item.itemStyle.normal.color)) {
|
73
|
+
item.itemStyle = {
|
74
|
+
normal: {
|
75
|
+
color : echartsColorData[index]
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
});
|
80
|
+
}
|
81
|
+
// chartOption.yAxis[0].splitLine = node.appearance.splitLine;
|
63
82
|
}
|
83
|
+
|
64
84
|
// 自动配置仪表盘的节点数据
|
65
85
|
export function setMapGaugeOptions(option, node) {
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
seriesNode.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
86
|
+
//const chartOption = JSON.parse(JSON.stringify(option));
|
87
|
+
const seriesNode = option.series[0];
|
88
|
+
const appearance = node.appearance;
|
89
|
+
if(!appearance.min) appearance.min = 0;
|
90
|
+
if(!appearance.max) appearance.max = 100;
|
91
|
+
if (typeof appearance.min === 'number') seriesNode.min = appearance.min;
|
92
|
+
if (appearance.max) seriesNode.max = appearance.max;
|
93
|
+
if (appearance.splitNumber) seriesNode.splitNumber = appearance.splitNumber;
|
94
|
+
if (appearance.pointer) seriesNode.pointer = appearance.pointer;
|
95
|
+
if (appearance.axisLabel) seriesNode.axisLabel = appearance.axisLabel;
|
96
|
+
if (appearance.axisLine) seriesNode.axisLine.lineStyle = appearance.axisLine.lineStyle;
|
97
|
+
if (appearance.detail) seriesNode.detail = appearance.detail;
|
98
|
+
if (appearance.data) seriesNode.data = appearance.data;
|
99
|
+
if (appearance.detail) seriesNode.detail = appearance.detail;
|
100
|
+
if (appearance.data) seriesNode.data = appearance.data;
|
101
|
+
if (option.isGaugeLinear) {
|
102
|
+
seriesNode.axisLine.lineStyle.color = [
|
103
|
+
[1, new echarts.graphic.LinearGradient(0, 0, 1, 0, option.linearColors)]
|
104
|
+
]
|
105
|
+
}
|
83
106
|
}
|
107
|
+
|
84
108
|
// 自动配置环形图和饼图的节点数据
|
85
109
|
export function setMapRingOptions(option, node) {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
110
|
+
//const chartOption = JSON.parse(JSON.stringify(option));
|
111
|
+
const seriesNode = option.series[0];
|
112
|
+
const appearance = node.appearance;
|
113
|
+
if(!appearance.inner) {
|
114
|
+
if ((!appearance.label || typeof appearance.label.showValue !== 'boolean')) {
|
115
|
+
appearance.label = {
|
116
|
+
showValue: appearance.type === 'ring',
|
117
|
+
unit: appearance.type === 'ring' ? '%' : ''
|
118
|
+
}
|
119
|
+
}
|
120
|
+
seriesNode.label = {
|
121
|
+
normal: {
|
122
|
+
show: true,
|
123
|
+
position: 'outside'
|
124
|
+
}
|
125
|
+
};
|
126
|
+
seriesNode.label.normal.formatter = (data) => {
|
127
|
+
if (appearance.label.showValue === true) {
|
128
|
+
return `${data.name}:${data.value}${appearance.label.unit}`;
|
129
|
+
} else {
|
130
|
+
return `${data.name}`;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}else {
|
134
|
+
// chartOption.title.text = '{v|'+appearance.alarmCount+'}{unit|/'+appearance.total+'台}';
|
135
|
+
const {
|
136
|
+
vFontSize, vFontWeight, vColor,
|
137
|
+
vTop, unitFontSize, unitFontWeight,
|
138
|
+
unitColor} = appearance.text;
|
139
|
+
const rich = {
|
140
|
+
v: {
|
141
|
+
fontSize: vFontSize,
|
142
|
+
fontWeight: vFontWeight,
|
143
|
+
color: vColor,
|
144
|
+
padding: [vTop, 0, 0, 0]
|
145
|
+
},
|
146
|
+
unit: {
|
147
|
+
fontSize: unitFontSize,
|
148
|
+
fontWeight: unitFontWeight,
|
149
|
+
color: unitColor
|
150
|
+
}
|
151
|
+
};
|
152
|
+
Object.assign(option.title.textStyle.rich, rich);
|
153
|
+
option.title.y = `${appearance.text.y}%`;
|
154
|
+
option.series[0].radius[1] = `${appearance.inner.borderWidth}%`;
|
155
|
+
// const value1 = ((100 / appearance.total) * appearance.alarmCount).toFixed(6);
|
156
|
+
// chartOption.series[0].data[0].value = value1;
|
157
|
+
option.series[0].data[0].itemStyle.color = appearance.inner.borderColor;
|
158
|
+
// chartOption.series[0].data[1].value = 100 - value1;
|
159
|
+
option.series[0].data[1].itemStyle.color = appearance.inner.borderBgColor;
|
160
|
+
option.series[1].radius[1] = `${appearance.outer.borderWidth}%`;
|
161
|
+
option.series[1].data[0].itemStyle.color = appearance.outer.borderColor;
|
162
|
+
}
|
92
163
|
}
|
164
|
+
|
93
165
|
// 自动配置3D柱状图的节点数据
|
94
166
|
export function setMap3dBarOptions(option, node) {
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
167
|
+
// 取消注册自定义形状
|
168
|
+
//const chartOption = JSON.parse(JSON.stringify(option));
|
169
|
+
const seriesNode = option.series[0];
|
170
|
+
const appearance = node.appearance;
|
171
|
+
if (appearance.seriesCubeLeftLinear) appearance.seriesCubeLeftColor = 'rgb(0, 128, 215)';
|
172
|
+
if (appearance.seriesCubeRightLinear) appearance.seriesCubeRightColor = 'rgb(3, 58, 125)';
|
173
|
+
if (appearance.graphicShape) {
|
174
|
+
const {CubeLeft, CubeRight, CubeTop} = drawGraphicShape(appearance);
|
175
|
+
// 注册三个面图形
|
176
|
+
echarts.graphic.registerShape('CubeLeft', CubeLeft);
|
177
|
+
echarts.graphic.registerShape('CubeRight', CubeRight);
|
178
|
+
echarts.graphic.registerShape('CubeTop', CubeTop);
|
179
|
+
}
|
180
|
+
option.tooltip.formatter = function (params) {
|
181
|
+
const item = params[0];
|
182
|
+
return item.name + ' : ' + item.value;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
function renderMap3dBarSeriesItem(seriesNode, appearance) {
|
107
187
|
seriesNode.renderItem = (params, api) => {
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
188
|
+
const seriesRenderData = setSeriesRenderGroup(appearance, api);
|
189
|
+
return {
|
190
|
+
type: 'group',
|
191
|
+
children: seriesRenderData,
|
192
|
+
};
|
113
193
|
};
|
114
|
-
}
|
115
|
-
chartOption.tooltip.formatter = function(params) {
|
116
|
-
const item = params[0];
|
117
|
-
return item.name + ' : ' + item.value;
|
118
|
-
}
|
119
|
-
return chartOption;
|
120
194
|
}
|
195
|
+
|
121
196
|
export function setMapTopOptions(option, node) {
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
return chartOption;
|
197
|
+
//const chartOption = JSON.parse(JSON.stringify(option));
|
198
|
+
const appearance = node.appearance;
|
199
|
+
Object.assign(option.grid, appearance.grid);
|
126
200
|
}
|
201
|
+
|
127
202
|
// 公共配置
|
128
203
|
export function setMapGlobalOptions(option, node) {
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
return chartOption;
|
204
|
+
// const chartOption = JSON.parse(JSON.stringify(option));
|
205
|
+
const appearance = node.appearance;
|
206
|
+
// 图表网格数据
|
207
|
+
if (appearance.grid) {
|
208
|
+
|
209
|
+
option.grid ? Object.assign(option.grid, appearance.grid) : option.grid = appearance.grid;
|
210
|
+
|
211
|
+
}
|
212
|
+
// 图表X轴数据
|
213
|
+
if (option.xAxis) setChartXAxisData(option.xAxis, appearance);
|
214
|
+
// 图表Y轴数据
|
215
|
+
if (option.yAxis) setChartYAxisData(option.yAxis, appearance);
|
216
|
+
// 图表图例数据
|
217
|
+
if (option.legend) setChartLegendData(option.legend, appearance);
|
218
|
+
// 曲线样式数据
|
219
|
+
if (appearance.type.includes('line')) setLineSeriesStyleData(option.series, appearance);
|
147
220
|
}
|
221
|
+
|
148
222
|
// 实时改变图表data值
|
149
223
|
export function setMapDataOptions(option, node) {
|
150
|
-
const optionNode =
|
151
|
-
|
152
|
-
|
224
|
+
const optionNode = echartsOptionsPool[node.id].option;
|
225
|
+
const appearance = node.appearance;
|
226
|
+
const params = node.data ? node.data.params : node.params;
|
227
|
+
// 3d 柱状图
|
228
|
+
if (appearance.type === '3dBar') renderMap3dBarSeriesItem(optionNode.series[0], appearance);
|
229
|
+
const displayMode = parseInt(option.displayMode); // 图表类型
|
230
|
+
const staticForType = params && params.staticForType || ''; //统计类型:日,周,月,年,实时
|
231
|
+
const syncEchartsData = echartsRealDataPool[node.id]; // 统计图实时数据
|
232
|
+
const staticTypeData = staticForType ? syncEchartsData && syncEchartsData[`${staticForType}_Data`] : syncEchartsData; // 统计类型数据
|
233
|
+
// 实时数据加载
|
234
|
+
if(staticTypeData) {
|
235
|
+
|
236
|
+
if (displayMode === 1 || displayMode === 2) { // 折线图,柱状图
|
237
|
+
|
238
|
+
lineBarDataAuto(optionNode, params, staticTypeData);
|
239
|
+
|
240
|
+
}
|
241
|
+
if(displayMode === 4) { // top排行榜
|
242
|
+
|
243
|
+
topRankingListAuto(optionNode, staticTypeData);
|
244
|
+
|
245
|
+
}
|
246
|
+
if (displayMode === 5 || displayMode === 3) { // 饼图/环形图
|
247
|
+
const pieData = staticTypeData || staticTypeData.data || [];
|
248
|
+
if(appearance.type === 'ringPre') {
|
249
|
+
// 按照资产总台数统计设备告警数量
|
250
|
+
pieRingAssetTotalAuto(optionNode, pieData, appearance.total, appearance.alarmCount);
|
251
|
+
|
252
|
+
}else {
|
253
|
+
|
254
|
+
pieRingNormalAuto(optionNode, pieData);
|
255
|
+
|
256
|
+
}
|
257
|
+
}
|
258
|
+
if(displayMode === 6) { // 仪表盘
|
259
|
+
|
260
|
+
gaugeNormalAuto(optionNode, staticTypeData);
|
261
|
+
|
262
|
+
}
|
153
263
|
}else {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
264
|
+
if(option.title && option.title.text) {
|
265
|
+
optionNode.title.text = option.title.text;
|
266
|
+
}
|
267
|
+
if (option.legend) {
|
268
|
+
optionNode.legend = option.legend;
|
269
|
+
} else {
|
270
|
+
delete optionNode['legend'];
|
271
|
+
}
|
272
|
+
if (option.xAxis) {
|
273
|
+
for (let i = 0; i < option.xAxis.length; i++) {
|
274
|
+
const item = option.xAxis[i];
|
275
|
+
if (item.data) {
|
276
|
+
optionNode.xAxis[i].data = item.data;
|
277
|
+
}
|
161
278
|
}
|
162
279
|
}
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
280
|
+
if (option.yAxis) {
|
281
|
+
for (let i = 0; i < option.yAxis.length; i++) {
|
282
|
+
const item = option.yAxis[i];
|
283
|
+
if (item.data) {
|
284
|
+
optionNode.yAxis[i].data = item.data;
|
285
|
+
}
|
286
|
+
;
|
287
|
+
}
|
170
288
|
}
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
289
|
+
if (option.series) {
|
290
|
+
for (let i = 0; i < option.series.length; i++) {
|
291
|
+
const item = option.series[i];
|
292
|
+
if(item.name) optionNode.series[i].name = item.name;
|
293
|
+
optionNode.series[i].data = item.data;
|
294
|
+
}
|
176
295
|
}
|
177
296
|
}
|
178
|
-
|
297
|
+
|
298
|
+
const currentChartNode = echartsDataPool[node.id];
|
299
|
+
const mapChart = currentChartNode.chart;
|
300
|
+
clearInterval(currentChartNode.timeTicket);
|
301
|
+
currentChartNode.timeTicket = null;
|
302
|
+
// 自动滑动展示数据
|
303
|
+
if (appearance.timeTicket) {
|
304
|
+
mapChart.off('mouseover');
|
305
|
+
mapChart.off('mouseout');
|
306
|
+
mapChart.on('mouseover', function () {
|
307
|
+
setMapStopAutoMoveOptions(currentChartNode);
|
308
|
+
});
|
309
|
+
mapChart.on('mouseout', function () {
|
310
|
+
setMapAutoMoveOptions(optionNode, currentChartNode, node, function (chartNode) {
|
311
|
+
return mapChart.setOption(chartNode);
|
312
|
+
})
|
313
|
+
});
|
314
|
+
setMapAutoMoveOptions(optionNode, currentChartNode, node, function (chartNode) {
|
315
|
+
return mapChart.setOption(chartNode);
|
316
|
+
})
|
317
|
+
}
|
318
|
+
mapChart.setOption(optionNode);
|
319
|
+
mapChart.resize();
|
179
320
|
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export declare function lineBarDataAuto(option: any, params: {}, data: {}): void;
|
2
|
+
export declare function topRankingListAuto(option: any, data: {}): void;
|
3
|
+
export declare function pieRingAssetTotalAuto(option: any, data: {}, total: number, count: number): void;
|
4
|
+
export declare function pieRingNormalAuto(option: any, data: {}): void;
|
5
|
+
export declare function gaugeNormalAuto(option: any, data: {}): void;
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import {echartsColorData} from "../../../static";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* 折线和柱状图实时数据
|
5
|
+
* @param option 图表配置数据
|
6
|
+
* @param params 绑定的图表参数
|
7
|
+
* @param data 实时图表数据
|
8
|
+
*/
|
9
|
+
export function lineBarDataAuto(option, params, data) {
|
10
|
+
const seriesNodes = option.series;
|
11
|
+
if(data && data.XData) option.xAxis[0].data = data.XData;
|
12
|
+
if(!(data && data.seriesData && data.seriesData.length)) return;
|
13
|
+
if(seriesNodes.length > 1 || params && params.curveNum > 1){
|
14
|
+
// 双曲线|柱状
|
15
|
+
const legendData = [];
|
16
|
+
let legendChange = false;
|
17
|
+
seriesNodes.map((item, index) => {
|
18
|
+
const seriesItem = data.seriesData[index];
|
19
|
+
item.data = seriesItem ? seriesItem.data : [];
|
20
|
+
// 获取角标数据
|
21
|
+
if(seriesItem && seriesItem.name) {
|
22
|
+
item.name = seriesItem.name;
|
23
|
+
legendData.push(seriesItem.name);
|
24
|
+
legendChange = true;
|
25
|
+
}
|
26
|
+
});
|
27
|
+
if(option.legend && legendChange) option.legend.data = legendData; // 为角标数据赋值
|
28
|
+
}else{
|
29
|
+
if(!data.seriesData.length) return;
|
30
|
+
let seriesData = [];
|
31
|
+
for (let i = 0; i < data.seriesData.length; i++){
|
32
|
+
const realSeriesNode = data.seriesData[i];
|
33
|
+
const currSeriesNode = seriesNodes[i] ? seriesNodes[i] : JSON.parse(JSON.stringify(seriesNodes[0]));
|
34
|
+
if(realSeriesNode.name) currSeriesNode.name = realSeriesNode.name;
|
35
|
+
currSeriesNode.data = realSeriesNode.data;
|
36
|
+
seriesData.push(currSeriesNode);
|
37
|
+
}
|
38
|
+
option.series = seriesData;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* TOP排行榜实时数据
|
44
|
+
* @param option 图表配置数据
|
45
|
+
* @param data 实时图表数据
|
46
|
+
*/
|
47
|
+
export function topRankingListAuto(option, data) {
|
48
|
+
if(data && data.XData) option.yAxis[0].data = data.XData;
|
49
|
+
if(!(data && data.seriesData && data.seriesData.length)) return;
|
50
|
+
const seriesData = data.seriesData[0].data;
|
51
|
+
option.yAxis[1].data = seriesData;
|
52
|
+
for (let i = 0; i < option.series.length; i++) {
|
53
|
+
const node = option.series[i];
|
54
|
+
node.symbolBoundingData = data.total;
|
55
|
+
node.data = seriesData;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
/**
|
60
|
+
* 环形设备告警数量实时数据
|
61
|
+
* @param option 图表配置数据
|
62
|
+
* @param data 实时图表数据
|
63
|
+
* @param total 总数
|
64
|
+
* @param count 告警数
|
65
|
+
*/
|
66
|
+
export function pieRingAssetTotalAuto(option, data, total, count) {
|
67
|
+
if(data && data.length > 1) {
|
68
|
+
total = parseInt(data[0].value);
|
69
|
+
count = parseInt(data[1].value);
|
70
|
+
}
|
71
|
+
option.title.text = '{v|'+count+'}{unit|/'+total+'台}';
|
72
|
+
const value1 = ((100 / total) * count).toFixed(6);
|
73
|
+
option.series[0].data[0].value = value1;
|
74
|
+
option.series[0].data[1].value = 100 - value1;
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* 饼图环形图默认展示 实时数据
|
79
|
+
* @param option 图表配置数据
|
80
|
+
* @param data 实时图表数据
|
81
|
+
*/
|
82
|
+
export function pieRingNormalAuto(option, data) {
|
83
|
+
if(!(data && data.length)) return;
|
84
|
+
const colors = option.color || echartsColorData;
|
85
|
+
const seriesData = [];
|
86
|
+
data.map((chd, index) => {
|
87
|
+
seriesData.push({
|
88
|
+
itemStyle: { color: colors[index] },
|
89
|
+
name: chd.name,
|
90
|
+
value: chd.value
|
91
|
+
})
|
92
|
+
})
|
93
|
+
option.series[0].data = seriesData;
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* 仪表盘默认展示 实时数据
|
98
|
+
* @param option 图表配置数据
|
99
|
+
* @param data 实时图表数据
|
100
|
+
*/
|
101
|
+
export function gaugeNormalAuto(option, data) {
|
102
|
+
if(!data) return;
|
103
|
+
// 仪表盘分两种,分别有不同的取值方式,下面两行先注释掉
|
104
|
+
// node.appearance.title.text = data.name;
|
105
|
+
// option.title.text = data.name;
|
106
|
+
option.series[0].data[0].value = data.value;
|
107
|
+
}
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
@@ -7,6 +7,7 @@ export * from './src/models';
|
|
7
7
|
export * from './src/middles';
|
8
8
|
export * from './src/healps';
|
9
9
|
export * from './src/store';
|
10
|
+
export * from './src/element';
|
10
11
|
//# sourceMappingURL=index.js.map
|
11
12
|
import axios from 'axios'
|
12
13
|
if(axios.defaults.headers.common) axios.defaults.headers.common['Authorization'] = getToken();
|
package/core/src/activeLayer.js
CHANGED
@@ -306,12 +306,6 @@ var ActiveLayer = /** @class */ (function (_super) {
|
|
306
306
|
}
|
307
307
|
}
|
308
308
|
}
|
309
|
-
if(item.name == 'arbitraryGraph') {
|
310
|
-
for(let i = 0, circles = item.rect.circles; i<circles.length; i++) {
|
311
|
-
circles[i].x = circles[i].x + offsetX;
|
312
|
-
circles[i].y = circles[i].y + offsetY;
|
313
|
-
}
|
314
|
-
}
|
315
309
|
}
|
316
310
|
if (item instanceof Line && item.from) {
|
317
311
|
var offsetX_1 = this.nodeRects[i].x + x - item.from.x;
|
package/core/src/canvas.js
CHANGED
@@ -19,6 +19,7 @@ var Canvas = /** @class */ (function (_super) {
|
|
19
19
|
function Canvas(TID) {
|
20
20
|
var _this = _super.call(this, TID) || this;
|
21
21
|
_this.canvas = document.createElement('canvas');
|
22
|
+
_this.canvas.setAttribute('class', 'canvas-draw');
|
22
23
|
_this.width = commonStore[TID].parentElem.clientWidth;
|
23
24
|
_this.height = commonStore[TID].parentElem.clientHeight;
|
24
25
|
_this.canvas.style.position = 'absolute';
|
package/core/src/common.d.ts
CHANGED
@@ -75,8 +75,7 @@ export declare class Common {
|
|
75
75
|
ratioCord: Object;
|
76
76
|
_emitter: Emitter;
|
77
77
|
conversionData(data?: any): void;
|
78
|
-
|
79
|
-
switchStaticsCheckType(node: Node | any): any;
|
78
|
+
switchStaticsCheckType(node: Node | any, staticTypeNode: any): any;
|
80
79
|
canvasResize(size?: {
|
81
80
|
width: number;
|
82
81
|
height: number;
|