我想要一个响应式谷歌饼图。
我所做的是——
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart()
{
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 11],
['Eat', 2],
['Commute', 2],
['Watch TV', 2],
['Sleep', 7]
]);
var options = {
title: 'My Daily Activities',
is3D: true,
animation:
{
duration: 1000,
easing: 'in',
},
width: '100%',
height: '100%',
legend:'none',
pieSliceText: 'percentage',
chartArea:
{
left: "0%",
top: "0%",
height: "100%",
width: "100%"
}
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div style="width: 100%; height: 100%;">
<div id="piechart_3d" style="width: inherit; height: inherit;"></div>
</div>
</body>
</html>
但它没有响应。
任何人都可以帮助我吗?