Fixes calculation of axis width/height in case values are not shown.
This commit is contained in:
parent
22ecd3cc41
commit
aa4b790dd2
@ -242,10 +242,12 @@ class AxisItem(GraphicsWidget):
|
|||||||
"""Set the height of this axis reserved for ticks and tick labels.
|
"""Set the height of this axis reserved for ticks and tick labels.
|
||||||
The height of the axis label is automatically added."""
|
The height of the axis label is automatically added."""
|
||||||
if h is None:
|
if h is None:
|
||||||
if self.style['autoExpandTextSpace'] is True:
|
h = 0
|
||||||
h = self.textHeight
|
if self.showValues:
|
||||||
else:
|
if self.style['autoExpandTextSpace'] is True:
|
||||||
h = self.style['tickTextHeight']
|
h = self.textHeight
|
||||||
|
else:
|
||||||
|
h = self.style['tickTextHeight']
|
||||||
h += max(0, self.tickLength) + self.style['tickTextOffset'][1]
|
h += max(0, self.tickLength) + self.style['tickTextOffset'][1]
|
||||||
if self.label.isVisible():
|
if self.label.isVisible():
|
||||||
h += self.label.boundingRect().height() * 0.8
|
h += self.label.boundingRect().height() * 0.8
|
||||||
@ -258,10 +260,12 @@ class AxisItem(GraphicsWidget):
|
|||||||
"""Set the width of this axis reserved for ticks and tick labels.
|
"""Set the width of this axis reserved for ticks and tick labels.
|
||||||
The width of the axis label is automatically added."""
|
The width of the axis label is automatically added."""
|
||||||
if w is None:
|
if w is None:
|
||||||
if self.style['autoExpandTextSpace'] is True:
|
w = 0
|
||||||
w = self.textWidth
|
if self.showValues:
|
||||||
else:
|
if self.style['autoExpandTextSpace'] is True:
|
||||||
w = self.style['tickTextWidth']
|
w = self.textWidth
|
||||||
|
else:
|
||||||
|
w = self.style['tickTextWidth']
|
||||||
w += max(0, self.tickLength) + self.style['tickTextOffset'][0]
|
w += max(0, self.tickLength) + self.style['tickTextOffset'][0]
|
||||||
if self.label.isVisible():
|
if self.label.isVisible():
|
||||||
w += self.label.boundingRect().height() * 0.8 ## bounding rect is usually an overestimate
|
w += self.label.boundingRect().height() * 0.8 ## bounding rect is usually an overestimate
|
||||||
@ -859,8 +863,8 @@ class AxisItem(GraphicsWidget):
|
|||||||
textSpecs.append((rect, textFlags, vstr))
|
textSpecs.append((rect, textFlags, vstr))
|
||||||
profiler('compute text')
|
profiler('compute text')
|
||||||
|
|
||||||
## update max text size if needed.
|
## update max text size if needed.
|
||||||
self._updateMaxTextSize(textSize2)
|
self._updateMaxTextSize(textSize2)
|
||||||
|
|
||||||
return (axisSpec, tickSpecs, textSpecs)
|
return (axisSpec, tickSpecs, textSpecs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user