Qt Data Visualization Getting Started

Installing the Qt Data Visualization Module

Use the Package Manager in Maintenance Tool or the Online installer to install the Qt Data Visualization module. The module can be found under Qt Enterprise Add-Ons in the package manager.

After installation Qt Data Visualization documentation and examples are available in Qt Creator. Examples can be found on the examples page of Qt Creator by selecting the Qt Data Visualization component from the drop-down menu.

The source code is installed into the QtDataVisualization folder under EnterpriseAddOns.

Building Qt Data Visualization

To build the Qt Data Visualization module from source code yourself, set up a command prompt with an environment for building Qt applications, navigate to the directory containing qtdatavisualization.pro, and configure the project with qmake:

qmake

After running qmake, build the project with make:

OSMake command
Linuxmake
Windows (MinGw)mingw32-make
Windows (MSVC)nmake
OS Xmake

The above generates the default makefiles for your configuration, which is typically the release build if you are using precompiled binary Qt distribution. To build both debug and release, or one specifically, use one of the following qmake lines instead.

For debug builds:

qmake CONFIG+=debug
make

or

qmake CONFIG+=debug_and_release
make debug

For release builds:

qmake CONFIG+=release
make

or

qmake CONFIG+=debug_and_release
make release

For both builds (Windows/OS X only):

qmake CONFIG+="debug_and_release build_all"
make

After building, install the module to your Qt directory:

make install

If you want to uninstall the module:

make uninstall

To build a statically linked version of the Qt Data Visualization module, give the following commands:

qmake CONFIG+=static
make
make install

Creating a Simple Application

To create a simple application, start by creating a new Qt Gui Application project in Qt Creator and add this line to the .pro file of the project:

QT += datavisualization

In the main.cpp file, include the module headers and declare namespace usage:

#include <QtDataVisualization>

using namespace QtDataVisualization;

Then, add the sample code found in one of the following pages, depending on what kind of visualization you are interested in: How to construct a minimal Q3DBars graph, How to construct a minimal Q3DScatter graph, or How to construct a minimal Q3DSurface graph.

To use Qt Data Visualization graphs in widget based applications, you can use the QWidget::createWindowContainer() function to wrap the graph into a widget:

Q3DBars *graph = new Q3DBars();
QWidget *container = QWidget::createWindowContainer(graph);

For further code examples, see one of the Qt Data Visualization examples:

Audiolevels Example

Simple application showing real time audio data.

Axis Range Dragging With Labels Example

Implementing a custom input handler to support axis dragging.

Bars Example

Using Q3DBars in a widget application.

Custom Input Example

Implementing custom input handler in a widget application.

Custom Items Example

Adding custom items to a surface graph.

Custom Proxy Example

Using Q3DBars with a custom proxy.

Item Model Example

Using an item model as data source for Q3DBars.

Qt Quick 2 Axis Dragging Example

Implementing axis dragging in QML

Qt Quick 2 Axis Formatter Example

Example of a hybrid C++ and QML application demonstrating different axis formatters.

Qt Quick 2 Bars Example

Using Bars3D in a QML application.

Qt Quick 2 Custom Input Example

Customizing input in a QML application.

Qt Quick 2 Legend Example

Showing graph legend in a QML application.

Qt Quick 2 Multiple Graphs Example

Showing multiple graphs simultaneously in a QML application.

Qt Quick 2 Oscilloscope Example

Example of a hybrid C++ and QML application.

Qt Quick 2 Scatter Example

Using Scatter3D in a QML application.

Qt Quick 2 Spectrogram Example

Showing spectrogram graph in a QML application.

Qt Quick 2 Surface Example

Using Surface3D in a QML application.

Qt Quick 2 Surface Multiseries Example

Using multiple series with Surface3D in a QML application.

Rotations Example

Using rotated scatter items

Scatter Example

Using Q3DScatter in a widget application.

Surface Example

Using Q3DSurface in a widget application.

Textured Surface Example

Using texture with Q3DSurface.

Volumetric rendering Example

Rendering volumetric objects.

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