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 data set
4
var data = anychart.data.set([
5
["John", 10000, 12500],
6
["Jake", 12000, 15000],
7
["Peter", 13000, 16500],
8
["James", 10000, 13000],
9
["Mary", 9000, 11000]
10
]);
11
12
// map the data
13
var seriesData_1 = data.mapAs({x: 0, value: 1});
14
var seriesData_2 = data.mapAs({x: 0, value: 2});
15
16
// create a chart
17
var chart = anychart.column();
18
19
// create the first series, set the data and name
20
var series1 = chart.column(seriesData_1);
21
series1.name("Sales in 2015");
22
23
// create the second series, set the data and name
24
var series2 = chart.column(seriesData_2);
25
series2.name("Sales in 2016");
26
27
// set the padding between columns
28
chart.barsPadding(-0.5);
29
30
// set the padding between column groups
31
chart.barGroupsPadding(2);
32
33
// set the chart title
34
chart.title("Column Chart: Padding (Multiple Series)");
35
36
// set the titles of the axes
37
chart.xAxis().title("Manager");
38
chart.yAxis().title("Sales, $");
39
40
// set the container id
41
chart.container("container");
42
43
// initiate drawing the chart
44
chart.draw();
45
});