fix(dashboard): Tooltip 过滤零值数据项,提升图表可读性#200
Merged
Merged
Conversation
在 makeExternalTooltipHandler 中新增 visiblePoints 过滤逻辑, 仅渲染 dp.raw 非零的数据项,避免大量零值条目稀释 Tooltip 可读性。 适用所有 4 个图表(请求量趋势、供应商分布、Token 趋势、模型 Token 堆叠)。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
Dashboard 图表 Tooltip 在鼠标悬停时会展示所有数据集的数值,包括大量数值为 0 的项目。当模型/供应商数量较多时,零值条目严重稀释了 Tooltip 的信息密度,影响可读性(如截图所示,14 个有效值混杂 9+ 个零值条目)。
解决方案
在
makeExternalTooltipHandler工厂函数中新增一行过滤逻辑:利用 JavaScript 的0
为 falsy),将原dataPoints的所有引用替换为过滤后的visiblePoints`,共涉及 3 处:showTotal)的数量判断与 reduce 累加影响范围
+5 / -4行验证
🤖 Generated with Claude Code, CodeX, Gemini