feat(plot): add eight markers and high-rate timestamps

This commit is contained in:
2026-09-04 10:25:27 +03:00
parent e8490b3122
commit 0a30c39e07
7 changed files with 68 additions and 14 deletions

View File

@@ -21,10 +21,14 @@ class Marker(IntEnum):
B = 1
C = 2
D = 3
E = 4
F = 5
G = 6
H = 7
@property
def horizontal(self) -> bool:
return self in (Marker.C, Marker.D)
return self in (Marker.E, Marker.F, Marker.G, Marker.H)
class PlotMath:
@@ -103,6 +107,10 @@ class Markers:
b: Optional[float] = None
c: Optional[float] = None
d: Optional[float] = None
e: Optional[float] = None
f: Optional[float] = None
g: Optional[float] = None
h: Optional[float] = None
def value(self, marker: Marker) -> Optional[float]:
return getattr(self, marker.name.lower())
@@ -115,13 +123,14 @@ class Markers:
def positioned(self, core: PlotMath, bounds: Bounds) -> "Markers":
result = self
for marker, fraction in ((Marker.A, 1/3), (Marker.B, 2/3), (Marker.C, 2/3), (Marker.D, 1/3)):
for marker, fraction in ((Marker.A, .2), (Marker.B, .4), (Marker.C, .6), (Marker.D, .8),
(Marker.E, .2), (Marker.F, .4), (Marker.G, .6), (Marker.H, .8)):
if result.value(marker) is None:
result = result.move(marker, bounds.value(core, fraction, marker.horizontal))
return result
def reset(self, core: PlotMath, bounds: Bounds) -> "Markers":
return replace(self, a=None, b=None, c=None, d=None).positioned(core, bounds)
return replace(self, a=None, b=None, c=None, d=None, e=None, f=None, g=None, h=None).positioned(core, bounds)
def fraction(self, core: PlotMath, marker: Marker, bounds: Bounds) -> float:
value = self.value(marker)