From 0e6970dac5557233ea50cfb9f4d4cf5cd9724a95 2019-04-12 16:18:01 From: Alexis Jeandet Date: 2019-04-12 16:18:01 Subject: [PATCH] Implemented MultiComponent TS initial plot auto-scale Signed-off-by: Alexis Jeandet --- diff --git a/gui/src/Visualization/VisualizationGraphHelper.cpp b/gui/src/Visualization/VisualizationGraphHelper.cpp index 570baa6..d6588e2 100644 --- a/gui/src/Visualization/VisualizationGraphHelper.cpp +++ b/gui/src/Visualization/VisualizationGraphHelper.cpp @@ -269,14 +269,11 @@ struct PlottablesUpdater(&dataSeries)) { - // TODO - // std::for_each( - // std::begin(*serie), std::end(*serie), [&minValue, &maxValue](const - // auto& v) { - // minValue = std::min({ minValue, - // std::min_element(v.begin(),v.end()) }); maxValue = std::max({ - // maxValue, std::max_element(v.begin(),v.end()) }); - // }); + std::for_each( + std::begin(*serie), std::end(*serie), [&minValue, &maxValue](const auto& v) { + minValue = std::min( minValue, std::min_element(v.begin(), v.end())->v() ); + maxValue = std::max( maxValue, std::max_element(v.begin(), v.end())->v() ); + }); } plot.yAxis->setRange(QCPRange { minValue, maxValue }); diff --git a/plugins/python_providers/resources/test.py b/plugins/python_providers/resources/test.py index 3f895b7..d236313 100644 --- a/plugins/python_providers/resources/test.py +++ b/plugins/python_providers/resources/test.py @@ -12,16 +12,16 @@ def make_scalar(x): return pysciqlopcore.ScalarTimeSerie(x,y) def make_vector(x): - v=np.ones((3,len(x))) + v=np.ones((len(x),3)) for i in range(3): - v[:][i] = np.cos(x/10. + float(i)) + v.transpose()[:][i] = np.cos(x/10. + float(i)) return pysciqlopcore.VectorTimeSerie(x,v) def make_multicomponent(x): - v=np.ones((4,len(x))) + v=np.ones((len(x),4)) for i in range(4): - v[:][i] = float(i+1) * np.cos(x/10. + float(i)) + v.transpose()[:][i] = float(i+1) * np.cos(x/10. + float(i)) return pysciqlopcore.MultiComponentTimeSerie(x,v)