g6/demos/plugin-forceAtlas2.html

50 lines
1.2 KiB
HTML

<!doctype html>
<html itemscope="" itemtype="http://schema.org/SearchResultsPage" lang="en">
<head>
<meta content="origin" name="referrer">
<title>plugin-forceAtlas2</title>
<script src="../build/g6.js"></script>
<script src="../build/layoutForceAtlas2.js"></script>
<script src="./assets/jquery-3.2.1.min.js"></script>
</head>
<body>
<div id='mountNode'></div>
<script>
$.getJSON('../../test/fixtures/viralMarketing.json', data => {
const Plugin = G6.Plugins['layout.forceAtlas2'];
const layout_params = {
max_iteration: 1500,
prev_overlapping: true,
kr: 15,
mode: 'normal',
barnes_hut: false, // may be counter-productive on small networks
ks: 0.1,
dissuade_hubs: false
};
graph = new G6.Graph({
id: 'mountNode', // dom id
fitView: 'autoZoom',
plugins: [new Plugin(layout_params)],
minZoom: 0,
modes: {
default: ['panCanvas']
},
height: 1000,
});
graph.edge({
style() {
return {
endArrow: true,
lineWidth: 2
};
}
});
graph.read(data);
graph.setFitView('autoZoom');
});
</script>
</body>