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 mapping1 = dataTable.mapAs({
6
open: 1,
7
high: 2,
8
low: 3,
9
close: 4
10
});
11
12
var mapping2 = dataTable.mapAs({value: 1});
13
14
var chart = anychart.stock();
15
16
var controller = chart.plot(0).annotations();
17
controller.verticalLine({xAnchor: '2006-10-12', normal: {stroke: '#FF0000'}}).allowEdit(false);
18
controller.verticalLine({xAnchor: '2006-11-12', normal: {stroke: '#FF0000'}}).allowEdit(false);
19
20
var plot1 = chart.plot();
21
plot1.ohlc(mapping1);
22
23
var plot2 = chart.plot(1);
24
plot2.column(mapping2);
25
26
var eventMarkers = chart.eventMarkers();
27
eventMarkers.group(['2006-10-12']);
28
eventMarkers.group(1, ['2006-10-12', '2006-11-12']).format('B');
29
eventMarkers.connector().length(30);
30
31
// Disable sticking to left value.
32
eventMarkers.stickToLeft(false);
33
34
chart.selectRange('2006-09-01', '2006-12-21');
35
chart.title('Disable sticking of the event markers to left value. \n Event markers stick to the specified timestamp');
36
chart.container('container');
37
chart.draw();
38
});