我有以下代码,其中一个 Jquery 选项卡显示一个表格,另一个选项卡显示一个使用 HighCharts 制作的饼图。如果我删除 div 标签之间的表格,饼图会成功显示,但是一旦表格包含在 div 中,饼图将不再显示。我的代码有问题还是已知的 highcharts/jQuery 问题?
<script type="text/javascript">
$(function () {
$('#pie').highcharts({
chart: { type:'pie' },
title: { text: 'Test'},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage}%</b>',
formatter: function() {
return '<b>'+ this.point.name +'</b>: '+ Math.round(this.percentage) +' %';
}
},
plotOptions: {
pie: {
allowPointSelect: true,
dataLabels: false,
showInLegend: true
}
},
series: [{
name: 'Overall Attendance',
data: [
['Present Students',4],
['Absent Students',4],
['Late Students',5]
]
}],
colors: [
'#132f55',
'#eeeeee',
'#7f95aa'
]
});
});
</script>
<p id="notice"><%= notice %></p>
<ul id="tabs" class="nav nav-tabs">
<li class="active"><a href="#registration" data-toggle="tab">Registration</a></li>
<li><a href="#pie" data-toggle="tab">Pie Chart</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="registration">
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
<%= link_to 'Edit', edit_register_path(@register) %> |
<%= link_to 'Back', registers_path %>
</div>
<div class="tab-pane" id="pie" style="width:91%; height:400px; "> </div>
</div>