Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EO Time Series Viewer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin Jakimow
EO Time Series Viewer
Commits
ee0825d6
Commit
ee0825d6
authored
11 years ago
by
Luke Campagnola
Browse files
Options
Downloads
Patches
Plain Diff
Allow custom ItemSamples in LegendItem.
parent
91ac29bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyqtgraph/graphicsItems/LegendItem.py
+8
-11
8 additions, 11 deletions
pyqtgraph/graphicsItems/LegendItem.py
with
8 additions
and
11 deletions
pyqtgraph/graphicsItems/LegendItem.py
+
8
−
11
View file @
ee0825d6
...
...
@@ -63,21 +63,23 @@ class LegendItem(GraphicsWidget, GraphicsWidgetAnchor):
=========== ========================================================
Arguments
item A PlotDataItem from which the line and point style
of the item will be determined
of the item will be determined or an instance of
ItemSample (or a subclass), allowing the item display
to be customized.
title The title to display for this item. Simple HTML allowed.
=========== ========================================================
"""
label
=
LabelItem
(
name
)
sample
=
ItemSample
(
item
)
if
isinstance
(
item
,
ItemSample
):
sample
=
item
else
:
sample
=
ItemSample
(
item
)
row
=
len
(
self
.
items
)
self
.
items
.
append
((
sample
,
label
))
self
.
layout
.
addItem
(
sample
,
row
,
0
)
self
.
layout
.
addItem
(
label
,
row
,
1
)
self
.
updateSize
()
#
#
# Ulrich
def
removeItem
(
self
,
name
):
"""
Removes one item from the legend.
...
...
@@ -87,6 +89,7 @@ class LegendItem(GraphicsWidget, GraphicsWidgetAnchor):
title The title displayed for this item.
=========== ========================================================
"""
# Thanks, Ulrich!
# cycle for a match
for
sample
,
label
in
self
.
items
:
print
label
.
text
,
name
...
...
@@ -98,12 +101,6 @@ class LegendItem(GraphicsWidget, GraphicsWidgetAnchor):
label
.
close
()
self
.
updateSize
()
# redraq box
# hcirlU
#
#
def
updateSize
(
self
):
if
self
.
size
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment