fix(mining-app): K线蜡烛图最小实体高度优化,消除横线"-"显示

问题:销毁时段(无交易)的小时K线中,open ≈ close(价差仅 ~2.8e-10),
蜡烛实体映射到像素后高度接近0,旧代码强制最小1px导致显示为横线"-"。

修复:将蜡烛实体最小高度从固定1px改为 max(bodyWidth * 0.4, 3.0)px,
即至少为蜡烛宽度的40%或3像素(取较大值),使 doji 蜡烛显示为
可辨识的小方块而非横线。有正常涨跌幅的蜡烛不受影响。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-04 21:31:52 -08:00
parent ef5ac2bf94
commit cba7ff590a
1 changed files with 3 additions and 1 deletions

View File

@ -179,7 +179,9 @@ class KlinePainter extends CustomPainter {
//
final bodyTop = math.min(yOpen, yClose);
final bodyBottom = math.max(yOpen, yClose);
final actualBodyBottom = bodyBottom - bodyTop < 1 ? bodyTop + 1 : bodyBottom;
// 40%3 openclose 线"-"
final minBodyHeight = math.max(bodyWidth * 0.4, 3.0);
final actualBodyBottom = bodyBottom - bodyTop < minBodyHeight ? bodyTop + minBodyHeight : bodyBottom;
if (isUp) {
// 线