Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. function errorHandler(errorMessage) {
  2. //curisosity, check out the error in the console
  3. console.log(errorMessage);
  4.  
  5. //simply remove the error, the user never see it
  6. google.visualization.errors.removeError(errorMessage.id);
  7. }
  8.  
  9. function drawChart(json) {
  10. var data = new google.visualization.DataTable(json); //here, JSON is buggy
  11. var options = {
  12. title: 'test'
  13. };
  14. var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
  15.  
  16. //attach the error handler here, before draw()
  17. google.visualization.events.addListener(chart, 'error', errorHandler);
  18.  
  19. chart.draw(data, options);
  20. }
  21.  
  22. var data = google.visualization.arrayToDataTable(sourcedata);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement