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 data
4
var data = [
5
["January", 12000, 10000],
6
["February", 15000, 12000],
7
["March", 16000, 18000],
8
["April", 14000, 11000],
9
["May", 10000, 9000]
10
];
11
12
// create a data set
13
var dataSet = anychart.data.set(data);
14
15
// map the data
16
var mapping1 = dataSet.mapAs({x: 0, value: 1});
17
var mapping2 = dataSet.mapAs({x: 0, value: 2});
18
19
// create a chart
20
var chart = anychart.column();
21
22
// create the first series and set the data
23
var series1 = chart.column(mapping1);
24
25
// create the second series and set the data
26
var series2 = chart.column(mapping2);
27
28
// set the chart title
29
chart.title("Data Sets: Mapping");
30
31
// set the container id
32
chart.container("container");
33
34
// initiate drawing the chart
35
chart.draw();
36
});