Qt 5.7 | Qt Data Visualization | QML Types | AbstractGraph3D QML Type

Qt 5.7.1 Reference Documentation

# AbstractGraph3D QML Type

Base type for 3D visualizations. More...

Import Statement: | import QtDataVisualization 1.2
Since: | QtDataVisualization 1.0
Inherited By: | Bars3D, Scatter3D, and Surface3D

- List of all members, including inherited members

## Properties

- aspectRatio : real
- currentFps : int
- customItemList : list<Custom3DItem>
- horizontalAspectRatio : real
- inputHandler : AbstractInputHandler3D
- locale : locale
- margin : real
- measureFps : bool
- msaaSamples : int
- optimizationHints : AbstractGraph3D.OptimizationHints
- orthoProjection : bool
- polar : bool
- queriedGraphPosition : vector3d
- radialLabelOffset : real
- reflection : bool
- reflectivity : real
- renderingMode : AbstractGraph3D.RenderingMode
- scene : Scene3D
- selectedElement : AbstractGraph3D.ElementType
- selectionMode : AbstractGraph3D.SelectionMode
- shadowQuality : AbstractGraph3D.ShadowQuality
- shadowsSupported : bool
- theme : Theme3D

## Methods

- int addCustomItem(Custom3DItem item)
- void clearSelection()
- void releaseCustomItem(Custom3DItem item)
- void removeCustomItem(Custom3DItem item)
- void removeCustomItemAt(vector3d position)
- void removeCustomItems()
- Abstract3DAxis selectedAxis()
- Custom3DItem selectedCustomItem()
- int selectedCustomItemIndex()
- int selectedLabelIndex()

## Detailed Description

This type is the base type for all 3D visualizations in QtDataVisualization.

Note that this type is uncreatable, but contains properties that are shared between the 3D visualizations.

For AbstractGraph3D enums, see QAbstract3DGraph::SelectionFlag, QAbstract3DGraph::ShadowQuality, QAbstract3DGraph::ElementType, and QAbstract3DGraph::OptimizationHint.

See also Bars3D, Scatter3D, Surface3D, and Qt Data Visualization C++ Classes.

## Property Documentation

aspectRatio : real

The aspect ratio is the ratio of the graph scaling between the longest axis on the horizontal plane and the Y-axis. Defaults to `2.0`.

Note: Has no effect on Bars3D.

This QML property was introduced in QtDataVisualization 1.1.

See also horizontalAspectRatio.

currentFps : int

When fps measuring is enabled, the results for the last second are stored in this read-only property. It takes at least a second before this value updates after measurement is activated.

This QML property was introduced in QtDataVisualization 1.1.

See also measureFps.

customItemList : list<Custom3DItem>

Add a list of Custom3DItems to the graph. Graph takes ownership of the added items.

This QML property was introduced in QtDataVisualization 1.1.

horizontalAspectRatio : real

The horizontal aspect ratio is the ratio of the graph scaling between the X and Z axes. Value of 0.0 indicates automatic scaling according to axis ranges. Defaults to `0.0`.

Note: Has no effect on Bars3D, which handles scaling on the horizontal plane via barThickness and barSpacing properties. Polar graphs also ignore this property.

This QML property was introduced in QtDataVisualization 1.2.

See also aspectRatio, polar, Bars3D::barThickness, and Bars3D::barSpacing.

inputHandler : AbstractInputHandler3D

Input handler. You can disable default input handlers by setting this property to `null`.

locale : locale

Sets the locale used for formatting various numeric labels. Defaults to `"C"` locale.

This QML property was introduced in QtDataVisualization 1.2.

See also ValueAxis3D::labelFormat.

margin : real

This property contains the absolute value used for graph margin. The graph margin is 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 size of the items in the series and the type of the graph. The value is interpreted as a fraction of Y-axis range, provided the graph aspect ratios have not beed changed from the defaults. Defaults to `-1.0`.

Note: Having smaller than the automatically determined margin on scatter graph can cause the scatter items at the edges of the graph to overlap with the graph background.

Note: On scatter and surface graphs, if the margin is comparatively small 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.

This QML property was introduced in QtDataVisualization 1.2.

measureFps : bool

If `true`, the rendering is done continuously instead of on demand, and currentFps property is updated. Defaults to `false`.

This QML property was introduced in QtDataVisualization 1.1.

See also currentFps.

msaaSamples : int

The number of samples used in multisample antialiasing when renderingMode is `RenderIndirect`. When renderingMode is `RenderDirectToBackground` or `RenderDirectToBackground_NoClear`, this property value is read-only and returns the number of samples specified by the window surface format. Defaults to `4`.

See also renderingMode.

optimizationHints : AbstractGraph3D.OptimizationHints

Defines if the rendering optimization is default or static. Default mode provides the full feature set at reasonable performance. 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 it with massive data sets is not advisable. Static works only on the Scatter graph. Defaults to `OptimizationDefault`.

Note: 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 have different maximum vertice counts per call that they support. This is mostly an issue on 32bit and/or OpenGL ES2 platforms. To work around this issue, choose an item mesh with low vertex count or use the point mesh.

This QML property was introduced in QtDataVisualization 1.1.

See also Abstract3DSeries::mesh.

orthoProjection : bool

If `true`, orthographic projection will be used for displaying the graph. Defaults to `false`.

Note: Shadows will be disabled when set to `true`.

This QML property was introduced in QtDataVisualization 1.1.

polar : bool

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

Defaults to `false`.

This QML property was introduced in QtDataVisualization 1.2.

See also orthoProjection and 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 before any queries are made.

There isn't a single correct 3D coordinate to match to each specific screen position, so to be consistent, the queries are always done against the inner sides of an invisible box surrounding the graph.

Note: Bar graphs only allow querying graph position at the graph floor level, so the Y-value is always zero for bar graphs and the valid queries can be only made at screen positions that contain the floor of the graph.

This QML property was introduced in QtDataVisualization 1.2.

See also 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 the labels should be drawn next to the 0-angle angular axis grid line. The value 1.0 indicates the labels are drawn on their normal place at the edge of the graph background. This property is ignored if polar property value is `false`. Defaults to 1.0.

This QML property was introduced in QtDataVisualization 1.2.

See also polar.

reflection : bool

Sets floor reflections on or off. Defaults to `false`.

Note: Affects only Bars3D.

Note: In Bars3D graphs holding both positive and negative values, reflections are not supported for custom items that intersect the floor plane. In that case, reflections should be turned off to avoid incorrect rendering.

This QML property was introduced in QtDataVisualization 1.2.

See also reflectivity.

reflectivity : real

Adjusts floor reflectivity, larger number being more reflective. Valid range is `[0...1]`. Defaults to `0.5`.

Note: Affects only Bars3D.

This QML property was introduced in QtDataVisualization 1.2.

See also reflection.

renderingMode : AbstractGraph3D.RenderingMode

Defaults to `RenderIndirect`.

Render Mode | Description
--- | ---
RenderDirectToBackground | Indicates the graph will be rendered directly on the window background. This mode also clears the whole window before rendering the graph, including the areas outside the graph. Since the graphs in this rendering mode are drawn on the window background under other QML items, the regular QML window clearing before rendering is suppressed. The graphs handle the clearing themselves instead. If the surface format of the window supports antialiasing, it will be used (see `QtDataVisualization::qDefaultSurfaceFormat()`). This rendering mode offers the best performance at the expense of non-standard QML behavior. For example, the graphs do not obey the Z ordering of QML items and the opacity value has no effect on them.
RenderDirectToBackground_NoClear | Similar to RenderDirectToBackground mode, except that the graph will not clear the whole window before rendering the graph. This mode is better for windows where you have other custom items besides the graphs that also draw on the window background. In that case you need to either take care of the window clearing yourself or ensure that all areas of the window are fully covered with opaque items. If one graph in the window uses either of the direct rendering modes, then all other graphs in the same window also drawn in direct modes should use the exact same direct rendering mode. Otherwise some graphs may not show up, depending on the drawing order of the graphs.
RenderIndirect | Indicates the graph will be first rendered to an offscreen surface that is then drawn during normal QML item rendering. The rendered image is antialiased using multisampling method if it is supported in the current environment and the msaaSamples property value is greater than zero. This rendering mode offers good quality and normal QML item behavior at the expense of performance.

Note: Antialiasing is not supported in OpenGL ES2 environments in any rendering mode.

Note: Setting the `antialiasing` property of the graphs doesn't do anything. However, it is set by the graph itself if the current rendering mode uses antialiasing.

See also msaaSamples.

scene : Scene3D

Read only property that can be used to access for example Camera3D via the Scene3D held here.

selectedElement : AbstractGraph3D.ElementType

Can be used to query the selected element type. Type is valid until the next `selectedElementChanged` signal.

`selectedElementChanged` signal is emitted when a selection is made in the graph.

Signal can be used for example for implementing customized input handling, as demonstrated in this example.

This QML property was introduced in QtDataVisualization 1.1.

See also selectedLabelIndex(), selectedAxis(), selectedCustomItemIndex(), selectedCustomItem(), Bars3D::selectedSeries, Scatter3D::selectedSeries, and Scene3D::selectionQueryPosition.

selectionMode : AbstractGraph3D.SelectionMode

Active selection mode in the visualization.

shadowQuality : AbstractGraph3D.ShadowQuality

Shadow quality.

shadowsSupported : bool

This read-only property indicates if shadows are supported with the current configuration or not. OpenGL ES2 configurations do not support shadows.

theme : Theme3D

The active theme of the graph.

## Method Documentation

int addCustomItem(Custom3DItem item)

Adds a 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.

This QML method was introduced in QtDataVisualization 1.1.

See also removeCustomItems(), removeCustomItem(), and removeCustomItemAt().

void clearSelection()

Clears selection from all attached series.

void releaseCustomItem(Custom3DItem item)

Gets ownership of item back and removes the item from the graph.

Note: If the same item is added back to the graph, the texture file needs to be re-set.

This QML method was introduced in QtDataVisualization 1.1.

See also Custom3DItem::textureFile.

void removeCustomItem(Custom3DItem item)

Removes the custom item. Deletes the resources allocated to it.

This QML method was introduced in QtDataVisualization 1.1.

void removeCustomItemAt(vector3d position)

Removes all custom items at position. Deletes the resources allocated to them.

This QML method was introduced in QtDataVisualization 1.1.

void removeCustomItems()

Removes all custom items. Deletes the resources allocated to them.

This QML method was introduced in QtDataVisualization 1.1.

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

Returns the selected axis, or null.

This QML method was introduced in QtDataVisualization 1.1.

See also selectedElement.

Custom3DItem selectedCustomItem()

Can be used to get the selected custom item after receiving `selectedElementChanged` signal with ElementCustomItem type. Ownership of the item remains with the graph. Selection is valid until the next `selectedElementChanged` signal.

Returns the selected custom item, or null.

This QML method was introduced in QtDataVisualization 1.1.

See also selectedElement.

int selectedCustomItemIndex()

Can be used to query the index of the selected custom item after receiving `selectedElementChanged` signal with ElementCustomItem type. Selection is valid until the next `selectedElementChanged` signal.

Returns index of the selected custom item, or -1.

This QML method was introduced in QtDataVisualization 1.1.

See also 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` signal.

Returns index of the selected label, or -1.

This QML method was introduced in QtDataVisualization 1.1.

See also selectedElement.