Revert "监控面板内容修改"

This reverts commit 455603de92.
This commit is contained in:
liuwei
2025-03-19 13:17:48 +08:00
parent 455603de92
commit 27b6fbf86f
4 changed files with 216 additions and 204 deletions

View File

@@ -232,102 +232,49 @@
}
// 准备数据
const dates = trendData.map(item => item.date);
const callCounts = trendData.map(item => item.call_count);
const successRates = trendData.map(item => item.success_rate);
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);
// 创建图表
// 创建图表
this.charts.trendChart = new Chart(ctx, {
type: 'line',
data: {
labels: dates,
labels: labels,
datasets: [
{
label: '调用次数',
data: callCounts,
backgroundColor: 'rgba(54, 162, 235, 0.2)',
label: '调用',
data: totalData,
fill: false,
backgroundColor: 'rgba(54, 162, 235, 0.6)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1,
yAxisID: 'y-axis-1'
tension: 0.1
},
{
label: '成功率(%)',
data: successRates,
backgroundColor: 'rgba(255, 99, 132, 0.2)',
label: '成功调用',
data: successData,
fill: false,
backgroundColor: 'rgba(75, 192, 192, 0.6)',
borderColor: 'rgba(75, 192, 192, 1)',
tension: 0.1
},
{
label: '失败调用',
data: errorData,
fill: false,
backgroundColor: 'rgba(255, 99, 132, 0.6)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1,
yAxisID: 'y-axis-2'
tension: 0.1
}
]
},
options: {
responsive: true,
scales: {
yAxes: [
{
id: 'y-axis-1',
type: 'linear',
position: 'left',
ticks: {
beginAtZero: true
},
scaleLabel: {
display: true,
labelString: '调用次数'
}
},
{
id: 'y-axis-2',
type: 'linear',
position: 'right',
ticks: {
beginAtZero: true,
max: 100
},
scaleLabel: {
display: true,
labelString: '成功率(%)'
}
}
]
}
}
});
},
renderSuccessRateChart() {
const ctx = document.getElementById('successRateChart').getContext('2d');
// 销毁旧图表
if (this.charts.successRateChart) {
this.charts.successRateChart.destroy();
}
// 准备数据
const plugins = this.pluginStats.map(item => item.plugin_name);
const successRates = this.pluginStats.map(item => item.success_rate);
// 创建图表
this.charts.successRateChart = new Chart(ctx, {
type: 'bar',
data: {
labels: plugins,
datasets: [{
label: '成功率(%)',
data: successRates,
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
max: 100
}
}]
y: {
beginAtZero: true
}
}
}
});