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
// The data used in this sample can be obtained from the CDN
3
// https://cdn.anychart.com/samples/venn-charts/cooking-bacon-by-venn-chart/data.json
4
anychart.data.loadJsonFile(
5
'https://cdn.anychart.com/samples/venn-charts/cooking-bacon-by-venn-chart/data.json',
6
function (data) {
7
// create venn diagram
8
var chart = anychart.venn(data);
9
10
// set chart title
11
chart
12
.title()
13
.enabled(true)
14
.padding({ bottom: 35 })
15
.text('Cooking Bacon by Venn Diagram');
16
17
// set chart stroke
18
chart.stroke('2 #fff');
19
20
// set labels settings
21
chart.labels().fontSize(14).format('{%Name}');
22
23
// set intersections labels settings
24
chart
25
.intersections()
26
.labels()
27
.fontColor('#fff')
28
.fontWeight('bold')
29
.format('{%Name}');
30
31
// set font color for hover intersections labels
32
chart.intersections().hovered().fill('#fff 0.5');
33
34
// set legend padding
35
chart.legend().padding({ top: 35 });
36
37
// set tooltip settings
38
chart.tooltip().titleFormat('{%Name}');
39
40
// set container id for the chart
41
chart.container('container');
42
// initiate chart drawing
43
chart.draw();
44
}
45
);
46
});