简体   繁体   English

Google PieChart-在创建时添加动画

[英]Google PieChart - Adding Animation on Creation

I want to create a Google Pie Chart . 我想创建一个Google饼图

What I want to have is have a fancy animation on creating the chart when the page first loads. 我想拥有的是页面首次加载时创建图表时的精美动画。 What I have tried is this: 我试过的是:

<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',
          }
      };

      var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
      chart.draw(data, options);
    }
  </script>
</head>
<body>
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>
</body>
</html>

More specifically, it is: 更具体地说,它是:

animation: {
  duration: 1000,
  easing: 'in',
}

But it is not working. 但这是行不通的。

Can anyone help me please? 谁能帮我吗?

animation is not supported on Pie charts 饼图不支持动画

see Valid Chart Types in the table under supported-modifications 请参阅表中“ 支持的修改”下的有效图表类型

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM