From 591fbdf75adeffaccd6d6be7662ce0d7b5a25c9d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 13 Oct 2017 15:32:59 +0200 Subject: [PATCH] Store min, max values in plot. --- server/TracyView.cpp | 6 +++++- server/TracyView.hpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 7487230c..70714c5c 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -854,12 +854,16 @@ void View::InsertPlot( PlotData* plot, int64_t time, double val ) { if( plot->data.empty() || plot->data.back().time < time ) { + plot->min = val; + plot->max = val; plot->data.emplace_back( PlotItem { time, val } ); } else { + if( plot->min > val ) plot->min = val; + else if( plot->max < val ) plot->max = val; auto it = std::lower_bound( plot->data.begin(), plot->data.end(), time, [] ( const auto& lhs, const auto& rhs ) { return lhs.time < rhs; } ); - it = plot->data.insert( it, PlotItem { time, val } ); + plot->data.insert( it, PlotItem { time, val } ); } } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 466cc475..c1105205 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -71,6 +71,8 @@ private: struct PlotData { uint64_t name; + double min; + double max; std::vector data; };