示例加载中…
import { Graph } from '@antv/x6'
const graph = new Graph({
container: document.getElementById('container'),
grid: true,
})
graph.addEdge({
source: { x: 40, y: 40 },
target: { x: 380, y: 40 },
vertices: [
{ x: 40, y: 80 },
{ x: 200, y: 80 },
{ x: 200, y: 40 },
],
attrs: {
line: {
stroke: '#3c4260',
strokeWidth: 2,
targetMarker: 'classic',
},
},
tools: {
name: 'boundary',
},
})
graph.addEdge({
source: { x: 40, y: 160 },
target: { x: 380, y: 160 },
vertices: [
{ x: 40, y: 200 },
{ x: 200, y: 200 },
{ x: 200, y: 160 },
],
attrs: {
line: {
stroke: '#3c4260',
strokeWidth: 2,
targetMarker: 'classic',
},
},
connector: 'smooth',
tools: {
name: 'boundary',
args: {
padding: 5,
attrs: {
fill: '#7c68fc',
stroke: '#333',
strokeWidth: 0.5,
fillOpacity: 0.2,
},
},
},
})