Merge pull request #996 from kevinanewman/patch-1

Update LegendItem.py
This commit is contained in:
Ogi Moore 2019-08-16 21:19:18 -07:00 committed by GitHub
commit 750ec5a1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -101,6 +101,15 @@ class LegendItem(GraphicsWidget, GraphicsWidgetAnchor):
label.close()
self.updateSize() # redraq box
def clear(self):
"""
Removes all items from the legend.
Useful for reusing and dynamically updating charts and their legends.
"""
while self.items != []:
self.removeItem(self.items[0][1].text)
def updateSize(self):
if self.size is not None:
return