当我使用谷歌图表时,它使用一个位置:绝对位于其中一个div中。这会弄乱布局。
在我放的HTML上:
<div id="chart-1-year" />
和Javascript:
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['x', 'Performance'],
<%= CurrentData.first.chart_1_year%>
]);
// Create and draw the visualization.
new google.visualization.LineChart(document.getElementById('chart-1-year')).
draw(data, {curveType: "function",
width: 500, height: 400, title: "Performance 1 Year"
}
);
}
我在浏览器上获得以下内容(使用Firebug):
<div class="row">
<div id="chart-1-year" style="position: relative;">
<div style="position: relative; width: 500px; height: 400px;" dir="ltr">
<div style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;">
</div>
<div style="display: none; position: absolute; top: 410px; left: 510px; white-space: nowrap; font-family: Arial; font-size: 12px;">Performance</div>
</div>
</div>
如果我删除“position:absolute;”它会正常工作从内部div。
如何更改位置设置?