我试图改变图表的价值如下
<!doctype html>
<head>
<script>
var chart1; // globally available
$(document).ready(function() {
var chart = 'pie'
$("select").change(function(){
chart = $('#chart').val();
alert(chart);
});
chart1 = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: chart
},
yAxis: {
title: {
text: 'Temprature'
}
},
series: [{
name: 'mach_1',
data: [<?php
foreach($chart as $`row) {
echo $row['temp'].",";
}
?>]
}]
});
});
</script>
</head>
<body>
<div id="form">
<label>Select a chart : </label>
<select id="chart">
<option>pie</option>
<option>column</option>
</select>
</div>
<div id="container"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我知道这将改变选择图表的价值,但它不会改变图表本身.有任何想法吗?