From ef6a1167b059301b1f186497efcac3fd67ad48a3 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 16 Dec 2022 00:00:46 -0500 Subject: [PATCH] `Viz._index_field` a `typing.Literal[str]` --- piker/ui/_dataviz.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/piker/ui/_dataviz.py b/piker/ui/_dataviz.py index bec5481f..82cc2e37 100644 --- a/piker/ui/_dataviz.py +++ b/piker/ui/_dataviz.py @@ -21,6 +21,7 @@ Data vizualization APIs from __future__ import annotations from typing import ( Optional, + Literal, TYPE_CHECKING, ) @@ -243,8 +244,16 @@ class Viz(msgspec.Struct): # , frozen=True): is_ohlc: bool = False render: bool = True # toggle for display loop - # _index_field: str = 'index' - _index_field: str = 'time' + _index_field: Literal[ + 'index', + 'time', + + # TODO: idea is to re-index all time series to a common + # longest-len-int-index where we avoid gaps and instead + # graph on the 0 -> N domain of the array index super set. + # 'gapless', + + ] = 'time' # downsampling state _last_uppx: float = 0