Yes, that works. Thank you!

On Thu, Feb 4, 2021 at 6:20 PM Patrick <[email protected]> wrote:

> Hi,
>
> Try adding self.picture = None into your setTickStringsMode() method. I
> think the paint uses a rasterised buffer which simply gets redrawn on
> updates unless the buffer is cleared. So your self.update() is probably
> actually working - see the paint() method in AxisItem.
>
> Patrick
>
> On Friday, 5 February 2021 at 6:37:37 am UTC+10:30 pthomas wrote:
>
>> 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 a topic in the
> Google Groups "pyqtgraph" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/pyqtgraph/0ELS5lFkm_U/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyqtgraph/81f9e277-6185-4f56-b12b-6b010d82883en%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/81f9e277-6185-4f56-b12b-6b010d82883en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAGPNEROuXppH6x12YXaxZ%3DEG0Gr-iKWFj-gZ0crUhpFz9Dp5vg%40mail.gmail.com.

Reply via email to