HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create data
4
var data = {
5
nodes: [
6
{id: "Richard"},
7
{id: "Larry"},
8
{id: "Marta"},
9
{id: "Jane"},
10
{id: "Norma"},
11
{id: "Frank"},
12
{id: "Brett"}
13
],
14
edges: [
15
{from: "Richard", to: "Larry"},
16
{from: "Richard", to: "Marta"},
17
{from: "Larry", to: "Marta"},
18
{from: "Marta", to: "Jane"},
19
{from: "Jane", to: "Norma"},
20
{from: "Jane", to: "Frank"},
21
{from: "Jane", to: "Brett"},
22
{from: "Brett", to: "Frank"}
23
]
24
};
25
26
// create a chart and set the data
27
var chart = anychart.graph(data);
28
29
// set the chart title
30
chart.title("Network Graph: Basic Sample");
31
32
// set the container id
33
chart.container("container");
34
35
// initiate drawing the chart
36
chart.draw();
37
});