Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. <div id="table_div"></div>
  2. <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> //USADO PARA AMBOS GRÁFCOS
  3.  
  4. <script>
  5. google.charts.load('current', {'packages':['table']});
  6. google.charts.setOnLoadCallback(drawTable);
  7.  
  8. function drawTable() {
  9. var data2 = new google.visualization.DataTable();
  10. data2.addColumn('string', 'Name');
  11. data2.addColumn('number', 'Salary');
  12. data2.addColumn('boolean', 'Full Time Employee');
  13. data2.addRows([
  14. ['Mike', {v: 10000, f: '$10,000'}, true],
  15. ['Jim', {v:8000, f: '$8,000'}, false],
  16. ['Alice', {v: 12500, f: '$12,500'}, true],
  17. ['Bob', {v: 7000, f: '$7,000'}, true]
  18. ]);
  19.  
  20. var table = new google.visualization.Table(document.getElementById('table_div'));
  21.  
  22. table.draw(data2, {showRowNumber: true, width: '30%', height: '30%'});
  23. }
  24. </script>
  25.  
  26. <div id="table_div"></div>
  27. <script>
  28. google.charts.load('current', {packages: ['corechart', 'line']});
  29. google.charts.setOnLoadCallback(drawCurveTypes);
  30. google.charts.load('current', {'packages':['table']});
  31. google.charts.setOnLoadCallback(drawTable);
  32.  
  33. function drawCurveTypes() {
  34. var data = new google.visualization.DataTable();
  35. data.addColumn('number', 'X');
  36. data.addColumn('number', 'iPhone 16GB');
  37. data.addColumn('number', 'iPhone 32GB');
  38.  
  39. data.addRows([
  40. [0, 100, 150], [1, 120, 140], [2, 110, 200], [3, 150, 220], [4, 100, 140]
  41. ]);
  42.  
  43. var options = {
  44. title: 'Price variation of iPhone 6s',
  45. curveType: 'none',
  46. legend: { position: 'bottom' },
  47. hAxis: {
  48. title: 'Last 5 days'
  49. },
  50. vAxis: {
  51. title: 'Price in $'
  52. },
  53. series: {
  54. 1: {curveType: 'none'}
  55. }
  56. };
  57.  
  58. var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
  59. chart.draw(data, options);
  60. }
  61. </script>
  62.  
  63. google.charts.load('current', {'packages':['table']});
  64. google.charts.setOnLoadCallback(drawTable);
  65. google.charts.setOnLoadCallback(drawTable2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement