Files
Upsilon/apps/regression/graph_controller.cpp
Émilie Feral 176cd6d539 [apps/regression] Avoid displaying the regression graph in there is not
enough data for a regression

Change-Id: If0f65e2a377fb3f91d008d21812e318e92583548
2017-01-09 15:08:56 +01:00

41 lines
1.1 KiB
C++

#include "graph_controller.h"
namespace Regression {
GraphController::GraphController(Responder * parentResponder, HeaderViewController * headerViewController, Data * data) :
CurveViewWindowWithBannerAndCursorController(parentResponder, headerViewController, data, &m_view),
m_view(GraphView(data)),
m_data(data),
m_initialisationParameterController(InitialisationParameterController(this, m_data)),
m_predictionParameterController(PredictionParameterController(this, m_data))
{
}
ViewController * GraphController::initialisationParameterController() {
return &m_initialisationParameterController;
}
bool GraphController::isEmpty() {
if (m_data->numberOfPairs() < 2 || isinf(m_data->slope()) || isnan(m_data->slope())) {
return true;
}
return false;
}
const char * GraphController::emptyMessage() {
if (m_data->numberOfPairs() == 0) {
return "Aucune donnee a tracer";
}
return "Pas assez de donnees pour un regression";
}
bool GraphController::handleEnter() {
if (m_data->selectedDotIndex() == -1) {
stackController()->push(&m_predictionParameterController);
return true;
}
return false;
}
}