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
// data comes from the function in https://cdn.anychart.com/csv-data/dji-daily-short.js
4
dataTable.addData(get_dji_daily_short_data());
5
6
var chart = anychart.stock();
7
8
chart.plot(0).column(dataTable.mapAs({value: 1}));
9
chart.plot(0).column(dataTable.mapAs({value: 2}));
10
chart.plot(0).column(dataTable.mapAs({value: 3}));
11
12
// set y scale stack mode to value
13
chart.plot(0).yScale().stackMode("value");
14
15
chart.title("Value Stack Mode in Stock Charts");
16
chart.container("container");
17
chart.draw();
18
19
chart.selectRange("ytd");
20
});