mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[statistics][regression] CalculationController: fix column width to
display all digits
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "calculation_controller.h"
|
||||
#include "../constant.h"
|
||||
#include "../apps_container.h"
|
||||
#include "../shared/poincare_helpers.h"
|
||||
#include <poincare/char_layout.h>
|
||||
@@ -246,7 +245,7 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
||||
|
||||
KDCoordinate CalculationController::columnWidth(int i) {
|
||||
if (i == 0) {
|
||||
return k_smallCalculationCellWidth;
|
||||
return k_titleCalculationCellWidth;
|
||||
}
|
||||
Model::Type currentType = m_store->seriesRegressionType(m_store->indexOfKthNonEmptySeries(i-1));
|
||||
if (currentType == Model::Type::Quartic) {
|
||||
@@ -255,7 +254,7 @@ KDCoordinate CalculationController::columnWidth(int i) {
|
||||
if (currentType == Model::Type::Cubic) {
|
||||
return k_cubicCalculationCellWidth;
|
||||
}
|
||||
return k_smallCalculationCellWidth;
|
||||
return k_minCalculationCellWidth;
|
||||
}
|
||||
|
||||
KDCoordinate CalculationController::rowHeight(int j) {
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
#include "../shared/tab_table_controller.h"
|
||||
#include "../shared/separator_even_odd_buffer_text_cell.h"
|
||||
#include "../shared/store_cell.h"
|
||||
#include "../constant.h"
|
||||
|
||||
namespace Regression {
|
||||
|
||||
constexpr static size_t max(KDCoordinate a, KDCoordinate b) { return a > b ? a : b; }
|
||||
|
||||
class CalculationController : public Shared::TabTableController, public TableViewDataSource, public SelectableTableViewDelegate, public ButtonRowDelegate, public AlternateEmptyViewDefaultDelegate {
|
||||
|
||||
public:
|
||||
@@ -59,9 +62,11 @@ private:
|
||||
static constexpr int k_regressionCellIndex = 9;
|
||||
|
||||
static constexpr KDCoordinate k_cellHeight = 25;
|
||||
static constexpr KDCoordinate k_smallCalculationCellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
|
||||
static constexpr KDCoordinate k_cubicCalculationCellWidth = 150;
|
||||
static constexpr KDCoordinate k_quarticCalculationCellWidth = 195;
|
||||
static constexpr KDCoordinate k_titleCalculationCellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
|
||||
// TODO: change 7 for KDFont::SmallFont->glyphSize().width()
|
||||
static constexpr KDCoordinate k_minCalculationCellWidth = 7*2*(Poincare::PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)); //Calculation width should at least be able to hold to numbers with LargeNumberOfSignificantDigits.
|
||||
static constexpr KDCoordinate k_cubicCalculationCellWidth = max(150, k_minCalculationCellWidth); // Should hold aX^3+bX^2+cX+d
|
||||
static constexpr KDCoordinate k_quarticCalculationCellWidth = max(195, k_minCalculationCellWidth ); // Should hold ? aX^4+bX^3+c*X^2+dX+e
|
||||
static constexpr KDCoordinate k_margin = 8;
|
||||
static constexpr KDCoordinate k_r2CellMargin = 2;
|
||||
static constexpr KDCoordinate k_scrollBarMargin = Metric::CommonRightMargin;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "calculation_controller.h"
|
||||
#include "../constant.h"
|
||||
#include "../apps_container.h"
|
||||
#include "../shared/poincare_helpers.h"
|
||||
#include <assert.h>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define STATISTICS_CALCULATION_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include <poincare/print_float.h>
|
||||
#include "store.h"
|
||||
#include "calculation_selectable_table_view.h"
|
||||
#include "../shared/hideable_even_odd_cell.h"
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "../shared/separator_even_odd_buffer_text_cell.h"
|
||||
#include "../shared/store_title_cell.h"
|
||||
#include "../shared/tab_table_controller.h"
|
||||
#include "../constant.h"
|
||||
|
||||
namespace Statistics {
|
||||
|
||||
@@ -53,7 +55,8 @@ private:
|
||||
static constexpr int k_hideableCellType = 3;
|
||||
static constexpr KDCoordinate k_cellHeight = 20;
|
||||
static constexpr KDCoordinate k_calculationTitleCellWidth = 175;
|
||||
static constexpr KDCoordinate k_calculationCellWidth = 84;
|
||||
// TODO: change 7 for KDFont::SmallFont->glyphSize().width()
|
||||
static constexpr KDCoordinate k_calculationCellWidth = 7*(Poincare::PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits));
|
||||
static constexpr KDCoordinate k_margin = 8;
|
||||
static constexpr KDCoordinate k_scrollBarMargin = Metric::CommonRightMargin;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user