modularize style and add propagating widgets

This commit is contained in:
2026-03-26 01:01:06 -07:00
parent 8e16f9f0b4
commit 2c3256fffc
17 changed files with 670 additions and 358 deletions

View File

@@ -39,6 +39,34 @@ class MeasureTable(list):
"""Named scalar measurements, typically rows of quantity/value/unit."""
@dataclass
class LineData:
data: np.ndarray
x_axis: np.ndarray | None = None
x_unit: str = ""
y_unit: str = ""
def __post_init__(self) -> None:
self.data = np.asarray(self.data, dtype=np.float64).ravel()
if self.x_axis is not None:
axis = np.asarray(self.x_axis, dtype=np.float64).ravel()
self.x_axis = axis[: len(self.data)]
else:
self.x_axis = None
def __array__(self, dtype=None):
return np.asarray(self.data, dtype=dtype) if dtype is not None else self.data
def __len__(self) -> int:
return len(self.data)
def __iter__(self):
return iter(self.data)
def __getitem__(self, item):
return self.data[item]
def _normalize_hex_color(color: Any, default: str = "#000000") -> str:
if isinstance(color, str):
text = color.strip()