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 chart = anychart.line([
7
{x: 'January', value: 1},
8
{x: 'February', value: 2},
9
{x: 'March', value: 1.3},
10
{x: 'April', value: 2.9}
11
]);
12
13
chart.contextMenu().itemsFormatter(function (items) {
14
15
// Adding custom item to the top of context menu.
16
items['my-custom-item'] = {
17
index: 0,
18
text: 'Show help info',
19
href: 'https://docs.anychart.com/'
20
};
21
22
// Changing default item.
23
items['print-chart'] = {
24
text: 'Print this chart',
25
action: function () {
26
return chart.print();
27
}
28
};
29
30
// Delete item.
31
delete items['about'];
32
33
return items;
34
});
35
36
chart.title('Use items formatter to add, change and delete items');
37
chart.container('container');
38
chart.draw();
39
});