HTMLcopy
1
<button onclick="label();">Apply changes (add labels)</button>
2
<button onclick="autoRedraw();">Draw changes on the chart</button>
3
<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
var chart;
2
anychart.onDocumentReady(function () {
3
chart = anychart.sparkline([1.3, 2, 1.4, 4, 2.3, 6]);
4
5
chart.title({text: 'Set noData settings', orientation: 'top'});
6
chart.container('container');
7
chart.draw();
8
9
// Disable chart redrawing.
10
chart.autoRedraw(false);
11
});
12
13
function autoRedraw() {
14
15
// Enable chart redrawing.
16
chart.autoRedraw(true);
17
}
18
19
var counter = 0;
20
21
function label() {
22
chart.label(counter++, {enabled: true, offsetY: 10 * counter++, fontWeight: 600, fontColor: 'rgba(' + Math.floor(Math.random() * 130).toString(10) + ','
23
+ Math.floor(Math.random() * 140).toString(10) + ','
24
+ Math.floor(Math.random() * 150).toString(10) + ')'});
25
}