我在Boostrap标签中显示Google图表时遇到问题。我有两个标签,每个标签中都有一个Google图表。在第一个图表中,图表可以正确显示,但是在第二个图表中,图表很小并且可以压缩。我不明白为什么。
这是我的代码:
<div class="tab-pane active" id="player">
<h3>Players' resources</h3>
<div id="totalPlayerChart" style="height: 500px;"></div>
</div>
<div class="tab-pane" id="producer">
<h3>Producers' resources</h3>
<div id="totalProducerChart" style="height: 500px;"></div>
</div>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawTotalPlayerChart);
google.charts.setOnLoadCallback(drawTotalProducerChart);
function drawTotalPlayerChart() {
[...]
var chart = new google.visualization.LineChart(document.getElementById('totalPlayerChart'));
chart.draw(data, options);
}
function drawTotalProducerChart() {
[...]
var chart = new google.visualization.LineChart(document.getElementById('totalProducerChart'));
chart.draw(data, options);
}
</script>
Run Code Online (Sandbox Code Playgroud)