mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Fix DataNotSuitable message (was too long)
This commit is contained in:
@@ -2,16 +2,19 @@
|
||||
|
||||
namespace Regression {
|
||||
|
||||
constexpr KDColor BannerView::k_textColor;
|
||||
constexpr KDColor BannerView::k_backgroundColor;
|
||||
|
||||
BannerView::BannerView() :
|
||||
m_dotNameView(KDText::FontSize::Small, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_xView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_yView(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_regressionTypeView(KDText::FontSize::Small, (I18n::Message)0, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_subText1(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_subText2(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_subText3(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_subText4(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_subText5(KDText::FontSize::Small, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle)
|
||||
m_dotNameView(k_fontSize, 0.0f, 0.5f, k_textColor, k_backgroundColor),
|
||||
m_xView(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
|
||||
m_yView(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
|
||||
m_regressionTypeView(k_fontSize, (I18n::Message)0, 0.0f, 0.5f, k_textColor,k_backgroundColor),
|
||||
m_subText1(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
|
||||
m_subText2(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
|
||||
m_subText3(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
|
||||
m_subText4(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor),
|
||||
m_subText5(k_fontSize, 0.5f, 0.5f, k_textColor, k_backgroundColor)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,11 @@ class BannerView : public Shared::BannerView {
|
||||
public:
|
||||
BannerView();
|
||||
int numberOfTextviews() const { return k_numberOfTextViews; }
|
||||
KDText::FontSize fontSize() const { return k_fontSize; }
|
||||
private:
|
||||
static constexpr KDText::FontSize k_fontSize = KDText::FontSize::Small;
|
||||
static constexpr KDColor k_textColor = KDColorBlack;
|
||||
static constexpr KDColor k_backgroundColor = Palette::GreyMiddle;
|
||||
static constexpr int k_numberOfTextViews = 9;
|
||||
int numberOfSubviews() const override;
|
||||
TextView * textViewAtIndex(int i) const override;
|
||||
|
||||
@@ -18,4 +18,4 @@ Exponential = "Exponentielle"
|
||||
Power = "Potenz"
|
||||
Trigonometrical = "Trigonometrische"
|
||||
Logistic = "Logistische"
|
||||
DataNotSuitableForRegression = " Daten sind nicht für dieses Regressionsmodell geeignete"
|
||||
DataNotSuitableForRegression = "Daten sind nicht geeignet"
|
||||
|
||||
@@ -18,4 +18,4 @@ Exponential = "Exponencial"
|
||||
Power = "Potencial"
|
||||
Trigonometrical = "Trigonometrica"
|
||||
Logistic = "Logistica"
|
||||
DataNotSuitableForRegression = " Datos no adecuados para este modelo de regresión"
|
||||
DataNotSuitableForRegression = "Datos no adecuados"
|
||||
|
||||
@@ -18,4 +18,4 @@ Exponential = "Exponentielle"
|
||||
Power = "Puissance"
|
||||
Trigonometrical = "Trigonométrique"
|
||||
Logistic = "Logistique"
|
||||
DataNotSuitableForRegression = " Les données ne conviennent pas à ce modèle de régression"
|
||||
DataNotSuitableForRegression = "Les données ne conviennent pas"
|
||||
|
||||
@@ -18,4 +18,4 @@ Exponential = "Exponencial"
|
||||
Power = "Potencia"
|
||||
Trigonometrical = "Trigonometrica"
|
||||
Logistic = "Logistica"
|
||||
DataNotSuitableForRegression = " Dados não adequados para este modelo de regressão"
|
||||
DataNotSuitableForRegression = "Dados não adequados"
|
||||
|
||||
@@ -9,6 +9,7 @@ using namespace Shared;
|
||||
|
||||
static inline float min(float x, float y) { return (x<y ? x : y); }
|
||||
static inline float max(float x, float y) { return (x>y ? x : y); }
|
||||
static inline int maxInt(int x, int y) { return (x>y ? x : y); }
|
||||
|
||||
namespace Regression {
|
||||
|
||||
@@ -158,7 +159,8 @@ void GraphController::reloadBannerView() {
|
||||
|
||||
// Set formula
|
||||
Model * model = m_store->modelForSeries(selectedSeriesIndex());
|
||||
m_bannerView.setMessageAtIndex(model->formulaMessage(), 3);
|
||||
I18n::Message formula = model->formulaMessage();
|
||||
m_bannerView.setMessageAtIndex(formula, 3);
|
||||
|
||||
// Get the coefficients
|
||||
double * coefficients = m_store->coefficientsForSeries(selectedSeriesIndex(), globalContext());
|
||||
@@ -170,13 +172,22 @@ void GraphController::reloadBannerView() {
|
||||
}
|
||||
}
|
||||
if (!coefficientsAreDefined) {
|
||||
// Force the "Data not suitable" message to be on the next line
|
||||
int numberOfCharToCompleteLine = maxInt(Ion::Display::Width/(KDText::charSize(m_bannerView.fontSize()).width())- strlen(I18n::translate(formula)), 0);
|
||||
numberOfChar = 0;
|
||||
for (int i = 0; i < numberOfCharToCompleteLine-1; i++) {
|
||||
buffer[numberOfChar++] = ' ';
|
||||
}
|
||||
buffer[numberOfChar] = 0;
|
||||
m_bannerView.setLegendAtIndex(buffer, 4);
|
||||
|
||||
const char * dataNotSuitableMessage = I18n::translate(I18n::Message::DataNotSuitableForRegression);
|
||||
m_bannerView.setLegendAtIndex(const_cast<char *>(dataNotSuitableMessage), 4);
|
||||
for (int i = 5; i < m_bannerView.numberOfTextviews(); i++) {
|
||||
char empty[] = {0};
|
||||
m_bannerView.setLegendAtIndex(empty, i);
|
||||
}
|
||||
return;
|
||||
m_bannerView.setLegendAtIndex(const_cast<char *>(dataNotSuitableMessage), 5);
|
||||
for (int i = 6; i < m_bannerView.numberOfTextviews(); i++) {
|
||||
char empty[] = {0};
|
||||
m_bannerView.setLegendAtIndex(empty, i);
|
||||
}
|
||||
return;
|
||||
}
|
||||
char coefficientName = 'a';
|
||||
for (int i = 0; i < model->numberOfCoefficients(); i++) {
|
||||
@@ -261,7 +272,7 @@ bool GraphController::moveCursorHorizontally(int direction) {
|
||||
return false;
|
||||
}
|
||||
double x = direction > 0 ? m_cursor->x() + m_store->xGridUnit()/k_numberOfCursorStepsInGradUnit :
|
||||
m_cursor->x() - m_store->xGridUnit()/k_numberOfCursorStepsInGradUnit;
|
||||
m_cursor->x() - m_store->xGridUnit()/k_numberOfCursorStepsInGradUnit;
|
||||
double y = m_store->yValueForXValue(*m_selectedSeriesIndex, x, globalContext());
|
||||
m_cursor->moveTo(x, y);
|
||||
m_store->panToMakePointVisible(x, y, cursorTopMarginRatio(), k_cursorRightMarginRatio, cursorBottomMarginRatio(), k_cursorLeftMarginRatio);
|
||||
|
||||
Reference in New Issue
Block a user