diff --git a/plugins/stats_dashboard/templates/index.html b/plugins/stats_dashboard/templates/index.html index aca8966..26142da 100644 --- a/plugins/stats_dashboard/templates/index.html +++ b/plugins/stats_dashboard/templates/index.html @@ -140,7 +140,8 @@ topUsers: [], topGroups: [], topPlugins: [], - pluginStats: [] + pluginStats: [], + charts: {} // 添加charts对象 } }, mounted() { @@ -286,10 +287,15 @@ const ctx = document.getElementById('trendChart').getContext('2d'); // 销毁旧图表 - if (this.charts.trendChart) { + if (this.charts && this.charts.trendChart) { this.charts.trendChart.destroy(); } + // 确保charts对象存在 + if (!this.charts) { + this.charts = {}; + } + // 准备数据 const labels = trendData.map(item => item.stat_date); const totalData = trendData.map(item => item.total_calls); @@ -330,6 +336,7 @@ }, options: { responsive: true, + maintainAspectRatio: false, scales: { y: { beginAtZero: true