PySide6.QtGraphsWidgets.Q3DSurfaceWidgetItem¶
- class Q3DSurfaceWidgetItem¶
- The - Q3DSurfaceWidgetItemclass provides methods for rendering 3D surface plots. More…- Synopsis¶- Properties¶- axisXᅟ- Active x-axis
- axisYᅟ- Active y-axis
- axisZᅟ- Active z-axis
- flipHorizontalGridᅟ- Whether the horizontal axis grid is displayed on top of the graph rather than on the bottom
- selectedSeriesᅟ- Selected series or null
 - Methods¶- def - __init__()
- def - addAxis()
- def - addSeries()
- def - axes()
- def - axisX()
- def - axisY()
- def - axisZ()
- def - releaseAxis()
- def - removeSeries()
- def - selectedSeries()
- def - seriesList()
- def - setAxisX()
- def - setAxisY()
- def - setAxisZ()
 - Signals¶- def - axisXChanged()
- def - axisYChanged()
- def - axisZChanged()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- Warning - This section contains snippets that were automatically translated from C++ to Python and may contain errors. - This class enables developers to render 3D surface plots and to view them by rotating the scene freely. The visual properties of the surface such as draw mode and shading can be controlled via - QSurface3DSeries.- The - Q3DSurfaceWidgetItemsupports selection by showing a highlighted ball on the data point where the user has clicked with the left mouse button (when the default input handler is in use) or selected via- QSurface3DSeries. The selection pointer is accompanied by a label, which in the default case shows the value of the data point and the coordinates of the point.- The value range and the label format shown on the axis can be controlled through - QValue3DAxis.- To rotate the graph, hold down the right mouse button and move the mouse. Zooming is done using the mouse wheel. Both actions assume the default input handler is in use. - If no axes are set explicitly for - Q3DSurfaceWidgetItem, temporary default axes with no labels are created. These default axes can be modified via axis accessors, but as soon as any axis is set explicitly for the orientation, the default axis for that orientation is destroyed.- How to construct a minimal Q3DSurfaceWidgetItem graph¶- First, construct - Q3DSurfaceWidgetItem. Since we are running the graph as a top-level window in this example, we need to clear the- Qt::FramelessWindowHintflag, which is set by default:- quickWidget = QQuickWidget() surface = Q3DSurfaceWidgetItem() surface.setWidget(quickWidget) surface.widget().setMinimumSize(QSize(256, 256)) - Now - Q3DSurfaceWidgetItemis ready to receive data to be rendered. Create data elements to receive values:- Note - In the new proxy-series relationship, data is held in series. Therefore, for the proxy to be able to add, delete, or edit the data, it is a prerequisite to create a series first. - data = QSurfaceDataArray() dataRow1 = QSurfaceDataRow() dataRow2 = QSurfaceDataRow() - First feed the data to the row elements and then add their pointers to the data element: - dataRow1 << QSurfaceDataItem(0.0f, 0.1f, 0.5f) << QSurfaceDataItem(1.0f, 0.5f, 0.5f) dataRow2 << QSurfaceDataItem(0.0f, 1.8f, 1.0f) << QSurfaceDataItem(1.0f, 1.2f, 1.0f) data << dataRow1 << dataRow2 - Create a new series and set data to it: - series = QSurface3DSeries() series.dataProxy().resetArray(data) surface.addSeries(series) - Finally you will need to set it visible: - surface.widget().show() - The complete code needed to create and display this graph is: - if __name__ == "__main__": app = QApplication([]) quickWidget = QQuickWidget() surface = Q3DSurfaceWidgetItem() surface.setWidget(quickWidget) surface.widget().setMinimumSize(QSize(256, 256)) data = QSurfaceDataArray() dataRow1 = QSurfaceDataRow() dataRow2 = QSurfaceDataRow() dataRow1 << QSurfaceDataItem(0.0f, 0.1f, 0.5f) << QSurfaceDataItem(1.0f, 0.5f, 0.5f) dataRow2 << QSurfaceDataItem(0.0f, 1.8f, 1.0f) << QSurfaceDataItem(1.0f, 1.2f, 1.0f) data << dataRow1 << dataRow2 series = QSurface3DSeries() series.dataProxy().resetArray(data) surface.addSeries(series) surface.widget().show() sys.exit(app.exec()) - And this is what those few lines of code produce:   - The scene can be rotated, zoomed into, and a surface point can be selected to view its position, but no other interactions are included in this minimal code example. You can learn more by familiarizing yourself with the examples provided, like the Surface Graph Gallery . - Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- property axisXᅟ: QValue3DAxis¶
 - This property holds The active x-axis.. - Sets - axisas the active x-axis. Implicitly calls- addAxis()to transfer the ownership of the axis to this graph.- If - axisis null, a temporary default axis with no labels and an automatically adjusting range is created.- This temporary axis is destroyed if another axis is set explicitly to the same orientation. - See also - Access functions:
- Signal - axisXChanged()
 
 - property axisYᅟ: QValue3DAxis¶
 - This property holds The active y-axis.. - Sets - axisas the active y-axis. Implicitly calls- addAxis()to transfer the ownership of the axis to this graph.- If - axisis null, a temporary default axis with no labels and an automatically adjusting range is created.- This temporary axis is destroyed if another axis is set explicitly to the same orientation. - See also - Access functions:
- Signal - axisYChanged()
 
 - property axisZᅟ: QValue3DAxis¶
 - This property holds The active z-axis.. - Sets - axisas the active z-axis. Implicitly calls- addAxis()to transfer the ownership of the axis to this graph.- If - axisis null, a temporary default axis with no labels and an automatically adjusting range is created.- This temporary axis is destroyed if another axis is set explicitly to the same orientation. - See also - Access functions:
- Signal - axisZChanged()
 
 - property flipHorizontalGridᅟ: bool¶
 - This property holds Whether the horizontal axis grid is displayed on top of the graph rather than on the bottom.. - In some use cases, the horizontal axis grid is mostly covered by the surface, so it can be more useful to display the horizontal axis grid on top of the graph rather than on the bottom. A typical use case for this is showing 2D spectrograms using orthographic projection with a top-down viewpoint. - If - false, the horizontal axis grid and labels are drawn on the horizontal background of the graph. If- true, the horizontal axis grid and labels are drawn on the opposite side of the graph from the horizontal background. Defaults to- false.- Access functions:
 - property selectedSeriesᅟ: QSurface3DSeries¶
 - This property holds The selected series or null.. - If selectionMode has - MultiSeriesset, this property holds the series which owns the selected point.- Access functions:
 - Constructs a new 3D surface graph with the optional - parent.- addAxis(axis)¶
- Parameters:
- axis – - QValue3DAxis
 
 - Adds - axisto the graph. The axes added via addAxis are not yet taken to use, addAxis is simply used to give the ownership of the- axisto the graph. The- axismust not be null or added to another graph.- See also - addSeries(series)¶
- Parameters:
- series – - QSurface3DSeries
 
 - Adds the - seriesto the graph. A graph can contain multiple series, but has only one set of axes. If the newly added series has specified a selected item, it will be highlighted and any existing selection will be cleared. Only one added series can have an active selection.- See also - axes()¶
- Return type:
- .list of QValue3DAxis 
 
 - Returns the list of all added axes. - See also - axisX()¶
- Return type:
 - See also 
 - Getter of property - axisXᅟ.- axisXChanged(axis)¶
- Parameters:
- axis – - QValue3DAxis
 
 - Notification signal of property - axisXᅟ.- axisY()¶
- Return type:
 - See also 
 - Getter of property - axisYᅟ.- axisYChanged(axis)¶
- Parameters:
- axis – - QValue3DAxis
 
 - Notification signal of property - axisYᅟ.- axisZ()¶
- Return type:
 - See also 
 - Getter of property - axisZᅟ.- axisZChanged(axis)¶
- Parameters:
- axis – - QValue3DAxis
 
 - Notification signal of property - axisZᅟ.- flipHorizontalGrid()¶
- Return type:
- bool 
 - See also 
 - Getter of property - flipHorizontalGridᅟ.- flipHorizontalGridChanged(flip)¶
- Parameters:
- flip – bool 
 
 - Notification signal of property - flipHorizontalGridᅟ.- releaseAxis(axis)¶
- Parameters:
- axis – - QValue3DAxis
 
 - Releases the ownership of the - axisback to the caller, if it is added to this graph. If the released- axisis in use, a new default axis will be created and set active.- If the default axis is released and added back later, it behaves as any other axis would. - See also - removeSeries(series)¶
- Parameters:
- series – - QSurface3DSeries
 
 - Removes the - seriesfrom the graph.- See also - selectedSeries()¶
- Return type:
 
 - Getter of property - selectedSeriesᅟ.- selectedSeriesChanged(series)¶
- Parameters:
- series – - QSurface3DSeries
 
 - Notification signal of property - selectedSeriesᅟ.- seriesList()¶
- Return type:
- .list of QSurface3DSeries 
 
 - Returns the list of series added to this graph. - See also - setAxisX(axis)¶
- Parameters:
- axis – - QValue3DAxis
 - See also 
 - Setter of property - axisXᅟ.- setAxisY(axis)¶
- Parameters:
- axis – - QValue3DAxis
 - See also 
 - Setter of property - axisYᅟ.- setAxisZ(axis)¶
- Parameters:
- axis – - QValue3DAxis
 - See also 
 - Setter of property - axisZᅟ.- setFlipHorizontalGrid(flip)¶
- Parameters:
- flip – bool 
 - See also 
 - Setter of property - flipHorizontalGridᅟ.