调整使用趋势

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: [],
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