I am collaborating on code that uses a custom class for the time axis:
class TimeStringAxis(pg.AxisItem):
def __init__(self, orientation='bottom', **kwargs):
super().__init__(orientation, **kwargs)
self.tick_strings_mode = 1
def tickSpacing(self, minVal, maxVal, size):
span = abs(maxVal - minVal)
for major, minordiv in const.TICK_SPACINGS:
if span >= 3*major:
break
return [
(major, 0),
(major/minordiv, 0),
]
def tickStrings(self, values, scale, spacing):
if self.tick_strings_mode == 0:
return values
elif self.tick_strings_mode == 1:
return [str(util.TDStr(t)) for t in values]
else:
return values
def setTickStringsMode(self, mode):
self.tick_strings_mode = mode
self.update()
The current goal is to be able to change the format of the tick strings
from the plot context menu. The issue is that the tick strings do not
update until a zoom or pan changes the range. Calling update doesn't seem
to do anything. Is there a means to force the axis to repaint after the
call to setTickStringsMode?
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/1fdb136c-3eb8-404f-b193-ae9bd92ba925n%40googlegroups.com.