dcim-topology2d 1.1.5 → 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.
Files changed (77) hide show
  1. package/chart-diagram/src/echarts/index.js +88 -96
  2. package/chart-diagram/src/register.js +3 -3
  3. package/chart-diagram/src/utils/changeOptions.d.ts +4 -4
  4. package/chart-diagram/src/utils/changeOptions.js +172 -144
  5. package/chart-diagram/src/utils/conversion.d.ts +12 -12
  6. package/chart-diagram/src/utils/conversion.js +278 -137
  7. package/chart-diagram/src/utils/render.d.ts +5 -0
  8. package/chart-diagram/src/utils/render.js +107 -0
  9. package/core/index.d.ts +1 -0
  10. package/core/index.js +1 -0
  11. package/core/src/activeLayer.js +0 -6
  12. package/core/src/calling.js +3 -0
  13. package/core/src/canvas.js +1 -0
  14. package/core/src/common.d.ts +1 -2
  15. package/core/src/common.js +124 -614
  16. package/core/src/core.js +65 -49
  17. package/core/src/divLayer.d.ts +0 -3
  18. package/core/src/divLayer.js +14 -32
  19. package/core/src/element/common.d.ts +5 -0
  20. package/core/src/element/common.js +52 -0
  21. package/core/src/element/iframe.d.ts +3 -0
  22. package/core/src/element/iframe.js +12 -0
  23. package/core/src/element/index.d.ts +4 -0
  24. package/core/src/element/index.js +4 -0
  25. package/core/src/element/select.d.ts +11 -0
  26. package/core/src/element/select.js +199 -0
  27. package/core/src/element/tab.d.ts +1 -0
  28. package/core/src/element/tab.js +22 -0
  29. package/core/src/healps/changeData.d.ts +1 -2
  30. package/core/src/healps/changeData.js +16 -122
  31. package/core/src/middles/default.js +3 -1
  32. package/core/src/middles/nodes/arbitrarygraph.js +11 -9
  33. package/core/src/middles/nodes/formselect.d.ts +2 -0
  34. package/core/src/middles/nodes/formselect.js +73 -0
  35. package/core/src/middles/nodes/iframe.js +21 -4
  36. package/core/src/middles/nodes/index.d.ts +1 -0
  37. package/core/src/middles/nodes/index.js +1 -0
  38. package/core/src/models/node.d.ts +4 -0
  39. package/core/src/models/node.js +25 -22
  40. package/core/src/models/pen.js +7 -8
  41. package/core/src/models/rect.js +2 -2
  42. package/core/src/options.d.ts +1 -0
  43. package/core/src/preview.js +45 -31
  44. package/core/src/renderLayer.d.ts +10 -6
  45. package/core/src/renderLayer.js +36 -43
  46. package/core/src/store/data.d.ts +19 -17
  47. package/core/src/store/data.js +38 -12
  48. package/core/src/utils/assignment.d.ts +6 -0
  49. package/core/src/utils/assignment.js +138 -0
  50. package/core/src/utils/construction.d.ts +9 -3
  51. package/core/src/utils/construction.js +6 -1
  52. package/core/src/utils/conversion.d.ts +3 -0
  53. package/core/src/utils/conversion.js +67 -0
  54. package/core/src/utils/index.d.ts +2 -1
  55. package/core/src/utils/index.js +2 -1
  56. package/core/src/utils/math.d.ts +1 -0
  57. package/core/src/utils/math.js +3 -0
  58. package/core/src/utils/onmousevent.d.ts +3 -0
  59. package/core/src/utils/onmousevent.js +28 -7
  60. package/core/src/utils/params.d.ts +7 -0
  61. package/core/src/utils/params.js +125 -0
  62. package/package.json +1 -1
  63. package/static/echartsDefaultData.js +27 -107
  64. package/static/element.js +14 -0
  65. package/static/form.js +11 -0
  66. package/static/index.js +2 -1
  67. package/store/actions.js +17 -0
  68. package/store/clear.js +72 -0
  69. package/store/index.js +2 -0
  70. package/style/common.css +18 -0
  71. package/style/editor.css +13 -0
  72. package/style/index.css +3 -12
  73. package/style/select.css +143 -0
  74. package/core/src/utils/dom.d.ts +0 -9
  75. package/core/src/utils/dom.js +0 -103
  76. package/core/src/utils/dom.js.map +0 -1
  77. package/static/echartsStore.js +0 -14
@@ -1,179 +1,320 @@
1
- import { echartsDataRoom, echartsOptionsStore } from '../../../static';
1
+ import {echartsDataRoom, echartsColorData} from '../../../static';
2
+ import {echartsOptionsPool, echartsDataPool, echartsRealDataPool} from '../../../store';
2
3
  import {
3
- setSeriesRenderGroup,
4
- drawGraphicShape,
5
- setChartLegendData,
6
- setChartXAxisData,
7
- setChartYAxisData,
8
- setLineSeriesStyleData
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
- if (index === 0 || index % intervalNum === 0) {
13
- return value;
14
- } else {
15
- return '';
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
- option.dataZoom = echartsDataRoom;
21
- const dataZoomNode = option.dataZoom[0];
22
- const { start, end, time } = node.appearance.zoomParams;
23
- const zoomStart = Number(start);
24
- const zoomEnd = Number(end);
25
- const zoomTime = Number(time);
26
- dataZoomNode.start = zoomStart;
27
- dataZoomNode.end = zoomEnd;
28
- chartNode.timeTicket = setInterval(() => {
29
- if (Number(dataZoomNode.end) > 100) {
30
- dataZoomNode.end = zoomEnd;
31
- dataZoomNode.start = zoomStart;
32
- } else {
33
- dataZoomNode.end = dataZoomNode.end + 1 * (100 / option.series[0].data.length);
34
- dataZoomNode.start = dataZoomNode.start + 1 * (100 / option.series[0].data.length);
35
- }
36
- callback(option);
37
- }, zoomTime * 1000);
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
- clearInterval(chartNode.timeTicket);
52
+ clearInterval(chartNode.timeTicket);
43
53
 
44
54
  }
55
+
45
56
  // 自动配置折线和柱状图的节点数据
46
57
  export function setMapLineBarOptions(option, node) {
47
- const chartOption = JSON.parse(JSON.stringify(option));
48
- chartOption.color = node.appearance.color;
49
- chartOption.xAxis[0].axisLabel.formatter = function(value, index) {
50
- return getXYAxisLabelVal(index, node.appearance.intervalNumX, value);
51
- }
52
- chartOption.yAxis[0].axisLabel.formatter = function(value, index) {
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
- // chartOption.yAxis[0].splitLine = node.appearance.splitLine;
62
- return chartOption;
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
- const chartOption = JSON.parse(JSON.stringify(option));
67
- const seriesNode = chartOption.series[0];
68
- const appearance = node.appearance;
69
- seriesNode.min = appearance.min;
70
- seriesNode.max = appearance.max;
71
- seriesNode.splitNumber = appearance.splitNumber;
72
- seriesNode.pointer = appearance.pointer;
73
- seriesNode.axisLabel = appearance.axisLabel;
74
- seriesNode.axisLine.lineStyle = appearance.axisLine.lineStyle;
75
- if(appearance.detail) seriesNode.detail = appearance.detail;
76
- if(appearance.data) seriesNode.data = appearance.data;
77
- if(chartOption.isGaugeLinear) {
78
- seriesNode.axisLine.lineStyle.color = [
79
- [1, new echarts.graphic.LinearGradient(0, 0, 1, 0, chartOption.linearColors)]
80
- ]
81
- }
82
- return chartOption;
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
- const chartOption = JSON.parse(JSON.stringify(option));
87
- const seriesNode = chartOption.series[0];
88
- const appearance = node.appearance;
89
- seriesNode.radius = [`${appearance.innerRadius}%`, `${appearance.outerRadius}%`];
90
- seriesNode.label = appearance.label;
91
- return chartOption;
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
- const chartOption = JSON.parse(JSON.stringify(option));
97
- const seriesNode = chartOption.series[0];
98
- const appearance = node.appearance;
99
- if(appearance.seriesCubeLeftLinear) appearance.seriesCubeLeftColor = 'rgb(0, 128, 215)';
100
- if(appearance.seriesCubeRightLinear) appearance.seriesCubeRightColor = 'rgb(3, 58, 125)';
101
- if(appearance.graphicShape) {
102
- const { CubeLeft, CubeRight, CubeTop } = drawGraphicShape(appearance);
103
- // 注册三个面图形
104
- echarts.graphic.registerShape('CubeLeft', CubeLeft);
105
- echarts.graphic.registerShape('CubeRight', CubeRight);
106
- echarts.graphic.registerShape('CubeTop', CubeTop);
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
- const seriesRenderData = setSeriesRenderGroup(appearance, api);
109
- return {
110
- type: 'group',
111
- children: seriesRenderData,
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
- const chartOption = JSON.parse(JSON.stringify(option));
123
- const appearance = node.appearance;
124
- Object.assign(chartOption.grid, appearance.grid);
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
- const chartOption = JSON.parse(JSON.stringify(option));
130
- const appearance = node.appearance;
131
- // 图表网格数据
132
- if (appearance.grid) {
133
-
134
- chartOption.grid ? Object.assign(chartOption.grid, appearance.grid) : chartOption.grid = appearance.grid;
135
-
136
- }
137
- // 图表X轴数据
138
- if(chartOption.xAxis) setChartXAxisData(chartOption.xAxis, appearance);
139
- // 图表Y轴数据
140
- if(chartOption.yAxis) setChartYAxisData(chartOption.yAxis, appearance);
141
- // 图表图例数据
142
- if (chartOption.legend) setChartLegendData(chartOption.legend, appearance);
143
- // 曲线样式数据
144
- if (appearance.type.includes('line')) setLineSeriesStyleData(chartOption.series, appearance);
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 = echartsOptionsStore[node.id];
151
- if (option.legend) {
152
- optionNode.legend = option.legend;
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
- delete optionNode['legend'];
155
- }
156
- if(option.xAxis) {
157
- for (let i = 0; i < option.xAxis.length; i++) {
158
- const item = option.xAxis[i];
159
- if(item.data){
160
- optionNode.xAxis[i].data = item.data;
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
- if(option.yAxis) {
165
- for (let i = 0; i < option.yAxis.length; i++) {
166
- const item = option.yAxis[i];
167
- if(item.data){
168
- optionNode.yAxis[i].data = item.data;
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
- if(option.series) {
173
- for (let i = 0; i < option.series.length; i++) {
174
- const item = option.series[i];
175
- optionNode.series[i].data = item.data;
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
- return optionNode;
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
@@ -7,3 +7,4 @@ 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';
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();
@@ -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;
@@ -71,12 +71,14 @@ var Calling = (function () {
71
71
  if (data.nodes) {
72
72
  for (var _i = 0, _a = data.nodes; _i < _a.length; _i++) {
73
73
  var item = _a[_i];
74
+ item.TID = this.id;
74
75
  item.rect.x = 0;
75
76
  item.rect.y = 0;
76
77
  this.store.data.pens.push(new Node(item));
77
78
  }
78
79
  for (var _b = 0, _c = data.lines; _b < _c.length; _b++) {
79
80
  var item = _c[_b];
81
+ item.TID = this.id;
80
82
  this.store.data.pens.push(new Line(item));
81
83
  }
82
84
  }
@@ -84,6 +86,7 @@ var Calling = (function () {
84
86
  if (data.pens) {
85
87
  for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
86
88
  var item = _e[_d];
89
+ item.TID = this.id;
87
90
  if (!item.from) {
88
91
  this.store.data.pens.push(new Node(item));
89
92
  } else {
@@ -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';
@@ -75,8 +75,7 @@ export declare class Common {
75
75
  ratioCord: Object;
76
76
  _emitter: Emitter;
77
77
  conversionData(data?: any): void;
78
- setSwitchTabData(node: Node | any, index: Number): void;
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;