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.column();
3
4
// configure no data label
5
noDataLabel = chart.noData().label();
6
noDataLabel.enabled(true);
7
noDataLabel.text("Error: could not connect to data server");
8
noDataLabel.hAlign('center');
9
noDataLabel.background().enabled(true);
10
noDataLabel.background().fill("Red 0.3").stroke("2 Red");
11
noDataLabel.padding(40);
12
13
attemp = 0;
14
15
// attach events to no data label
16
noDataLabel.listen('click', function () {
17
noDataLabel.text("Error: could not connect to data server... \n\n Attemp #" + attemp++);
18
});
19
noDataLabel.listen('mouseover', function () {
20
document.body.style.cursor = "pointer";
21
});
22
noDataLabel.listen('mouseout', function () {
23
document.body.style.cursor = "auto";
24
});
25
26
chart.title("No Data: Configure Label Event");
27
28
chart.container("container");
29
chart.draw();
30
});