HTMLcopy
1
<select id="typeSelect" onchange="switchType()">
2
<option value="ohlc">OHLC</option>
3
<option value="candlestick">Japanese Candlestick</option>
4
<option value="hilo">HiLo</option>
5
<option value="range-area">Range Area</option>
6
<option value="range-column">Range Column</option>
7
<option value="range-spline-area">Range Spline Area</option>
8
<option value="range-step-area">Range Step Area</option>
9
</select>
10
<div id="container"></div>
CSScopy
15
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
select {
8
margin: 10px 0 0 10px;
9
}
10
#container {
11
position: absolute;
12
width: 100%;
13
top: 35px;
14
bottom: 0;
15
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create data
4
var data = [
5
{x: Date.UTC(2015, 4, 1), open:18.23, high:19.36, low:18.18, close:19.31},
6
{x: Date.UTC(2015, 4, 2), open:19.50, high:19.89, low:19.00, close:19.29},
7
{x: Date.UTC(2015, 4, 3), open:19.13, high:19.15, low:18.43, close:18.75},
8
{x: Date.UTC(2015, 4, 6), open:18.54, high:18.76, low:18.27, close:18.76},
9
{x: Date.UTC(2015, 4, 7), open:18.76, high:19.14, low:18.63, close:18.76}
10
];
11
12
// set the chart type
13
var chart = anychart.ohlc();
14
15
// set the series type
16
series = chart.ohlc(data);
17
18
// set the chart title
19
chart.title("Switching the Series Type");
20
21
// set the container id
22
chart.container("container");
23
24
// initiate drawing the chart
25
chart.draw();
26
});
27
28
// switch the series type
29
function switchType() {
30
var select = document.getElementById("typeSelect");
31
series.seriesType(select.value);
32
}