Surface3D QML Type

描述三维曲面图的用法。更多

Import Statement: import QtDataVisualization 1.9
Since: QtDataVisualization 1.0
Inherits:

AbstractGraph3D

属性

方法

详细说明

该类型使开发人员能够使用Qt Quick 渲染三维表面图。

您需要导入数据可视化模块才能使用该类型:

import QtDataVisualization 1.2

之后,您就可以在 qml 文件中使用 Surface3D 了:

import QtQuick 2.0
import QtDataVisualization 1.2

Item {
    width: 640
    height: 480

    Surface3D {
        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"
            }
        }
    }
    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"; }
    }
}

有关更全面的使用示例,请参见Surface Graph Gallery

另请参见 Surface3DSeries,ItemModelSurfaceDataProxy,Bars3D,Scatter3D, 以及 Qt Data Visualization C++ Classes.

属性文档

axisX : ValueAxis3D

活动 x 轴。

如果没有给出轴,则会创建一个没有标签和自动调整范围的临时默认轴。如果另一个轴被显式设置为相同方向,该临时轴将被销毁。


axisY : ValueAxis3D

活动 Y 轴。

如果没有给出轴,则会创建一个没有标签和自动调整范围的临时默认轴。如果另一个轴被明确设置为相同方向,则该临时轴将被销毁。


axisZ : ValueAxis3D

活动 Z 轴。

如果没有给出轴,则会创建一个没有标签和自动调整范围的临时默认轴。如果另一个轴被明确设置为相同方向,则该临时轴将被销毁。


flipHorizontalGrid : bool [since QtDataVisualization 1.2]

在某些使用情况下,横轴网格大部分会被表面覆盖,因此将横轴网格显示在图形顶部比显示在底部更有用。一个典型的使用案例就是使用正投影图形以自上而下的视角显示二维频谱图。

如果false ,横轴网格和标签将绘制在图表的水平背景上。如果为true ,则横轴网格和标签绘制在图形与水平背景相反的一侧。默认值为false

此属性在 QtDataVisualization 1.2 中引入。


selectedSeries : Surface3DSeries

所选系列或空。如果selectionMode 已设置SelectionMultiSeries 标志,则此属性将保存拥有所选点的系列。


seriesList : list<Surface3DSeries> [default]

该属性保存图形的系列。默认情况下,该属性包含一个空列表。要设置序列,可使用addSeries() 函数或将其定义为图形的子序列。


方法文档

void addSeries(Surface3DSeries series)

series 添加到图形中。

另请参阅 AbstractGraph3D::hasSeries() 。


void removeSeries(Surface3DSeries series)

从图表中删除series

另请参阅 AbstractGraph3D::hasSeries()。


© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.