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", 10000],
6
["February", 12000],
7
["March", 18000],
8
["April", 11000],
9
["May", 9000]
10
];
11
12
// create an area chart
13
var chart = anychart.column(data);
14
15
// create an extra axes
16
chart.yAxis(1, {orientation: 'right'});
17
chart.xAxis(1, {orientation: 'top'});
18
19
// enable crosshair and create extra labels
20
chart.crosshair().enabled(true);
21
22
chart.crosshair().yLabel(0).axisIndex(0);
23
chart.crosshair().yLabel(1).axisIndex(1);
24
25
chart.crosshair().xLabel(0).axisIndex(0);
26
chart.crosshair().xLabel(1).axisIndex(1);
27
28
// set custom label format
29
chart.crosshair().xLabel(1).format("Month: {%Value}");
30
31
// set the chart title
32
chart.title("Crosshair: Multiple labels")
33
34
// set the container id
35
chart.container("container");
36
37
// initiate drawing the chart
38
chart.draw();
39
});