Skip to content

feat(usage): add bar and area chart toggle - #8439

Merged
farion1231 merged 2 commits into
farion1231:mainfrom
funkpopo:feat/8406-usage-chart-style
Oct 17, 2026
Merged

farion1231 merged 2 commits into
farion1231:mainfrom
funkpopo:feat/8406-usage-chart-style

Conversation

@funkpopo

@funkpopo funkpopo commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary / 概述

用量趋势目前只支持柱形图。本 PR 在趋势图右上方增加左右分段开关,允许用户在柱形图和平滑曲线面积图之间切换。

  • 默认使用柱形图,复用现有的本地偏好存储记住图表样式,重新打开用量页后恢复上次选择。
  • 两种样式共用 Token / 请求 / 成本指标、时间范围、筛选条件、坐标轴和提示信息,保留现有金额换算逻辑。
  • 面积图在只有一个数据点时显示圆点,避免趋势区域空白。
  • 补充简体中文、繁体中文、英文和日文文案,以及图表切换、偏好恢复和无效存储值回退的组件测试。

Related Issue / 关联 Issue

Fixes #8406

Screenshots / 截图

image

Checklist / 检查清单

  • pnpm typecheck passes / 通过 TypeScript 类型检查
  • pnpm format:check passes / 通过代码格式检查
  • pnpm test:unit --maxWorkers=4 --minWorkers=1 passes / 227 个测试文件、2,973 项测试全部通过
  • pnpm build:renderer passes / 通过前端构建
  • cargo clippy passes (if Rust code changed) / 不适用:本 PR 未修改 Rust 代码
  • Updated i18n files if user-facing text changed / 已更新四种语言的国际化文件

@funkpopo
funkpopo requested a review from farion1231 as a code owner October 16, 2026 18:39
@github-actions github-actions Bot added frontend Frontend (React/TypeScript) i18n Internationalization (zh/en/ja) labels Oct 16, 2026

@farion1231 farion1231 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,感谢您的贡献!

@farion1231
farion1231 merged commit 73f37c4 into farion1231:main Oct 17, 2026
5 checks passed
@farion1231

Copy link
Copy Markdown
Owner

已合并,再次感谢 @funkpopo!默认保持柱形图、面积图作为可记住的选项加回来,正好兼顾了 4.x 的默认观感和 3.x 用户的习惯;两种图共用坐标轴和金额换算,后续维护也省心。感谢您的贡献!

farion1231 added a commit that referenced this pull request Oct 17, 2026
The bar / area toggle added in #8439 sat on the trend chart header. Move it
to the Display section of the usage Settings tab, next to currency, the
sidebar Today items and request log columns, and store it with them as
usageDisplay.trendChartType in settings.json (bar when unset or unknown).
The chart header keeps only the metric switch. The localStorage key is
dropped; the toggle was never released, so there is nothing to migrate.
@funkpopo
funkpopo deleted the feat/8406-usage-chart-style branch October 18, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Frontend (React/TypeScript) i18n Internationalization (zh/en/ja)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

可否让3.x版本用量统计的趋势图回归

2 participants