【发布时间】:2016-10-12 00:17:10
【问题描述】:
我有以下代码来创建谷歌图表:
google.load("visualization", "1", {packages:["corechart"]});
var options = {
....
};
var data = google.visualization.arrayToDataTable([
...
]);
var chart = new google.visualization.BubbleChart(document.getElementById('consumer_s1'));
chart.draw(data, options);
在 BubbleChart 的文档中,Google 说“默认宽度:包含元素的宽度”。 我有这个容器:
<div class="responsive" id="consumer_s1">
与
.responsive{
height: 100%;
width: 100%;
}
但是当我创建图表时,在 Firebug 中我看到 Googlechart 创建了这些元素:
<div style="position: relative; width: 400px; height: 200px;" dir="ltr">
<div style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;" aria-label="Un grafico.">
<svg width="400" height="200" style="overflow: hidden;" aria-label="Un grafico." aria-hidden="true">
......
为什么创建的第一个 div 的高度和宽度具有该值??
【问题讨论】: