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
var chart = anychart.scatter();
3
chart.line([
4
{x: 0, value: 20},
5
{x: 1, value: 50},
6
{x: 2, value: 30},
7
{x: 3, value: 90},
8
{x: 4, value: 40}
9
]);
10
chart.left("5%");
11
12
var crosshair = chart.crosshair();
13
crosshair.enabled(true);
14
15
var crosshairYLabel = crosshair.yLabel();
16
crosshairYLabel.format(function () {
17
return "Value is " + this.value
18
});
19
20
// Get format.
21
var format = crosshairYLabel.format();
22
23
var crosshairXLabel = crosshair.xLabel();
24
crosshairXLabel.format(format);
25
26
chart.title("Get and use format");
27
chart.container("container");
28
chart.draw();
29
});