diff --git a/Parking_spaces/Views/Engineering/Engineering_Index.cshtml b/Parking_spaces/Views/Engineering/Engineering_Index.cshtml index 80785ff..9cafa80 100644 --- a/Parking_spaces/Views/Engineering/Engineering_Index.cshtml +++ b/Parking_spaces/Views/Engineering/Engineering_Index.cshtml @@ -192,16 +192,16 @@
- +
-
+
每日車流量
-
+
@@ -235,9 +235,56 @@ var dailyTrafficData = dailyTrafficData // 取得 canvas 元素 - var ctx = document.getElementById('in_car_Bar') + var ctx1 = document.getElementById('in_car_Bar') + // 使用 Chart.js 繪製長條圖 + var myLineChart = new Chart(ctx1, { + type: 'line', + data: { + labels: date.reverse(), + datasets: [{ + label: '車流量', + data: values.reverse(), + backgroundColor: 'rgba(75, 192, 192, 0.2)', // 設定背景色 + borderColor: 'rgba(75, 192, 192, 1)', // 設定邊框色 + pointHitRadius: 10, + pointBorderWidth: 2, + ineTension: 0.3, + pointRadius: 3, + pointHoverRadius: 3, + }] + }, + options: { + responsive: true, // 啟用 responsive 設置 + maintainAspectRatio: false, // 保持長寬比例 + scales: { + y: { + beginAtZero: true + }, + xAxes: { + gridLines: { + display: false // 移除 x 軸的網格線 + } + } + } + } + }); + + + + } + + function set_in_yuntech_table_1(labels, dailyTrafficData) { + date = JSON.parse(JSON.stringify(labels)); + values = JSON.parse(JSON.stringify(dailyTrafficData)); + // 假設你有一些資料,例如每日車流量 + var dailyTrafficData = dailyTrafficData + + // 取得 canvas 元素 + var ctx = document.getElementById('in_car_Bar') + + // 使用 Chart.js 繪製長條圖 var myBarChart = new Chart(ctx, { type: 'bar', @@ -262,8 +309,8 @@ } }); - - + + } @@ -403,7 +450,7 @@ var daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24));// 轉換為天數(毫秒 / 1000 / 60 / 60 / 24) - if (daysDifference > 6) { + if (daysDifference > 29) { console.log(date_list) break } @@ -465,7 +512,7 @@ var daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24));// 轉換為天數(毫秒 / 1000 / 60 / 60 / 24) ////console.log(daysDifference) - if (daysDifference > 6) { + if (daysDifference > date_list.length) { break } var D_1 = new Date(date); @@ -556,7 +603,7 @@ var daysDifference = Math.floor(timeDifference / (1000 * 60 * 60 * 24));// 轉換為天數(毫秒 / 1000 / 60 / 60 / 24) ////console.log(daysDifference) - if (daysDifference > 6) { + if (daysDifference > date_list.length) { break } var D_1 = new Date(date); diff --git a/Parking_spaces/Views/Engineering/Engineering_Violation.cshtml b/Parking_spaces/Views/Engineering/Engineering_Violation.cshtml index fb6d8a7..93de2a3 100644 --- a/Parking_spaces/Views/Engineering/Engineering_Violation.cshtml +++ b/Parking_spaces/Views/Engineering/Engineering_Violation.cshtml @@ -37,13 +37,13 @@
- +
- 違規累犯 - + 每日違規數量 +
@@ -53,9 +53,114 @@
+ +
+
+
+
+ 違規次數 + +
+
+
+
+ +
+
+
+
+ + + + + + + + + +