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
3
// data
4
var data = [
5
[Date.UTC(2007, 07, 23), 23.55, 23.88, 23.38, 23.62],
6
[Date.UTC(2007, 07, 24), 22.65, 23.7, 22.65, 23.36],
7
[Date.UTC(2007, 07, 25), 22.75, 23.7, 22.69, 23.44],
8
[Date.UTC(2007, 07, 26), 23.2, 23.39, 22.87, 22.92],
9
[Date.UTC(2007, 07, 27), 23.98, 24.49, 23.47, 23.49],
10
[Date.UTC(2007, 07, 30), 23.55, 23.88, 23.38, 23.62],
11
[Date.UTC(2007, 07, 31), 23.88, 23.93, 23.24, 23.25],
12
[Date.UTC(2007, 08, 01), 23.17, 23.4, 22.85, 23.25],
13
[Date.UTC(2007, 08, 02), 22.65, 23.7, 22.65, 23.36],
14
[Date.UTC(2007, 08, 03), 23.2, 23.39, 22.87, 22.92],
15
[Date.UTC(2007, 08, 06), 23.03, 23.15, 22.44, 22.97],
16
[Date.UTC(2007, 08, 07), 22.75, 23.7, 22.69, 23.44]
17
];
18
19
// create a chart
20
var chart = anychart.candlestick();
21
22
// set the interactivity mode
23
chart.interactivity("by-x");
24
25
// create a japanese candlestick series and set the data
26
var series = chart.candlestick(data);
27
series.pointWidth(10);
28
29
// set the chart title
30
chart.title("Japanese Candlestick Chart: Basic Sample");
31
32
// set the titles of the axes
33
chart.xAxis().title("Date");
34
chart.yAxis().title("Price, $");
35
36
// set the container id
37
chart.container("container");
38
39
// initiate drawing the chart
40
chart.draw();
41
});