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
// create variable for custom theme
3
var customTheme = {
4
// define settings for bar charts
5
"bar": {
6
// set chart title
7
"title": {
8
"text": "Bar Chart",
9
"enabled": true
10
},
11
// settings for default x axis
12
"defaultXAxisSettings": {
13
// set x axis title
14
"title": {
15
"text": "Retail Channel",
16
"enabled": true
17
}
18
},
19
// settings for default y axis
20
"defaultYAxisSettings": {
21
// set axis name
22
"title": {
23
"text": "Sales",
24
"enabled": true
25
}
26
}
27
}
28
};
29
30
// data
31
var data = [
32
["Department Stores", 637166],
33
["Discount Stores", 721630],
34
["Men's/Women's Specialty Stores", 148662],
35
["All other outlets", 90000]
36
];
37
38
// apply custom theme
39
anychart.theme(customTheme);
40
41
// create chart
42
var chart = anychart.bar(data);
43
44
// set container and draw chart
45
chart.container("container");
46
chart.draw();
47
});