From aa9bd9994d865d9a6c4c34a9208f39bd509742e2 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 28 Feb 2023 15:01:00 -0500 Subject: [PATCH] Repair x-label datetime labels when in array-index mode --- piker/ui/_axes.py | 13 ++++++++----- piker/ui/_cursor.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/piker/ui/_axes.py b/piker/ui/_axes.py index 9eda3c75..62214f60 100644 --- a/piker/ui/_axes.py +++ b/piker/ui/_axes.py @@ -1,5 +1,5 @@ # piker: trading gear for hackers -# Copyright (C) Tyler Goodlet (in stewardship for piker0) +# Copyright (C) Tyler Goodlet (in stewardship for pikers) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -304,8 +304,9 @@ class DynamicDateAxis(Axis): viz = chart._vizs[chart.name] shm = viz.shm array = shm.array - times = array['time'] - i_0, i_l = times[0], times[-1] + ifield = viz.index_field + index = array[ifield] + i_0, i_l = index[0], index[-1] # edge cases if ( @@ -317,11 +318,13 @@ class DynamicDateAxis(Axis): (indexes[0] > i_0 and indexes[-1] > i_l) ): + # print(f"x-label indexes empty edge case: {indexes}") return [] - if viz.index_field == 'index': - arr_len = times.shape[0] + if ifield == 'index': + arr_len = index.shape[0] first = shm._first.value + times = array['time'] epochs = times[ list( map( diff --git a/piker/ui/_cursor.py b/piker/ui/_cursor.py index c118829f..79df305b 100644 --- a/piker/ui/_cursor.py +++ b/piker/ui/_cursor.py @@ -1,5 +1,5 @@ # piker: trading gear for hackers -# Copyright (C) Tyler Goodlet (in stewardship for piker0) +# Copyright (C) Tyler Goodlet (in stewardship for pikers) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by