调整使用趋势

This commit is contained in:
liuwei
2025-03-21 15:17:45 +08:00
parent 80f69d0e66
commit d176f2eb9c

View File

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