Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2313

Numpy: QLineSeries.appendNp accepts arrays, but doesn't append

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 6.5.1, 6.6.0
    • 6.4.2
    • PySide
    • None
    • Python 3.9
    • Linux/Wayland, Linux/X11
    • 499832abf (dev), 45ba07e31 (6.5), b1d1161a8 (dev), 08164fff6 (6.5)

    Description

      from PySide6.QtCore 
      import QPointFfrom PySide6.QtWidgets 
      import QMainWindow, QApplicationfrom PySide6.QtCharts 
      import QChart, QChartView, QLineSeries
      import numpy 
      import sys
      
      class TestChart(QMainWindow):    
          def __init__(self):        
              super().__init__()        
              self.series = QLineSeries()
              arr1 = numpy.array([2])        
              self.series.appendNp(arr1,arr1)        
              #self.series.append(QPointF(17, 6))        
              print(self.series.count())
              self.chart = QChart()        
              self.chart.addSeries(self.series)    
              self.chart.createDefaultAxes()        
              self._chart_view = QChartView(self.chart)        
              self.setCentralWidget(self._chart_view)
      
      if __name__ == "__main__":    
          app = QApplication(sys.argv)
          window = TestChart()    
          window.show()    
          window.resize(440, 300)    
          sys.exit(app.exec())
      
      
      

      The above code doesn't seem to actually append the numpy array to the QLineseries, as indicated by the length of the series. If the line that is commented out containing the QPoint is used in place of the numpy array, the program works as expected.

      Likely associated with https://bugreports.qt.io/browse/PYSIDE-1935, but given that the function actually works and doesn't return the error from 1935, it was my assumption numpy support was built in now?

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              basedgroebner User Groebner
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: