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
// set the chart type
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
// configure tooltips on the chart
28
chart.tooltip().title("Information");
29
chart.tooltip().format("Manager: {%categoryName} \n{%seriesName}: ${%value}");
30
31
// set the chart title
32
chart.title("Tooltips (Chart)");
33
34
// set the titles of the axes
35
chart.xAxis().title("Manager");
36
chart.yAxis().title("Sales, $");
37
38
// set the container id
39
chart.container("container");
40
41
// initiate drawing the chart
42
chart.draw();
43
});