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
var chart = anychart.column3d([
3
{x: 'Meat', value: 10},
4
{x: 'Fruit', value: 12},
5
{x: 'Nuts', value: 18},
6
{x: 'Milk', value: 11},
7
{x: 'Fish', value: 5}
8
]);
9
chart.title('Click on the chart. You have 3 clicks');
10
chart.listen('click', customListener);
11
12
var listenKey = chart.listen('click', customListener);
13
14
var counter = 3;
15
16
function customListener(e) {
17
counter--;
18
chart.title('Click on the chart. You have ' + counter + ' clicks');
19
if (counter === 0) {
20
// Removes event listener by the key
21
chart.unlistenByKey(listenKey);
22
chart.title('You have no more clicks');
23
}
24
}
25
chart.container('container');
26
chart.draw();
27
});