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 stage = acgraph.create('container');
3
var hoverGap;
4
var chart1 = anychart.graph();
5
chart1.data(data);
6
7
chart1.bounds(0, 0, '50%', '100%');
8
chart1.interactivity().hoverGap(1);
9
hoverGap = chart1.interactivity().hoverGap();
10
chart1.title().enabled(true).text('hoverGap is ' + hoverGap + '.\n It is harder to hover edge');
11
12
var chart2 = anychart.graph(data);
13
chart2.title().enabled(true).text('Scroll on mousewheel');
14
chart2.bounds('50%', 0, '50%', '100%');
15
chart2.interactivity().hoverGap(10);
16
hoverGap = chart2.interactivity().hoverGap();
17
chart2.title().enabled(true).text('hoverGap is ' + hoverGap);
18
19
chart2.container(stage).draw();
20
chart1.container(stage).draw();
21
});
22
var data = {
23
nodes: [
24
{"id": "a"},
25
{"id": "a1"},
26
{"id": "a2"},
27
{"id": "a3"},
28
{"id": "a4"},
29
{"id": "a5"},
30
{"id": "a6"},
31
{"id": "b"},
32
{"id": "b1"},
33
{"id": "b2"},
34
{"id": "b3"},
35
{"id": "b4"},
36
{"id": "b5"},
37
{"id": "b6"}
38
],
39
edges: [
40
{from: 'a', to: 'b'},
41
{from: 'a', to: 'a1'},
42
{from: 'a', to: 'a2'},
43
{from: 'a', to: 'a3'},
44
{from: 'a', to: 'a4'},
45
{from: 'a', to: 'a5'},
46
{from: 'a', to: 'a6'},
47
{from: 'b', to: 'b1'},
48
{from: 'b', to: 'b2'},
49
{from: 'b', to: 'b3'},
50
{from: 'b', to: 'b4'},
51
{from: 'b', to: 'b5'},
52
{from: 'b', to: 'b6'},
53
]
54
};