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:
parent
ef5ac2bf94
commit
cba7ff590a
|
|
@ -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像素,避免 open≈close 时显示为横线"-"
|
||||
final minBodyHeight = math.max(bodyWidth * 0.4, 3.0);
|
||||
final actualBodyBottom = bodyBottom - bodyTop < minBodyHeight ? bodyTop + minBodyHeight : bodyBottom;
|
||||
|
||||
if (isUp) {
|
||||
// 阳线:空心或实心
|
||||
|
|
|
|||
Loading…
Reference in New Issue