Details
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
- relates to
-
PYSIDE-1935 calling QXYSeries.appendNp returns type error
- Closed
-
PYSIDE-1880 Conversion from numpy.ndarray to QSurfaceDataArray
- Closed