summaryrefslogtreecommitdiffstats
path: root/examples/charts/qmlgallery/qml/Main.qml
blob: 0670b8108c6e56b46ba3471c2f65c68408b0e2ed (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick

Rectangle {
    id: root
    width: 1200
    height: 600

    color: "#f0f0f0"

    Row {
        id: row
        padding: 8
        spacing: 8

        Rectangle {
            width: 200
            height: root.height - row.padding * 2
            border.width: 1

            ListView {
                id: listView
                focus: true
                anchors.fill: parent
                anchors.margins: 1
                highlightMoveDuration: 250
                orientation: ListView.Vertical
                boundsBehavior: Flickable.StopAtBounds
                currentIndex: 0
                clip: true

                model: ListModel {
                    ListElement {
                        name: "Area Chart"
                        component: "AreaSeries.qml"
                    }
                    ListElement {
                        name: "Bar Chart"
                        component: "BarSeries.qml"
                    }
                    ListElement {
                        name: "Bar Chart Horizontal"
                        component: "BarSeriesHorizontal.qml"
                    }
                    ListElement {
                        name: "Bar Chart Percent"
                        component: "BarSeriesPercent.qml"
                    }
                    ListElement {
                        name: "Bar Chart Percent Horizontal"
                        component: "BarSeriesPercentHorizontal.qml"
                    }
                    ListElement {
                        name: "Bar Chart Stacked"
                        component: "BarSeriesStacked.qml"
                    }
                    ListElement {
                        name: "Bar Chart Stacked Horizontal"
                        component: "BarSeriesStackedHorizontal.qml"
                    }
                    ListElement {
                        name: "Box Plot Chart"
                        component: "BoxPlotSeries.qml"
                    }
                    ListElement {
                        name: "Candlestick Chart"
                        component: "CandlestickSeries.qml"
                    }
                    ListElement {
                        name: "Category Axis"
                        component: "CategoryAxis.qml"
                    }
                    ListElement {
                        name: "Category Axis Polar"
                        component: "CategoryAxisPolar.qml"
                    }
                    ListElement {
                        name: "Custom Legend"
                        component: "customlegend/Main.qml"
                    }
                    ListElement {
                        name: "Datetime Axis"
                        component: "DateTimeAxis.qml"
                    }
                    ListElement {
                        name: "Datetime Axis Polar"
                        component: "DateTimeAxisPolar.qml"
                    }
                    ListElement {
                        name: "Donut"
                        component: "Donut.qml"
                    }
                    ListElement {
                        name: "F1 Legends"
                        component: "f1legends/F1Legends.qml"
                    }
                    ListElement {
                        name: "Line Chart"
                        component: "LineSeries.qml"
                    }
                    ListElement {
                        name: "Pie Chart"
                        component: "PieChart.qml"
                    }
                    ListElement {
                        name: "Spline Chart"
                        component: "SplineSeries.qml"
                    }
                    ListElement {
                        name: "Scatter Chart"
                        component: "ScatterSeries.qml"
                    }
                    ListElement {
                        name: "Two Series in Chart"
                        component: "TwoSeries.qml"
                    }
                    ListElement {
                        name: "Two Series in Polar Chart"
                        component: "TwoSeriesPolar.qml"
                    }
                    ListElement {
                        name: "Wheel of Fortune"
                        component: "WheelOfFortune.qml"
                    }
                }

                delegate: Text {
                    property string source: component
                    text: name
                    width: listView.width
                    leftPadding: 4

                    MouseArea {
                        anchors.fill: parent
                        onClicked: {
                            listView.currentIndex = index
                        }
                    }
                }

                highlight: Rectangle {
                    color: "lightblue";
                }
            }
        }

        Rectangle {
            height: root.height - row.padding * 2
            width: root.width - listView.width - row.spacing - row.padding * 2
            radius: 5
            clip: true

            Loader {
                id: loader
                anchors.fill: parent
                anchors.margins: 4

                asynchronous: true
                source: listView.currentItem.source
            }
        }
    }
}