homepage.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <!DOCTYPE html>
  2. <html lang="en-us">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta name="fastapitutorial.com" content="Nofoobar">
  7. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet"
  8. integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
  9. </head>
  10. <body>
  11. <h1 class="display-4">The Dash Board</h1>
  12. <canvas id="bar-yt" width="400" height="200"></canvas>
  13. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.6.2/chart.min.js"
  14. integrity="sha512-tMabqarPtykgDtdtSqCL3uLVM0gS1ZkUAVhRFu1vSEFgvB73niFQWJuvviDyBGBH22Lcau4rHB5p2K2T0Xvr6Q=="
  15. crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  16. <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
  17. <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js'></script>
  18. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"
  19. integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
  20. crossorigin="anonymous"></script>
  21. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js"
  22. integrity="sha384-Atwg2Pkwv9vp0ygtn1JAojH0nYbwNJLPhwyoVbhoPwBhjQPR5VtM2+xf0Uwh9KtT"
  23. crossorigin="anonymous"></script>
  24. <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.18/dist/sweetalert2.all.min.js"></script>
  25. <script src="https://kit.fontawesome.com/0b8ff4e055.js" crossorigin="anonymous"></script>
  26. <script>
  27. var ctx10 = document.getElementById('bar-yt');
  28. var myChart10 = new Chart(ctx10, {
  29. type: 'bar', //圖表類型
  30. data: {
  31. //標題
  32. labels: [ "{{ id }}", '那些足球教我的事'],
  33. datasets: [
  34. {
  35. label: '月搜量',
  36. data: [50, 11],
  37. borderColor: 'rgba(255, 206, 86, 1)',
  38. backgroundColor: 'rgba(255, 206, 86, 1)',
  39. },
  40. {
  41. label: '金額',
  42. data: [40.57, 91.72],
  43. borderColor: 'rgba(255, 99, 132, 1)',
  44. backgroundColor: 'rgba(255, 99, 132, 1)',
  45. },
  46. ],
  47. },
  48. options: {
  49. // indexAxis: 'y',
  50. plugins: {
  51. legend: {
  52. // display: false,
  53. labels: {
  54. padding: 5,
  55. font: {
  56. display: false,
  57. size: 16,
  58. },
  59. },
  60. },
  61. },
  62. scales: {
  63. x: {
  64. ticks: {
  65. font: {
  66. size: 16,
  67. }
  68. },
  69. title: {
  70. display: false,
  71. font: {
  72. family: 'Times',
  73. size: 48,
  74. },
  75. },
  76. },
  77. y: {
  78. title: {
  79. display: true,
  80. },
  81. ticks: {
  82. font: {
  83. size: 16,
  84. }
  85. },
  86. beginAtZero: true,
  87. }
  88. }
  89. }
  90. });
  91. </script>
  92. </body>
  93. </html>