donut-rotated.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*=========================================================================================
  2. File Name: donut-rotated.js
  3. Description: google donut chart
  4. ----------------------------------------------------------------------------------------
  5. Item Name: Robust - Responsive Admin Theme
  6. Version: 1.2
  7. Author: PIXINVENT
  8. Author URL: http://www.themeforest.net/user/pixinvent
  9. ==========================================================================================*/
  10. // Donut rotated chart
  11. // ------------------------------
  12. // Load the Visualization API and the corechart package.
  13. google.load('visualization', '1.0', {'packages':['corechart']});
  14. // Set a callback to run when the Google Visualization API is loaded.
  15. google.setOnLoadCallback(drawDonutRotated);
  16. // Callback that creates and populates a data table, instantiates the pie chart, passes in the data and draws it.
  17. function drawDonutRotated() {
  18. // Create the data table.
  19. var data = google.visualization.arrayToDataTable([
  20. ['Task', 'Hours per Day'],
  21. ['Work', 11],
  22. ['Eat', 2],
  23. ['Commute', 2],
  24. ['Watch TV', 2],
  25. ['Sleep', 7]
  26. ]);
  27. // Set chart options
  28. var options_donut_rotated = {
  29. title: 'My Daily Activities',
  30. height: 400,
  31. fontSize: 12,
  32. colors:['#99B898','#FECEA8', '#FF847C', '#E84A5F', '#474747'],
  33. pieHole: 0.55,
  34. pieStartAngle: 180,
  35. chartArea: {
  36. left: '5%',
  37. width: '90%',
  38. height: 350
  39. },
  40. };
  41. // Instantiate and draw our chart, passing in some options.
  42. var donutRotated = new google.visualization.PieChart(document.getElementById('donut-rotated'));
  43. donutRotated.draw(data, options_donut_rotated);
  44. }
  45. // Resize chart
  46. // ------------------------------
  47. $(function () {
  48. // Resize chart on menu width change and window resize
  49. $(window).on('resize', resize);
  50. $(".menu-toggle").on('click', resize);
  51. // Resize function
  52. function resize() {
  53. drawDonutRotated();
  54. }
  55. });