HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
anychart.data.loadJsonFile(
3
// The data used in this sample can be obtained from the CDN
4
'https://cdn.anychart.com/samples-data/graph/avengers/data.json',
5
function (data) {
6
// create graph chart
7
var chart = anychart.graph(data);
8
9
// set chart layout type
10
chart.layout().type('fixed');
11
12
// set chart background
13
chart.background().fill({
14
src:
15
'https://cdn.anychart.com/samples-data/graph/avengers/bg.png',
16
mode: 'fit'
17
});
18
19
// set nodes normal state size and stroke color
20
chart.nodes().height(40).width(40).stroke('2 #022a45');
21
22
// set nodes hovered state size and stroke color
23
chart.nodes().hovered().height(60).width(60).stroke('2 #96b9cd');
24
25
// set nodes selected state size and stroke color
26
chart.nodes().selected().height(60).width(60).stroke('2 #96b9cd');
27
28
// set edges normal state stroke color
29
chart.edges().stroke('2 #022a45');
30
31
// set edges hovered state stroke color
32
chart.edges().hovered().stroke('2 #96b9cd');
33
34
// set edges selected state stroke color
35
chart.edges().selected().stroke('2 #96b9cd');
36
37
// set container id for the chart
38
chart.container('container');
39
// initiate chart drawing
40
chart.draw();
41
}
42
);
43
});