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 line chart
4
var chart = anychart.column();
5
6
var crosshair = chart.crosshair();
7
crosshair.enabled(true);
8
9
// remove the x-axis line
10
crosshair.xStroke(null);
11
12
// turn on chart animation
13
chart.animation(true);
14
15
// set chart title text settings
16
chart.title("Column Chart with a Crosshair");
17
18
// create data set on our data
19
var dataSet = anychart.data.set([
20
["P1" , 3.6 , 2.3],
21
["P2" , 7.1 , 4.0],
22
["P3" , 8.5 , 6.2],
23
["P4" , 9.2 , 11.8],
24
["P5" , 10.1, 13.0],
25
["P6" , 11.6, 13.9],
26
["P7" , 16.4, 18.0],
27
["P8" , 18.0, 23.3],
28
["P9" , 13.2, 24.7],
29
["P10", 12.0, 18.0],
30
["P11", 3.2 , 15.1],
31
["P12", 4.1 , 11.3],
32
["P13", 6.3 , 14.2],
33
["P14", 9.4 , 13.7],
34
["P15", 11.5, 9.9],
35
["P16", 13.5, 12.1],
36
["P17", 14.8, 13.5],
37
["P18", 16.6, 15.1],
38
["P19", 18.1, 17.9],
39
["P20", 17.0, 18.9]
40
]);
41
42
// create first series with mapped data
43
chart.column(dataSet.mapAs({x: [0], value: [1]}));
44
chart.column(dataSet.mapAs({x: [0], value: [2]}));
45
46
// set container id for the chart
47
chart.container("container");
48
// initiate chart drawing
49
chart.draw();
50
});