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(get_csco_daily_short_data());
6
7
// map the data
8
mapping = dataTable.mapAs({'value': 5});
9
10
// create a chart
11
var chart = anychart.stock();
12
13
// enable second axis
14
chart.plot(0).yAxis(1).enabled(true);
15
chart.plot(0).yAxis(1).orientation('right');
16
17
// add two series
18
lineSeries = chart.plot(0).line(mapping);
19
20
// create indicator and put it on the first axis
21
indicator1 = chart.plot(0).priceIndicator(0);
22
// this actually is the default value
23
indicator1.axis(0);
24
25
// create another indicator and set the second axis
26
indicator2 = chart.plot(0).priceIndicator(1, {axis: chart.plot(0).yAxis(1), value: 'last-visible'});
27
28
// set the chart position and title
29
chart.title("Price Indicator: Axis to Show On");
30
31
// chart padding
32
chart.padding().left(75).right(75);
33
34
// set the chart container
35
chart.container("container");
36
37
// initiate drawing the chart
38
chart.draw();
39
});