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
11
chart.yAxis(1, {orientation: 'right'});
12
chart.yAxis(1).scale('log');
13
14
var crosshair = chart.crosshair();
15
crosshair.enabled(true);
16
17
// Get Y-label.
18
var yLabel1 = crosshair.yLabel();
19
yLabel1.background({fill: '#CFD8DC', stroke: '#455A64'});
20
yLabel1.fontColor('black');
21
22
// Get Y-label by index.
23
var yLabel2 = crosshair.yLabel(1);
24
yLabel2.axisIndex(1);
25
26
chart.title('Get and modify Y-label by index');
27
chart.container('container');
28
chart.draw();
29
});