Merge pull request #1010 from Axel-Jacobsen/develop

BarGraphItem CSV/image export
This commit is contained in:
Ogi Moore 2019-08-16 20:42:58 -07:00 committed by GitHub
commit b7a3237361
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,8 @@
BarGraphItem
============
.. autoclass:: pyqtgraph.BarGraphItem
:members:
.. automethod:: pyqtgraph.BarGraphItem.__init__

View File

@ -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()

View File

@ -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')