Bars3D QML Type

3D bar graph. More...

Import Statement: import QtDataVisualization 1.2
Since: QtDataVisualization 1.0
Inherits:

AbstractGraph3D

Properties

Methods

Detailed Description

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

You will need to import data visualization module to use this type:

import QtDataVisualization 1.2

After that you can use Bars3D in your qml files:

import QtQuick 2.0
import QtDataVisualization 1.2

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: "2012"; city: "Oulu";     expenses: "4200"; }
        ListElement{ year: "2012"; city: "Rauma";    expenses: "2100"; }
        ListElement{ year: "2012"; city: "Helsinki"; expenses: "7040"; }
        ListElement{ year: "2012"; city: "Tampere";  expenses: "4330"; }
        ListElement{ year: "2013"; city: "Oulu";     expenses: "3960"; }
        ListElement{ year: "2013"; city: "Rauma";    expenses: "1990"; }
        ListElement{ year: "2013"; city: "Helsinki"; expenses: "7230"; }
        ListElement{ year: "2013"; city: "Tampere";  expenses: "4650"; }
    }
}

See Qt Quick 2 Bars Example for more thorough usage example.

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

Property Documentation

barSpacing : size

Bar spacing in X and Z dimensions.


barSpacingRelative : bool

Relative or absolute bar spacing.


barThickness : real

Bar thickness ratio between X and Z dimensions. 1.0 means bars are as wide as they are deep, 0.5 makes them twice as deep as they are wide.


columnAxis : CategoryAxis3D

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 same orientation.


floorLevel : real

The desired floor level for the bar graph in Y-axis data coordinates. The actual floor level cannot go below Y-axis minimum or above Y-axis maximum. Defaults to zero.


multiSeriesUniform : bool

This property controls if 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 affect only X-axis correctly. It is preset to false by default.


primarySeries : Bar3DSeries

Specifies the series that is the primary series of the graph. The primary series 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 already 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 series is null, this property resets to default. Defaults to the first added series or zero if no series are added to the graph.


rowAxis : CategoryAxis3D

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 same orientation.


selectedSeries : Bar3DSeries

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


[default] seriesList : list<Bar3DSeries>

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.


valueAxis : ValueAxis3D

The active value axis.

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


Method Documentation

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.


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.


void removeSeries(Bar3DSeries series)

Remove the series from the graph.


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