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 dataTable = anychart.data.table();
3
dataTable.addData(get_dji_daily_short_data());
4
5
var data1 = dataTable.mapAs({value: 1});
6
var data2 = dataTable.mapAs({value: 5});
7
8
var chart = anychart.stock();
9
10
var plot1 = chart.plot(0);
11
plot1.line(data1);
12
plot1.line(data2);
13
14
var plot1YScale = plot1.yScale();
15
plot1YScale.comparisonMode('percent');
16
17
// Set date for the changes zero of the series.
18
plot1YScale.compareWith('series-start');
19
20
var plot2 = chart.plot(1);
21
plot2.line(data1);
22
plot2.line(data2);
23
24
var plot2YScale = plot2.yScale();
25
plot2YScale.comparisonMode('percent');
26
27
// Set date for first visible point.
28
plot2YScale.compareWith('first-visible');
29
30
var plot3 = chart.plot(2);
31
plot3.line(data1);
32
plot3.line(data2);
33
34
var plot3YScale = plot3.yScale();
35
plot3YScale.comparisonMode('percent');
36
37
// Set custom date.
38
plot3YScale.compareWith(1209081600000);
39
40
chart.title('First plot: compare scale with series start \n Second plot: compare scale with first visible point \n' +
41
'Third plot: compare scale with custom date');
42
chart.container('container');
43
chart.draw();
44
});