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
["John", 10000],
6
["Jake", 12000],
7
["Peter", 13000],
8
["James", 10000],
9
["Mary", 9000]
10
];
11
12
// create a column chart
13
var chart = anychart.column();
14
15
// set the data
16
chart.data(data);
17
18
// enable the crosshair
19
chart.crosshair(true);
20
21
// configure the strokes of the crosshair
22
chart.crosshair().xStroke(null);
23
chart.crosshair().yStroke("#dd2c00", 1.5, "10 5", "round");
24
25
// set the chart title
26
chart.title("Crosshair: Appearance")
27
28
// set the container id
29
chart.container("container");
30
31
// initiate drawing the chart
32
chart.draw();
33
});