pie-simple.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*=========================================================================================
  2. File Name: pie.js
  3. Description: Chartjs pie 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. // Pie chart
  11. // ------------------------------
  12. $(window).on("load", function(){
  13. //Get the context of the Chart canvas element we want to select
  14. var ctx = $("#simple-pie-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: [85, 65, 34, 45, 35],
  27. backgroundColor: ["#99B898","#FECEA8","#FF847C","#E84A5F","#2A363B"],
  28. }]
  29. };
  30. var config = {
  31. type: 'pie',
  32. // Chart Options
  33. options : chartOptions,
  34. data : chartData
  35. };
  36. // Create the chart
  37. var pieSimpleChart = new Chart(ctx, config);
  38. });