Merge pull request #1010 from Axel-Jacobsen/develop
BarGraphItem CSV/image export
This commit is contained in:
commit
b7a3237361
8
doc/source/graphicsItems/bargraphitem.rst
Normal file
8
doc/source/graphicsItems/bargraphitem.rst
Normal file
@ -0,0 +1,8 @@
|
||||
BarGraphItem
|
||||
============
|
||||
|
||||
.. autoclass:: pyqtgraph.BarGraphItem
|
||||
:members:
|
||||
|
||||
.. automethod:: pyqtgraph.BarGraphItem.__init__
|
||||
|
@ -48,7 +48,7 @@ class ImageExporter(Exporter):
|
||||
def export(self, fileName=None, toBytes=False, copy=False):
|
||||
if fileName is None and not toBytes and not copy:
|
||||
if QT_LIB in ['PySide', 'PySide2']:
|
||||
filter = ["*."+str(f) for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
filter = ["*."+str(f, encoding='utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
else:
|
||||
filter = ["*."+bytes(f).decode('utf-8') for f in QtGui.QImageWriter.supportedImageFormats()]
|
||||
preferred = ['*.png', '*.tif', '*.jpg']
|
||||
@ -105,7 +105,7 @@ class ImageExporter(Exporter):
|
||||
elif toBytes:
|
||||
return self.png
|
||||
else:
|
||||
self.png.save(fileName)
|
||||
return self.png.save(fileName)
|
||||
|
||||
ImageExporter.register()
|
||||
|
||||
|
@ -40,6 +40,7 @@ class BarGraphItem(GraphicsObject):
|
||||
y0=None,
|
||||
x1=None,
|
||||
y1=None,
|
||||
name=None,
|
||||
height=None,
|
||||
width=None,
|
||||
pen=None,
|
||||
@ -166,3 +167,15 @@ class BarGraphItem(GraphicsObject):
|
||||
if self.picture is None:
|
||||
self.drawPicture()
|
||||
return self._shape
|
||||
|
||||
def implements(self, interface=None):
|
||||
ints = ['plotData']
|
||||
if interface is None:
|
||||
return ints
|
||||
return interface in ints
|
||||
|
||||
def name(self):
|
||||
return self.opts.get('name', None)
|
||||
|
||||
def getData(self):
|
||||
return self.opts.get('x'), self.opts.get('height')
|
||||
|
Loading…
Reference in New Issue
Block a user