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({'open': 1, 'high': 2,'low': 3,'close':4, 'value': 5});
9
10
// create a chart
11
var chart = anychart.stock();
12
13
// add two series
14
ohlcSeries = chart.plot(0).ohlc(mapping);
15
lineSeries = chart.plot(1).line(mapping);
16
17
// add indicator to OHLC series
18
var indicator1 = chart.plot(0).priceIndicator();
19
indicator1.series(ohlcSeries);
20
indicator1.valueField('high');
21
22
// add indicator to line series
23
var indicator2 = chart.plot(1).priceIndicator({'series': lineSeries});
24
25
// set the chart position and title
26
chart.title("Price Indicator: Series and Value Field");
27
28
// alter padding
29
chart.padding().left(75);
30
31
// set the chart container
32
chart.container("container");
33
34
// initiate drawing the chart
35
chart.draw();
36
});