From 38798c7a532d805134127db59ead4ea05231be89 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 14 Dec 2020 12:22:05 -0500 Subject: [PATCH] Fix axes for shm primary indexing --- piker/ui/_axes.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/piker/ui/_axes.py b/piker/ui/_axes.py index c5d8f2ea..d2bac3cd 100644 --- a/piker/ui/_axes.py +++ b/piker/ui/_axes.py @@ -116,13 +116,25 @@ class DynamicDateAxis(Axis): indexes: List[int], ) -> List[str]: - bars = self.linked_charts.chart._ohlc + # try: + chart = self.linked_charts.chart + bars = chart._ohlc + shm = self.linked_charts.chart._shm + first = shm._first.value + bars_len = len(bars) times = bars['time'] epochs = times[list( - map(int, filter(lambda i: i < bars_len, indexes)) + map( + int, + filter( + lambda i: i > 0 and i < bars_len, + (i-first for i in indexes) + ) + ) )] + # TODO: **don't** have this hard coded shift to EST dts = pd.to_datetime(epochs, unit='s') # - 4*pd.offsets.Hour()