summaryrefslogtreecommitdiffstats
path: root/examples/qmlbarchart/qml/qmlbarchart/main.qml
blob: 990c78e61eea401f48c24a5029f826b64de3e11e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/****************************************************************************
**
** Copyright (C) 2013 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 QtDataVis3D module.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial 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
** $QT_END_LICENSE$
**
****************************************************************************/

import QtQuick 2.0
import QtQuick.Window 2.1
import com.digia.QtDataVis3D 1.0

Item {
    id: mainview
    //title: "My MainWindow"
    width: 640
    height: 480
    visible: true

    Bars3D {
        id: testchart
        width: mainview.width
        height: mainview.height

        DataItem {
            id: testitem
            label: "Test"
            value: 10
        }
        DataItem {
            id: testitem2
            label: "Test2"
            value: -10
        }
        DataItem {
            id: testitem3
            label: "Test3"
            value: 5
        }

        DataItem {
            id: testitem4
            label: "Test4"
            value: -7
        }
        DataItem {
            id: testitem5
            label: "Test5"
            value: 8
        }
        DataItem {
            id: testitem6
            label: "Test6"
            value: 1
        }

        DataRow {
            id: testrow1
            function addData() {
                testrow1.addItem(testitem);
                testrow1.addItem(testitem2);
                testrow1.addItem(testitem3);
                testrow1.addItem(testitem4);
                testrow1.addItem(testitem5);
                testrow1.addItem(testitem6);
            }
        }

        //visible: true
        //x: mainview.x + mainview.width
        //y: mainview.y

        grid: false
        shadowQuality: Bars3D.ShadowNone
        selectionMode: Bars3D.ModeNone
        labelTransparency: Bars3D.TransparencyNone

        function setUpBars3D() {
            /*console.log(parent)
            console.log(container.x)
            console.log(container.y)
            console.log(Window.x)
            console.log(Window.y)
            console.log(Screen.desktopAvailableHeight)
            console.log(Screen.desktopAvailableWidth)
            console.log(mainview.x)
            console.log(mainview.y)
            console.log(x)
            console.log(y)*/
            testchart.setupSampleSpace(6, 1);
            testchart.addDataRow(testrow1);
        }
    }

    MouseArea {
        anchors.fill: parent
        onClicked: {
            Qt.quit();
        }
    }

    Component.onCompleted: {
        // This allows us to flip the texture to be displayed correctly in scene graph
        // TODO: Find a way to do it in code..
        //rotation.angle = 180
        testrow1.addData();
        testchart.setUpBars3D();
    }
}