2 #include "../apps_container.h" 13 m_roundCursorView(
Palette::YellowDark),
15 m_view(store, m_cursor, &m_bannerView, &m_crossCursorView),
17 m_initialisationParameterController(this, m_store),
18 m_predictionParameterController(this, m_store, m_cursor, this),
19 m_selectedDotIndex(selectedDotIndex)
25 return &m_initialisationParameterController;
37 return I18n::Message::NoDataToPlot;
39 return I18n::Message::NoEnoughDataForRegression;
43 InteractiveCurveViewController::viewWillAppear();
44 m_view.
setCursorView(*m_selectedDotIndex >= 0 ? static_cast<View *>(&m_crossCursorView): static_cast<View *>(&m_roundCursorView));
48 *m_selectedDotIndex = -1;
52 CurveView * GraphController::curveView() {
60 bool GraphController::handleEnter() {
65 void GraphController::reloadBannerView() {
70 const char * legend =
" P(";
71 int legendLength =
strlen(legend);
72 strlcpy(buffer, legend, legendLength+1);
73 numberOfChar += legendLength;
76 legendLength =
strlen(legend);
77 strlcpy(buffer+numberOfChar, legend, legendLength+1);
78 numberOfChar += legendLength;
79 }
else if (*m_selectedDotIndex < 0) {
81 legendLength =
strlen(legend);
82 strlcpy(buffer+numberOfChar, legend, legendLength+1);
83 numberOfChar += legendLength;
88 legendLength =
strlen(legend);
89 strlcpy(buffer+numberOfChar, legend, legendLength+1);
90 buffer[k_maxLegendLength] = 0;
102 legendLength =
strlen(legend);
103 strlcpy(buffer, legend, legendLength+1);
104 numberOfChar += legendLength;
107 legendLength =
strlen(legend);
108 strlcpy(buffer+numberOfChar, legend, legendLength+1);
109 buffer[k_maxLegendLength] = 0;
120 legendLength =
strlen(legend);
121 strlcpy(buffer, legend, legendLength+1);
122 numberOfChar += legendLength;
125 legendLength =
strlen(legend);
126 strlcpy(buffer+numberOfChar, legend, legendLength+1);
127 buffer[k_maxLegendLength] = 0;
132 double slope = m_store->
slope();
133 legendLength =
strlen(legend);
134 strlcpy(buffer, legend, legendLength+1);
135 numberOfChar += legendLength;
138 legendLength =
strlen(legend);
139 strlcpy(buffer+numberOfChar, legend, legendLength+1);
140 buffer[k_maxLegendLength] = 0;
146 legendLength =
strlen(legend);
147 strlcpy(buffer, legend, legendLength+1);
148 numberOfChar += legendLength;
151 legendLength =
strlen(legend);
152 strlcpy(buffer+numberOfChar, legend, legendLength+1);
153 buffer[k_maxLegendLength] = 0;
159 legendLength =
strlen(legend);
160 strlcpy(buffer, legend, legendLength+1);
161 numberOfChar += legendLength;
164 legendLength =
strlen(legend);
165 strlcpy(buffer+numberOfChar, legend, legendLength+1);
166 buffer[k_maxLegendLength+10] = 0;
172 legendLength =
strlen(legend);
173 strlcpy(buffer, legend, legendLength+1);
174 numberOfChar += legendLength;
177 legendLength =
strlen(legend);
178 strlcpy(buffer+numberOfChar, legend, legendLength+1);
179 buffer[k_maxLegendLength] = 0;
183 void GraphController::initRangeParameters() {
187 void GraphController::initCursorParameters() {
195 bool GraphController::moveCursorHorizontally(
int direction) {
196 if (*m_selectedDotIndex >= 0) {
197 int dotSelected = m_store->
nextDot(direction, *m_selectedDotIndex);
198 if (dotSelected >= 0 && dotSelected < m_store->numberOfPairs()) {
199 *m_selectedDotIndex = dotSelected;
205 *m_selectedDotIndex = dotSelected;
220 bool GraphController::moveCursorVertically(
int direction) {
222 if (*m_selectedDotIndex >= 0) {
223 if ((yRegressionCurve -
m_cursor->
y() > 0) == (direction > 0)) {
233 if (dotSelected >= 0 && dotSelected <= m_store->numberOfPairs()) {
236 *m_selectedDotIndex = dotSelected;
241 *m_selectedDotIndex = dotSelected;
250 uint32_t GraphController::modelVersion() {
254 uint32_t GraphController::rangeVersion() {
258 bool GraphController::isCursorVisible() {
virtual StackViewController * stackController() const
void setLegendAtIndex(char *text, int index)
double squaredCorrelationCoefficient()
static constexpr int MediumNumberOfSignificantDigits
int closestVerticalDot(int direction, float x)
void push(ViewController *vc, KDColor textColor=Palette::SubTab, KDColor backgroundColor=KDColorWhite, KDColor separatorColor=Palette::GreyBright)
double meanOfColumn(int i)
bool isEmpty() const override
size_t strlcpy(char *dst, const char *src, size_t len)
double correlationCoefficient()
void setMessageAtIndex(I18n::Message text, int index)
static constexpr float k_numberOfCursorStepsInGradUnit
float xGridUnit() override
static constexpr int ShortNumberOfSignificantDigits
void viewWillAppear() override
int nextDot(int direction, int dot)
enum Message uint16_t enum Language uint16_t const char * translate(Message m, Language l=(Language) 0)
static constexpr float k_cursorRightMarginRatio
size_t strlen(const char *s)
static constexpr int LargeNumberOfSignificantDigits
uint32_t rangeChecksum() override
void moveTo(double x, double y)
bool isCursorVisible(float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation)
I18n::Message emptyMessage() override
void panToMakePointVisible(float x, float y, float topMarginRatio, float rightMarginRatio, float bottomMarginRation, float leftMarginRation)
ViewController * initialisationParameterController() override
void setDefault() override
void setCursorView(View *cursorView)
double yValueForXValue(double x)
static constexpr float k_cursorLeftMarginRatio
void selectRegressionCurve()
CurveViewCursor * m_cursor
void setCursor(CurveViewCursor *cursor)