1:坐标定位画一个框区分流向效果
let dataLists = [
{
name: '111',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [240, 0],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '222',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [105, 50],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '333',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [105, 110],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{ name: "444", symbol: "", value: [105, 180], symbolSize: [10, 10] },
{ name: "555", symbol: "", value: [40, 180], symbolSize: [10, 10] },
{ name: "666", symbol: "", value: [170, 180], symbolSize: [10, 10] },
{
name: '888',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [40, 330],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '777',
deviceType: "ZONGHE",
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [40, 230],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '999',
deviceType: "CAIJI",
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [170, 230],
x: 170,
y: 230,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{ name: "1010", symbol: "", value: [170, 270], symbolSize: [10, 10] },
{ name: "1111", symbol: "", value: [110, 270], symbolSize: [10, 10] },
{ name: "1212", symbol: "", value: [230, 270], symbolSize: [10, 10] },
{
name: '13',
deviceType: "YINGYONG",
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [110, 330],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '14',
deviceType: "YINGYONG",
symbol: "",
symbolSize: [30, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [230, 330],
x: 220,
y: 330,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '15',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [500, 50],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '16',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [500, 110],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '17',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [750, 240],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '18',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [335, 290],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '19',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [415, 290],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '20',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [495, 290],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '21',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [575, 290],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '22',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [660, 290],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '23',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [335, 210],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '24',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [415, 210],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '25',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [495, 210],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '26',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [575, 210],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{
name: '27',
symbol: "",
symbolSize: [40, 20],
label: {
color: '#53B5EA',
position: 'bottom',
},
value: [660, 210],
x: 200,
y: 500,
fixed: true,
category: 1,
itemStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 1, 0, [
{
offset: 0,
color: '#ffb402',
},
{
offset: 1,
color: '#ffdc84',
},
]),
},
},
},
{ name: "xxxxx1111", symbol: "", value: [0, 350], label: { color: '#53B5EA', position: 'top', }, symbolSize: [1, 0] },
{ name: "rectangle1", symbol: "", value: [250, 350], symbolSize: [0, 0] },
{ name: "rectangle2", symbol: "", value: [250, 20], symbolSize: [0, 0] },
{ name: "rectangle3", symbol: "", value: [0, 20], symbolSize: [0, 0] },
{ name: "xxxxxx222", symbol: "", value: [280, 350], symbolSize: [0, 0] },
{ name: "rectangle4", symbol: "", value: [800, 350], symbolSize: [0, 0] },
{ name: "rectangle5", symbol: "", value: [800, 20], symbolSize: [0, 0] },
{ name: "rectangle6", symbol: "", value: [280, 20], symbolSize: [0, 0] },
{ name: "数据采集节点", symbol: "", value: [300, 330], label: { color: '#53B5EA', position: 'top', }, symbolSize: [0, 0] },
{ name: "rectangle7", symbol: "", value: [720, 330], symbolSize: [0, 0] },
{ name: "rectangle8", symbol: "", value: [720, 160], symbolSize: [0, 0] },
{ name: "rectangle9", symbol: "", value: [300, 160], symbolSize: [0, 0] },
];
// 线指向设置
let linkesList = [
{
source: '111',
target: '333',
// deviceType: "YINGYONG",
lineStyle: {
normal: {
color: '#53B5EA',
// color: 'red',
},
},
},
{
source: '222',
target: '333',
deviceType: "YINGYONG",
lineStyle: {
normal: {
color: '#53B5EA',
// color: 'red',
},
},
},
{
source: '333',
target: '444',
deviceType: "YINGYONG",
lineStyle: {
normal: {
color: '#53B5EA',
// color: 'red',
},
},
},
{
source: '444',
target: '555',
deviceType: "CAIJI",
lineStyle: {
normal: {
color: '#53B5EA',
// color: 'red',
},
},
},
{
source: '444',
target: '666',
deviceType: "JIAOHUAN",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '555',
target: '777',
deviceType: "JIAOHUAN",
lineStyle: {
normal: {
color: '#53B5EA',
// color: 'red',
},
},
},
{
source: '777',
target: '888',
deviceType: "CAIJI",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '666',
target: '999',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '999',
target: '1010',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '1010',
target: '1111',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '1010',
target: '1212',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '1111',
target: '13',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '1212',
target: '14',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '111',
target: '16',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '15',
target: '16',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: '111',
target: '16',
deviceType: "YINGYONG",
lineStyle: {
normal: {
// color: 'red',
color: '#53B5EA',
},
},
},
{
source: 'xxxxx1111',
target: 'rectangle1',
lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle1',
target: 'rectangle2', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle2',
target: 'rectangle3', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle3',
target: 'xxxxx1111', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'xxxxxx222',
target: 'rectangle4', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle4',
target: 'rectangle5', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle5',
target: 'rectangle6', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle6',
target: 'xxxxxx222', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: '数据采集节点',
target: 'rectangle7', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle7',
target: 'rectangle8', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle8',
target: 'rectangle9', lineStyle: {
normal: {
// color: 'red',
},
},
},
{
source: 'rectangle9',
target: '数据采集节点', lineStyle: {
normal: {
// color: 'red',
},
},
},
];
let option = {
// backgroundColor: '#000',
xAxis: {
show: false,
type: 'value',
},
yAxis: {
show: false,
type: 'value',
max: 350
},
grid: {
left: 50,
right: 60,
top: 30,
bottom: 30,
},
tooltip: {
formatter: function (x) {
let str = `
<div>
11
</div>
`
return str
},
},
series: [
{
type: 'graph',
zlevel: 5,
draggable: false,
coordinateSystem: 'cartesian2d', // 使用二维的直角坐标系(也称笛卡尔坐标系)
symbol: 'rect',
symbolOffset: ['15%', 0],
label: {
normal: {
show: true,
},
},
data: dataLists,
links: linkesList,
/** 设置服务器件的连线样式*/
lineStyle: {
normal: {
opacity: 1,
// color: '#53B5EA',
// curveness: 0.3,
width: 2,
},
},
},
/** 分发点*/
{
type: 'lines',
coordinateSystem: 'cartesian2d',
z: 1,
zlevel: 2,
animation: false,
effect: {
show: true,
period: 5,
trailLength: 0.01,
symbolSize: 18,
symbol: 'pin',
loop: true,
color: 'rgba(55,155,255,0.5)',
},
lineStyle: {
normal: {
color: '#22AC38',
width: 0,
// curveness: 0.3,
},
},
data: []
// --- 坐标流向设置
// [
// {
// coords: [
// [190, 250],
// [40, 250],
// ],
// },
// {
// coords: [
// [40, 250],
// [120, 290],
// ],
// },
// {
// coords: [
// [120, 290],
// [190, 330],
// ],
// },
// {
// coords: [
// [190, 330],
// [40, 330],
// ],
// },
// {
// coords: [
// [455, 330],
// [610, 330],
// ],
// },
// {
// coords: [
// [610, 330],
// [455, 250],
// ],
// },
// {
// coords: [
// [455, 250],
// [610, 250],
// ],
// },
// ],
},
],
};