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 the data
4
var data = {
5
header: ["Country", "Number of cases"],
6
rows: [
7
["United States", 337072],
8
["Spain", 131646],
9
["Italy", 128948],
10
["Germany", 100123],
11
["France", 93773],
12
["China", 82602],
13
["Iran", 58226],
14
["United Kingdom", 48436],
15
["Turkey", 27069],
16
["Switzerland", 21100]
17
]};
18
19
// create the bar chart
20
var chart = anychart.bar();
21
22
// set the theme
23
anychart.theme(anychart.themes.darkTurquoise);
24
25
// add the data
26
chart.data(data);
27
28
// set the chart title
29
chart.title("Top 10 Countries with the Most Cases of COVID-19");
30
31
// add ticks
32
chart.yScale().ticks().interval(50000);
33
chart.yScale().minorTicks().interval(10000);
34
// add grid lines
35
chart.yGrid().enabled(true);
36
chart.yMinorGrid().enabled(true);
37
38
// set the container
39
chart.container("container");
40
41
// draw the chart
42
chart.draw();
43
44
});