HTMLcopy
1
<select id="typeSelect" onchange="switchType()">
2
<option value="area">Area</option>
3
<option value="column">Column</option>
4
<option value="jump-line">Jump Line</option>
5
<option value="line">Line</option>
6
<option value="marker">Marker</option>
7
<option value="spline-area">Spline Area</option>
8
<option value="spline">Spline</option>
9
<option value="step-area">Step Area</option>
10
<option value="step-line">Step Line</option>
11
<option value="stick">Stick</option>
12
</select>
13
<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
["Spring", 10],
6
["Summer", 15],
7
["Autumn", 8],
8
["Winter", 23]
9
];
10
11
// set the chart type
12
var chart = anychart.area();
13
14
// set the series type and data
15
series = chart.area(data);
16
17
// set the chart title
18
chart.title("Switching the Series Type");
19
20
// set the container id
21
chart.container("container");
22
23
// initiate drawing the chart
24
chart.draw();
25
});
26
27
// switch the series type
28
function switchType() {
29
var select = document.getElementById("typeSelect");
30
series.seriesType(select.value);
31
}