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 ohlcMapping = dataTable.mapAs({
6
open: 1,
7
high: 2,
8
low: 3,
9
close: 4
10
});
11
var stepMapping = dataTable.mapAs({value: 1});
12
13
var chart = anychart.stock();
14
chart.grouping({minPixPerPoint: 5});
15
chart.scrollerGrouping({minPixPerPoint: 5});
16
chart.padding(10, 10, 10, 50);
17
18
var plot = chart.plot();
19
plot.ohlc(ohlcMapping);
20
21
var scroller = chart.scroller();
22
scroller.height("20%");
23
24
var series = scroller.stepLine(stepMapping);
25
26
// Set stroke.
27
series.stroke(function () {
28
return "2 " + anychart.color.darken(this.sourceColor)
29
});
30
31
chart.title("Set stroke parameter as a function. Move the scroller.");
32
chart.container("container");
33
chart.draw();
34
});