From 176cd6d53968cb00c2e9ae75745da53b5e731bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 3 Jan 2017 15:12:58 +0100 Subject: [PATCH] [apps/regression] Avoid displaying the regression graph in there is not enough data for a regression Change-Id: If0f65e2a377fb3f91d008d21812e318e92583548 --- apps/regression/graph_controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 8242aa401..53c4b775f 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -16,14 +16,17 @@ ViewController * GraphController::initialisationParameterController() { } bool GraphController::isEmpty() { - if (m_data->numberOfPairs() == 0) { + if (m_data->numberOfPairs() < 2 || isinf(m_data->slope()) || isnan(m_data->slope())) { return true; } return false; } const char * GraphController::emptyMessage() { - return "Aucune donnee a tracer"; + if (m_data->numberOfPairs() == 0) { + return "Aucune donnee a tracer"; + } + return "Pas assez de donnees pour un regression"; } bool GraphController::handleEnter() {