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
// configure the visual settings of the first series
24
series1.normal().fill("#00cc99", 0.3);
25
series1.hovered().fill("#00cc99", 0.1);
26
series1.selected().fill("#00cc99", 0.5);
27
series1.normal().stroke("#00cc99", 1, "10 5", "round");
28
series1.hovered().stroke("#00cc99", 2, "10 5", "round");
29
series1.selected().stroke("#00cc99", 4, "10 5", "round");
30
31
// create the second series, set the data and name
32
var series2 = chart.column(seriesData_2);
33
series2.name("Sales in 2016");
34
35
// configure the visual settings of the second series
36
series2.normal().fill("#0066cc", 0.3);
37
series2.hovered().fill("#0066cc", 0.1);
38
series2.selected().fill("#0066cc", 0.5);
39
series2.normal().hatchFill("forward-diagonal", "#0066cc", 1, 15);
40
series2.hovered().hatchFill("forward-diagonal", "#0066cc", 1, 15);
41
series2.selected().hatchFill("forward-diagonal", "#0066cc", 1, 15);
42
series2.normal().stroke("#0066cc");
43
series2.hovered().stroke("#0066cc", 2);
44
series2.selected().stroke("#0066cc", 4);
45
46
// set the chart title
47
chart.title("Column Chart: Appearance");
48
49
// set the titles of the axes
50
chart.xAxis().title("Manager");
51
chart.yAxis().title("Sales, $");
52
53
// set the container id
54
chart.container("container");
55
56
// initiate drawing the chart
57
chart.draw();
58
});