Loading...
Loading...
Compare original and translation side by side
displayStatedata.mapkeyhoveredIndexusePieStableuseRingStableuseChartStableStudioChartRenderpackages/studio/src/components/studio-chart-render.tsxdisplayStatedata.mapkeyhoveredIndexusePieStableuseRingStableuseChartStableStudioChartRenderpackages/studio/src/components/studio-chart-render.tsxddduseTransform| Prefer | Avoid |
|---|---|
| Continuous |
Static | Keeping Motion subscriptions on |
| Enter animation only, then static paths | Re-running enter path math on unrelated prop changes |
useMountProgressuseEnterCompletexyopacityscalemotion.gscalemotion.pathpackages/ui/src/charts/use-enter-complete.tsuseTransformd| 推荐方案 | 避免操作 |
|---|---|
使用 | 入场完成后持续对 |
入场完成后使用静态 | 在图表生命周期内保持对 |
| 仅保留入场动画,之后使用静态路径 | 在无关属性变化时重新执行入场路径计算 |
useMountProgressuseEnterCompletemotion.gxyopacityscalemotion.pathscalepackages/ui/src/charts/use-enter-complete.tshoveredIndexsetHoveredIndexuseCallbackisLoadeduseEffectuseStatepie-context.tsxring-context.tsxchart-context.tsxPieChartCoreRingChartCoreuseMemohoveredIndexsetHoveredIndexuseCallbackisLoadeduseEffectuseStatepie-context.tsxring-context.tsxchart-context.tsxPieChartCoreRingChartCoreuseMemopackages/studio/src/components/charts/*-studio*.tsx| Win | How |
|---|---|
| Conditional defs | Only pass |
| Memo derived data | Colored/mapped data arrays; slice/series lists ( |
| Memo motion enter | Don't call |
| Memo legend hover | |
| Memo chart body | |
| Disable glow in Studio | |
pie-studio-preview.tsxring-studio-preview.tsxpackages/studio/src/components/charts/*-studio*.tsx| 优化点 | 实现方式 |
|---|---|
| 条件式定义 | 仅当系列使用图案时才传递 |
| 记忆化衍生数据 | 着色/映射后的数数组、切片/系列列表(使用 |
| 记忆化motion入场属性 | 不要内联调用 |
| 记忆化图例悬停 | 在 |
| 记忆化图表主体 | 使用 |
| 在Studio中禁用发光效果 | 在系列组件上设置 |
pie-studio-preview.tsxring-studio-preview.tsx| Check | Slow chart often has | Fast chart often has |
|---|---|---|
| Shell | Inline render, extra defs | |
| Series count | Many animated paths | Fewer paths or simpler geometry |
| Hover | Context + full tree re-render | Stable subscribers; hover on |
| Enter | Path | Static |
| Pan | Chart tree rebuilds every frame | |
| 检查项 | 卡顿图表通常存在的问题 | 流畅图表通常具备的特征 |
|---|---|---|
| 外壳 | 内联渲染、冗余定义 | |
| 系列数量 | 大量带动画的路径 | 路径更少或几何形状更简单 |
| 悬停 | 上下文触发整树重新渲染 | 稳定的订阅者;在 |
| 入场动画 | 每个系列都有路径 | 入场后使用静态 |
| 平移 | 图表树每帧都重建 | |
pnpm lint
pnpm --filter @bklitui/ui check-types
pnpm --filter @bklitui/studio check-typespnpm lint
pnpm --filter @bklitui/ui check-types
pnpm --filter @bklitui/studio check-types
Manual `/studio?chart=<slug>`:
- [ ] Enter animation
- [ ] Hover / legend sync
- [ ] Drag geometry sliders (no unnecessary remount)
- [ ] Canvas pan (space + drag) after enter — FPS near pie-chart baseline
- [ ] Pattern/gradient mode if supported
---
手动访问`/studio?chart=<slug>`验证:
- [ ] 入场动画正常
- [ ] 悬停/图例同步正常
- [ ] 拖动几何形状滑块(无不必要的重新挂载)
- [ ] 入场完成后画布平移(空格+拖动)—— FPS接近饼图基准
- [ ] 若支持图案/渐变模式,需验证该模式正常
---| Chart | Slug | Status |
|---|---|---|
| Pie | | ✅ Reference (#120) |
| Ring | | ✅ Aligned to checklist (context split, static paths, |
| Radar / Funnel / Choropleth | various | Partial — run checklist |
| Cartesian / scatter / live-line | various | ✅ #91 decimation + hover batching |
| Sankey | | |
| Gauge | | Low priority (single arc) |
| 图表 | Slug | 状态 |
|---|---|---|
| 饼图 | | ✅ 参考实现(#120) |
| 环形图 | | ✅ 符合检查清单(上下文拆分、静态路径、 |
| 雷达图/漏斗图/分级统计图 | 多种 | 部分完成 —— 执行检查清单 |
| 笛卡尔图/散点图/实时折线图 | 多种 | ✅ #91 降采样 + 悬停批处理 |
| 桑基图 | | 在链接描边上使用 |
| 仪表盘 | | 低优先级(仅单个圆弧) |
| Area | Path |
|---|---|
| Enter-complete hook | |
| Pie reference | |
| Ring | |
| Pan isolation | |
| Registry | |
| 领域 | 路径 |
|---|---|
| 入场完成钩子 | |
| 饼图参考实现 | |
| 环形图 | |
| 平移隔离 | |
| 注册表 | |