diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-01-27 13:10:44 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2014-01-27 13:13:58 +0200 |
commit | b368e57e59351736f9ad06834a743a7c1b49d368 (patch) | |
tree | 3b7d42569905d8cde0ca7571cd664428354a50dd /examples/qmlmultigraph/qml/qmlmultigraph | |
parent | eb3d0514ca886db33776522ea00f27b69bc86ad1 (diff) | |
parent | 05d06fbc61f07e400b519a9b020c2473398627c1 (diff) |
Merge branch 'develop'v1.0.0-beta1
Change-Id: I1c9a255eb8f30a24b665856d3711f0abe77c6ef4
Diffstat (limited to 'examples/qmlmultigraph/qml/qmlmultigraph')
-rw-r--r-- | examples/qmlmultigraph/qml/qmlmultigraph/data.qml | 76 | ||||
-rw-r--r-- | examples/qmlmultigraph/qml/qmlmultigraph/main.qml | 169 | ||||
-rw-r--r-- | examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml | 52 |
3 files changed, 297 insertions, 0 deletions
diff --git a/examples/qmlmultigraph/qml/qmlmultigraph/data.qml b/examples/qmlmultigraph/qml/qmlmultigraph/data.qml new file mode 100644 index 00000000..679cb067 --- /dev/null +++ b/examples/qmlmultigraph/qml/qmlmultigraph/data.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 + +Item { + property alias barData: barDataModel + property alias scatterData: scatterDataModel + property alias surfaceData: surfaceDataModel + + ListModel { + id: barDataModel + ListElement{ year: "2012"; city: "Oulu"; expenses: "4200"; income: "8300"; } + ListElement{ year: "2012"; city: "Kemi"; expenses: "2100"; income: "6500"; } + ListElement{ year: "2012"; city: "Helsinki"; expenses: "7040"; income: "7500"; } + ListElement{ year: "2012"; city: "Tampere"; expenses: "4330"; income: "5800"; } + ListElement{ year: "2013"; city: "Oulu"; expenses: "3960"; income: "9000"; } + ListElement{ year: "2013"; city: "Kemi"; expenses: "1990"; income: "3000"; } + ListElement{ year: "2013"; city: "Helsinki"; expenses: "7230"; income: "9900"; } + ListElement{ year: "2013"; city: "Tampere"; expenses: "4650"; income: "7600"; } + } + + ListModel { + id: scatterDataModel + ListElement{ xPos: "2.754"; yPos: "1.000"; zPos: "3.362"; } + ListElement{ xPos: "3.164"; yPos: "2.022"; zPos: "4.348"; } + ListElement{ xPos: "4.564"; yPos: "1.865"; zPos: "1.000"; } + ListElement{ xPos: "1.000"; yPos: "1.224"; zPos: "2.983"; } + ListElement{ xPos: "2.323"; yPos: "2.502"; zPos: "3.133"; } + ListElement{ xPos: "3.663"; yPos: "3.186"; zPos: "2.843"; } + ListElement{ xPos: "4.190"; yPos: "4.875"; zPos: "3.942"; } + ListElement{ xPos: "3.569"; yPos: "3.685"; zPos: "1.456"; } + ListElement{ xPos: "5.000"; yPos: "5.000"; zPos: "4.678"; } + ListElement{ xPos: "4.349"; yPos: "3.850"; zPos: "5.000"; } + } + + ListModel { + id: surfaceDataModel + ListElement{ longitude: "20"; latitude: "10"; pop_density: "4.75"; } + ListElement{ longitude: "21"; latitude: "10"; pop_density: "3.00"; } + ListElement{ longitude: "22"; latitude: "10"; pop_density: "1.24"; } + ListElement{ longitude: "23"; latitude: "10"; pop_density: "2.53"; } + ListElement{ longitude: "20"; latitude: "11"; pop_density: "3.55"; } + ListElement{ longitude: "21"; latitude: "11"; pop_density: "3.03"; } + ListElement{ longitude: "22"; latitude: "11"; pop_density: "3.46"; } + ListElement{ longitude: "23"; latitude: "11"; pop_density: "4.12"; } + ListElement{ longitude: "20"; latitude: "12"; pop_density: "3.37"; } + ListElement{ longitude: "21"; latitude: "12"; pop_density: "2.98"; } + ListElement{ longitude: "22"; latitude: "12"; pop_density: "3.33"; } + ListElement{ longitude: "23"; latitude: "12"; pop_density: "3.23"; } + ListElement{ longitude: "20"; latitude: "13"; pop_density: "5.34"; } + ListElement{ longitude: "21"; latitude: "13"; pop_density: "4.54"; } + ListElement{ longitude: "22"; latitude: "13"; pop_density: "4.65"; } + ListElement{ longitude: "23"; latitude: "13"; pop_density: "6.67"; } + ListElement{ longitude: "20"; latitude: "14"; pop_density: "6.01"; } + ListElement{ longitude: "21"; latitude: "14"; pop_density: "5.83"; } + ListElement{ longitude: "22"; latitude: "14"; pop_density: "5.90"; } + ListElement{ longitude: "23"; latitude: "14"; pop_density: "7.32"; } + } +} + diff --git a/examples/qmlmultigraph/qml/qmlmultigraph/main.qml b/examples/qmlmultigraph/qml/qmlmultigraph/main.qml new file mode 100644 index 00000000..bc2f7fe3 --- /dev/null +++ b/examples/qmlmultigraph/qml/qmlmultigraph/main.qml @@ -0,0 +1,169 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.0 +import QtDataVisualization 1.0 +import "." + +Item { + id: mainView + width: 1280 + height: 400 + + Data { + id: data + } + + //! [0] + RowLayout { + id: graphLayout + spacing: 1 + anchors.top: buttonLayout.bottom + anchors.bottom: mainView.bottom + anchors.left: mainView.left + anchors.right: mainView.right + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + border.color: surfaceGraph.theme.gridLineColor + border.width: 2 + color: "#00000000" // Transparent + + Surface3D { + id: surfaceGraph + anchors.fill: parent + anchors.margins: parent.border.width + theme: Theme3D { type: Theme3D.ThemePrimaryColors } + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh + + Surface3DSeries { + itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel" + ItemModelSurfaceDataProxy { + itemModel: data.surfaceData + // Mapping model roles to surface series rows, columns, and values. + rowRole: "longitude" + columnRole: "latitude" + valueRole: "pop_density" + } + } + } + } + + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + border.color: scatterGraph.theme.gridLineColor + border.width: 2 + color: "#00000000" // Transparent + + Scatter3D { + id: scatterGraph + anchors.fill: parent + anchors.margins: parent.border.width + theme: Theme3D { type: Theme3D.ThemeDigia } + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh + + Scatter3DSeries { + ItemModelScatterDataProxy { + itemModel: data.scatterData + // Mapping model roles to scatter series item coordinates. + xPosRole: "xPos" + yPosRole: "yPos" + zPosRole: "zPos" + } + } + } + } + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + border.color: barGraph.theme.gridLineColor + border.width: 2 + color: "#00000000" // Transparent + + Bars3D { + id: barGraph + anchors.fill: parent + anchors.margins: parent.border.width + theme: Theme3D { type: Theme3D.ThemeQt } + selectionMode: AbstractGraph3D.SelectionItemAndRow | AbstractGraph3D.SelectionSlice + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh + + Bar3DSeries { + itemLabelFormat: "@seriesName for @colLabel, @rowLabel: @valueLabel" + name: "Yearly expenses" + + ItemModelBarDataProxy { + itemModel: data.barData + // Mapping model roles to bar series rows, columns, and values. + rowRole: "year" + columnRole: "city" + valueRole: "expenses" + } + } + + Bar3DSeries { + itemLabelFormat: "@seriesName for @colLabel, @rowLabel: @valueLabel" + name: "Yearly income" + + ItemModelBarDataProxy { + itemModel: data.barData + // Mapping model roles to bar series rows, columns, and values. + rowRole: "year" + columnRole: "city" + valueRole: "income" + } + } + } + } + } + //! [0] + + RowLayout { + id: buttonLayout + Layout.minimumHeight: exitButton.height + width: parent.width + anchors.left: parent.left + anchors.top: parent.top + spacing: 0 + + NewButton { + id: clearSelectionsButton + Layout.fillHeight: true + Layout.fillWidth: true + text: "Clear Selections" + onClicked: { + barGraph.clearSelection() + scatterGraph.clearSelection() + surfaceGraph.clearSelection() + } + } + + NewButton { + id: exitButton + Layout.fillHeight: true + Layout.fillWidth: true + text: "Quit" + onClicked: Qt.quit(0); + } + } +} diff --git a/examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml b/examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml new file mode 100644 index 00000000..e4fb99d2 --- /dev/null +++ b/examples/qmlmultigraph/qml/qmlmultigraph/newbutton.qml @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** All rights reserved. +** For any questions to Digia, please use contact form at http://qt.digia.com +** +** This file is part of the QtDataVisualization module. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Controls 1.0 +import QtQuick.Controls.Styles 1.0 + +Item { + id: newbutton + + property alias text: buttonText.text + + signal clicked + + implicitWidth: buttonText.implicitWidth + 5 + implicitHeight: buttonText.implicitHeight + 10 + + Button { + id: buttonText + width: parent.width + height: parent.height + + style: ButtonStyle { + label: Component { + Text { + text: buttonText.text + clip: true + wrapMode: Text.WordWrap + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + anchors.fill: parent + } + } + } + onClicked: newbutton.clicked() + } +} |