3D bar graph. 更多...
import 语句: | import QtDataVisualization 1.15 |
Since: | QtDataVisualization 1.0 |
继承: |
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"; } } }
见 Qt Quick 2 Bars Example for more thorough usage example.
另请参阅 Bar3DSeries , ItemModelBarDataProxy , Scatter3D , Surface3D ,和 Qt Data Visualization C++ 类 .
barSpacing : size |
Bar spacing in X and Z dimensions.
Preset to
(1.0, 1.0)
by default. Spacing is affected by the
barSpacingRelative
特性。
barSpacingRelative : bool |
Whether spacing is absolute or relative to bar thickness.
若
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.
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 the same orientation.
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.
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
在默认情况下。
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.
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 the same orientation.
selectedSeries : Bar3DSeries |
The selected series or
null
。若
selectionMode
拥有
SelectionMultiSeries
flag set, this property holds the series that owns the selected bar.
[default] seriesList : list < Bar3DSeries > |
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 an automatically adjusting range is created. This temporary axis is destroyed if another axis is explicitly set to the same orientation.
void addSeries ( Bar3DSeries series ) |
添加 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 ) |
插入 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 .
注意: 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.