Quellcode durchsuchen

fleat: update chart

igb vor 1 Woche
Ursprung
Commit
e896fefa28
1 geänderte Dateien mit 8 neuen und 50 gelöschten Zeilen
  1. 8 50
      statistics_utils.php

+ 8 - 50
statistics_utils.php

@@ -291,11 +291,11 @@ function renderNewCustomersChart($customers) {
                 <tbody>
                     <?php foreach ($customers as $customer): ?>
                     <tr>
-                        <td><?php echo htmlspecialchars($customer['company_name']); ?></td>
-                        <td><?php echo htmlspecialchars($customer['customer_code']); ?></td>
-                        <td><?php echo htmlspecialchars($customer['country']); ?></td>
-                        <td><?php echo htmlspecialchars($customer['customer_type'] ?: '未分类'); ?></td>
-                        <td><?php echo htmlspecialchars($customer['employee_name']); ?></td>
+                        <td><?php echo htmlspecialcharsFix($customer['company_name']); ?></td>
+                        <td><?php echo htmlspecialcharsFix($customer['customer_code']); ?></td>
+                        <td><?php echo htmlspecialcharsFix($customer['country']); ?></td>
+                        <td><?php echo htmlspecialcharsFix($customer['customer_type'] ?: '未分类'); ?></td>
+                        <td><?php echo htmlspecialcharsFix($customer['employee_name']); ?></td>
                         <td><?php echo date('Y-m-d', strtotime($customer['add_date'])); ?></td>
                     </tr>
                     <?php endforeach; ?>
@@ -304,13 +304,8 @@ function renderNewCustomersChart($customers) {
         </div>
     </div>
     
-    <!-- 新增客户添加时间分布图 -->
-    <div class="chart-container">
-        <div>
-            <canvas id="newCustomersChart"></canvas>
-        </div>
-    </div>
-    
+
+
     <script>
     // 准备图表数据
     <?php
@@ -336,44 +331,7 @@ function renderNewCustomersChart($customers) {
     }
     ?>
     
-    var newCustomersCtx = document.getElementById('newCustomersChart').getContext('2d');
-    new Chart(newCustomersCtx, {
-        type: 'bar',
-        data: {
-            labels: <?php echo json_encode($dates); ?>,
-            datasets: [{
-                label: '新增客户数量',
-                data: <?php echo json_encode($counts); ?>,
-                backgroundColor: 'rgba(54, 162, 235, 0.5)',
-                borderColor: 'rgba(54, 162, 235, 1)',
-                borderWidth: 1
-            }]
-        },
-        options: {
-            responsive: true,
-            scales: {
-                y: {
-                    beginAtZero: true,
-                    title: {
-                        display: true,
-                        text: '客户数量'
-                    }
-                },
-                x: {
-                    title: {
-                        display: true,
-                        text: '日期'
-                    }
-                }
-            },
-            plugins: {
-                title: {
-                    display: true,
-                    text: '新增客户时间分布'
-                }
-            }
-        }
-    });
+
     </script>
     <?php
 }