Repair x-label datetime labels when in array-index mode

log_linearized_curve_overlays
Tyler Goodlet 2023-02-28 15:01:00 -05:00
parent 7579863068
commit 94f0ef13ef
2 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,5 @@
# piker: trading gear for hackers # 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 # 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 # 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] viz = chart._vizs[chart.name]
shm = viz.shm shm = viz.shm
array = shm.array array = shm.array
times = array['time'] ifield = viz.index_field
i_0, i_l = times[0], times[-1] index = array[ifield]
i_0, i_l = index[0], index[-1]
# edge cases # edge cases
if ( if (
@ -317,11 +318,13 @@ class DynamicDateAxis(Axis):
(indexes[0] > i_0 (indexes[0] > i_0
and indexes[-1] > i_l) and indexes[-1] > i_l)
): ):
# print(f"x-label indexes empty edge case: {indexes}")
return [] return []
if viz.index_field == 'index': if ifield == 'index':
arr_len = times.shape[0] arr_len = index.shape[0]
first = shm._first.value first = shm._first.value
times = array['time']
epochs = times[ epochs = times[
list( list(
map( map(

View File

@ -1,5 +1,5 @@
# piker: trading gear for hackers # 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 # 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 # it under the terms of the GNU Affero General Public License as published by