Javascript google PieChart动画加载

时间:2017-04-17 12:17:06

标签: javascript

我正在进行Google PieChart,我希望负载具有加载效果,就像本网站上显示的圈子一样。 enter link description here 但在这个网站上使用另一个不是谷歌的图书馆。我需要找到谷歌的解决方案。

这是我的代码:

enter code here 

function cargarDonut(idElemento, color){
   google.charts.load("current", {packages:["corechart"]});
   google.charts.setOnLoadCallback(drawChart);

function drawChart() {
  var data = google.visualization.arrayToDataTable([
    ['Task', 'Hours per Day'],
    ['Work',     11],
    ['Eat',      2],
    ]);

  var options = {
    chartArea:{top:'0%',width:'100%', height:'80%'},
    height: 240,
    backgroundColor: 'transparent',
    pieHole: 0.67,
    legend: 'none',
    pieSliceBorder: 100,
    pieSliceText: 'none',
    slices: {  2: {offset: 1}},

    colors: [ '#797879', color],

  };

  var chart = new 
google.visualization.PieChart(document.getElementById(idElemento));
chart.draw(data, options);


}

}

1 个答案:

答案 0 :(得分:3)

我在这里为你做了一个例子。 https://jsfiddle.net/wecv3x8r/

class testModule {
    @Provides @Singleton
    fun provideTestServer(): TestService {
    }

 @Provides @Singleton
    fun provideTestServer(testService: TestService): TestClass {
    }
}