Hello,
due to some missing feature on  "FERNman / angular-google-charts" wrapper 
(like: role "style"/"annotation") I'm trying to feed the classic "google.
charts.load" into a fresh test-ui angular project (v10).

So far I've put in app.component.html:

<html>
  <head>
   <script type="text/javascript" src=
"https://www.gstatic.com/charts/loader.js";></script>
  </head>

  <body>
   <div id="donutchart" style="width: 900px; height: 500px; border:solid 
1px black"></div>
  </body>
</html>

while app.component.ts I've the following:

import { Component } from '@angular/core';

declare var google: any;

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  title = 'test-ui';

  drawChart=function() {
  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', pieHole: 0.4 }; 
  var chart = new   google.visualization.PieChart(document.getElementById(
'donutchart')); 
  chart.draw(data, options); 
}

ngOnInit() {
  google.charts.load('current', {'packages':['corechart']});
  google.charts.setOnLoadCallback(this.drawChart);
}

}


Unfortunately this generate a "ERROR ReferenceError: google is not 
defined"...

Any tip to make this sample graph working in a angular environment ?

Thx in advance for any suggestion/hint/example!

Andrea


-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/435f4d45-d323-476c-8821-fc7c8c57dda5n%40googlegroups.com.

Reply via email to