dcim-topology2d 1.1.6 → 2.0.5

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