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
3
// create a stage
4
var stage = anychart.graphics.create("container");
5
6
// create data
7
var data = [
8
["P1", 10000],
9
["P2", 12000],
10
["P3", 18000],
11
["P4", 11000],
12
["P5", 9000]
13
];
14
15
// create and configure the first chart
16
var column1 = anychart.column(data);
17
column1.title("Chart Background");
18
column1.bounds(0, 0, "50%", "100%");
19
// configure the background of the chart
20
column1.background({fill: "#ffd54f 0.2"});
21
// set the chart container
22
column1.container(stage);
23
// initiate drawing the chart
24
column1.draw();
25
26
// create and configure the first chart
27
var column2 = anychart.column(data);
28
column2.title("Data Area Background");
29
column2.bounds("50%", 0, "50%", "100%");
30
// configure the background of the data area
31
column2.dataArea().background().enabled(true);
32
column2.dataArea().background().fill("#ffd54f 0.2");
33
// set the chart container
34
column2.container(stage);
35
// initiate drawing the chart
36
column2.draw();
37
});