dcim-topology2d 1.1.6 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart-diagram/src/echarts/index.js +88 -96
- package/chart-diagram/src/register.js +3 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +4 -4
- package/chart-diagram/src/utils/changeOptions.js +172 -144
- package/chart-diagram/src/utils/conversion.d.ts +12 -12
- package/chart-diagram/src/utils/conversion.js +278 -137
- package/chart-diagram/src/utils/render.d.ts +5 -0
- package/chart-diagram/src/utils/render.js +107 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/src/activeLayer.js +0 -6
- package/core/src/canvas.js +1 -0
- package/core/src/common.d.ts +1 -2
- package/core/src/common.js +123 -540
- package/core/src/core.js +61 -46
- package/core/src/divLayer.d.ts +0 -3
- package/core/src/divLayer.js +13 -34
- package/core/src/element/common.d.ts +5 -0
- package/core/src/element/common.js +52 -0
- package/core/src/element/iframe.d.ts +3 -0
- package/core/src/element/iframe.js +12 -0
- package/core/src/element/index.d.ts +4 -0
- package/core/src/element/index.js +4 -0
- package/core/src/element/select.d.ts +11 -0
- package/core/src/element/select.js +199 -0
- package/core/src/element/tab.d.ts +1 -0
- package/core/src/element/tab.js +22 -0
- package/core/src/healps/changeData.d.ts +1 -2
- package/core/src/healps/changeData.js +16 -122
- package/core/src/middles/default.js +3 -1
- package/core/src/middles/nodes/arbitrarygraph.js +11 -9
- package/core/src/middles/nodes/formselect.d.ts +2 -0
- package/core/src/middles/nodes/formselect.js +73 -0
- package/core/src/middles/nodes/iframe.js +21 -4
- package/core/src/middles/nodes/index.d.ts +1 -0
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/models/node.d.ts +4 -0
- package/core/src/models/node.js +24 -22
- package/core/src/models/pen.js +1 -2
- package/core/src/models/rect.js +2 -2
- package/core/src/options.d.ts +1 -0
- package/core/src/preview.js +45 -31
- package/core/src/renderLayer.d.ts +10 -6
- package/core/src/renderLayer.js +36 -43
- package/core/src/store/data.d.ts +16 -17
- package/core/src/store/data.js +36 -14
- package/core/src/utils/assignment.d.ts +6 -3
- package/core/src/utils/assignment.js +84 -15
- package/core/src/utils/construction.d.ts +9 -3
- package/core/src/utils/construction.js +6 -1
- package/core/src/utils/conversion.d.ts +3 -0
- package/core/src/utils/conversion.js +67 -0
- package/core/src/utils/index.d.ts +1 -1
- package/core/src/utils/index.js +1 -1
- package/core/src/utils/math.d.ts +1 -0
- package/core/src/utils/math.js +3 -0
- package/core/src/utils/onmousevent.d.ts +3 -0
- package/core/src/utils/onmousevent.js +28 -7
- package/core/src/utils/params.d.ts +7 -0
- package/core/src/utils/params.js +125 -0
- package/package.json +1 -1
- package/static/echartsDefaultData.js +27 -107
- package/static/element.js +14 -0
- package/static/form.js +11 -0
- package/static/index.js +2 -1
- package/store/actions.js +17 -0
- package/store/clear.js +72 -0
- package/store/index.js +2 -0
- package/style/common.css +18 -0
- package/style/editor.css +13 -0
- package/style/index.css +3 -12
- package/style/select.css +143 -0
- package/core/src/utils/dom.d.ts +0 -9
- package/core/src/utils/dom.js +0 -103
- package/core/src/utils/dom.js.map +0 -1
- package/static/echartsStore.js +0 -14
@@ -1,106 +1,98 @@
|
|
1
|
-
import {
|
1
|
+
import {s8, createDiv, rectangle, commonStore} from '../../../core';
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
setMapGlobalOptions,
|
11
|
-
setMapDataOptions
|
3
|
+
setMapLineBarOptions,
|
4
|
+
setMapGaugeOptions,
|
5
|
+
setMapRingOptions,
|
6
|
+
setMap3dBarOptions,
|
7
|
+
setMapTopOptions,
|
8
|
+
setMapGlobalOptions,
|
9
|
+
setMapDataOptions
|
12
10
|
} from '../utils';
|
13
|
-
import {
|
11
|
+
import {echartsTypeMap} from '../../../static';
|
12
|
+
import {echartsDataPool, echartsOptionsPool} from '../../../store';
|
14
13
|
|
15
14
|
export function echarts(ctx, node) {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
node.data = JSON.parse(node.data)
|
27
|
-
}
|
28
|
-
if (!node.data.echarts) {
|
29
|
-
return
|
30
|
-
}
|
31
|
-
if (!node.elementId) {
|
32
|
-
node.elementId = s8()
|
33
|
-
}
|
34
|
-
const currentElement = document.getElementById(node.id)
|
35
|
-
if (!node.elementLoaded && !currentElement) {
|
36
|
-
echartsDataStore[node.id] = {
|
37
|
-
div: createDiv(node)
|
15
|
+
if (!(commonStore[node.TID] && commonStore[node.TID].data.dataResize)) return;
|
16
|
+
//console.log('echarts绘制-----node', node);
|
17
|
+
// if(currentElement) currentElement.style.display = !node.visible ? 'none': 'block';
|
18
|
+
// if(!node.visible) return;
|
19
|
+
// 绘制一个底图,类似于占位符。
|
20
|
+
rectangle(ctx, node)
|
21
|
+
// tslint:disable-next-line:no-shadowed-variable
|
22
|
+
var echarts = echartsDataPool.echarts || window.echarts
|
23
|
+
if (!node.data || !echarts) {
|
24
|
+
return
|
38
25
|
}
|
39
|
-
node.
|
40
|
-
|
41
|
-
|
42
|
-
node.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
// 环形图
|
67
|
-
if (appearance.type === 'ring') option = setMapRingOptions(option, node);
|
68
|
-
// 3d 柱状图
|
69
|
-
if (appearance.type === '3dBar') option = setMap3dBarOptions(option, node);
|
70
|
-
// Top排行榜
|
71
|
-
if (appearance.type === 'TOP') option = setMapTopOptions(option, node);
|
72
|
-
//option.title = appearance.title;
|
73
|
-
option.backgroundColor = appearance.backgroundColor;
|
74
|
-
echartsOptionsStore[node.id] = option;
|
75
|
-
if(!isLocked) mapChart.clear();
|
76
|
-
}else {
|
77
|
-
// 【锁定状态且option值已初始化完成】
|
78
|
-
option = setMapDataOptions(option, node);
|
79
|
-
}
|
80
|
-
// if (window.location.pathname.includes('workspace')) mapChart.clear();
|
81
|
-
clearInterval(currentChartNode.timeTicket);
|
82
|
-
currentChartNode.timeTicket = null;
|
83
|
-
// 自动滑动展示数据
|
84
|
-
if(appearance.timeTicket) {
|
85
|
-
mapChart.off('mouseover');
|
86
|
-
mapChart.off('mouseout');
|
87
|
-
mapChart.on('mouseover', function(){
|
88
|
-
setMapStopAutoMoveOptions(currentChartNode);
|
89
|
-
});
|
90
|
-
mapChart.on('mouseout', function(){
|
91
|
-
setMapAutoMoveOptions(option, currentChartNode, node, function(chartNode){
|
92
|
-
return mapChart.setOption(chartNode);
|
93
|
-
})
|
26
|
+
if (typeof node.data === 'string') {
|
27
|
+
node.data = JSON.parse(node.data)
|
28
|
+
}
|
29
|
+
if (!node.data.echarts) {
|
30
|
+
return
|
31
|
+
}
|
32
|
+
if (!node.elementId) {
|
33
|
+
node.elementId = s8()
|
34
|
+
}
|
35
|
+
let echartsData = echartsDataPool[node.id];
|
36
|
+
if (!node.elementLoaded && !(echartsData && echartsData.div)) {
|
37
|
+
if(!echartsData) {
|
38
|
+
echartsData = {
|
39
|
+
div: createDiv(node)
|
40
|
+
};
|
41
|
+
}else {
|
42
|
+
echartsData.div = createDiv(node);
|
43
|
+
}
|
44
|
+
node.elementLoaded = true
|
45
|
+
document.body.appendChild(echartsData.div)
|
46
|
+
// 添加当前节点到div层
|
47
|
+
node.addToDiv()
|
48
|
+
echartsData.chart = echarts.init(echartsData.div, node.data.echarts.theme)
|
49
|
+
node.elementRendered = false
|
50
|
+
// 等待父div先渲染完成,避免初始图表控件太大
|
51
|
+
setTimeout(function () {
|
52
|
+
echartsData.chart.resize()
|
94
53
|
});
|
95
|
-
|
96
|
-
|
54
|
+
echartsDataPool[node.id] = echartsData;
|
55
|
+
}
|
56
|
+
if (!node.elementRendered) {
|
57
|
+
const appearance = node.appearance;
|
58
|
+
// 初始化时,等待父div先渲染完成,避免初始图表控件太大。
|
59
|
+
setTimeout(function () {
|
60
|
+
let option = node.data.echarts.option;
|
61
|
+
if(!(echartsData && echartsData.chart)) return;
|
62
|
+
const isLocked = commonStore[node.TID] && commonStore[node.TID].data.locked;
|
63
|
+
if (!isLocked || !echartsOptionsPool[node.id]) {
|
64
|
+
// 【未锁定(编辑)状态, options未初始化的状态】
|
65
|
+
if (!appearance.type) appearance.type = echartsTypeMap[`type_${option.displayMode}`]; // 兼容旧数据配置
|
66
|
+
// 公共配置 Top排行榜跳过公共属性配置
|
67
|
+
if (option.displayMode !== 4) setMapGlobalOptions(option, node);
|
68
|
+
// 折线图和柱状图
|
69
|
+
if (['line', 'bar'].includes(appearance.type)) setMapLineBarOptions(option, node);
|
70
|
+
// 仪表盘
|
71
|
+
if (appearance.type === 'gauge') setMapGaugeOptions(option, node);
|
72
|
+
// 环形图 || 饼图
|
73
|
+
if (appearance.type.includes('ring') || appearance.type.includes('pie')) setMapRingOptions(option, node);
|
74
|
+
// 3d 柱状图
|
75
|
+
if (appearance.type === '3dBar') setMap3dBarOptions(option, node);
|
76
|
+
// Top排行榜
|
77
|
+
if (appearance.type === 'TOP') setMapTopOptions(option, node);
|
78
|
+
//option.title = appearance.title;
|
79
|
+
option.backgroundColor = appearance.backgroundColor;
|
80
|
+
echartsOptionsPool[node.id] = {
|
81
|
+
option: JSON.parse(JSON.stringify(option)),
|
82
|
+
data: {
|
83
|
+
appearance,
|
84
|
+
id: node.id,
|
85
|
+
params: node.data.params
|
86
|
+
}
|
87
|
+
};
|
88
|
+
if (!isLocked) echartsData.chart.clear();
|
89
|
+
}
|
90
|
+
// echarts 数据渲染更新
|
91
|
+
setMapDataOptions(option, node);
|
92
|
+
|
93
|
+
node.elementRendered = true;
|
97
94
|
})
|
98
|
-
|
99
|
-
mapChart.setOption(option);
|
100
|
-
mapChart.resize();
|
101
|
-
node.elementRendered = true;
|
102
|
-
})
|
103
|
-
}
|
95
|
+
}
|
104
96
|
}
|
105
97
|
|
106
98
|
//# sourceMappingURL=index.js.map
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { registerNode } from '../../core';
|
2
2
|
import { echarts } from './echarts';
|
3
|
-
import {
|
3
|
+
import { echartsDataPool } from '../../store';
|
4
4
|
// import './echarts/echarts.min.js';
|
5
5
|
export function register(_echarts) {
|
6
|
-
|
7
|
-
// if (process.browser && !
|
6
|
+
echartsDataPool.echarts = _echarts;
|
7
|
+
// if (process.browser && !echartsDataPool.echarts && !window.echarts) {
|
8
8
|
// //loadJS('https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts.min.js', null, true);
|
9
9
|
// loadJS(`${location.origin}/libary/echarts.min.js`, null, true);
|
10
10
|
// }
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export declare function setChartLegendData<T>(legend: T, appearance: T):
|
2
|
-
export declare function setChartXAxisData<T>(xAxis: [], appearance: T):
|
3
|
-
export declare function setChartYAxisData<T>(yAxis: [], appearance: T):
|
4
|
-
export declare function setLineSeriesStyleData<T>(series: [], appearance: T):
|
1
|
+
export declare function setChartLegendData<T>(legend: T, appearance: T): void;
|
2
|
+
export declare function setChartXAxisData<T>(xAxis: [], appearance: T): void;
|
3
|
+
export declare function setChartYAxisData<T>(yAxis: [], appearance: T): void;
|
4
|
+
export declare function setLineSeriesStyleData<T>(series: [], appearance: T): void;
|
@@ -1,163 +1,191 @@
|
|
1
1
|
// 初始化图例数据和图例配置数据
|
2
2
|
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
echartsLegendDefaultData,
|
4
|
+
echartsXAxisDefaultStyleData,
|
5
|
+
echartsYAxisDefaultStyleData,
|
6
|
+
echartsLineSeriesStyleData,
|
7
|
+
echartsColorData
|
7
8
|
} from '../../../static';
|
9
|
+
|
8
10
|
// 图表X轴数据
|
9
|
-
export function setChartXAxisData(xAxis, appearance){
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
export function setChartXAxisData(xAxis, appearance) {
|
12
|
+
for (let i = 0; i < xAxis.length; i++) {
|
13
|
+
const item = xAxis[i];
|
14
|
+
if (!item.axisLabel) {
|
15
|
+
item.axisLabel = JSON.parse(JSON.stringify(echartsXAxisDefaultStyleData['x1AxisLabel']));
|
16
|
+
}
|
17
|
+
const axisLabelStr = `x${i + 1}AxisLabel`;
|
18
|
+
if (!appearance[axisLabelStr]) {
|
19
|
+
appearance[axisLabelStr] = JSON.parse(JSON.stringify(echartsXAxisDefaultStyleData[axisLabelStr]));
|
20
|
+
Object.assign(appearance[axisLabelStr], item.axisLabel);
|
21
|
+
} else {
|
22
|
+
item.axisLabel.color = appearance[axisLabelStr].color || '';
|
23
|
+
item.axisLabel.fontSize = appearance[axisLabelStr].fontSize || 12;
|
24
|
+
}
|
14
25
|
}
|
15
|
-
|
16
|
-
if(!appearance[axisLabelStr]) {
|
17
|
-
appearance[axisLabelStr] = JSON.parse(JSON.stringify(echartsXAxisDefaultStyleData[axisLabelStr]));
|
18
|
-
Object.assign(appearance[axisLabelStr], item.axisLabel);
|
19
|
-
}else {
|
20
|
-
item.axisLabel.color = appearance[axisLabelStr].color || '';
|
21
|
-
item.axisLabel.fontSize = appearance[axisLabelStr].fontSize || 12;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
return xAxis;
|
26
|
+
//return xAxis;
|
25
27
|
}
|
28
|
+
|
26
29
|
// 图表Y轴数据
|
27
|
-
export function setChartYAxisData(yAxis, appearance){
|
28
|
-
|
29
|
-
|
30
|
-
}
|
31
|
-
if(!appearance.ysplitLineLineStyle && yAxis[0].splitLine.show) {
|
32
|
-
appearance.ysplitLineLineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
|
33
|
-
}
|
34
|
-
for (let i = 0; i < yAxis.length; i++) {
|
35
|
-
const item = yAxis[i];
|
36
|
-
if(!item.axisLabel.textStyle) {
|
37
|
-
item.axisLabel.textStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['y1axisLabelTextStyle']));
|
38
|
-
}
|
39
|
-
if(!item.splitLine.lineStyle) {
|
40
|
-
item.splitLine.lineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
|
41
|
-
}
|
42
|
-
const axisLabelTextStyleStr = `y${i+1}axisLabelTextStyle`;
|
43
|
-
if(!appearance[axisLabelTextStyleStr]) {
|
44
|
-
appearance[axisLabelTextStyleStr] = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData[axisLabelTextStyleStr]));
|
45
|
-
Object.assign(appearance[axisLabelTextStyleStr], item.axisLabel.textStyle);
|
46
|
-
}else {
|
47
|
-
const axisLabelTextStyNode = appearance[axisLabelTextStyleStr];
|
48
|
-
item.axisLabel.textStyle.color = axisLabelTextStyNode.color || '';
|
49
|
-
item.axisLabel.textStyle.fontSize = axisLabelTextStyNode.fontSize || '12';
|
50
|
-
item.axisLabel.textStyle.padding = axisLabelTextStyNode.padding || [20, 20, 20, 20];
|
51
|
-
}
|
52
|
-
if(appearance.ysplitLineLineStyle) {
|
53
|
-
item.splitLine.show = appearance.ySplitLineShow;
|
54
|
-
const axisLabelTextStyNode = appearance.ysplitLineLineStyle;
|
55
|
-
item.splitLine.lineStyle.type = axisLabelTextStyNode.type || 'solid';
|
56
|
-
item.splitLine.lineStyle.color = axisLabelTextStyNode.color || '';
|
30
|
+
export function setChartYAxisData(yAxis, appearance) {
|
31
|
+
if (typeof appearance.ySplitLineShow !== 'boolean') {
|
32
|
+
appearance.ySplitLineShow = yAxis[0].splitLine.show;
|
57
33
|
}
|
58
|
-
|
59
|
-
|
60
|
-
appearance[minMaxStr] = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData[minMaxStr]));
|
61
|
-
const minMaxParams = {
|
62
|
-
max: item.max,
|
63
|
-
min: item.min,
|
64
|
-
interval: item.interval
|
65
|
-
};
|
66
|
-
Object.assign(appearance[minMaxStr], minMaxParams);
|
67
|
-
}else {
|
68
|
-
const minMaxNode = appearance[minMaxStr];
|
69
|
-
if(minMaxNode) {
|
70
|
-
item.max = minMaxNode.max;
|
71
|
-
item.min = minMaxNode.min;
|
72
|
-
item.interval = minMaxNode.interval;
|
73
|
-
}
|
34
|
+
if (!appearance.ysplitLineLineStyle && yAxis[0].splitLine.show) {
|
35
|
+
appearance.ysplitLineLineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
|
74
36
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
37
|
+
for (let i = 0; i < yAxis.length; i++) {
|
38
|
+
const item = yAxis[i];
|
39
|
+
if (!item.axisLabel.textStyle) {
|
40
|
+
item.axisLabel.textStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['y1axisLabelTextStyle']));
|
41
|
+
}
|
42
|
+
if (!item.splitLine.lineStyle) {
|
43
|
+
item.splitLine.lineStyle = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData['ysplitLineLineStyle']));
|
44
|
+
}
|
45
|
+
const axisLabelTextStyleStr = `y${i + 1}axisLabelTextStyle`;
|
46
|
+
if (!appearance[axisLabelTextStyleStr]) {
|
47
|
+
appearance[axisLabelTextStyleStr] = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData[axisLabelTextStyleStr]));
|
48
|
+
Object.assign(appearance[axisLabelTextStyleStr], item.axisLabel.textStyle);
|
49
|
+
} else {
|
50
|
+
const axisLabelTextStyNode = appearance[axisLabelTextStyleStr];
|
51
|
+
item.axisLabel.textStyle.color = axisLabelTextStyNode.color || '';
|
52
|
+
item.axisLabel.textStyle.fontSize = axisLabelTextStyNode.fontSize || '12';
|
53
|
+
item.axisLabel.textStyle.padding = axisLabelTextStyNode.padding || [20, 20, 20, 20];
|
54
|
+
}
|
55
|
+
if (appearance.ysplitLineLineStyle) {
|
56
|
+
item.splitLine.show = appearance.ySplitLineShow;
|
57
|
+
const axisLabelTextStyNode = appearance.ysplitLineLineStyle;
|
58
|
+
item.splitLine.lineStyle.type = axisLabelTextStyNode.type || 'solid';
|
59
|
+
item.splitLine.lineStyle.color = axisLabelTextStyNode.color || '';
|
60
|
+
}
|
61
|
+
const minMaxStr = `y${i + 1}MinMaxData`;
|
62
|
+
if (!appearance[minMaxStr] && item.max) {
|
63
|
+
appearance[minMaxStr] = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData[minMaxStr]));
|
64
|
+
const minMaxParams = {
|
65
|
+
max: item.max,
|
66
|
+
min: item.min,
|
67
|
+
interval: item.interval
|
68
|
+
};
|
69
|
+
Object.assign(appearance[minMaxStr], minMaxParams);
|
70
|
+
} else {
|
71
|
+
const minMaxNode = appearance[minMaxStr];
|
72
|
+
if (minMaxNode) {
|
73
|
+
item.max = minMaxNode.max;
|
74
|
+
item.min = minMaxNode.min;
|
75
|
+
item.interval = minMaxNode.interval;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
const nameStr = `y${i + 1}NameData`;
|
79
|
+
if (!appearance[nameStr] && item.name) {
|
80
|
+
appearance[nameStr] = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData[nameStr]));
|
81
|
+
const nameParams = {
|
82
|
+
name: item.name,
|
83
|
+
nameTextStyle: {
|
84
|
+
color: item.nameTextStyle.color,
|
85
|
+
padding: item.nameTextStyle.padding,
|
86
|
+
},
|
87
|
+
nameGap: item.nameGap
|
88
|
+
};
|
89
|
+
Object.assign(appearance[nameStr], nameParams);
|
90
|
+
} else {
|
91
|
+
const nameNode = appearance[nameStr];
|
92
|
+
if (nameNode) {
|
93
|
+
item.name = nameNode.name;
|
94
|
+
item.nameTextStyle.color = nameNode.nameTextStyle.color;
|
95
|
+
item.nameTextStyle.padding = nameNode.nameTextStyle.padding;
|
96
|
+
item.nameGap = nameNode.nameGap;
|
97
|
+
}
|
98
|
+
}
|
95
99
|
}
|
96
|
-
|
97
|
-
return yAxis;
|
100
|
+
//return yAxis;
|
98
101
|
}
|
102
|
+
|
99
103
|
// 图表图例数据
|
100
104
|
export function setChartLegendData(legend, appearance) {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
105
|
+
if (!legend.formatter) legend.formatter = ['{a|{name}}'].join('\n');
|
106
|
+
// 设置默认图例文字配置,如果想改变初始化文字属性,在 appearance中配置即可
|
107
|
+
if (!legend.textStyle) legend.textStyle = {
|
108
|
+
color: '#fff',
|
109
|
+
height: 8
|
110
|
+
};
|
111
|
+
legend.textStyle.rich = {
|
112
|
+
a: {
|
113
|
+
fontSize: 12,
|
114
|
+
verticalAlign: 'bottom',
|
115
|
+
}
|
116
|
+
};
|
117
|
+
if (!appearance.legend) {
|
118
|
+
appearance.legend = JSON.parse(JSON.stringify(echartsLegendDefaultData));
|
119
|
+
Object.assign(appearance.legend, legend);
|
120
|
+
delete appearance.legend['data'];
|
121
|
+
delete appearance.legend['textStyle'];
|
122
|
+
} else {
|
123
|
+
const {
|
124
|
+
icon,
|
125
|
+
itemWidth,
|
126
|
+
itemHeight,
|
127
|
+
itemGap,
|
128
|
+
top,
|
129
|
+
right,
|
130
|
+
bottom,
|
131
|
+
left,
|
132
|
+
padding,
|
133
|
+
color,
|
134
|
+
height,
|
135
|
+
fontSize
|
136
|
+
} = appearance.legend;
|
137
|
+
legend.icon = icon || '';
|
138
|
+
legend.itemWidth = itemWidth || 12;
|
139
|
+
legend.itemHeight = itemHeight || 12;
|
140
|
+
legend.itemGap = itemGap || 8;
|
141
|
+
legend.top = top || 'auto';
|
142
|
+
legend.right = right || 'auto';
|
143
|
+
legend.bottom = bottom || 'auto';
|
144
|
+
legend.left = left || 'auto';
|
145
|
+
legend.padding = padding || [5, 5, 5, 5];
|
146
|
+
legend.textStyle.color = color || '';
|
147
|
+
legend.textStyle.height = height || 8;
|
148
|
+
legend.textStyle.rich.a = fontSize || 12;
|
111
149
|
}
|
112
|
-
|
113
|
-
if (!appearance.legend) {
|
114
|
-
appearance.legend = JSON.parse(JSON.stringify(echartsLegendDefaultData));
|
115
|
-
Object.assign(appearance.legend, legend);
|
116
|
-
delete appearance.legend['data'];
|
117
|
-
delete appearance.legend['textStyle'];
|
118
|
-
}else {
|
119
|
-
const { icon, itemWidth, itemHeight, itemGap, top, right, bottom, left, padding, color, height, fontSize } = appearance.legend;
|
120
|
-
legend.icon = icon || '';
|
121
|
-
legend.itemWidth = itemWidth || 12;
|
122
|
-
legend.itemHeight = itemHeight || 12;
|
123
|
-
legend.itemGap = itemGap || 8;
|
124
|
-
legend.top = top || 'auto';
|
125
|
-
legend.right = right || 'auto';
|
126
|
-
legend.bottom = bottom || 'auto';
|
127
|
-
legend.left = left || 'auto';
|
128
|
-
legend.padding = padding || [5, 5, 5, 5];
|
129
|
-
legend.textStyle.color = color || '';
|
130
|
-
legend.textStyle.height = height || 8;
|
131
|
-
legend.textStyle.rich.a = fontSize || 12;
|
132
|
-
}
|
133
|
-
return legend;
|
150
|
+
//return legend;
|
134
151
|
}
|
152
|
+
|
135
153
|
// 图表曲线数据配置
|
136
154
|
export function setLineSeriesStyleData(series, appearance) {
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
155
|
+
let seriesOptions = [];
|
156
|
+
for (let i = 0; i < series.length; i++) {
|
157
|
+
const defaultSeriesStyle = JSON.parse(JSON.stringify(echartsLineSeriesStyleData));
|
158
|
+
const item = series[i];
|
159
|
+
let appearanceSeries = appearance.seriesOptions && appearance.seriesOptions[i];
|
160
|
+
if(!appearanceSeries) {
|
161
|
+
appearanceSeries = defaultSeriesStyle;
|
162
|
+
appearanceSeries.name = item.name;
|
163
|
+
appearanceSeries.itemLineStyle.color = i === 0 ? defaultSeriesStyle.itemLineStyle.color : echartsColorData[i];
|
164
|
+
seriesOptions.push(defaultSeriesStyle);
|
165
|
+
}else {
|
166
|
+
seriesOptions.push(appearanceSeries);
|
167
|
+
}
|
168
|
+
item.symbol = appearanceSeries.symbol;
|
169
|
+
item.smooth = appearanceSeries.smooth;
|
170
|
+
item.symbolSize = appearanceSeries.symbolSize || 18;
|
171
|
+
item.itemStyle = {
|
172
|
+
normal: {
|
173
|
+
color: appearanceSeries.itemLineStyle.color,
|
174
|
+
lineStyle: appearanceSeries.itemLineStyle
|
175
|
+
}
|
176
|
+
};
|
177
|
+
if (appearanceSeries.area) {
|
178
|
+
item.areaStyle = {
|
179
|
+
color: appearanceSeries.areaColor && {...appearanceSeries.areaColor} || {...defaultSeriesStyle.areaColor}
|
180
|
+
};
|
181
|
+
appearanceSeries.linear ?
|
182
|
+
item.areaStyle.color.colorStops = [...appearanceSeries.areaColorStops] :
|
183
|
+
item.areaStyle = Object.assign({}, item.areaStyle, {color: appearanceSeries.areaBgColor || 'rgba(49, 144, 255, 0.21)'});
|
184
|
+
} else {
|
185
|
+
if (item.areaStyle) delete item['areaStyle'];
|
186
|
+
}
|
160
187
|
}
|
161
|
-
|
162
|
-
|
188
|
+
|
189
|
+
appearance.seriesOptions = seriesOptions;
|
190
|
+
//return series;
|
163
191
|
}
|
@@ -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;
|