Javascript p你操纵数据。我已经发布了我的完整代码。在此代码中,数据以表格格式显示,但我想以下拉方式显示,我之前已经解释过了。@NewToJSNate谢谢你的回复。。但是你能告诉我我需要在代码中做什么更改吗。我已经在这里发布了我的代码。我知道你的想法,但如何做。@Na
Javascript p你操纵数据。我已经发布了我的完整代码。在此代码中,数据以表格格式显示,但我想以下拉方式显示,我之前已经解释过了。@NewToJSNate谢谢你的回复。。但是你能告诉我我需要在代码中做什么更改吗。我已经在这里发布了我的代码。我知道你的想法,但如何做。@Na,javascript,jquery,html,highcharts,Javascript,Jquery,Html,Highcharts,p你操纵数据。我已经发布了我的完整代码。在此代码中,数据以表格格式显示,但我想以下拉方式显示,我之前已经解释过了。@NewToJSNate谢谢你的回复。。但是你能告诉我我需要在代码中做什么更改吗。我已经在这里发布了我的代码。我知道你的想法,但如何做。@Nate巴贝蒂尼 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html;
p你操纵数据。我已经发布了我的完整代码。在此代码中,数据以表格格式显示,但我想以下拉方式显示,我之前已经解释过了。@NewToJSNate谢谢你的回复。。但是你能告诉我我需要在代码中做什么更改吗。我已经在这里发布了我的代码。我知道你的想法,但如何做。@Nate巴贝蒂尼
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Highcharts Example</title>
<style type="text/css">
table{
border-collapse:collapse;
font-family:helvetica, arial, sans-serif;
}
th{
font-weight:bold;
text-align:center;
padding:5px;
}
thead th{
border-bottom:1px solid #999;
}
td{
padding:5px;
vertical-align:middle;
}
</style>
<script type="text/javascript" src="../../js/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'area',
margin:[0,0,0,0],
//borderWidth:1
},
title:{
text:''
},
credits:{
enabled:false
},
xAxis: {
labels: {
enabled:false
}
},
yAxis: {
maxPadding:0,
minPadding:0,
endOnTick:false,
labels: {
enabled:false
}
},
legend: {
enabled:false
},
tooltip: {
enabled:false
},
plotOptions: {
series:{
lineWidth:1,
shadow:false,
states:{
hover:{
lineWidth:9
}
},
marker:{
//enabled:false,
radius:1,
states:{
hover:{
radius:2
}
}
}
}
},
series: [{
color:'#666',
fillColor:'rgba(204,204,204,.25)',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});
$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container1',
defaultSeriesType: 'pie',
margin:[0,0,0,0],
//borderWidth:1
},
title:{
text:''
},
credits:{
enabled:false
},
xAxis: {
labels: {
enabled:false
}
},
yAxis: {
maxPadding:0,
minPadding:0,
endOnTick:false,
labels: {
enabled:false
}
},
legend: {
enabled:false
},
tooltip: {
enabled:false
},
plotOptions: {
series:{
lineWidth:1,
shadow:false,
states:{
hover:{
lineWidth:9
}
},
marker:{
//enabled:false,
radius:1,
states:{
hover:{
radius:2
}
}
}
}
},
series: [{
color:'#666',
fillColor:'rgba(204,204,204,.25)',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});
$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container2',
defaultSeriesType: 'bar',
margin:[0,0,0,0],
//borderWidth:1
},
title:{
text:''
},
credits:{
enabled:false
},
xAxis: {
labels: {
enabled:false
}
},
yAxis: {
maxPadding:0,
minPadding:0,
endOnTick:false,
labels: {
enabled:false
}
},
legend: {
enabled:false
},
tooltip: {
enabled:false
},
plotOptions: {
series:{
lineWidth:1,
shadow:false,
states:{
hover:{
lineWidth:9
}
},
marker:{
//enabled:false,
radius:1,
states:{
hover:{
radius:2
}
}
}
}
},
series: [{
color:'#666',
fillColor:'rgba(204,204,204,.25)',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});
</script>
</head>
<body>
<script src="../../js/highcharts.js"></script>
<table>
<caption>Sparkline</caption>
<thead>
<tr>
<th>Category</th>
<th>Value</th>
<th>Trend</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Category 1</th>
<td>54.4</td>
<td><div id="container" style="height:60px;width:200px;"></div></td>
</tr>
<tr>
<th scope="row">Category 2</th>
<td>60.4</td>
<td><div id="container1" style="height:60px;width:200px;"></div></td>
</tr>
<tr>
<th scope="row">Category 3</th>
<td>60.4</td>
<td><div id="container2" style="height:80px;width:300px;"></div></td>
</tr>
</tbody>
</table>
</body>
</html>
var value = 3; // Here you have to set value that you get from database
var $select = $('.js-select'); // Specify your select here
var updateBoxes = function( value ) {
$('.js-box').hide();
$('#container' + value).show();
}
var initSelects = function( value ) {
if (value !== 0) {
$select.val( value );
}
$select.on('change', function() {
updateBoxes( $select.val() );
});
}
initSelects( value );
updateBoxes( value );