I already have the zoom set with setLimits. Also, since the text is able to be aligned at the top of the TextItem using anchor, I no longer have included the _hover_label_pos_offset; thus I am not customizing or modifying the position of the label.
On Sunday, April 14, 2019 at 8:53:25 PM UTC-4, Patrick wrote: > > Hi, > > Are the zoom limits where things go wrong realistic? If not, then you > could try restricting the zoom limits with something like > plotitem.setLimits(minXRange=1.0, maxXRange=1e6) > > Otherwise, is the problem because of a difference in plot vs pixel > coordinates? That is, a setPosition() call places items on the plot using > plot coordinates but, because a TextItem stays the same (pixel) size and is > not scaled with the view, your _hover_label_pos_offset (measured in plot > coordinates) becomes small/zero as you zoom out, and so isn't enough to > shift the label down into the plot range. > If that's the case, then you might need to convert coordinate systems, eg > using the getViewBox().mapFromView() method. > > Patrick > > On Saturday, 13 April 2019 02:22:05 UTC+9:30, [email protected] wrote: >> >> Oh, that's exactly what I am looking for. I had misinterpreted what it >> meant. >> Thank you! >> >> However, something else awkward is still happening (it was doing this >> before). Whenever the x-axis is zoomed far enough out, the label begins >> to get pushed up (beyond the maximum limit). >> When my x-axis is set large enough relative to the y-axis (x values are >> changed from velocity to frequency while the y values remain the same), the >> label is placed above the visible range. >> > -- 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/1429b735-d181-42fe-a4a3-f5d21b2ebb2c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
