On this page

Bars3D QML Type

3D bar graph. More...

Import Statement: import QtGraphs
Inherits:

GraphsItem3D

Properties

Signals

Methods

Detailed Description

This type enables developers to render bar graphs in 3D with Qt Quick.

You will need to import Qt Graphs module to use this type:

import QtGraphs

After that you can use Bars3D in your qml files:

import QtQuick
import QtGraphs

Item {
    width: 640
    height: 480

    Bars3D {
        width: parent.width
        height: parent.height

        Bar3DSeries {
            itemLabelFormat: "@colLabel, @rowLabel: @valueLabel"

            ItemModelBarDataProxy {
                itemModel: dataModel
                // Mapping model roles to bar series rows, columns, and values.
                rowRole: "year"
                columnRole: "city"
                valueRole: "expenses"
            }
        }
    }

    ListModel {
        id: dataModel
        ListElement{ year: "2022"; city: "Oulu";     expenses: "4200"; }
        ListElement{ year: "2022"; city: "Rauma";    expenses: "2100"; }
        ListElement{ year: "2022"; city: "Helsinki"; expenses: "7040"; }
        ListElement{ year: "2022"; city: "Tampere";  expenses: "4330"; }
        ListElement{ year: "2023"; city: "Oulu";     expenses: "3960"; }
        ListElement{ year: "2023"; city: "Rauma";    expenses: "1990"; }
        ListElement{ year: "2023"; city: "Helsinki"; expenses: "7230"; }
        ListElement{ year: "2023"; city: "Tampere";  expenses: "4650"; }
    }
}

See Simple Bar Graph for more thorough usage example.

See also Bar3DSeries, ItemModelBarDataProxy, Scatter3D, Surface3D, and Qt Graphs C++ Classes for 3D.

Property Documentation

ambientLightStrength : real

The ambient light strength for the whole graph. This value determines how evenly and brightly the colors are shown throughout the graph regardless of the light position. The value must be between 0.0 and 1.0.

aspectRatio : real

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.

See also horizontalAspectRatio.

barSeriesMargin : size

Margin between series columns in X and Z dimensions. Preset to (0.0, 0.0) by default. Sensible values are on the range [0,1).

barSpacing : size

Bar spacing in X and Z dimensions.

Preset to (1.0, 1.0) by default. Spacing is affected by the barSpacingRelative property.

barSpacingRelative : bool

Whether spacing is absolute or relative to bar thickness.

If true, the value of 0.0 means that the bars are placed side-to-side, 1.0 means that a space as wide as the thickness of one bar is left between the bars, and so on. Preset to true.

barThickness : real

The bar thickness ratio between the X and Z dimensions. The value 1.0 means that the bars are as wide as they are deep, whereas 0.5 makes them twice as deep as they are wide.

cameraPreset : enumeration

The currently active camera preset, which is one of Graphs3D.CameraPreset. If no preset is active, the value is Graphs3D.CameraPreset.NoPreset.

ConstantDescription
Graphs3D.CameraPreset.NoPresetUsed to indicate a preset has not been set, or the scene has been rotated freely.
Graphs3D.CameraPreset.FrontLowBoth x and y rotations of the camera are 0.
Graphs3D.CameraPreset.FrontX rotation is 0 and y rotation is 22.5 degrees.
Graphs3D.CameraPreset.FrontHighX rotation is 0 and y rotation is 45 degrees.
Graphs3D.CameraPreset.LeftLowX rotation is 90 and y rotation is 0 degrees.
Graphs3D.CameraPreset.LeftX rotation is 90 and y rotation is 22.5 degrees.
Graphs3D.CameraPreset.LeftHighX rotation is 90 and y rotation is 45 degrees.
Graphs3D.CameraPreset.RightLowX rotation is -90 and y rotation is 0 degrees.
Graphs3D.CameraPreset.RightX rotation is -90 and y rotation is 22.5 degrees.
Graphs3D.CameraPreset.RightHighX rotation is -90 and y rotation is 45 degrees.
Graphs3D.CameraPreset.BehindLowX rotation is 180 and y rotation is 0 degrees.
Graphs3D.CameraPreset.BehindX rotation is 180 and y rotation is 22.5 degrees.
Graphs3D.CameraPreset.BehindHighX rotation is 180 and y rotation is 45 degrees.
Graphs3D.CameraPreset.IsometricLeftX rotation is 45 and y rotation is 22.5 degrees.
Graphs3D.CameraPreset.IsometricLeftHighX rotation is 45 and y rotation is 45 degrees.
Graphs3D.CameraPreset.IsometricRightX rotation is -45 and y rotation is 22.5 degrees.
Graphs3D.CameraPreset.IsometricRightHighX rotation is -45 and y rotation is 45 degrees.
Graphs3D.CameraPreset.DirectlyAboveX rotation is 0 and y rotation is 90 degrees.
Graphs3D.CameraPreset.DirectlyAboveCW45X rotation is -45 and y rotation is 90 degrees.
Graphs3D.CameraPreset.DirectlyAboveCCW45X rotation is 45 and y rotation is 90 degrees.
Graphs3D.CameraPreset.FrontBelowX rotation is 0 and y rotation is -45 degrees. In Q3DBarsWidgetItem from FrontBelow onward these only work for graphs including negative values. They act as CameraPreset...Low for positive-only values.
Graphs3D.CameraPreset.LeftBelowX rotation is 90 and y rotation is -45 degrees.
Graphs3D.CameraPreset.RightBelowX rotation is -90 and y rotation is -45 degrees.
Graphs3D.CameraPreset.BehindBelowX rotation is 180 and y rotation is -45 degrees.
Graphs3D.CameraPreset.DirectlyBelowX rotation is 0 and y rotation is -90 degrees. Acts as FrontLow for positive-only bars.

cameraTargetPosition : vector3d

The camera target as a vector3d. Defaults to vector3d(0.0, 0.0, 0.0).

Valid coordinate values are between -1.0...1.0, where the edge values indicate the edges of the corresponding axis range. Any values outside this range are clamped to the edge.

cameraXRotation : real

The X-rotation angle of the camera around the target point in degrees starting from the current base position.

cameraYRotation : real

The Y-rotation angle of the camera around the target point in degrees starting from the current base position.

cameraZoomLevel : real

The camera zoom level in percentage. The default value of 100.0 means there is no zoom in or out set in the camera. The value is limited by the minCameraZoomLevel and maxCameraZoomLevel properties.

See also minCameraZoomLevel and maxCameraZoomLevel.

columnAxis : Category3DAxis

The active column axis.

If an axis is not given, a temporary default axis with no labels is created. This temporary axis is destroyed if another axis is explicitly set to the same orientation.

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 measuring is activated.

See also measureFps.

customItemList : list<Custom3DItem>

The list of Custom3DItem items added to the graph. The graph takes ownership of the added items.

cutoffMargin : real [since 6.11]

The value used for the difference between the axis limits and the position at which graph elements are culled.

Note: Does not affect bar graphs.

This property was introduced in Qt 6.11.

dragMode : enumeration [since 6.12]

Determines how drag events on the graph are interpreted, one of Graphs3D.DragMode enum values.

Defaults to Graphs3D.DragMode.Rotate.

ConstantDescription
Graphs3D.DragMode.RotateDragging rotates the graph.
Graphs3D.DragMode.PanDragging pans the graph.

This property was introduced in Qt 6.12.

See also panEnabled.

floorLevel : real

The floor level for the bar graph in Y-axis data coordinates.

The actual floor level will be restricted by the Y-axis minimum and maximum values. Defaults to zero.

gridLineType : enumeration

Defines whether the grid lines type is Graphs3D.GridLineType.Shader or Graphs3D.GridLineType.Geometry.

This value affects all grid lines.

ConstantDescription
Graphs3D.GridLineType.ShaderGrid lines are rendered with GPU in a shader.
Graphs3D.GridLineType.GeometryGrid lines are rendered with 3D models.

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

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

See also aspectRatio, polar, Bars3D::barThickness, and Bars3D::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

See also QAbstract3DAxis::labelAutoAngle.

lightColor : color

The color of the ambient and specular light defined in Scene3D.

lightStrength : real

The specular light strength for the whole graph. The value must be between 0.0 and 10.0.

This value affects the light specified in Scene3D.

locale : locale

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

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

Note: 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.

Note: 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.

maxCameraXRotation : real [since 6.9]

The maximum X-rotation angle of the camera around the target point in degrees. The default value is 180.0

This property was introduced in Qt 6.9.

maxCameraYRotation : real [since 6.9]

The maximum Y-rotation angle of the camera around the target point in degrees. The default value is 90.0

This property was introduced in Qt 6.9.

maxCameraZoomLevel : real

Sets the maximum allowed camera zoom level. If the new maximum level is lower than the existing minimum level, the minimum level is adjusted to the new maximum as well. If the current cameraZoomLevel is outside the new bounds, it is adjusted as well. Defaults to 500.0f.

See also cameraZoomLevel and minCameraZoomLevel.

measureFps : bool

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

See also currentFps.

minCameraXRotation : real [since 6.9]

The minimum X-rotation angle of the camera around the target point in degrees. The default value is -180.0

This property was introduced in Qt 6.9.

minCameraYRotation : real [since 6.9]

The minimum Y-rotation angle of the camera around the target point in degrees. The default value is 0.0

This property was introduced in Qt 6.9.

minCameraZoomLevel : real

Sets the minimum allowed camera zoom level. If the new minimum level is higher than the existing maximum level, the maximum level is adjusted to the new minimum as well. If the current cameraZoomLevel is outside the new bounds, it is adjusted as well. The minCameraZoomLevel cannot be set below 1.0. Defaults to 10.0.

See also cameraZoomLevel and maxCameraZoomLevel.

msaaSamples : int

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

See also renderingMode.

multiSeriesUniform : bool

Defines whether bars are to be scaled with proportions set to a single series bar even if there are multiple series displayed. If set to true, bar spacing will be correctly applied only to the X-axis. Preset to false by default.

optimizationHint : enumeration

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. Legacy mode renders all items in the graph individually, without instancing. Use it only if the default mode does not work, that is, if the target system does not support instancing. Defaults to Default.

ConstantDescription
Graphs3D.OptimizationHint.DefaultProvides the full feature set with instancing at a good performance.
Graphs3D.OptimizationHint.LegacyProvides the full feature set at a reasonable performance. To be used if OptimizationHint.Default performs poorly or does not work.

See also Abstract3DSeries::mesh and Graphs3D.OptimizationHint.

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.

panEnabled : bool [since 6.12]

Whether this input handler allows graph panning.

Defaults to true.

This property was introduced in Qt 6.12.

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.

See also orthoProjection and radialLabelOffset.

primarySeries : Bar3DSeries

The primary series of the graph. It is used to determine the row and column axis labels when the labels are not explicitly set to the axes.

If the specified series is not yet added to the graph, setting it as the primary series will also implicitly add it to the graph.

If the primary series itself is removed from the graph, this property resets to default.

If the series is null, this property resets to default. Defaults to the first added series or zero if no series are added to the graph.

queriedGraphPosition : vector3d [read-only]

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.

Note: 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.

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 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. Defaults to 1.0.

See also polar.

renderingMode : enumeration

How the graph will be rendered. Defaults to Indirect.

Note: Setting the antialiasing property of the graph does not do anything. However, it is set by the graph itself if the current rendering mode uses antialiasing.

ConstantDescription
Graphs3D.RenderingMode.DirectToBackgroundIndicates that the graph will be rendered directly on the window background and QML items are rendered on top of it. Using non-transparent QML item as a background will hide the graph. Clears the whole window before rendering the graph, including the areas outside the graph. If the surface format of the window supports antialiasing, it will be used (see QQuick3D::idealSurfaceFormat()). 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.
Graphs3D.RenderingMode.IndirectIndicates 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 the 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.

See also msaaSamples and Graphs3D.RenderingMode.

rootNode : Node [read-only, since 6.9]

Returns a pointer to the root node of the 3D graph. Use this property for injecting a 3D graph into a separate View3D using importScene:

Bars3D {
  id: bars
}
View3D {
  importScene: bars.rootNode
}

This property was introduced in Qt 6.9.

See also View3D.

rotationEnabled : bool

Whether this input handler allows graph rotation.

Defaults to true.

rowAxis : Category3DAxis

The active row axis.

If an axis is not given, a temporary default axis with no labels is created. This temporary axis is destroyed if another axis is explicitly set to the same orientation.

scene : Scene3D [read-only]

The Scene3D pointer that can be used to manipulate the scene and access the scene elements.

This property is read-only.

selectedElement : enumeration [read-only]

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 signal is emitted.

The signal can be used for example for implementing customized input handling, as demonstrated by the Axis Handling example.

ConstantDescription
Graphs3D.ElementType.NoneNo defined element.
Graphs3D.ElementType.SeriesAn item in a series.
Graphs3D.ElementType.AxisXLabelThe x-axis label.
Graphs3D.ElementType.AxisYLabelThe y-axis label.
Graphs3D.ElementType.AxisZLabelThe z-axis label.
Graphs3D.ElementType.CustomItemA custom item.

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

selectedSeries : Bar3DSeries [read-only]

The selected series or null. If selectionMode has the SelectionFlag.MultiSeries flag set, this property holds the series that owns the selected bar.

selectionEnabled : bool

Whether this input handler allows selection from the graph.

Defaults to true.

selectionMode : enumeration

The active selection mode in the graph. One of the Graphs3D.SelectionFlag enum values.

ConstantDescription
Graphs3D.SelectionFlag.NoneSelection mode disabled.
Graphs3D.SelectionFlag.ItemSelection highlights a single item.
Graphs3D.SelectionFlag.RowSelection highlights a single row.
Graphs3D.SelectionFlag.ItemAndRowCombination flag for highlighting both item and row with different colors.
Graphs3D.SelectionFlag.ColumnSelection highlights a single column.
Graphs3D.SelectionFlag.ItemAndColumnCombination flag for highlighting both item and column with different colors.
Graphs3D.SelectionFlag.RowAndColumnCombination flag for highlighting both row and column.
Graphs3D.SelectionFlag.ItemRowAndColumnCombination flag for highlighting item, row, and column.
Graphs3D.SelectionFlag.SliceSetting this mode flag indicates that the graph should take care of the slice view handling automatically. If you wish to control the slice view yourself via Q3DScene, do not set this flag. When setting this mode flag, either Row or Column must also be set, but not both. Slicing is supported by Q3DBarsWidgetItem and Q3DSurfaceWidgetItem only. When this flag is set, slice mode is entered in the following situations:
  • When selection is changed explicitly via series API to a visible item
  • When selection is changed by clicking on the graph
  • When the selection mode changes and the selected item is visible
Graphs3D.SelectionFlag.MultiSeriesSetting this mode means that items for all series at same position are highlighted, instead of just the selected item. The actual selection in the other series doesn't change. When setting this mode flag, one or more of the basic selection flags (Item, Row, or Column) must also be set. Multi-series selection is not supported for Q3DScatterWidgetItem.

seriesList : list<Bar3DSeries> [default]

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.

shadowQuality : enumeration

The quality of shadows. One of the Graphs3D.ShadowQuality enum values.

ConstantDescription
Graphs3D.ShadowQuality.NoneShadows are disabled.
Graphs3D.ShadowQuality.LowShadows are rendered in low quality.
Graphs3D.ShadowQuality.MediumShadows are rendered in medium quality.
Graphs3D.ShadowQuality.HighShadows are rendered in high quality.
Graphs3D.ShadowQuality.SoftLowShadows are rendered in low quality with softened edges.
Graphs3D.ShadowQuality.SoftMediumShadows are rendered in medium quality with softened edges.
Graphs3D.ShadowQuality.SoftHighShadows are rendered in high quality with softened edges.

shadowStrength : real

The shadow strength for the whole graph. The higher the number, the darker the shadows will be. The value must be between 0.0 and 100.0.

This value affects the light specified in Scene3D.

theme : GraphsTheme

The active theme of the graph.

See also GraphsTheme.

transparencyTechnique : enumeration [since 6.9]

Specifies which transparency technique to use. The Default value is Default. When rendering transparent surface graphs, use Approximate or Accurate. Default should be used for other graph types.

ConstantDescription
Graphs3D.TransparencyTechnique.DefaultIndicates that order-independent transparency techniques are not used. Offers the best performance. Use when graphs don't contain transparency or when a bar or scatter graph is also using instancing, that is, when the optimization hint is Default.
Graphs3D.TransparencyTechnique.ApproximateIndicates that a graph attempts an approximation of order-independent transparency. This method is faster than Accurate and works on older hardware but may yield inaccurate results. Use when the order-independent transparency is needed, but the performance cost has to be lower than when using accurate order-independent transparency.
Graphs3D.TransparencyTechnique.AccurateIndicates that accurate order-independent transparency is used. Use when perfect transparency rendering is needed.

This property was introduced in Qt 6.9.

valueAxis : Value3DAxis

The active value 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.

wrapCameraXRotation : bool

The behavior of the minimum and maximum limits in the X-rotation. By default, the X-rotation wraps from minimum value to maximum and from maximum to minimum.

If set to true, the X-rotation of the camera is wrapped from minimum to maximum and from maximum to minimum. If set to false, the X-rotation of the camera is limited to the sector determined by the minimum and maximum values.

wrapCameraYRotation : bool

The behavior of the minimum and maximum limits in the Y-rotation. By default, the Y-rotation is limited between the minimum and maximum values without any wrapping.

If true, the Y-rotation of the camera is wrapped from minimum to maximum and from maximum to minimum. If false, the Y-rotation of the camera is limited to the sector determined by the minimum and maximum values.

zoomAtTargetEnabled : bool

Whether zooming should change the camera target so that the zoomed point of the graph stays at the same location after the zoom.

Defaults to true.

zoomEnabled : bool

Whether this input handler allows graph zooming.

Defaults to true.

Signal Documentation

barSeriesMarginChanged(size margin)

This signal is emitted when barSeriesMargin changes to margin.

Note: The corresponding handler is onBarSeriesMarginChanged.

barSpacingChanged(size spacing)

This signal is emitted when barSpacing changes to spacing.

Note: The corresponding handler is onBarSpacingChanged.

barSpacingRelativeChanged(bool relative)

This signal is emitted when barSpacingRelative changes to relative.

Note: The corresponding handler is onBarSpacingRelativeChanged.

barThicknessChanged(real thicknessRatio)

This signal is emitted when barThickness changes to thicknessRatio.

Note: The corresponding handler is onBarThicknessChanged.

columnAxisChanged(Category3DAxis axis)

This signal is emitted when columnAxis changes to axis.

Note: The corresponding handler is onColumnAxisChanged.

doubleTapped(QEventPoint eventPoint, Qt::MouseButton button)

This signal is emitted when the graph item is tapped twice within a short span of time. The eventPoint signal parameter contains information from the release event about the point that was tapped, and button is the mouse button that was clicked, or NoButton on a touchscreen.

Note: The corresponding handler is onDoubleTapped.

See also QEventPoint, Qt::MouseButtons, and TapHandler::doubleTapped.

dragged(QVector2D delta)

This signal is emitted when the translation of the cluster of points on the graph is changed while the pinch gesture is being performed. The delta vector gives the change in translation.

Note: The corresponding handler is onDragged.

See also PinchHandler::translationChanged.

floorLevelChanged(real level)

This signal is emitted when floorLevel changes to level.

Note: The corresponding handler is onFloorLevelChanged.

longPressed()

This signal is emitted when the parent Item is pressed and held for a time period greater than TapHandler::longPressThreshold.

Note: The corresponding handler is onLongPressed.

See also TapHandler::longPressed.

mouseMove(QPoint mousePos)

This signal is emitted when the graph receives a mouseMove event. mousePos value gives the position of mouse while mouse is moving.

Note: The corresponding handler is onMouseMove.

See also QQuickItem::mouseMoveEvent.

multiSeriesUniformChanged(bool uniform)

This signal is emitted when multiSeriesUniform changes to uniform.

Note: The corresponding handler is onMultiSeriesUniformChanged.

pinch(qreal delta)

This signal is emitted when the scale factor on the graph changes while the pinch gesture is being performed. The delta value gives the multiplicative change in scale.

Note: The corresponding handler is onPinch.

See also PinchHandler::scaleChanged.

primarySeriesChanged(Bar3DSeries series)

This signal is emitted when primarySeries changes to series.

Note: The corresponding handler is onPrimarySeriesChanged.

rowAxisChanged(Category3DAxis axis)

This signal is emitted when rowAxis changes to axis.

Note: The corresponding handler is onRowAxisChanged.

selectedSeriesChanged(Bar3DSeries series)

This signal is emitted when selectedSeries changes to series.

Note: The corresponding handler is onSelectedSeriesChanged.

tapped(QEventPoint eventPoint, Qt::MouseButton button)

This signal is emitted when the graph item is tapped once. The eventPoint signal parameter contains information from the release event about the point that was tapped, and button is the mouse button that was clicked, or NoButton on a touchscreen.

Note: The corresponding handler is onTapped.

See also QEventPoint, Qt::MouseButtons, and TapHandler::singleTapped.

valueAxisChanged(Value3DAxis axis)

This signal is emitted when valueAxis changes to axis.

Note: The corresponding handler is onValueAxisChanged.

wheel(QQuickWheelEvent *event)

This signal is emitted every time the graph receives an event of type QWheelEvent: that is, every time the wheel is moved or the scrolling gesture is updated.

Note: The corresponding handler is onWheel.

See also WheelEvent and WheelHandler::wheel.

Method Documentation

qsizetype addCustomItem(Custom3DItem item)

Adds a Custom3DItem item to the graph. Graph takes ownership of the added item.

Returns the index to the added item if add was successful, -1 if trying to add a null item, and the index of the item if trying to add an already added item.

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

void addSeries(Bar3DSeries series)

Adds the series to the graph. A graph can contain multiple series, but only one set of axes, so the rows and columns of all series must match for the visualized data to be meaningful. If the graph has multiple visible series, only the first one added will generate the row or column labels on the axes in cases where the labels are not explicitly set to the axes. If the newly added series has specified a selected bar, it will be highlighted and any existing selection will be cleared. Only one added series can have an active selection.

See also GraphsItem3D::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.

See also selectedElement.

void doRayPicking(QVector3D origin, QVector3D direction)

Performs picking starting from origin and in direction on the elements of the graph, selecting the first item hit.

See also selectedElement.

bool hasSeries(Abstract3DSeries series)

Returns whether the series has already been added to the graph.

void insertSeries(int index, Bar3DSeries series)

Inserts the series into the position index in the series list. If the series has already been added to the list, it is moved to the new index.

Note: When moving a series to a new index that is after its old index, the new position in list is calculated as if the series was still in its old index, so the final index is actually the index decremented by one.

See also GraphsItem3D::hasSeries().

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.

See also 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(Bar3DSeries series)

Remove the series from the graph.

See also GraphsItem3D::hasSeries().

[since 6.10] void renderSliceToImage(int requestedIndex, QtGraphs3D::SliceCaptureType sliceType, QUrl filePath)

Exports a 2d slice from series at requestedIndex and saves the result to an image at a specified filePath. The exported slice includes bars of row or column, which is defined by sliceType.

This method was introduced in Qt 6.10.

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.

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

Returns the selected custom item, or null.

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

Returns the index of the selected custom item, or -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 the index of the selected label, or -1.

See also selectedElement.

void setDefaultInputHandler()

* * Restores the default input handling mechanism. * * This method reactivates the internal, pre-defined input handlers. * Use this to revert to default behavior after previously calling * unsetDefaultInputHandler. *

See also unsetDefaultInputHandler().

void setDragButton(Qt::MouseButtons button)

* * Sets the mouse button used to trigger drag events. * * This method allows changing the mouse button required to initiate * a drag operation to button. * Defaults to Qt::RightButton.

[since 6.12] void setPanButton(Qt::MouseButtons button)

* * * Sets the mouse button used to trigger pan events. * * This method allows changing the mouse button required to initiate * a drag operation to button. * Defaults to Qt::MiddleButton.

This method was introduced in Qt 6.12.

void unsetDefaultDragHandler()

* * Disables the default drag event handler. * * This specifically unsets the built-in response to drag gestures. * Use this if you need to implement a custom handler for dragging. *

See also unsetDefaultInputHandler().

void unsetDefaultInputHandler()

* * Disables the default input handling mechanism. * * This method deactivates the pre-defined all default input handlers. * Call this method when you intend to override the default behaviors. *

See also unsetDefaultTapHandler(), unsetDefaultDragHandler(), unsetDefaultWheelHandler(), and unsetDefaultPinchHandler().

void unsetDefaultPinchHandler()

* * Disables the default pinch gesture handler. * * This specifically unsets the built-in response to pinch gestures. * Use this to implement custom pinch gesture handler. *

See also unsetDefaultInputHandler().

void unsetDefaultTapHandler()

* * Disables the default tap event handler. * * This specifically unsets the built-in response to tap or click events, * allowing for custom tap handling logic. *

See also unsetDefaultInputHandler().

void unsetDefaultWheelHandler()

* * Disables the default mouse wheel event handler. * * This specifically unsets the built-in response to mouse wheel scrolling. * Use this when implementing custom wheel behavior. *

See also unsetDefaultInputHandler().

© 2026 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.