Fix disconnections every 20sec and fix Y zoom
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user