chore: migrate remaining ECharts components to Chart.js
- Migrated 4 components from ECharts to Chart.js: * MonthlyExpenseCard.vue (折线图) * DailyTrendChart.vue (双系列折线图) * ExpenseCategoryCard.vue (环形图) * BudgetChartAnalysis.vue (仪表盘 + 多种图表) - Removed all ECharts imports and environment variable switches - Unified all charts to use BaseChart.vue component - Build verified: pnpm build success ✓ - No echarts imports remaining ✓ Refs: openspec/changes/migrate-remaining-echarts-to-chartjs
This commit is contained in:
45
AGENTS.md
45
AGENTS.md
@@ -29,8 +29,10 @@ EmailBill/
|
||||
| Data access | Repository/ | BaseRepository, GlobalUsings |
|
||||
| Business logic | Service/ | Jobs, Email services, App settings |
|
||||
| Application orchestration | Application/ | DTO 转换、业务编排、接口门面 |
|
||||
| Icon search integration | Service/IconSearch/ | Iconify API, AI keyword generation |
|
||||
| API endpoints | WebApi/Controllers/ | DTO patterns, REST controllers |
|
||||
| Frontend views | Web/src/views/ | Vue composition API |
|
||||
| Icon components | Web/src/components/ | Icon.vue, IconPicker.vue |
|
||||
| API clients | Web/src/api/ | Axios-based HTTP clients |
|
||||
| Tests | WebApi.Test/ | xUnit + NSubstitute + FluentAssertions |
|
||||
| Documentation archive | .doc/ | Technical docs, migration guides |
|
||||
@@ -163,6 +165,49 @@ const messageStore = useMessageStore()
|
||||
- Trailing commas: none
|
||||
- Print width: 100 chars
|
||||
|
||||
**Chart.js Usage (替代 ECharts):**
|
||||
- 使用 `chart.js` (v4.5+) + `vue-chartjs` (v5.3+) 进行图表渲染
|
||||
- 通用组件:`@/components/Charts/BaseChart.vue`
|
||||
- 主题配置:`@/composables/useChartTheme.ts`(自动适配 Vant 暗色模式)
|
||||
- 工具函数:`@/utils/chartHelpers.ts`(格式化、颜色、数据抽样)
|
||||
- 仪表盘插件:`@/plugins/chartjs-gauge-plugin.ts`(Doughnut + 中心文本)
|
||||
- 图表类型:line, bar, pie, doughnut
|
||||
- 特性:支持响应式、触控交互、prefers-reduced-motion
|
||||
|
||||
**Example:**
|
||||
```vue
|
||||
<template>
|
||||
<BaseChart
|
||||
type="line"
|
||||
:data="chartData"
|
||||
:options="chartOptions"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import BaseChart from '@/components/Charts/BaseChart.vue'
|
||||
import { useChartTheme } from '@/composables/useChartTheme'
|
||||
|
||||
const { getChartOptions } = useChartTheme()
|
||||
|
||||
const chartData = {
|
||||
labels: ['1月', '2月', '3月'],
|
||||
datasets: [{
|
||||
label: '支出',
|
||||
data: [100, 200, 150],
|
||||
borderColor: '#ff6b6b',
|
||||
backgroundColor: 'rgba(255, 107, 107, 0.1)'
|
||||
}]
|
||||
}
|
||||
|
||||
const chartOptions = getChartOptions({
|
||||
plugins: {
|
||||
legend: { display: false }
|
||||
}
|
||||
})
|
||||
</script>
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
**Backend (xUnit + NSubstitute + FluentAssertions):**
|
||||
|
||||
Reference in New Issue
Block a user