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
// create a data table
4
var dataTable = anychart.data.table();
5
dataTable.addData([
6
["2016-12-24", 511.53, 514.98, 505.79, 506.40],
7
["2016-12-25", 512.53, 514.88, 505.69, 507.34],
8
["2016-12-26", 511.83, 514.98, 505.59, 506.23],
9
["2016-12-27", 511.22, 515.30, 505.49, 506.47],
10
["2016-12-28", 510.35, 515.72, 505.23, 505.80],
11
["2016-12-29", 510.53, 515.86, 505.38, 508.25],
12
["2016-12-30", 511.43, 515.98, 505.66, 507.45],
13
["2016-12-31", 511.50, 515.33, 505.99, 507.98],
14
["2017-01-01", 511.32, 514.29, 505.99, 506.37],
15
["2017-01-02", 511.70, 514.87, 506.18, 506.75]
16
]);
17
18
// map the data
19
mapping = dataTable.mapAs(
20
{open: 1, high: 2, low: 3, close: 4, value: 4}
21
);
22
23
// create a stock chart
24
var chart = anychart.stock();
25
26
// create two plots
27
var plot1 = chart.plot(0);
28
var plot2 = chart.plot(1);
29
30
// create two series: line and ohlc
31
plot1.line(mapping);
32
plot2.ohlc(mapping);
33
34
// disable the legend on the first plot
35
plot1.legend(false);
36
37
// set the chart title
38
chart.title("AnyStock Legend: Enabling / Disabling");
39
40
// set the container id
41
chart.container("container");
42
43
// initiate drawing the chart
44
chart.draw();
45
});