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/knowledge_graph/data.json',
5
function (data) {
6
// create graph chart
7
var chart = anychart.graph(data);
8
9
// set settings for each group
10
for (var i = 0; i < 8; i++) {
11
// get group
12
var group = chart.group(i);
13
14
// set group labels settings
15
group
16
.labels()
17
.enabled(true)
18
.anchor('left-center')
19
.position('right-center')
20
.padding(0, -5)
21
.fontColor(anychart.palettes.defaultPalette[i]);
22
23
// set group nodes stroke and fill
24
group.stroke(anychart.palettes.defaultPalette[i]);
25
group.fill(anychart.palettes.defaultPalette[i]);
26
}
27
28
// set container id for the chart
29
chart.container('container');
30
// initiate chart drawing
31
chart.draw();
32
}
33
);
34
});