dcim-topology2d 2.1.0 → 3.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/activity-diagram/src/final/final.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.d.ts +1 -1
- package/activity-diagram/src/final/final.rect.js +1 -1
- package/activity-diagram/src/fork/fork.anchor.d.ts +1 -1
- package/activity-diagram/src/fork/fork.anchor.js +1 -1
- package/activity-diagram/src/fork/fork.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.d.ts +1 -1
- package/activity-diagram/src/fork/fork.rect.js +1 -1
- package/activity-diagram/src/register.js +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +1 -1
- package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +1 -1
- package/chart-diagram/index.d.ts +1 -3
- package/chart-diagram/index.js +1 -2
- package/chart-diagram/src/echarts/index.d.ts +2 -1
- package/chart-diagram/src/echarts/index.js +104 -109
- package/chart-diagram/src/register.js +8 -9
- package/class-diagram/src/class/class.d.ts +1 -1
- package/class-diagram/src/class/class.rect.d.ts +1 -1
- package/class-diagram/src/class/class.rect.js +1 -1
- package/class-diagram/src/register.js +1 -1
- package/core/index.d.ts +0 -2
- package/core/index.js +0 -2
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +47 -42
- package/core/src/animateLayer.d.ts +7 -3
- package/core/src/animateLayer.js +12 -10
- package/core/src/calling.d.ts +4 -1
- package/core/src/calling.js +41 -43
- package/core/src/canvas.d.ts +6 -1
- package/core/src/canvas.js +21 -22
- package/core/src/common.d.ts +7 -6
- package/core/src/common.js +674 -341
- package/core/src/core.d.ts +4 -5
- package/core/src/core.js +385 -522
- package/core/src/divLayer.d.ts +36 -2
- package/core/src/divLayer.js +305 -33
- package/core/src/healps/changeData.d.ts +2 -1
- package/core/src/healps/changeData.js +66 -32
- package/core/src/hoverLayer.d.ts +9 -2
- package/core/src/hoverLayer.js +34 -31
- package/core/src/middles/default.d.ts +3 -1
- package/core/src/middles/default.js +51 -59
- package/core/src/middles/index.js +2 -3
- package/core/src/middles/nodes/arbitrarygraph.js +9 -11
- package/core/src/middles/nodes/pentagon.rect.js +1 -1
- package/core/src/middles/nodes/rectangle.rect.js +1 -1
- package/core/src/models/data.d.ts +26 -0
- package/core/src/models/data.js +77 -0
- package/core/src/models/data.js.map +1 -0
- package/core/src/models/index.d.ts +1 -0
- package/core/src/models/index.js +1 -0
- package/core/src/models/node.d.ts +0 -10
- package/core/src/models/node.js +36 -81
- package/core/src/models/pen.js +59 -19
- package/core/src/models/rect.js +2 -2
- package/core/src/mqtt.d.ts +14 -0
- package/core/src/mqtt.js +82 -0
- package/core/src/mqtt.js.map +1 -0
- package/core/src/offscreen.d.ts +4 -1
- package/core/src/offscreen.js +8 -10
- package/core/src/options.d.ts +1 -3
- package/core/src/options.js +0 -2
- package/core/src/poll.js +39 -0
- package/core/src/preview.d.ts +13 -2
- package/core/src/preview.js +43 -135
- package/core/src/renderLayer.d.ts +9 -11
- package/core/src/renderLayer.js +61 -60
- package/core/src/socket.d.ts +10 -0
- package/core/src/socket.js +51 -0
- package/core/src/socket.js.map +1 -0
- package/core/src/utils/canvas.js +1 -1
- package/core/src/utils/construction.d.ts +3 -12
- package/core/src/utils/construction.js +1 -8
- package/core/src/utils/conversion.d.ts +0 -13
- package/core/src/utils/conversion.js +0 -210
- package/core/src/utils/dom.d.ts +8 -0
- package/core/src/utils/dom.js +67 -0
- package/core/src/utils/dom.js.map +1 -0
- package/core/src/utils/index.d.ts +1 -2
- package/core/src/utils/index.js +1 -2
- package/core/src/utils/math.d.ts +0 -1
- package/core/src/utils/math.js +0 -3
- package/core/src/utils/onmousevent.d.ts +0 -3
- package/core/src/utils/onmousevent.js +10 -42
- package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
- package/flow-diagram/src/comment/comment.anchor.js +1 -1
- package/flow-diagram/src/comment/comment.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.d.ts +1 -1
- package/flow-diagram/src/data/data.anchor.js +1 -1
- package/flow-diagram/src/data/data.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.d.ts +1 -1
- package/flow-diagram/src/data/data.rect.js +1 -1
- package/flow-diagram/src/db/db.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.d.ts +1 -1
- package/flow-diagram/src/db/db.rect.js +1 -1
- package/flow-diagram/src/display/display.anchor.d.ts +1 -1
- package/flow-diagram/src/display/display.anchor.js +1 -1
- package/flow-diagram/src/display/display.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.d.ts +1 -1
- package/flow-diagram/src/display/display.rect.js +1 -1
- package/flow-diagram/src/document/document.anchor.d.ts +1 -1
- package/flow-diagram/src/document/document.anchor.js +1 -1
- package/flow-diagram/src/document/document.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.d.ts +1 -1
- package/flow-diagram/src/document/document.rect.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
- package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
- package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
- package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
- package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
- package/flow-diagram/src/manually/manually.anchor.js +1 -1
- package/flow-diagram/src/manually/manually.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
- package/flow-diagram/src/manually/manually.rect.js +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
- package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
- package/flow-diagram/src/parallel/parallel.d.ts +1 -1
- package/flow-diagram/src/queue/queue.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
- package/flow-diagram/src/queue/queue.rect.js +1 -1
- package/flow-diagram/src/register.js +1 -1
- package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
- package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
- package/layout/src/align.d.ts +1 -1
- package/layout/src/align.js +1 -1
- package/layout/src/layout.d.ts +1 -1
- package/layout/src/layout.js +1 -1
- package/myShape-diagram/{index.js → myShape.js} +1 -4
- package/package.json +1 -1
- package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.anchor.js +1 -1
- package/sequence-diagram/src/focus/focus.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
- package/sequence-diagram/src/focus/focus.rect.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
- package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
- package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
- package/sequence-diagram/src/register.js +1 -1
- package/chart-diagram/src/utils/changeOptions.d.ts +0 -8
- package/chart-diagram/src/utils/changeOptions.js +0 -267
- package/chart-diagram/src/utils/conversion.d.ts +0 -19
- package/chart-diagram/src/utils/conversion.js +0 -559
- package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
- package/chart-diagram/src/utils/drawGraphic.js +0 -97
- package/chart-diagram/src/utils/formatter.d.ts +0 -1
- package/chart-diagram/src/utils/formatter.js +0 -206
- package/chart-diagram/src/utils/index.d.ts +0 -5
- package/chart-diagram/src/utils/index.js +0 -5
- package/chart-diagram/src/utils/render.d.ts +0 -8
- package/chart-diagram/src/utils/render.js +0 -219
- package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +0 -3
- package/chart-diagram/src/utils/surfaceParametricConversion.js +0 -252
- package/core/src/element/common.d.ts +0 -6
- package/core/src/element/common.js +0 -54
- package/core/src/element/datePicker.d.ts +0 -3
- package/core/src/element/datePicker.js +0 -47
- package/core/src/element/iframe.d.ts +0 -3
- package/core/src/element/iframe.js +0 -12
- package/core/src/element/index.d.ts +0 -5
- package/core/src/element/index.js +0 -6
- package/core/src/element/select.d.ts +0 -11
- package/core/src/element/select.js +0 -275
- package/core/src/element/tab.d.ts +0 -1
- package/core/src/element/tab.js +0 -25
- package/core/src/element/time.d.ts +0 -3
- package/core/src/element/time.js +0 -44
- package/core/src/middles/arrows/index.d.ts +0 -4
- package/core/src/middles/arrows/index.js +0 -5
- package/core/src/middles/lines/index.d.ts +0 -4
- package/core/src/middles/lines/index.js +0 -5
- package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
- package/core/src/middles/nodes/formDatePicker.js +0 -66
- package/core/src/middles/nodes/formoverflow.js +0 -61
- package/core/src/middles/nodes/formselect.d.ts +0 -2
- package/core/src/middles/nodes/formselect.js +0 -102
- package/core/src/middles/nodes/iframe.d.ts +0 -2
- package/core/src/middles/nodes/iframe.js +0 -29
- package/core/src/middles/nodes/index.d.ts +0 -50
- package/core/src/middles/nodes/index.js +0 -52
- package/core/src/middles/nodes/time.d.ts +0 -2
- package/core/src/middles/nodes/time.js +0 -98
- package/core/src/store/common.d.ts +0 -9
- package/core/src/store/common.js +0 -5
- package/core/src/store/data.d.ts +0 -194
- package/core/src/store/data.js +0 -187
- package/core/src/store/index.d.ts +0 -2
- package/core/src/store/index.js +0 -2
- package/core/src/utils/assignment.d.ts +0 -7
- package/core/src/utils/assignment.js +0 -185
- package/core/src/utils/params.d.ts +0 -2
- package/core/src/utils/params.js +0 -65
- package/static/echartsDefaultData.js +0 -178
- package/static/element.js +0 -14
- package/static/form.js +0 -11
- package/static/index.js +0 -3
- package/store/actions.js +0 -1
- package/store/clear.js +0 -10
- package/store/index.js +0 -2
- package/style/common.css +0 -15
- package/style/datePicker.css +0 -44
- package/style/editor.css +0 -16
- package/style/index.css +0 -5
- package/style/select.css +0 -143
- /package/myShape-diagram/{index.ts → myShape.ts} +0 -0
@@ -1,206 +0,0 @@
|
|
1
|
-
import {rankingTopColorList} from '../../../static';
|
2
|
-
|
3
|
-
export function mapFormatterSet(appearance, options, data, dataDictionary) {
|
4
|
-
if(appearance.type.includes('ring') || appearance.type.includes('pie')) {
|
5
|
-
const seriesNode = options.series[0];
|
6
|
-
if(seriesNode.label && seriesNode.label.normal &&!seriesNode.label.normal.formatter) {
|
7
|
-
setMapRingOptionsFormatter(appearance, seriesNode);
|
8
|
-
}
|
9
|
-
}
|
10
|
-
if(appearance.type === 'ring3d') setMapRing3DFormatter(appearance, options, dataDictionary);
|
11
|
-
if(appearance.type === 'pie3d') setMapPie3DFormatter(appearance, options);
|
12
|
-
if(appearance.type.includes('line') || appearance.type.includes('bar')) setMapLineBarFormatter(appearance, options);
|
13
|
-
if(appearance.type.includes('lineTwins')) setMapLineTwinsFormatter(appearance, options);
|
14
|
-
if(appearance.type.includes('scatter')) setMapScatterFormatter(options);
|
15
|
-
if(appearance.type.includes('TOPRanking')) setMapTopScoreFormatter(options, data, appearance);
|
16
|
-
if(appearance.type.includes('barPileStatic')) setMapBarPileStaticFormatter(appearance, options);
|
17
|
-
}
|
18
|
-
function setMapLineTwinsFormatter(appearance, options) {
|
19
|
-
if(!options.tooltip.formatter && appearance.tooltipUnit) {
|
20
|
-
options.tooltip.formatter = function (params) {
|
21
|
-
let relVal = params[0].name;
|
22
|
-
for (var i = 0, l = params.length; i < l; i++) {
|
23
|
-
const unit = appearance.tooltipUnit[i] || '';
|
24
|
-
relVal +=
|
25
|
-
"<br/>" +
|
26
|
-
params[i].marker +
|
27
|
-
params[i].seriesName +
|
28
|
-
" : " +
|
29
|
-
params[i].value +
|
30
|
-
unit;
|
31
|
-
}
|
32
|
-
return relVal;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
// 折线 || 柱状图
|
37
|
-
function setMapLineBarFormatter(appearance, options){
|
38
|
-
if(!options.tooltip.formatter){
|
39
|
-
options.tooltip.formatter = function(param) {
|
40
|
-
const firstUnit = getTooltipUnit(0, appearance);
|
41
|
-
const firstDott = getTooltipDott(param[0].color);
|
42
|
-
let data = `${firstDott}${param[0].seriesName}:${param[0].value} ${firstUnit}`;
|
43
|
-
for (let i = 1; i < param.length; i++){
|
44
|
-
const item = param[i];
|
45
|
-
const unit = getTooltipUnit(i, appearance);
|
46
|
-
const dott = getTooltipDott(param[i].color);
|
47
|
-
data += `<br>${dott}${item.seriesName}:${appearance.total && appearance.total[item.dataIndex].value || item.value} ${unit}`;
|
48
|
-
}
|
49
|
-
return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;margin-bottom: 5px;">${param[0].name}</div>${data}`;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
function getTooltipUnit(index, appearance) {
|
54
|
-
return appearance.tooltipUnit && appearance.tooltipUnit[index] || appearance.series && appearance.series[index] && appearance.series[index].labelUnit || '';
|
55
|
-
}
|
56
|
-
function getTooltipDott(color) {
|
57
|
-
return `<span style="display: inline-block;margin-right: 8px;border: 5px solid ${color};border-radius: 100%"></span>`;
|
58
|
-
}
|
59
|
-
// 堆叠统计
|
60
|
-
function setMapBarPileStaticFormatter(appearance, options) {
|
61
|
-
for (let i = 0; i < options.series.length; i++) {
|
62
|
-
const item = options.series[i];
|
63
|
-
const setItem = appearance.series[i];
|
64
|
-
if(setItem) {
|
65
|
-
item.itemStyle.normal.color = setItem.itemColor;
|
66
|
-
item.label.color = setItem.labelColor;
|
67
|
-
item.label.fontSize = setItem.labelSize;
|
68
|
-
item.label.padding[0] = setItem.labelTop;
|
69
|
-
}
|
70
|
-
item.label.formatter = `{c}${setItem ? setItem.labelUnit : ''}`;
|
71
|
-
}
|
72
|
-
if(appearance.total && appearance.total.length) {
|
73
|
-
options.series[1].label.formatter = function(param) {
|
74
|
-
if(!param.value) return '';
|
75
|
-
const val = appearance.totalLabel ? appearance.total[param.dataIndex].value || options.series[1].data[param.dataIndex] : '';
|
76
|
-
return `${val}${appearance.series[1].labelUnit}`;
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
// Top排行榜自定义展示配置
|
81
|
-
function setMapTopScoreFormatter(options, data, appearance) {
|
82
|
-
const yNode = options.yAxis[0];
|
83
|
-
if(!yNode.axisLabel.formatter) {
|
84
|
-
yNode.axisLabel.formatter = function(value, i) {
|
85
|
-
return `{a${i+1}|}{b|${value}}`;
|
86
|
-
}
|
87
|
-
}
|
88
|
-
const seriesNode = options.series[0];
|
89
|
-
if(appearance.total && appearance.total.length) {
|
90
|
-
const realData = data && data.seriesData && data.seriesData[0] && data.seriesData[0].data;
|
91
|
-
const normalData = [28.7, 24.2, 20.3, 19.8, 19.3];
|
92
|
-
const resultData = realData && realData.length ? realData : normalData;
|
93
|
-
seriesNode.itemStyle.normal.label.formatter = function(param) {
|
94
|
-
return `${resultData[param.dataIndex]}${appearance.unit}`;
|
95
|
-
}
|
96
|
-
for(let i = 0; i < appearance.total.length; i++) {
|
97
|
-
const value = appearance.total[i].value;
|
98
|
-
seriesNode.data[i] = value ? parseInt(value) : normalData[i];
|
99
|
-
}
|
100
|
-
}
|
101
|
-
if(seriesNode.itemStyle.normal.color) return;
|
102
|
-
const colorList = appearance.barColor || rankingTopColorList;
|
103
|
-
for (let i = 0; i < options.series.length; i++) {
|
104
|
-
const node = options.series[i];
|
105
|
-
node.itemStyle.normal.color = function(params) {
|
106
|
-
return colorList[params.dataIndex];
|
107
|
-
}
|
108
|
-
}
|
109
|
-
}
|
110
|
-
// 散点图series自定义展示配置
|
111
|
-
function setMapScatterFormatter(options) {
|
112
|
-
const seriesNode = options.series[0];
|
113
|
-
if(!options.tooltip.formatter) {
|
114
|
-
options.tooltip.formatter = function(param) {
|
115
|
-
const value = param.value;
|
116
|
-
// prettier-ignore
|
117
|
-
return `<div style="border-bottom: 1px solid rgba(255,255,255,.3); font-size: 12px;padding-bottom: 5px;margin-bottom: 5px;">${param.seriesName}告警</div>告警等级:${value[1]}<br>告警数量:${value[2]}`;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
if(!options.yAxis[0].axisLabel.formatter) {
|
121
|
-
options.yAxis[0].axisLabel.formatter = function (value, index) {
|
122
|
-
return `{f${index+1}|${value}}`;
|
123
|
-
}
|
124
|
-
}
|
125
|
-
if(seriesNode.symbolSize) return;
|
126
|
-
for (let i = 0; i < options.series.length; i++) {
|
127
|
-
const node = options.series[i];
|
128
|
-
node.symbolSize = function(d) {
|
129
|
-
let markSize = Math.sqrt(d[2]) * 2;
|
130
|
-
if(markSize < 6) markSize = 6;
|
131
|
-
if(markSize > 20) markSize = 20;
|
132
|
-
//if(!markSize) markSize = 1;
|
133
|
-
return markSize;
|
134
|
-
}
|
135
|
-
node.label.emphasis.formatter = function(param) {
|
136
|
-
return param.data[0];
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
// 环形图自定义展示配置
|
141
|
-
function setMapRingOptionsFormatter(appearance, seriesNode) {
|
142
|
-
if(appearance.labelDetail && appearance.labelDetail.length) {
|
143
|
-
seriesNode.label.normal.formatter = (data) => {
|
144
|
-
let result = `{a|${data.name}}\n{cir|}`;
|
145
|
-
for (let i = 0; i < appearance.labelDetail.length; i++) {
|
146
|
-
const detail = appearance.labelDetail[i];
|
147
|
-
result += '\n'+`{b${i+1}|${detail.title}${i === 0 ? data.value : data[`value${i+1}`]}${detail.unit}}`;
|
148
|
-
}
|
149
|
-
return result;
|
150
|
-
}
|
151
|
-
}else {
|
152
|
-
seriesNode.label.normal.formatter = (data) => {
|
153
|
-
if (appearance.label.showValue === true) {
|
154
|
-
return `${data.name}:${data.value}${appearance.label.unit}`;
|
155
|
-
} else {
|
156
|
-
return `${data.name}`;
|
157
|
-
}
|
158
|
-
}
|
159
|
-
}
|
160
|
-
}
|
161
|
-
// 环形3D图自定义展示配置
|
162
|
-
function setMapRing3DFormatter(appearance, options, data) {
|
163
|
-
if(!options.tooltip.formatter) {
|
164
|
-
options.tooltip.formatter = (params) => {
|
165
|
-
if (params.seriesName !== 'mouseoutSeries' && params.seriesName !== 'pie2d') {
|
166
|
-
const pieData = options.series[params.seriesIndex].pieData;
|
167
|
-
const pv = (pieData.endRatio - pieData.startRatio) *100;
|
168
|
-
let bfb = Math.round(pv);
|
169
|
-
return `${
|
170
|
-
params.seriesName
|
171
|
-
}<br/><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${
|
172
|
-
params.color
|
173
|
-
};"></span>${bfb}${appearance.unit}`;
|
174
|
-
}
|
175
|
-
}
|
176
|
-
}
|
177
|
-
options.legend.formatter = (name) => {
|
178
|
-
const legendItem = data.node[name];
|
179
|
-
const pv = (legendItem.value / data.total) * 100;
|
180
|
-
const p = Math.round(pv)+'%';
|
181
|
-
return `{a|${name}}{b${legendItem.order}|${legendItem.value}}{b${legendItem.order}|${p}}`;
|
182
|
-
}
|
183
|
-
}
|
184
|
-
// 饼图3D图自定义展示配置
|
185
|
-
function setMapPie3DFormatter(appearance, options) {
|
186
|
-
if(!options.tooltip.formatter) {
|
187
|
-
options.tooltip.formatter = (params) => {
|
188
|
-
if (params.seriesName !== 'mouseoutSeries') {
|
189
|
-
const pieData = options.series[params.seriesIndex].pieData;
|
190
|
-
if(!pieData) return; // 先退出,后期若有hover引线时,图形联动的需求时再做逻辑处理
|
191
|
-
return `${
|
192
|
-
params.seriesName
|
193
|
-
}<br/><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:${
|
194
|
-
params.color
|
195
|
-
};"></span>${pieData.value}${appearance.unit}`;
|
196
|
-
}
|
197
|
-
}
|
198
|
-
}
|
199
|
-
const lastSeriesNode = options.series[options.series.length - 1];
|
200
|
-
if(appearance.labelLine.show && !lastSeriesNode.label.formatter) {
|
201
|
-
lastSeriesNode.label.formatter = (params) => {
|
202
|
-
const dataIndex = params.dataIndex + 1;
|
203
|
-
return `{name${dataIndex}|${params.name}}{value${dataIndex}|${params.value}}{unit${dataIndex}|${appearance.unit}}`;
|
204
|
-
}
|
205
|
-
}
|
206
|
-
}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare function lineBarDataAuto(option: any, params: {}, data: {}, appearance: {}): void;
|
2
|
-
export declare function barPileStaticDataAuto(option: any, data: {}, appearance: {}): void;
|
3
|
-
export declare function topRankingListAuto(option: any, data: {}, appearance: {}): void;
|
4
|
-
export declare function scatterDataAuto(option: any, data: {}): void;
|
5
|
-
export declare function pieRingAssetTotalAuto(option: any, data: {}, total: number, count: number): void;
|
6
|
-
export declare function pieRingProportionAuto(option: any, data: {}, proportion: number): void;
|
7
|
-
export declare function pieRingNormalAuto(option: any, data: {}): void;
|
8
|
-
export declare function gaugeNormalAuto(option: any, data: {}): void;
|
@@ -1,219 +0,0 @@
|
|
1
|
-
import {echartsColorData} from "../../../static";
|
2
|
-
|
3
|
-
/**
|
4
|
-
* 折线和柱状图实时数据
|
5
|
-
* @param option 图表配置数据
|
6
|
-
* @param params 绑定的图表参数
|
7
|
-
* @param data 实时图表数据
|
8
|
-
* @param appearance 配置参数
|
9
|
-
*/
|
10
|
-
export function lineBarDataAuto(option, params, data, appearance) {
|
11
|
-
const seriesNodes = option.series;
|
12
|
-
if(data && data.XData) option.xAxis[0].data = data.XData;
|
13
|
-
if(!(data && data.seriesData && data.seriesData.length)) return;
|
14
|
-
if(params.tabCorrelationType) {
|
15
|
-
// 如果操作类型是select下拉分组下的tab切换,执行下面的逻辑
|
16
|
-
const realSeriesNode = data.seriesData[params.tabVisitOrder || 0];
|
17
|
-
seriesNodes[0].data = realSeriesNode.data;
|
18
|
-
if(realSeriesNode.name) seriesNodes[0].name = realSeriesNode.name;
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
const realSeriesData = data.seriesData;
|
22
|
-
// 双轴曲线间距配置
|
23
|
-
if(option.yAxis.length > 1 && appearance.yAxisValueAuto) {
|
24
|
-
if(!appearance.yAxisMaxIntervalue) appearance.yAxisMaxIntervalue = 1;
|
25
|
-
// 双轴曲线,且曲线值为自适应
|
26
|
-
const dataGroup = {
|
27
|
-
data1: realSeriesData[0] && realSeriesData[0].data || [],
|
28
|
-
data2: realSeriesData[1] && realSeriesData[1].data || []
|
29
|
-
};
|
30
|
-
const newData = [...dataGroup.data1, ...dataGroup.data2];
|
31
|
-
let min = Math.min(...newData);
|
32
|
-
let max = Math.max(...newData);
|
33
|
-
const power = Math.floor(Math.log10(min));
|
34
|
-
for (let i = 0; i < option.yAxis.length; i++) {
|
35
|
-
const currentData = dataGroup[`data${i + 1}`];
|
36
|
-
if(min < 0 && Math.max(...currentData) < max) max *= appearance.yAxisMaxIntervalue;
|
37
|
-
if(min > 0 && Math.max(...currentData) < max) min = Math.pow(10, power);
|
38
|
-
option.yAxis[i].min = Math.ceil(min);
|
39
|
-
option.yAxis[i].max = Math.ceil(max);
|
40
|
-
}
|
41
|
-
}
|
42
|
-
let legendChange = false;
|
43
|
-
let seriesData = [];
|
44
|
-
const legendData = [];
|
45
|
-
for (let i = 0; i < realSeriesData.length; i++){
|
46
|
-
const realSeriesNode = realSeriesData[i];
|
47
|
-
let currSeriesNode = {};
|
48
|
-
const seriesItem = seriesNodes[i];
|
49
|
-
if(seriesItem) {
|
50
|
-
currSeriesNode = seriesItem;
|
51
|
-
}else {
|
52
|
-
const newSeriesItem = JSON.parse(JSON.stringify(seriesNodes[0]));
|
53
|
-
newSeriesItem.itemStyle.normal.lineStyle.color = echartsColorData[i];
|
54
|
-
newSeriesItem.itemStyle.normal.color = echartsColorData[i];
|
55
|
-
currSeriesNode = newSeriesItem;
|
56
|
-
}
|
57
|
-
if(realSeriesNode.name) {
|
58
|
-
currSeriesNode.name = realSeriesNode.name;
|
59
|
-
legendData.push(realSeriesNode.name);
|
60
|
-
legendChange = true;
|
61
|
-
}
|
62
|
-
currSeriesNode.data = realSeriesNode.data;
|
63
|
-
seriesData.push(currSeriesNode);
|
64
|
-
}
|
65
|
-
if(option.legend && legendChange) option.legend.data = legendData; // 为角标数据赋值
|
66
|
-
option.series = seriesData;
|
67
|
-
}
|
68
|
-
|
69
|
-
export function barPileStaticDataAuto(option, data, appearance) {
|
70
|
-
if(data && data.XData) option.yAxis[0].data = data.XData;
|
71
|
-
if(!(data && data.seriesData && data.seriesData.length)) return;
|
72
|
-
const seriesData = data.seriesData[0].data;
|
73
|
-
option.series[0].data = seriesData;
|
74
|
-
const data2 = [];
|
75
|
-
for (let i = 0; i < seriesData.length; i++) {
|
76
|
-
const dr = appearance.total[i] ? appearance.total[i].value - Number(seriesData[i]) : data.seriesData[1].data[i];
|
77
|
-
data2.push(dr);
|
78
|
-
}
|
79
|
-
option.series[1].data = data2;
|
80
|
-
}
|
81
|
-
|
82
|
-
/**
|
83
|
-
* TOP排行-电量仪实时数据
|
84
|
-
* @param option 图表配置数据
|
85
|
-
* @param data 实时图表数据
|
86
|
-
* @param appearance 自定义配置数据
|
87
|
-
*/
|
88
|
-
export function topRankingListAuto(option, data, appearance) {
|
89
|
-
if(data && data.XData) option.yAxis[0].data = data.XData;
|
90
|
-
if(!(data && data.seriesData && data.seriesData.length)) return;
|
91
|
-
if(appearance.type === 'TOPRanking') {
|
92
|
-
if(appearance.total && appearance.total.length) return;
|
93
|
-
option.series[0].data = data.seriesData[0].data;
|
94
|
-
}else {
|
95
|
-
const seriesData = data.seriesData[0].data;
|
96
|
-
option.yAxis[1].data = seriesData;
|
97
|
-
for (let i = 0; i < option.series.length; i++) {
|
98
|
-
const node = option.series[i];
|
99
|
-
node.symbolBoundingData = data.total;
|
100
|
-
node.data = seriesData;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}
|
104
|
-
/**
|
105
|
-
* 散点图-分数实时数据
|
106
|
-
* @param option 图表配置数据
|
107
|
-
* @param data 实时图表数据
|
108
|
-
*/
|
109
|
-
export function scatterDataAuto(option, data) {
|
110
|
-
if(data && data.XData) option.xAxis[0].data = data.XData;
|
111
|
-
if(!(data && data.seriesData && data.seriesData.length)) return;
|
112
|
-
const { scatterData, legend, yData } = convertScatter3DTo2D(data);
|
113
|
-
option.legend.data = [...legend];
|
114
|
-
option.yAxis[0].data = [...yData];
|
115
|
-
for (let i = 0; i < option.series.length; i++) {
|
116
|
-
const seriesNode = option.series[i];
|
117
|
-
const name = option.legend.data[i];
|
118
|
-
seriesNode.name = name;
|
119
|
-
seriesNode.data = scatterData[name];
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
function convertScatter3DTo2D(arr3d) {
|
124
|
-
const { XData, seriesData } = arr3d;
|
125
|
-
const scatterData = {};
|
126
|
-
const legend = [];
|
127
|
-
const yData = new Set();
|
128
|
-
// 第一层遍历
|
129
|
-
for (let d = 0, depth = seriesData.length; d < depth; d++) {
|
130
|
-
const areaData = seriesData[d];
|
131
|
-
const areaName = areaData.name;
|
132
|
-
if(!scatterData[areaName]) scatterData[areaName] = [];
|
133
|
-
legend.push(areaData.name);
|
134
|
-
// 第二层遍历
|
135
|
-
const statusData = areaData.data;
|
136
|
-
for (let h = 0, height = statusData.length; h < height; h++) {
|
137
|
-
const issues = statusData[h];
|
138
|
-
const statusName = XData[h];
|
139
|
-
// 第三层遍历
|
140
|
-
for (let w = 0, width = issues.length; w < width; w++) {
|
141
|
-
const { name, value } = issues[w];
|
142
|
-
yData.add(name);
|
143
|
-
if(value) scatterData[areaName].push([statusName, name, Number(value)]);
|
144
|
-
}
|
145
|
-
}
|
146
|
-
}
|
147
|
-
return {
|
148
|
-
scatterData,
|
149
|
-
legend,
|
150
|
-
yData
|
151
|
-
};
|
152
|
-
}
|
153
|
-
|
154
|
-
/**
|
155
|
-
* 环形设备告警数量实时数据
|
156
|
-
* @param option 图表配置数据
|
157
|
-
* @param data 实时图表数据
|
158
|
-
* @param total 总数
|
159
|
-
* @param count 告警数
|
160
|
-
*/
|
161
|
-
export function pieRingAssetTotalAuto(option, data, total, count) {
|
162
|
-
if(data && data.length > 1) {
|
163
|
-
total = parseInt(data[0].value);
|
164
|
-
count = parseInt(data[1].value);
|
165
|
-
}
|
166
|
-
option.title.text = '{v|'+count+'}{unit|/'+total+'台}';
|
167
|
-
const value1 = ((100 / total) * count).toFixed(6);
|
168
|
-
option.series[0].data[0].value = value1;
|
169
|
-
option.series[0].data[1].value = 100 - value1;
|
170
|
-
}
|
171
|
-
|
172
|
-
/**
|
173
|
-
*
|
174
|
-
* @param option 图表配置数据
|
175
|
-
* @param data 实时图表数据
|
176
|
-
* @param proportion 默认百分数
|
177
|
-
*/
|
178
|
-
export function pieRingProportionAuto(option, data, proportion) {
|
179
|
-
if(data && data.length) {
|
180
|
-
proportion = Number(data[0].value);
|
181
|
-
}
|
182
|
-
if(!option.series[0].data[0].label.normal.formatter) option.series[0].data[0].label.normal.formatter = function(params){
|
183
|
-
return params.value ? `{v|${params.value}}{unit|%}` : `{v|${params.value}}`;
|
184
|
-
}
|
185
|
-
option.series[0].data[0].value = proportion;
|
186
|
-
option.series[0].data[1].value = 100 - proportion;
|
187
|
-
}
|
188
|
-
|
189
|
-
/**
|
190
|
-
* 饼图环形图默认展示 实时数据
|
191
|
-
* @param option 图表配置数据
|
192
|
-
* @param data 实时图表数据
|
193
|
-
*/
|
194
|
-
export function pieRingNormalAuto(option, data) {
|
195
|
-
if(!(data && data.length)) return;
|
196
|
-
const colors = option.color || echartsColorData;
|
197
|
-
const seriesData = [];
|
198
|
-
data.map((chd, index) => {
|
199
|
-
seriesData.push({
|
200
|
-
itemStyle: { color: colors[index] },
|
201
|
-
name: chd.name,
|
202
|
-
value: chd.value
|
203
|
-
})
|
204
|
-
})
|
205
|
-
option.series[0].data = seriesData;
|
206
|
-
}
|
207
|
-
|
208
|
-
/**
|
209
|
-
* 仪表盘默认展示 实时数据
|
210
|
-
* @param option 图表配置数据
|
211
|
-
* @param data 实时图表数据
|
212
|
-
*/
|
213
|
-
export function gaugeNormalAuto(option, data) {
|
214
|
-
if(!data) return;
|
215
|
-
// 仪表盘分两种,分别有不同的取值方式,下面两行先注释掉
|
216
|
-
// node.appearance.title.text = data.name;
|
217
|
-
// option.title.text = data.name;
|
218
|
-
option.series[0].data[0].value = data.value;
|
219
|
-
}
|
@@ -1,3 +0,0 @@
|
|
1
|
-
export declare function getPie3D(internalDiameterRatio: Number, type: String, appearance: {}, labelLineData: any, realData: any): {};
|
2
|
-
export declare function getParametricEquation(startRatio: Number, endRatio: Number, isSelected: Boolean, isHovered: Boolean, k: any, h: Number): {};
|
3
|
-
export declare function set3DPieMouseHover(myChart: object, type: String, option: {}, valueData: any): void;
|