Qt Graphs Interacting with Data in 3D

Interacting with Data

End users can interact with the rendered graph by using either the mouse or touch to rotate, zoom, or select data. Graphs can be rotated freely by holding down the right mouse button and moving the mouse. Zooming is done by rolling the mouse wheel. Selecting, if enabled, is done by pressing the left mouse button. In touch devices, rotation is done by tap-and-move, selection by tap-and-hold, and zoom by pinch.

Qt Graphs has default handlers for mouse actions and touch gestures. The default handlers must be disabled when using customized input handlers. The Axis Handling example, under Axis Dragging tab, illustrates how to use a custom input handler to drag an axis label to move the visible part of the data.

In addition to perspective projection, orthographic projection can be used to create 2D graphs by replacing the default input handler with one that does not allow rotating the graph and setting the camera to view the graph directly from the side or from the top.

Data Selection Modes

All graph types support selecting a single data item - a bar, a scatter item, or a surface point - using mouse, touch, and programmatically via the series APIs. The selected item is highlighted in the rendered graph, and selecting causes the emission of a series-specific signal for this purpose, for example, QBar3DSeries::selectedBarChanged(), which the application can handle.

Bar and surface graphs support slice selection modes, where the selected row or column is drawn in a separate viewport as a pseudo-2D graph. This makes it easier to see the actual values of a single row or column.

Bar graph additionally supports highlighting the whole row and/or column of the selected bar without opening the slice view. Bar graph also supports selecting/slicing a whole row and/or column by clicking the axis label, based on selection mode.

When multiple series are added to a graph, selecting an item in one of them will clear the selection on other series.

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