g6/demos/layout-concentric.html

45 lines
1.0 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
2020-02-14 10:10:54 +08:00
<meta charset="UTF-8" />
<title>Concentric Layout</title>
</head>
2020-02-14 10:10:54 +08:00
<body>
<div id="mountNode"></div>
<script src="../build/g6.js"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script>
const radius = 100;
const graphSize = [1000, 600];
const graph = new G6.Graph({
container: 'mountNode',
width: graphSize[0],
height: graphSize[1],
fitView: true,
modes: {
2020-02-14 10:10:54 +08:00
default: ['zoom-canvas', 'drag-canvas', 'drag-node'],
},
layout: {
type: 'concentric',
center: [500, 300],
2019-10-23 17:02:21 +08:00
maxLevelDiff: 0.5,
2020-02-14 10:10:54 +08:00
sortBy: 'degree',
},
animate: true,
defaultNode: {
2020-02-14 10:10:54 +08:00
size: [5, 5],
},
defaultEdge: {
size: 1,
2020-02-14 10:10:54 +08:00
color: '#e2e2e2',
},
});
$.getJSON('./assets/data/concentric-data.json', data1 => {
graph.data(data1);
graph.render();
});
</script>
</body>
2020-02-14 10:10:54 +08:00
</html>