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.onDocumentLoad(function() {
2
var chart = anychart.graph(data);
3
4
chart.interactivity().enabled(true);
5
6
var edgesInteractivity = chart.interactivity().enabled();
7
8
var titleText = 'Chart interactivity is ' + (edgesInteractivity ? 'enabled' : 'disabled')+'.\n'+
9
'You ' + (edgesInteractivity ? 'can': 'can\'t') + ' drag chart nodes or chart itself';
10
chart.title()
11
.enabled(true)
12
.text(titleText);
13
14
chart.container('container').draw();
15
});
16
var data = {
17
nodes: [
18
{id: 'a'},
19
{id: 'a1'},
20
{id: 'a2'},
21
{id: 'a3'},
22
{id: 'a4'},
23
{id: 'a5'},
24
{id: 'a6'},
25
{id: 'b'},
26
{id: 'b1'},
27
{id: 'b2'},
28
{id: 'b3'},
29
{id: 'b4'},
30
{id: 'b5'},
31
{id: 'b6'}
32
],
33
edges: [
34
{from: 'a', to: 'b'},
35
{from: 'a', to: 'a1'},
36
{from: 'a', to: 'a2'},
37
{from: 'a', to: 'a3'},
38
{from: 'a', to: 'a4'},
39
{from: 'a', to: 'a5'},
40
{from: 'a', to: 'a6'},
41
{from: 'b', to: 'b1'},
42
{from: 'b', to: 'b2'},
43
{from: 'b', to: 'b3'},
44
{from: 'b', to: 'b4'},
45
{from: 'b', to: 'b5'},
46
{from: 'b', to: 'b6'},
47
]
48
};