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
// To change the way how context menu looks you need to change CSS.
3
// By default CSS from AnyChart CDN is used: https://cdn.anychart.com/releases/8.13.0/css/anychart-ui.min.css
4
// Download it, alter, upload to your server and link from your pages to change the look.
5
6
var data = getData();
7
8
var chart = anychart.treeMap(data);
9
10
// Disable context menu.
11
chart.contextMenu(false);
12
13
chart.title('Disable context menu. Right-click on the chart');
14
chart.container('container');
15
chart.draw();
16
});
17
18
function getData() {
19
return [
20
{
21
name: 'Eurasia',
22
children: [
23
{
24
name: 'Asia', children: [
25
{
26
name: 'Eastern Asia', children: [
27
{name: 'Mongolia', value: 1564116, capital: 'Ulan-Bator'},
28
{name: 'China', value: 1564116, capital: 'Beijing'},
29
{name: 'Southern Korea', value: 1564116, capital: 'Seoul'},
30
{name: 'Northern Korea', value: 120540, capital: 'Pyongyang'},
31
{name: 'Japan', value: 1564116, capital: 'Tokio'}
32
]
33
}
34
]
35
},
36
{
37
name: 'Europe', children: [
38
{
39
name: 'Northern Europe', children: [
40
{name: 'Finland', value: 338424, capital: 'Helsinki'},
41
{name: 'Great Britain', value: 209331, capital: 'London'},
42
{name: 'Ireland', value: 84421, capital: 'Dublin'},
43
{name: 'Scandinavia', value: 928057}
44
]
45
}
46
]
47
}
48
]
49
}
50
];
51
}