Axis line can optionally stop at the last tick
This commit is contained in:
parent
829503f3d2
commit
ee89b291dc
@ -383,7 +383,8 @@ class AxisItem(GraphicsWidget):
|
|||||||
picture = QtGui.QPicture()
|
picture = QtGui.QPicture()
|
||||||
painter = QtGui.QPainter(picture)
|
painter = QtGui.QPainter(picture)
|
||||||
specs = self.generateDrawSpecs(painter)
|
specs = self.generateDrawSpecs(painter)
|
||||||
self.drawPicture(painter, *specs)
|
if specs is not None:
|
||||||
|
self.drawPicture(painter, *specs)
|
||||||
finally:
|
finally:
|
||||||
painter.end()
|
painter.end()
|
||||||
self.picture = picture
|
self.picture = picture
|
||||||
@ -646,12 +647,16 @@ class AxisItem(GraphicsWidget):
|
|||||||
|
|
||||||
## determine mapping between tick values and local coordinates
|
## determine mapping between tick values and local coordinates
|
||||||
dif = self.range[1] - self.range[0]
|
dif = self.range[1] - self.range[0]
|
||||||
if axis == 0:
|
if dif == 0:
|
||||||
xScale = -bounds.height() / dif
|
xscale = 1
|
||||||
offset = self.range[0] * xScale - bounds.height()
|
offset = 0
|
||||||
else:
|
else:
|
||||||
xScale = bounds.width() / dif
|
if axis == 0:
|
||||||
offset = self.range[0] * xScale
|
xScale = -bounds.height() / dif
|
||||||
|
offset = self.range[0] * xScale - bounds.height()
|
||||||
|
else:
|
||||||
|
xScale = bounds.width() / dif
|
||||||
|
offset = self.range[0] * xScale
|
||||||
|
|
||||||
xRange = [x * xScale - offset for x in self.range]
|
xRange = [x * xScale - offset for x in self.range]
|
||||||
xMin = min(xRange)
|
xMin = min(xRange)
|
||||||
|
Loading…
Reference in New Issue
Block a user