From daae7381865bfd2ff3c214fbefa5a585be39a684 Mon Sep 17 00:00:00 2001 From: koldo Date: Sun, 25 Dec 2016 16:06:39 +0000 Subject: [PATCH] ScatterCtrl: FFT view is auto centered to max. git-svn-id: svn://ultimatepp.org/upp/trunk@10581 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ScatterCtrl/Properties.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/uppsrc/ScatterCtrl/Properties.cpp b/uppsrc/ScatterCtrl/Properties.cpp index 99b3471ab..e07ced791 100644 --- a/uppsrc/ScatterCtrl/Properties.cpp +++ b/uppsrc/ScatterCtrl/Properties.cpp @@ -815,6 +815,7 @@ void ProcessingTab::OnFFT() Exclamation(t_("Incorrect sampling time")); return; } + int64 idMaxFFT; { WaitCursor waitcursor; @@ -852,6 +853,8 @@ void ProcessingTab::OnFFT() VectorY series(resampledSeries, 0, samplingTime); fft = series.FFTY(samplingTime, tabFreq.opXAxis == 1, tabFreq.type, tabFreq.setWindow); + VectorPointf fftData(fft); + fftData.MaxY(idMaxFFT); } if (fft.IsEmpty()) { tabFreq.comments.SetText(errText); @@ -871,6 +874,9 @@ void ProcessingTab::OnFFT() tabFreq.scatter.SetLabelX(tabFreq.opXAxis == 1 ? t_("Frequency [Hz]") : t_("Period [sec]")); tabFreq.scatter.SetLabelY(legend); tabFreq.scatter.ZoomToFit(true, true); + if (fft[int(idMaxFFT)].x < (fft[fft.GetCount() - 1].x)/2) + tabFreq.scatter.SetRange(fft[int(idMaxFFT)].x*2, Null); + tabFreq.comments.SetText(errText); }