diff --git a/plugins/stats_dashboard/templates/index.html b/plugins/stats_dashboard/templates/index.html index 26142da..c34cb0d 100644 --- a/plugins/stats_dashboard/templates/index.html +++ b/plugins/stats_dashboard/templates/index.html @@ -296,11 +296,13 @@ this.charts = {}; } - // 准备数据 - const labels = trendData.map(item => item.stat_date); - const totalData = trendData.map(item => item.total_calls); - const successData = trendData.map(item => item.success_calls); - const errorData = trendData.map(item => item.error_calls); + // 准备数据 - 修改字段名匹配和数据类型转换 + const labels = trendData.map(item => item.date); // 使用date而不是stat_date + const totalData = trendData.map(item => parseInt(item.total_calls) || 0); // 确保转换为数字 + const successData = trendData.map(item => parseInt(item.success_calls) || 0); + const errorData = trendData.map(item => parseInt(item.failed_calls) || 0); // 使用failed_calls而不是error_calls + + console.log('处理后的趋势数据:', { labels, totalData, successData, errorData }); // 创建新图表 this.charts.trendChart = new Chart(ctx, { @@ -336,7 +338,7 @@ }, options: { responsive: true, - maintainAspectRatio: false, + maintainAspectRatio: true, scales: { y: { beginAtZero: true