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
{
6
x: "A",
7
name: "Set A",
8
custom_field: "info 1",
9
value: 100
10
},
11
{
12
x: "B",
13
name: "Set A",
14
custom_field: "info 2",
15
value: 100
16
},
17
{
18
x: ["A", "B"],
19
name: "Set A + Set B",
20
custom_field: "info 3",
21
value: 25
22
}
23
];
24
25
// create a chart and set the data
26
chart = anychart.venn(data);
27
28
// configure labels of circles
29
chart.labels().format("{%name}\n\n{%custom_field}\n{%value}");
30
31
// configure labels of intersections
32
chart.intersections().labels().format("{%name}\n\n{%value}");
33
34
// configure tooltips of circles
35
chart.tooltip().format(
36
"Set Info: {%custom_field}\nCardinality: {%value}"
37
);
38
39
// configure tooltips of intersections
40
chart.intersections().tooltip().format(
41
"Intersection Info: {%custom_field}\nCardinality: {%value}"
42
);
43
44
// set the chart title
45
chart.title("Venn Diagram: Labels and Tooltips (Tokens)");
46
47
// set the container id
48
chart.container('container');
49
50
// initiate drawing the chart
51
chart.draw();
52
});