Skip to content

Commit 33c000a

Browse files
committed
UI: Add a max limit to plot window size
The more data are displayed, the longer the plot takes to render. Some very coarse numbers (with default RT values enabled): 2016 phone: usable up to about 5min window 2023 phone: usable up to about 30min window
1 parent 9cacabc commit 33c000a

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

ui.qml.in

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ Item {
801801
property int tempWarningOffset: 10
802802
property alias tuneSlotCount: prefTuneSlotCount.value
803803
property alias showTuneDiffCount: prefShowTuneDiffCount.checked
804+
property int plotMaxWindowMinutes: 30
804805
property alias showWelcomeDialog: prefShowWelcomeDialog.checked
805806
}
806807

@@ -2130,6 +2131,7 @@ Item {
21302131
property real toolbarOffset: 0
21312132

21322133
property bool showRecordDownload: false
2134+
property int maxWindowMinutes
21332135

21342136
function init(ticksPerSec) {
21352137
ticksPerSecond = ticksPerSec;
@@ -2546,6 +2548,7 @@ Item {
25462548

25472549
property real bounceOffset: 0.05
25482550
property real minWindow: 0.001 * plot.ticksPerSecond
2551+
property real maxWindow: Math.max(plot.followEnd ? plot.startWindow * plot.ticksPerSecond : 0, Math.min(plot.maxWindowMinutes * 60 * plot.ticksPerSecond, plotData.timeRange))
25492552

25502553
property real moveReferencePos
25512554
property real moveUnbluntedPos
@@ -2619,10 +2622,6 @@ Item {
26192622
return a * Math.exp(x / a) - a;
26202623
}
26212624

2622-
function maxWindow() {
2623-
return Math.max(plot.followEnd ? plot.startWindow * plot.ticksPerSecond : 0, plotData.timeRange);
2624-
}
2625-
26262625
function moveRelative(pos, x) {
26272626
moveUnbluntedPos = plotCanvas.toPlotPos(pos, x);
26282627
var newPos = moveUnbluntedPos;
@@ -2680,7 +2679,7 @@ Item {
26802679
bounceBackZoom.stop();
26812680
lastZoomCenter = center;
26822681

2683-
var maxWin = maxWindow();
2682+
var maxWin = maxWindow;
26842683
var maxDist = maxWin - newWindow;
26852684
if (maxDist < 0) {
26862685
newWindow = (1 - blunt(maxDist / maxWin, bounceOffset * 2)) * maxWin;
@@ -2703,7 +2702,7 @@ Item {
27032702
}
27042703

27052704
function snapToBounds() {
2706-
var windowTo = clamp(plotCanvas.window, minWindow, maxWindow());
2705+
var windowTo = clamp(plotCanvas.window, minWindow, maxWindow);
27072706

27082707
bounceBackZoom.stop();
27092708
bounceBackZoom.to = windowTo;
@@ -3638,6 +3637,15 @@ Item {
36383637
label: "Show changed options count on tunes"
36393638
}
36403639

3640+
IntTextField {
3641+
label: "Realtime plot maximum window"
3642+
valueUnit: "minutes"
3643+
sourceValue: preferences.plotMaxWindowMinutes
3644+
onValueChanged: {
3645+
preferences.plotMaxWindowMinutes = value
3646+
}
3647+
}
3648+
36413649
RightSwitch {
36423650
id: prefShowWelcomeDialog
36433651
checked: true
@@ -4582,6 +4590,8 @@ Item {
45824590
OverlayPlot {
45834591
id: recordedPlot
45844592

4593+
maxWindowMinutes: preferences.plotMaxWindowMinutes
4594+
45854595
plotData: RecordedPlotData {
45864596
id: recordedPlotData
45874597
seriesMetaData: plotSeriesMetaData
@@ -6069,6 +6079,7 @@ Item {
60696079
height: parent.height - dataTopColumn.height
60706080

60716081
followEnd: true
6082+
maxWindowMinutes: preferences.plotMaxWindowMinutes
60726083

60736084
showRecordDownload: state.capDataRecord
60746085

0 commit comments

Comments
 (0)