HTMLcopy
1
<button onclick="enableBackground()">Enable background</button>
2
<button onclick="disableBackground();">Disable background</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
3
function disableBackground() {
4
5
// Disable background.
6
chart.background(false);
7
}
8
9
function enableBackground() {
10
11
// Enable background.
12
chart.background(true);
13
}
14
15
anychart.onDocumentReady(function () {
16
chart = anychart.sparkline([1.3, 2, 1.4, 4, 2.3, 6]);
17
chart.background('#FFF59D 0.4');
18
chart.title({text: 'Enable/Disable chart background', orientation: 'top'});
19
chart.container('container');
20
chart.draw();
21
});