1-
1+ import QtCharts 2.2
22import QtQuick 2.6
33import QtQuick.Controls 2.12
4- import QtCharts 2.2
54import QtQuick.Layouts 1.15
6-
75import SwiftConsole 1.0
86
97Item {
10-
11- SolutionVelocityPoints {
12- id: solutionVelocityPoints
13- }
14-
158 id: solutionVelocityTab
16- width: parent .width
17- height: parent .height
9+
1810 property variant labels: [" Horizontal" , " Vertical" ]
1911 property variant lines: []
2012 property variant colors: []
2113 property variant available_units: []
2214 property variant unit: " "
15+
16+ width: parent .width
17+ height: parent .height
18+ Component .onCompleted : {
19+ }
20+
21+ SolutionVelocityPoints {
22+ id: solutionVelocityPoints
23+ }
24+
2325 Rectangle {
2426 id: solutionVelocityArea
27+
2528 width: parent .width
2629 height: parent .height
30+
2731 ColumnLayout {
2832 id: solutionVelocityAreaRowLayout
33+
2934 anchors .fill : parent
3035 width: parent .width
3136 height: parent .height
3237 spacing: 0
3338
3439 ComboBox {
3540 id: solutionVelocitySelectedUnit
41+
3642 Layout .alignment : Qt .AlignCenter
3743 width: 100
3844 model: available_units
3945 onCurrentIndexChanged: {
40- if (! available_units){
41- return ;
42- }
46+ if (! available_units)
47+ return ;
48+
4349 data_model .solution_velocity_unit (available_units[currentIndex]);
4450 }
4551 }
52+
4653 ChartView {
4754 id: solutionVelocityChart
55+
4856 Layout .preferredWidth : parent .width
4957 Layout .preferredHeight : parent .height - 100
5058 Layout .alignment : Qt .AlignBottom
5159 Layout .bottomMargin : 20
5260 Layout .fillHeight : true
5361 backgroundColor: " #CDC9C9"
54- plotAreaColor: " #FFFFFF"
62+ plotAreaColor: " #FFFFFF"
5563 legend .visible : false
5664 antialiasing: true
65+ Component .onCompleted : {
66+ }
67+
5768 Rectangle {
5869 id: lineLegend
70+
5971 border .color : " #000000"
6072 border .width : 1
61-
6273 anchors .bottom : solutionVelocityChart .bottom
6374 anchors .left : solutionVelocityChart .left
6475 anchors .bottomMargin : 120
6576 anchors .leftMargin : 80
6677 implicitHeight: lineLegendRepeater .height
6778 width: lineLegendRepeater .width
68-
6979
7080 Column {
7181 id: lineLegendRepeater
82+
7283 spacing: - 1
7384 padding: 10
7485 anchors .bottom : lineLegend .bottom
86+
7587 Repeater {
76- model: labels
7788 id: lineLegendRepeaterRows
89+
90+ model: labels
91+
7892 Row {
93+ Component .onCompleted : {
94+ for (var idx in colors) {
95+ if (lineLegendRepeaterRows .itemAt (idx))
96+ lineLegendRepeaterRows .itemAt (idx).children [0 ].color = colors[idx];
97+
98+ }
99+ }
100+
79101 Rectangle {
80102 id: marker
103+
81104 width: 20
82105 height: 3
83106 color: " #000000"
84107 anchors .verticalCenter : parent .verticalCenter
85108 }
86- Text {
109+
110+ Text {
87111 id: label
112+
88113 text: modelData
89114 font .pointSize : 9
90115 anchors .verticalCenter : parent .verticalCenter
91116 anchors .verticalCenterOffset : - 1
92117 }
93- Component .onCompleted : {
94- for (var idx in colors) {
95- if (lineLegendRepeaterRows .itemAt (idx)){
96- lineLegendRepeaterRows .itemAt (idx).children [0 ].color = colors[idx];
97- }
98- }
99- }
118+
100119 }
120+
101121 }
102-
122+
103123 }
124+
104125 }
126+
105127 ValueAxis {
128+ // useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
129+
106130 id: solutionVelocityXAxis
107- labelsFont { pointSize : 10 ; bold : true }
131+
108132 labelsAngle: 45
109133 titleText: " GPS Time of Week"
110134 gridVisible: true
111135 lineVisible: true
112136 minorGridVisible: true
113137 minorGridLineColor: " #CDC9C9"
114138 visible: true
115- // useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
139+
140+ labelsFont {
141+ pointSize: 10
142+ bold: true
143+ }
144+
116145 }
146+
117147 ValueAxis {
148+ // useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
149+
118150 id: solutionVelocityYAxis
151+
119152 titleText: solutionVelocitySelectedUnit .currentText
120153 min: 0
121154 max: 1
122- labelsFont { pointSize: 10 ; bold: true }
123155 gridVisible: true
124156 lineVisible: true
125157 minorGridVisible: true
126158 minorGridLineColor: " #CDC9C9"
127159 visible: true
128- // useOpenGL: true // [CPP-93] Invesigate usage of `useOpenGL` in plots
160+
161+ labelsFont {
162+ pointSize: 10
163+ bold: true
164+ }
165+
129166 }
167+
130168 Timer {
131- interval: 1000 / 5 // 5 Hz refresh
169+ interval: 1000 / 5 // 5 Hz refresh
132170 running: true
133171 repeat: true
134172 onTriggered: {
135- if (! solutionTab .visible ) {
136- return ;
137- }
173+ if (! solutionTab .visible )
174+ return ;
175+
138176 solution_velocity_model .fill_console_points (solutionVelocityPoints);
139- if (! solutionVelocityPoints .points .length ) {
140- return ;
141- }
177+ if (! solutionVelocityPoints .points .length )
178+ return ;
179+
142180 var points = solutionVelocityPoints .points ;
143181 if (colors != solutionVelocityPoints .colors ) {
144182 colors = solutionVelocityPoints .colors ;
145183 for (var idx in colors) {
146- if (lineLegendRepeaterRows .itemAt (idx)){
184+ if (lineLegendRepeaterRows .itemAt (idx))
147185 lineLegendRepeaterRows .itemAt (idx).children [0 ].color = colors[idx];
148- }
186+
149187 }
150188 }
151- if (available_units != solutionVelocityPoints .available_units ) {
189+ if (available_units != solutionVelocityPoints .available_units )
152190 available_units = solutionVelocityPoints .available_units ;
153- }
154-
191+
155192 if (! lines .length ) {
156193 for (var idx in labels) {
157194 var line = solutionVelocityChart .createSeries (ChartView .SeriesTypeLine , labels[idx], solutionVelocityXAxis);
@@ -162,22 +199,20 @@ Item {
162199 }
163200 }
164201 solutionVelocityPoints .fill_series (lines);
165-
166202 var last = points[0 ][points[0 ].length - 1 ];
167- solutionVelocityXAxis .min = last .x - 20 ;
203+ solutionVelocityXAxis .min = last .x - 20 ;
168204 solutionVelocityXAxis .max = last .x ;
169-
170- if (solutionVelocityYAxis .min != solutionVelocityPoints .min_ || solutionVelocityYAxis .max != solutionVelocityPoints .max_ ){
205+ if (solutionVelocityYAxis .min != solutionVelocityPoints .min_ || solutionVelocityYAxis .max != solutionVelocityPoints .max_ ) {
171206 solutionVelocityYAxis .min = solutionVelocityPoints .min_ ;
172207 solutionVelocityYAxis .max = solutionVelocityPoints .max_ ;
173208 }
174209 }
175210 }
176- Component .onCompleted : {
177- }
211+
178212 }
213+
179214 }
215+
180216 }
181- Component .onCompleted : {
182- }
217+
183218}
0 commit comments