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.gauges.circular([{value: 7.5}]);
3
chart.axis();
4
chart.needle();
5
chart.listen('click', customListener);
6
7
var counter = 3;
8
9
function customListener(e) {
10
counter--;
11
chart.title('Click on the chart. You have ' + counter + ' clicks');
12
if (counter === 0) {
13
// Removes event listener
14
chart.unlisten('click', customListener);
15
chart.title('You have no more clicks');
16
}
17
}
18
19
chart.title('Click on the chart. You have 3 clicks');
20
chart.container('container');
21
chart.draw();
22
});