Added basic symbol support to LegendItem
This commit is contained in:
parent
a55d58024d
commit
91ac29bf23
@ -4,6 +4,7 @@ from ..Qt import QtGui, QtCore
|
|||||||
from .. import functions as fn
|
from .. import functions as fn
|
||||||
from ..Point import Point
|
from ..Point import Point
|
||||||
from .GraphicsWidgetAnchor import GraphicsWidgetAnchor
|
from .GraphicsWidgetAnchor import GraphicsWidgetAnchor
|
||||||
|
import pyqtgraph as pg
|
||||||
__all__ = ['LegendItem']
|
__all__ = ['LegendItem']
|
||||||
|
|
||||||
class LegendItem(GraphicsWidget, GraphicsWidgetAnchor):
|
class LegendItem(GraphicsWidget, GraphicsWidgetAnchor):
|
||||||
@ -136,6 +137,7 @@ class ItemSample(GraphicsWidget):
|
|||||||
return QtCore.QRectF(0, 0, 20, 20)
|
return QtCore.QRectF(0, 0, 20, 20)
|
||||||
|
|
||||||
def paint(self, p, *args):
|
def paint(self, p, *args):
|
||||||
|
#p.setRenderHint(p.Antialiasing) # only if the data is antialiased.
|
||||||
opts = self.item.opts
|
opts = self.item.opts
|
||||||
|
|
||||||
if opts.get('fillLevel',None) is not None and opts.get('fillBrush',None) is not None:
|
if opts.get('fillLevel',None) is not None and opts.get('fillBrush',None) is not None:
|
||||||
@ -146,6 +148,13 @@ class ItemSample(GraphicsWidget):
|
|||||||
p.setPen(fn.mkPen(opts['pen']))
|
p.setPen(fn.mkPen(opts['pen']))
|
||||||
p.drawLine(2, 18, 18, 2)
|
p.drawLine(2, 18, 18, 2)
|
||||||
|
|
||||||
|
symbol = opts.get('symbol', None)
|
||||||
|
if symbol is not None:
|
||||||
|
p.translate(10,10)
|
||||||
|
pen = pg.mkPen(opts['symbolPen'])
|
||||||
|
brush = pg.mkBrush(opts['symbolBrush'])
|
||||||
|
path = pg.graphicsItems.ScatterPlotItem.drawSymbol(p, symbol, opts['symbolSize'], pen, brush)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user