This commit is contained in:
SunSeekerX
2026-01-19 20:24:47 +08:00
parent 12fd5e1cb4
commit 76ecbe18a5
98 changed files with 8182 additions and 1896 deletions

View File

@@ -52,7 +52,7 @@ import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import { Chart } from 'chart.js/auto'
import { useDashboardStore } from '@/stores/dashboard'
import { useChartConfig } from '@/composables/useChartConfig'
import { formatNumber } from '@/utils/format'
import { formatNumber } from '@/utils/tools'
const dashboardStore = useDashboardStore()
const chartCanvas = ref(null)

View File

@@ -39,8 +39,10 @@ import { ref, onMounted, onUnmounted, watch } from 'vue'
import { Chart } from 'chart.js/auto'
import { useDashboardStore } from '@/stores/dashboard'
import { useChartConfig } from '@/composables/useChartConfig'
import { useThemeStore } from '@/stores/theme'
const dashboardStore = useDashboardStore()
const themeStore = useThemeStore()
const chartCanvas = ref(null)
let chart = null
@@ -83,16 +85,16 @@ const createChart = () => {
{
label: '请求次数',
data: dashboardStore.trendData.map((item) => item.requests),
borderColor: '#667eea',
backgroundColor: getGradient(ctx, '#667eea', 0.1),
borderColor: themeStore.currentColorScheme.primary,
backgroundColor: getGradient(ctx, themeStore.currentColorScheme.primary, 0.1),
yAxisID: 'y',
tension: 0.4
},
{
label: 'Token使用量',
data: dashboardStore.trendData.map((item) => item.tokens),
borderColor: '#f093fb',
backgroundColor: getGradient(ctx, '#f093fb', 0.1),
borderColor: themeStore.currentColorScheme.accent,
backgroundColor: getGradient(ctx, themeStore.currentColorScheme.accent, 0.1),
yAxisID: 'y1',
tension: 0.4
}
@@ -169,6 +171,14 @@ watch(
{ deep: true }
)
// 监听色系变化,重新创建图表
watch(
() => themeStore.colorScheme,
() => {
createChart()
}
)
onMounted(() => {
createChart()
})