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.
- package/chart-diagram/index.d.ts +1 -1
- package/chart-diagram/index.js +1 -1
- 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 +7 -4
- package/chart-diagram/src/utils/changeOptions.js +228 -144
- package/chart-diagram/src/utils/conversion.d.ts +12 -12
- package/chart-diagram/src/utils/conversion.js +263 -137
- package/chart-diagram/src/utils/render.d.ts +6 -0
- package/chart-diagram/src/utils/render.js +124 -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 +197 -541
- package/core/src/core.js +116 -60
- 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 +234 -0
- package/core/src/element/tab.d.ts +1 -0
- package/core/src/element/tab.js +19 -0
- package/core/src/healps/changeData.d.ts +1 -2
- package/core/src/healps/changeData.js +33 -125
- 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 +87 -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 +3 -52
- package/core/src/models/rect.js +2 -2
- package/core/src/options.d.ts +2 -0
- package/core/src/options.js +2 -1
- package/core/src/preview.js +51 -32
- package/core/src/renderLayer.d.ts +10 -6
- package/core/src/renderLayer.js +36 -43
- package/core/src/store/data.d.ts +71 -21
- package/core/src/store/data.js +93 -17
- package/core/src/utils/assignment.d.ts +6 -3
- package/core/src/utils/assignment.js +120 -21
- package/core/src/utils/construction.d.ts +10 -3
- package/core/src/utils/construction.js +7 -1
- package/core/src/utils/conversion.d.ts +3 -0
- package/core/src/utils/conversion.js +62 -1
- 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 +27 -7
- package/core/src/utils/params.d.ts +2 -0
- package/core/src/utils/params.js +57 -0
- package/myShape-diagram/index.js +196 -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 +1 -0
- package/store/clear.js +10 -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/poll.js +0 -37
- 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/myShape-diagram/myShape.js +0 -196
- package/static/echartsStore.js +0 -14
- /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
@@ -1,17 +1,17 @@
|
|
1
1
|
interface echartsOptions {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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):
|
10
|
-
export declare function setMapGaugeOptions(option: echartsOptions, node: any):
|
11
|
-
export declare function setMapRingOptions(option: echartsOptions, node: any):
|
12
|
-
export declare function setMap3dBarOptions(option: echartsOptions, node: any):
|
13
|
-
export declare function setMapTopOptions(option: echartsOptions, node: any):
|
14
|
-
export declare function setMapGlobalOptions(option: echartsOptions, node: any):
|
15
|
-
export declare function setMapDataOptions(option: echartsOptions, node: any):
|
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 {
|
1
|
+
import {echartsDataRoom, echartsColorData} from '../../../static';
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
55
|
+
clearInterval(chartNode.timeTicket);
|
43
56
|
|
44
57
|
}
|
58
|
+
|
45
59
|
// 自动配置折线和柱状图的节点数据
|
46
60
|
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;
|
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
|
-
|
62
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
seriesNode.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
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
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
-
|
123
|
-
|
124
|
-
|
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
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
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 =
|
151
|
-
|
152
|
-
|
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
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
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
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
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
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
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
|
-
|
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
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;
|