Describes the usage of the 3D surface graph node. 更多...
| import 语句: |
import QtGraphs
|
| 继承: |
This type enables developers to render a surface graph node in 3D with Qt Quick.
You will need to import the Qt Graphs module to use this type:
import QtGraphs
After that you can use Surface3DNode in your qml files:
import QtQuick
import QtGraphs
View3D {
width: 640
height: 480
Surface3DNode {
width: parent.width
height: parent.height
Surface3DSeries {
itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel"
ItemModelSurfaceDataProxy {
itemModel: dataModel
// Mapping model roles to surface series rows, columns, and values.
rowRole: "longitude"
columnRole: "latitude"
yPosRole: "pop_density"
}
}
onTapped: {
// Disable the default input handler
unsetDefaultTapHandler()
// Implement own custom event handler
console.log("Custom tap event handler")
}
}
ListModel {
id: dataModel
ListElement{ longitude: "20"; latitude: "10"; pop_density: "4.75"; }
ListElement{ longitude: "21"; latitude: "10"; pop_density: "3.00"; }
ListElement{ longitude: "22"; latitude: "10"; pop_density: "1.24"; }
ListElement{ longitude: "23"; latitude: "10"; pop_density: "2.53"; }
ListElement{ longitude: "20"; latitude: "11"; pop_density: "2.55"; }
ListElement{ longitude: "21"; latitude: "11"; pop_density: "2.03"; }
ListElement{ longitude: "22"; latitude: "11"; pop_density: "3.46"; }
ListElement{ longitude: "23"; latitude: "11"; pop_density: "5.12"; }
ListElement{ longitude: "20"; latitude: "12"; pop_density: "1.37"; }
ListElement{ longitude: "21"; latitude: "12"; pop_density: "2.98"; }
ListElement{ longitude: "22"; latitude: "12"; pop_density: "3.33"; }
ListElement{ longitude: "23"; latitude: "12"; pop_density: "3.23"; }
ListElement{ longitude: "20"; latitude: "13"; pop_density: "4.34"; }
ListElement{ longitude: "21"; latitude: "13"; pop_density: "3.54"; }
ListElement{ longitude: "22"; latitude: "13"; pop_density: "1.65"; }
ListElement{ longitude: "23"; latitude: "13"; pop_density: "2.67"; }
}
}
另请参阅 Surface3DSeries , ItemModelSurfaceDataProxy , Bars3DNode , Scatter3DNode ,和 Qt Graphs C++ Classes for 3D .
|
aspectRatio : real |
The ratio of the graph scaling between the longest axis on the horizontal plane and the y-axis. Defaults to
2.0
.
注意: Has no effect on Bars3D .
另请参阅 horizontalAspectRatio .
|
axisX : Value3DAxis |
The active x-axis.
If an axis is not given, a temporary default axis with no labels and an automatically adjusting range is created. This temporary axis is destroyed if another axis is explicitly set to the same orientation.
|
axisY : Value3DAxis |
The active y-axis.
If an axis is not given, a temporary default axis with no labels and an automatically adjusting range is created. This temporary axis is destroyed if another axis is explicitly set to the same orientation.
|
axisZ : Value3DAxis |
The active z-axis.
If an axis is not given, a temporary default axis with no labels and an automatically adjusting range is created. This temporary axis is destroyed if another axis is explicitly set to the same orientation.
|
customItemList : list < Custom3DItem > |
列表 Custom3DItem items added to the graph. The graph takes ownership of the added items.
|
flipHorizontalGrid : bool |
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.
若
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
.
|
gridLineType : Graphs3D . GridLineType |
Defines whether the grid lines type is
Graphs3D.GridLineType.Shader
or
Graphs3D.GridLineType.Geometry
.
此值影响所有栅格线。
另请参阅 Graphs3D.GridLineType .
|
horizontalAspectRatio : real |
The ratio of the graph scaling between the x-axis and z-axis. The value of
0.0
indicates automatic scaling according to axis ranges. Defaults to
0.0
.
注意: Has no effect on Bars3DNode , which handles scaling on the horizontal plane via the barThickness and barSpacing properties. Polar graphs also ignore this property.
另请参阅 aspectRatio , polar , Bars3DNode::barThickness ,和 Bars3DNode::barSpacing .
|
labelMargin : real |
This property specifies the margin for the placement of the axis labels.
Negative values place the labels inside the plot-area while positive values place them outside the plot-area. Label automatic rotation is disabled when the value is negative. Defaults to
0.1
另请参阅 QAbstract3DAxis::labelAutoAngle .
|
locale : locale |
Sets the locale used for formatting various numeric labels. Defaults to the
"C"
locale.
另请参阅 Value3DAxis::labelFormat .
|
margin : real |
The absolute value used for the space left between the edge of the plottable graph area and the edge of the graph background.
If the margin value is negative, the margins are determined automatically and can vary according to the size of the items in the series and the type of the graph. The value is interpreted as a fraction of the y-axis range if the graph aspect ratios have not been changed from the default values. Defaults to
-1.0
.
注意: Setting a smaller margin for a scatter graph than the automatically determined margin can cause the scatter items at the edges of the graph to overlap with the graph background.
注意: On scatter and surface graphs, if the margin is small in comparison to the axis label size, the positions of the edge labels of the axes are adjusted to avoid overlap with the edge labels of the neighboring axes.
|
optimizationHint : Graphs3D . OptimizationHint |
Specifies whether the default or legacy mode is used for rendering optimization.
The default mode uses instanced rendering, and provides the full feature set at the best level of performance on most systems. The static mode optimizes graph rendering and is ideal for large non-changing data sets. It is slower with dynamic data changes and item rotations. Selection is not optimized, so using the static mode with massive data sets is not advisable. Legacy mode renders all items in th graph individually, without instancing. It should be used only if default mode does not work, that is the same as if the target system does not support instancing. Defaults to 默认 .
注意: On some environments, large graphs using static optimization may not render, because all of the items are rendered using a single draw call, and different graphics drivers support different maximum vertice counts per call. This is mostly an issue on 32bit and OpenGL ES2 platforms. To work around this issue, choose an item mesh with a low vertex count or use the point mesh.
另请参阅 Abstract3DSeries::mesh and Graphs3D.OptimizationHint .
|
polar : bool |
若
true
, the horizontal axes are changed into polar axes. The x-axis becomes the angular axis and the z-axis becomes the radial axis. Polar mode is not available for bar graphs.
默认为
false
.
另请参阅 radialLabelOffset .
|
queriedGraphPosition
:
vector3d
|
This read-only property contains the latest graph position values along each axis queried using
Scene3D::graphPositionQuery
. The values are normalized to range
[-1, 1]
. If the queried position was outside the graph bounds, the values will not reflect the real position, but will instead be some undefined position outside the range
[-1, 1]
. The value will be undefined until a query is made.
There is no single correct 3D coordinate to match a particular screen position, so to be consistent, the queries are always done against the inner sides of an invisible box surrounding the graph.
注意: Bar graphs only allow querying graph position at the graph floor level, so the y-value is always zero for bar graphs and valid queries can be only made at screen positions that contain the floor of the graph.
另请参阅 Scene3D::graphPositionQuery .
|
radialLabelOffset : real |
This property specifies the normalized horizontal offset for the axis labels of the radial polar axis. The value
0.0
indicates that the labels should be drawn next to the 0-angle angular axis grid line. The value
1.0
indicates that the labels are drawn in their usual place at the edge of the graph background. This property is ignored if the polar property value is
false
。默认为
1.0
.
另请参阅 polar .
|
selectedElement
:
Graphs3D
.
ElementType
|
The element selected in the graph.
This property can be used to query the selected element type. The type is valid until a new selection is made in the graph and the
selectedElementChanged
信号发射。
The signal can be used for example for implementing customized input handling, as demonstrated by the Axis Handling 范例。
另请参阅 selectedLabelIndex (), selectedAxis (), selectedCustomItemIndex (), selectedCustomItem (), Bars3DNode::selectedSeries , Scatter3DNode::selectedSeries , Scene3D::selectionQueryPosition ,和 Graphs3D.ElementType .
|
selectedSeries
:
Surface3DSeries
|
The selected series or null. If
selectionMode
拥有
MultiSeries
flag set, this property holds the series which owns the selected point.
|
selectionMode : Graphs3D . SelectionMode |
The active selection mode in the graph. One of the graphs3d.selectionflag 枚举值。
|
seriesList
:
list
<
Surface3DSeries
>
|
This property holds the series of the graph. By default, this property contains an empty list. To set the series, either use the addSeries () function or define them as children of the graph.
|
theme : GraphsTheme |
The active theme of the graph.
另请参阅 GraphsTheme .
|
axisXChanged ( ValueAxis3D axis ) |
此信号发射,当 axisX changes to axis .
注意:
相应处理程序是
onAxisXChanged
.
|
axisYChanged ( ValueAxis3D axis ) |
此信号发射,当 axisY changes to axis .
注意:
相应处理程序是
onAxisYChanged
.
|
axisZChanged ( ValueAxis3D axis ) |
此信号发射,当 axisZ changes to axis .
注意:
相应处理程序是
onAxisZChanged
.
|
flipHorizontalGridChanged ( bool flip ) |
此信号发射,当 flipHorizontalGrid changes to flip .
注意:
相应处理程序是
onFlipHorizontalGridChanged
.
|
selectedSeriesChanged ( Surface3DSeries series ) |
此信号发射,当 selectedSeries changes to series .
注意:
相应处理程序是
onSelectedSeriesChanged
.
|
qsizetype addCustomItem ( Custom3DItem item ) |
添加 Custom3DItem item to the graph. Graph takes ownership of the added item.
Returns index to the added item if add was successful, -1 if trying to add a null item, and index of the item if trying to add an already added item.
另请参阅 removeCustomItems (), removeCustomItem (),和 removeCustomItemAt ().
|
void addSeries ( Surface3DSeries series ) |
添加 series to the graph.
另请参阅 GraphsNode::hasSeries ().
|
void clearSelection () |
Clears selection from all attached series.
|
void doPicking ( QPoint point ) |
Performs picking using view coordinates from point on the elements of the graph, selecting the first item hit. Default input handling performs this upon receiving the onTapped event.
另请参阅 selectedElement .
|
void doRayPicking ( QVector3D origin , QVector3D direction ) |
Performs picking starting from origin 和在 direction on the elements of the graph, selecting the first item hit.
另请参阅 selectedElement .
|
bool hasSeries ( Abstract3DSeries series ) |
Returns whether the series has already been added to the graph.
|
void releaseCustomItem ( Custom3DItem item ) |
Gets ownership of item back and removes the item 从图形。
注意: If the same item is added back to the graph, the texture file needs to be re-set.
另请参阅 Custom3DItem::textureFile .
|
void removeCustomItem ( Custom3DItem item ) |
Removes the custom item . Deletes the resources allocated to it.
|
void removeCustomItemAt ( vector3d position ) |
Removes all custom items at position . Deletes the resources allocated to them.
|
void removeCustomItems () |
Removes all custom items. Deletes the resources allocated to them.
|
void removeSeries ( Surface3DSeries series ) |
移除 series 从图形。
另请参阅 GraphsNode::hasSeries ().
|
Abstract3DAxis selectedAxis () |
Can be used to get the selected axis after receiving
selectedElementChanged
signal with any label type. Selection is valid until the next
selectedElementChanged
信号。
Returns the selected axis, or null.
另请参阅 selectedElement .
|
Custom3DItem selectedCustomItem () |
Can be used to get the selected custom item after receiving
selectedElementChanged
signal with
ElementType.CustomItem
type. Ownership of the item remains with the graph. Selection is valid until the next
selectedElementChanged
信号。
Returns the selected custom item, or null.
另请参阅 selectedElement .
|
qsizetype selectedCustomItemIndex () |
Can be used to query the index of the selected custom item after receiving
selectedElementChanged
signal with
ElementType.CustomItem
type. Selection is valid until the next
selectedElementChanged
信号。
Returns index of the selected custom item, or -1.
另请参阅 selectedElement .
|
int selectedLabelIndex () |
Can be used to query the index of the selected label after receiving
selectedElementChanged
signal with any label type. Selection is valid until the next
selectedElementChanged
信号。
Returns index of the selected label, or -1.
另请参阅 selectedElement .