doughnut-simple.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*=========================================================================================
  2. File Name: doughnut.js
  3. Description: Chartjs simple doughnut 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. // Doughnut chart
  11. // ------------------------------
  12. $(window).on("load", function(){
  13. //Get the context of the Chart canvas element we want to select
  14. var ctx = $("#simple-doughnut-chart");
  15. // Chart Options
  16. var chartOptions = {
  17. responsive: true,
  18. maintainAspectRatio: false,
  19. responsiveAnimationDuration:500,
  20. };
  21. // Chart Data
  22. var chartData = {
  23. labels: ["January", "February", "March", "April", "May"],
  24. datasets: [{
  25. label: "My First dataset",
  26. data: [65, 35, 24, 45, 85],
  27. backgroundColor: ["#99B898","#FECEA8","#FF847C","#E84A5F","#2A363B"],
  28. }]
  29. };
  30. var config = {
  31. type: 'doughnut',
  32. // Chart Options
  33. options : chartOptions,
  34. data : chartData
  35. };
  36. // Create the chart
  37. var doughnutSimpleChart = new Chart(ctx, config);
  38. });