Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
27f7ef72
Commit
27f7ef72
authored
Mar 29, 2014
by
Luke Campagnola
Browse files
Fixed AxisItem.__init__(showValues=False)
Merge branch 'JNevrly-showValues_fix' into develop
parents
604ea494
26c57a0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
27f7ef72
...
...
@@ -78,6 +78,7 @@ pyqtgraph-0.9.9 [unreleased]
- Fixed multiprocess deadlocks on windows
- Fixed GLGridItem.setSize
- Fixed parametertree.Parameter.sigValueChanging
- Fixed AxisItem.__init__(showValues=False)
pyqtgraph-0.9.8 2013-11-24
...
...
pyqtgraph/graphicsItems/AxisItem.py
View file @
27f7ef72
...
...
@@ -33,7 +33,6 @@ class AxisItem(GraphicsWidget):
GraphicsWidget
.
__init__
(
self
,
parent
)
self
.
label
=
QtGui
.
QGraphicsTextItem
(
self
)
self
.
showValues
=
showValues
self
.
picture
=
None
self
.
orientation
=
orientation
if
orientation
not
in
[
'left'
,
'right'
,
'top'
,
'bottom'
]:
...
...
@@ -53,7 +52,8 @@ class AxisItem(GraphicsWidget):
(
2
,
0.6
),
## If we already have 2 ticks with text, fill no more than 60% of the axis
(
4
,
0.4
),
## If we already have 4 ticks with text, fill no more than 40% of the axis
(
6
,
0.2
),
## If we already have 6 ticks with text, fill no more than 20% of the axis
]
],
'showValues'
:
showValues
,
}
self
.
textWidth
=
30
## Keeps track of maximum width / height of tick text
...
...
@@ -242,27 +242,31 @@ class AxisItem(GraphicsWidget):
"""Set the height of this axis reserved for ticks and tick labels.
The height of the axis label is automatically added."""
if
h
is
None
:
if
self
.
style
[
'autoExpandTextSpace'
]
is
True
:
if
not
self
.
style
[
'showValues'
]:
h
=
0
elif
self
.
style
[
'autoExpandTextSpace'
]
is
True
:
h
=
self
.
textHeight
else
:
h
=
self
.
style
[
'tickTextHeight'
]
h
+=
max
(
0
,
self
.
tickLength
)
+
self
.
style
[
'tickTextOffset'
][
1
]
textOffset
=
self
.
style
[
'tickTextOffset'
][
1
]
if
self
.
style
[
'showValues'
]
else
0
h
+=
max
(
0
,
self
.
tickLength
)
+
textOffset
if
self
.
label
.
isVisible
():
h
+=
self
.
label
.
boundingRect
().
height
()
*
0.8
self
.
setMaximumHeight
(
h
)
self
.
setMinimumHeight
(
h
)
self
.
picture
=
None
def
setWidth
(
self
,
w
=
None
):
"""Set the width of this axis reserved for ticks and tick labels.
The width of the axis label is automatically added."""
if
w
is
None
:
if
self
.
style
[
'autoExpandTextSpace'
]
is
True
:
if
not
self
.
style
[
'showValues'
]:
w
=
0
elif
self
.
style
[
'autoExpandTextSpace'
]
is
True
:
w
=
self
.
textWidth
else
:
w
=
self
.
style
[
'tickTextWidth'
]
w
+=
max
(
0
,
self
.
tickLength
)
+
self
.
style
[
'tickTextOffset'
][
0
]
textOffset
=
self
.
style
[
'tickTextOffset'
][
0
]
if
self
.
style
[
'showValues'
]
else
0
if
self
.
label
.
isVisible
():
w
+=
self
.
label
.
boundingRect
().
height
()
*
0.8
## bounding rect is usually an overestimate
self
.
setMaximumWidth
(
w
)
...
...
@@ -775,7 +779,11 @@ class AxisItem(GraphicsWidget):
textSize2
=
0
textRects
=
[]
textSpecs
=
[]
## list of draw
textSize2
=
0
# If values are hidden, return early
if
not
self
.
style
[
'showValues'
]:
return
(
axisSpec
,
tickSpecs
,
textSpecs
)
for
i
in
range
(
len
(
tickLevels
)):
## Get the list of strings to display for this level
if
tickStrings
is
None
:
...
...
@@ -858,7 +866,7 @@ class AxisItem(GraphicsWidget):
#p.drawText(rect, textFlags, vstr)
textSpecs
.
append
((
rect
,
textFlags
,
vstr
))
profiler
(
'compute text'
)
## update max text size if needed.
self
.
_updateMaxTextSize
(
textSize2
)
...
...
pyqtgraph/graphicsItems/HistogramLUTItem.py
View file @
27f7ef72
...
...
@@ -58,7 +58,7 @@ class HistogramLUTItem(GraphicsWidget):
self
.
region
=
LinearRegionItem
([
0
,
1
],
LinearRegionItem
.
Horizontal
)
self
.
region
.
setZValue
(
1000
)
self
.
vb
.
addItem
(
self
.
region
)
self
.
axis
=
AxisItem
(
'left'
,
linkView
=
self
.
vb
,
maxTickLength
=-
10
,
showValues
=
False
)
self
.
axis
=
AxisItem
(
'left'
,
linkView
=
self
.
vb
,
maxTickLength
=-
10
)
self
.
layout
.
addItem
(
self
.
axis
,
0
,
0
)
self
.
layout
.
addItem
(
self
.
vb
,
0
,
1
)
self
.
layout
.
addItem
(
self
.
gradient
,
0
,
2
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment