Fix disconnections every 20sec and fix Y zoom

This commit is contained in:
2026-04-22 00:22:50 -03:00
parent 65a57b3429
commit 239ca7c5b4
5 changed files with 225 additions and 68 deletions

View File

@@ -79,6 +79,11 @@ class ChartPainter extends CustomPainter {
double yForVal(double v) =>
padTop + plotH * (1 - (v - yMin) / ySpan);
// Everything that draws into the plot area must stay within it; a
// Y-zoom can push line segments outside [padTop, padTop+plotH].
canvas.save();
canvas.clipRect(Rect.fromLTWH(padLeft, padTop, plotW, plotH));
// Hatched gap rectangles.
final hatchPaint = Paint()
..color = const Color(0x55993C1D)
@@ -134,6 +139,8 @@ class ChartPainter extends CustomPainter {
);
}
canvas.restore();
// Axes labels.
_drawText(canvas, '${yMax.toStringAsFixed(2)}',
Offset(padLeft - 4, padTop), align: TextAlign.right);