- Qt 6.7
- Qt Graphs
- QML Types
- QtGraphs (Technical Preview)
- Surface3D
- Qt Graphs | Commercial or GPLv3

# Surface3D QML Type

Describes the usage of the 3D surface graph. More...

Import Statement: | import QtGraphs
Inherits: | AbstractGraph3D
Status: | Technical Preview

- List of all members, including inherited members
- Surface3D is part of Qt Graphs QML Types for 3D.

## Properties

- axisX : ValueAxis3D
- axisY : ValueAxis3D
- axisZ : ValueAxis3D
- flipHorizontalGrid : bool
- selectedSeries : Surface3DSeries
- seriesList : list<Surface3DSeries>

## Methods

- void addSeries(Surface3DSeries series)
- void removeSeries(Surface3DSeries series)

## Detailed Description

This type enables developers to render surface plots 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 Surface3D in your qml files:

     import QtQuick
     import QtGraphs

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

See Surface Graph Gallery for more thorough usage example.

See also Surface3DSeries, ItemModelSurfaceDataProxy, Bars3D, Scatter3D, and Qt Graphs C++ Classes for 3D.

## Property Documentation

axisX : ValueAxis3D

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 : ValueAxis3D

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 : ValueAxis3D

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.

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.

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`.

selectedSeries : Surface3DSeries

The selected series or null. If selectionMode has the `SelectionMultiSeries` flag set, this property holds the series which owns the selected point.

seriesList : list<Surface3DSeries> `[default]`

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.

## Method Documentation

void addSeries(Surface3DSeries series)

Adds the series to the graph.

See also AbstractGraph3D::hasSeries().

void removeSeries(Surface3DSeries series)

Removes the series from the graph.

See also AbstractGraph3D::hasSeries().