dcim-topology2d 1.1.6 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +0 -2
- package/chart-diagram/index.js +0 -1
- package/chart-diagram/src/echarts/index.d.ts +2 -1
- package/chart-diagram/src/echarts/index.js +104 -106
- 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 -1
- package/core/index.js +0 -1
- package/core/src/activeLayer.d.ts +10 -2
- package/core/src/activeLayer.js +41 -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 +18 -17
- package/core/src/common.d.ts +5 -5
- package/core/src/common.js +202 -172
- package/core/src/core.d.ts +4 -3
- package/core/src/core.js +321 -339
- package/core/src/divLayer.d.ts +33 -2
- package/core/src/divLayer.js +292 -41
- package/core/src/healps/changeData.d.ts +1 -1
- package/core/src/healps/changeData.js +44 -102
- 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 -51
- package/core/src/middles/index.js +2 -3
- 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 -6
- package/core/src/models/node.js +16 -29
- package/core/src/models/pen.js +7 -16
- 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.js +0 -1
- package/core/src/poll.js +2 -0
- package/core/src/preview.d.ts +13 -1
- package/core/src/preview.js +34 -56
- package/core/src/renderLayer.d.ts +3 -1
- package/core/src/renderLayer.js +31 -26
- 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/conversion.d.ts +0 -7
- package/core/src/utils/conversion.js +0 -54
- package/core/src/utils/dom.d.ts +5 -6
- package/core/src/utils/dom.js +46 -82
- package/core/src/utils/index.d.ts +0 -1
- package/core/src/utils/index.js +0 -1
- package/core/src/utils/onmousevent.js +3 -12
- 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/myShape.js +1 -1
- 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 -4
- package/chart-diagram/src/utils/changeOptions.js +0 -163
- package/chart-diagram/src/utils/conversion.d.ts +0 -17
- package/chart-diagram/src/utils/conversion.js +0 -179
- package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
- package/chart-diagram/src/utils/drawGraphic.js +0 -97
- package/chart-diagram/src/utils/index.d.ts +0 -3
- package/chart-diagram/src/utils/index.js +0 -3
- 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/iframe.d.ts +0 -2
- package/core/src/middles/nodes/iframe.js +0 -12
- package/core/src/middles/nodes/index.d.ts +0 -46
- package/core/src/middles/nodes/index.js +0 -47
- 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 -129
- package/core/src/store/data.js +0 -86
- 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 -3
- package/core/src/utils/assignment.js +0 -69
- package/static/echartsDefaultData.js +0 -239
- package/static/echartsStore.js +0 -14
- package/static/index.js +0 -2
- package/style/index.css +0 -13
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowInternalStorage(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowManuallyAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowManuallyAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + (node.rect.height * 5) / 8, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height / 8, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowManually(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowParallelAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function flowParallelAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowParallel(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowQueue(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { registerNode } from '
|
1
|
+
import { registerNode } from 'dcim-topology/core';
|
2
2
|
import { flowData, flowDataAnchors, flowDataIconRect, flowDataTextRect } from './data';
|
3
3
|
import { flowSubprocess, flowSubprocessIconRect, flowSubprocessTextRect } from './subprocess';
|
4
4
|
import { flowDb, flowDbIconRect, flowDbTextRect } from './db';
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function flowSubprocess(ctx: CanvasRenderingContext2D, node: Node): void;
|
package/layout/src/align.d.ts
CHANGED
package/layout/src/align.js
CHANGED
package/layout/src/layout.d.ts
CHANGED
package/layout/src/layout.js
CHANGED
package/package.json
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function sequenceFocusAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function sequenceFocusAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.ey, Direction.Bottom));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function sequenceFocus(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function lifelineAnchors(node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Point, Direction } from '
|
1
|
+
import { Point, Direction } from 'dcim-topology/core';
|
2
2
|
export function lifelineAnchors(node) {
|
3
3
|
node.anchors.push(new Point(node.rect.x, node.rect.y + 25, Direction.Left));
|
4
4
|
node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Node } from '
|
1
|
+
import { Node } from 'dcim-topology/core';
|
2
2
|
export declare function lifeline(ctx: CanvasRenderingContext2D, node: Node): void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { registerNode } from '
|
1
|
+
import { registerNode } from 'dcim-topology/core';
|
2
2
|
import { lifeline, lifelineAnchors, lifelineIconRect, lifelineTextRect } from './lifeline';
|
3
3
|
import { sequenceFocus, sequenceFocusAnchors, sequenceFocusIconRect, sequenceFocusTextRect } from './focus';
|
4
4
|
export function register() {
|
@@ -1,4 +0,0 @@
|
|
1
|
-
export declare function setChartLegendData<T>(legend: T, appearance: T): 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,163 +0,0 @@
|
|
1
|
-
// 初始化图例数据和图例配置数据
|
2
|
-
import {
|
3
|
-
echartsLegendDefaultData,
|
4
|
-
echartsXAxisDefaultStyleData,
|
5
|
-
echartsYAxisDefaultStyleData,
|
6
|
-
echartsLineSeriesStyleData
|
7
|
-
} from '../../../static';
|
8
|
-
// 图表X轴数据
|
9
|
-
export function setChartXAxisData(xAxis, appearance){
|
10
|
-
for (let i = 0; i < xAxis.length; i++) {
|
11
|
-
const item = xAxis[i];
|
12
|
-
if(!item.axisLabel) {
|
13
|
-
item.axisLabel = JSON.parse(JSON.stringify(echartsXAxisDefaultStyleData['x1AxisLabel']));
|
14
|
-
}
|
15
|
-
const axisLabelStr = `x${i+1}AxisLabel`;
|
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;
|
25
|
-
}
|
26
|
-
// 图表Y轴数据
|
27
|
-
export function setChartYAxisData(yAxis, appearance){
|
28
|
-
if(typeof appearance.ySplitLineShow !== 'boolean') {
|
29
|
-
appearance.ySplitLineShow = yAxis[0].splitLine.show;
|
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 || '';
|
57
|
-
}
|
58
|
-
const minMaxStr = `y${i+1}MinMaxData`;
|
59
|
-
if(!appearance[minMaxStr] && item.max){
|
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
|
-
}
|
74
|
-
}
|
75
|
-
const nameStr = `y${i+1}NameData`;
|
76
|
-
if(!appearance[nameStr] && item.name){
|
77
|
-
appearance[nameStr] = JSON.parse(JSON.stringify(echartsYAxisDefaultStyleData[nameStr]));
|
78
|
-
const nameParams = {
|
79
|
-
name: item.name,
|
80
|
-
nameTextStyle: {
|
81
|
-
color: item.nameTextStyle.color,
|
82
|
-
padding: item.nameTextStyle.padding,
|
83
|
-
},
|
84
|
-
nameGap: item.nameGap
|
85
|
-
};
|
86
|
-
Object.assign(appearance[nameStr], nameParams);
|
87
|
-
}else {
|
88
|
-
const nameNode = appearance[nameStr];
|
89
|
-
if(nameNode) {
|
90
|
-
item.name = nameNode.name;
|
91
|
-
item.nameTextStyle.color = nameNode.nameTextStyle.color;
|
92
|
-
item.nameTextStyle.padding = nameNode.nameTextStyle.padding;
|
93
|
-
item.nameGap = nameNode.nameGap;
|
94
|
-
}
|
95
|
-
}
|
96
|
-
}
|
97
|
-
return yAxis;
|
98
|
-
}
|
99
|
-
// 图表图例数据
|
100
|
-
export function setChartLegendData(legend, appearance) {
|
101
|
-
if(!legend.formatter) legend.formatter = ['{a|{name}}'].join('\n');
|
102
|
-
// 设置默认图例文字配置,如果想改变初始化文字属性,在 appearance中配置即可
|
103
|
-
if(!legend.textStyle) legend.textStyle = {
|
104
|
-
color: '#fff',
|
105
|
-
height: 8,
|
106
|
-
rich: {
|
107
|
-
a: {
|
108
|
-
fontSize: 12,
|
109
|
-
verticalAlign: 'bottom',
|
110
|
-
}
|
111
|
-
}
|
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;
|
134
|
-
}
|
135
|
-
// 图表曲线数据配置
|
136
|
-
export function setLineSeriesStyleData(series, appearance) {
|
137
|
-
const defaultSeriesStyle = JSON.parse(JSON.stringify(echartsLineSeriesStyleData));
|
138
|
-
if(!appearance.seriesOptions) appearance.seriesOptions = [defaultSeriesStyle];
|
139
|
-
for (let i = 0; i < series.length; i++) {
|
140
|
-
const item = series[i];
|
141
|
-
const appearanceSeries = appearance.seriesOptions[i] || defaultSeriesStyle;
|
142
|
-
item.symbol = appearanceSeries.symbol;
|
143
|
-
item.smooth = appearanceSeries.smooth;
|
144
|
-
item.symbolSize = appearanceSeries.symbolSize || 18;
|
145
|
-
item.itemStyle = {
|
146
|
-
normal: {
|
147
|
-
color: appearanceSeries.itemLineStyle.color,
|
148
|
-
lineStyle: appearanceSeries.itemLineStyle
|
149
|
-
}
|
150
|
-
};
|
151
|
-
if(appearanceSeries.area) {
|
152
|
-
item.areaStyle = {
|
153
|
-
color: appearanceSeries.areaColor && { ...appearanceSeries.areaColor } || { ...defaultSeriesStyle.areaColor }
|
154
|
-
};
|
155
|
-
appearanceSeries.linear ?
|
156
|
-
item.areaStyle.color.colorStops = [...appearanceSeries.areaColorStops] :
|
157
|
-
item.areaStyle = Object.assign({}, item.areaStyle, {color: appearanceSeries.areaBgColor || 'rgba(49, 144, 255, 0.21)'});
|
158
|
-
}else {
|
159
|
-
if(item.areaStyle) delete item['areaStyle'];
|
160
|
-
}
|
161
|
-
}
|
162
|
-
return series;
|
163
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
interface echartsOptions {
|
2
|
-
color: '',
|
3
|
-
xAxis: [],
|
4
|
-
yAxis: [],
|
5
|
-
series: [],
|
6
|
-
tooltip: null
|
7
|
-
}
|
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;
|
16
|
-
export declare function setMapAutoMoveOptions(option: echartsOptions, chartNode: string,node: any, callback: any): void;
|
17
|
-
export declare function setMapStopAutoMoveOptions(chartNode: string): void;
|
@@ -1,179 +0,0 @@
|
|
1
|
-
import { echartsDataRoom, echartsOptionsStore } from '../../../static';
|
2
|
-
import {
|
3
|
-
setSeriesRenderGroup,
|
4
|
-
drawGraphicShape,
|
5
|
-
setChartLegendData,
|
6
|
-
setChartXAxisData,
|
7
|
-
setChartYAxisData,
|
8
|
-
setLineSeriesStyleData
|
9
|
-
} from '../utils';
|
10
|
-
|
11
|
-
export function getXYAxisLabelVal(index, intervalNum, value) {
|
12
|
-
if (index === 0 || index % intervalNum === 0) {
|
13
|
-
return value;
|
14
|
-
} else {
|
15
|
-
return '';
|
16
|
-
}
|
17
|
-
}
|
18
|
-
// 自动滑动展示数据
|
19
|
-
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);
|
38
|
-
}
|
39
|
-
// 停止自动滑动展示数据
|
40
|
-
export function setMapStopAutoMoveOptions(chartNode) {
|
41
|
-
|
42
|
-
clearInterval(chartNode.timeTicket);
|
43
|
-
|
44
|
-
}
|
45
|
-
// 自动配置折线和柱状图的节点数据
|
46
|
-
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;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
// chartOption.yAxis[0].splitLine = node.appearance.splitLine;
|
62
|
-
return chartOption;
|
63
|
-
}
|
64
|
-
// 自动配置仪表盘的节点数据
|
65
|
-
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;
|
83
|
-
}
|
84
|
-
// 自动配置环形图和饼图的节点数据
|
85
|
-
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;
|
92
|
-
}
|
93
|
-
// 自动配置3D柱状图的节点数据
|
94
|
-
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);
|
107
|
-
seriesNode.renderItem = (params, api) => {
|
108
|
-
const seriesRenderData = setSeriesRenderGroup(appearance, api);
|
109
|
-
return {
|
110
|
-
type: 'group',
|
111
|
-
children: seriesRenderData,
|
112
|
-
};
|
113
|
-
};
|
114
|
-
}
|
115
|
-
chartOption.tooltip.formatter = function(params) {
|
116
|
-
const item = params[0];
|
117
|
-
return item.name + ' : ' + item.value;
|
118
|
-
}
|
119
|
-
return chartOption;
|
120
|
-
}
|
121
|
-
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;
|
126
|
-
}
|
127
|
-
// 公共配置
|
128
|
-
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;
|
147
|
-
}
|
148
|
-
// 实时改变图表data值
|
149
|
-
export function setMapDataOptions(option, node) {
|
150
|
-
const optionNode = echartsOptionsStore[node.id];
|
151
|
-
if (option.legend) {
|
152
|
-
optionNode.legend = option.legend;
|
153
|
-
}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;
|
161
|
-
}
|
162
|
-
}
|
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
|
-
};
|
170
|
-
}
|
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;
|
176
|
-
}
|
177
|
-
}
|
178
|
-
return optionNode;
|
179
|
-
}
|