Advertisement
Guest User

Untitled

a guest
May 26th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <% content_for :js do %>
  2. alert('{{graphData}}')
  3. google.load('visualization', '1', {packages: ['corechart', 'line']});
  4. google.setOnLoadCallback(drawBasic);
  5. function drawBasic() {
  6. var data = new google.visualization.DataTable();
  7. data.addColumn('date', 'X');
  8. data.addColumn('number', 'Y');
  9. data.addRows([
  10. [new Date(2000, 8, 5), 0],
  11. [new Date(2000, 8, 6), 10],
  12. [new Date(2000, 8, 7), 23],
  13. [new Date(2000, 8, 8), 12],
  14. [new Date(2000, 8, 9), 2],
  15. [new Date(2000, 8, 10), 18],
  16. [new Date(2000, 8, 11), 25],
  17. ]);
  18. /**
  19. * Modify the javascript as you see fit just keep the options
  20. */
  21. var options = {
  22. chartArea: {
  23. top: 0,
  24. left: 0,
  25. width: '100%',
  26. height: '88%'
  27. },
  28. hAxis: {
  29. textStyle: {
  30. color: '#999',
  31. fontSize: 12,
  32. },
  33. baselineColor: 'transparent',
  34. gridlines: {
  35. color: 'transparent'
  36. }
  37. },
  38. vAxis: {
  39. textPosition: 'in',
  40. textStyle: {
  41. color: '#999',
  42. fontSize: 12,
  43. },
  44. baselineColor: 'transparent',
  45. gridlines: {
  46. count: 4,
  47. color: '#dfdfdf'
  48. }
  49. },
  50. legend: {
  51. position: 'none'
  52. },
  53. colors: [
  54. '#81abf1'
  55. ],
  56. pointSize: 8
  57. };
  58. var chart = new google.visualization.AreaChart(document.getElementById('chart'));
  59. chart.draw(data, options);
  60. }
  61. <% end %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement