mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/statisctics] Adjust to display mode to preferences
Change-Id: I744cb8e88fd2c5d14bf4c288037762b8f3a8fa8c
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "box_controller.h"
|
||||
#include "../apps_container.h"
|
||||
#include <math.h>
|
||||
|
||||
namespace Statistics {
|
||||
@@ -68,7 +69,8 @@ void BoxController::reloadBannerView() {
|
||||
CalculPointer calculationMethods[5] = {&Store::minValue, &Store::firstQuartile, &Store::median, &Store::thirdQuartile,
|
||||
&Store::maxValue};
|
||||
float calculation = (m_store->*calculationMethods[(int)m_view.selectedQuantile()])();
|
||||
Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
AppsContainer * container = (AppsContainer *)app()->container();
|
||||
Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode());
|
||||
m_boxBannerView.setLegendAtIndex(buffer, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "calculation_controller.h"
|
||||
#include "../constant.h"
|
||||
#include "../apps_container.h"
|
||||
#include <poincare.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -87,7 +88,8 @@ void CalculationController::willDisplayCellAtLocation(TableViewCell * cell, int
|
||||
float calculation = (m_store->*calculationMethods[j])();
|
||||
EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)cell;
|
||||
char buffer[Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
|
||||
Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
AppsContainer * container = (AppsContainer *)app()->container();
|
||||
Float(calculation).convertFloatToText(buffer, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode());
|
||||
myCell->setText(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "histogram_controller.h"
|
||||
#include "../apps_container.h"
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
@@ -123,15 +124,16 @@ Responder * HistogramController::tabController() const {
|
||||
}
|
||||
|
||||
void HistogramController::reloadBannerView() {
|
||||
AppsContainer * container = (AppsContainer *)app()->container();
|
||||
char buffer[k_maxNumberOfCharacters+ Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)*2];
|
||||
const char * legend = "Interval [";
|
||||
int legendLength = strlen(legend);
|
||||
strlcpy(buffer, legend, legendLength+1);
|
||||
float lowerBound = m_store->startOfBarAtIndex(m_selectedBarIndex);
|
||||
int lowerBoundNumberOfChar = Float(lowerBound).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
int lowerBoundNumberOfChar = Float(lowerBound).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode());
|
||||
buffer[legendLength+lowerBoundNumberOfChar] = ';';
|
||||
float upperBound = m_store->endOfBarAtIndex(m_selectedBarIndex);
|
||||
int upperBoundNumberOfChar = Float(upperBound).convertFloatToText(buffer+legendLength+lowerBoundNumberOfChar+1, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
int upperBoundNumberOfChar = Float(upperBound).convertFloatToText(buffer+legendLength+lowerBoundNumberOfChar+1, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode());
|
||||
buffer[legendLength+lowerBoundNumberOfChar+upperBoundNumberOfChar+1] = '[';
|
||||
buffer[legendLength+lowerBoundNumberOfChar+upperBoundNumberOfChar+2] = 0;
|
||||
m_bannerView.setLegendAtIndex(buffer, 0);
|
||||
@@ -140,14 +142,14 @@ void HistogramController::reloadBannerView() {
|
||||
legendLength = strlen(legend);
|
||||
strlcpy(buffer, legend, legendLength+1);
|
||||
float size = m_store->heightOfBarAtIndex(m_selectedBarIndex);
|
||||
Float(size).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
Float(size).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode());
|
||||
m_bannerView.setLegendAtIndex(buffer, 1);
|
||||
|
||||
legend = "Frequence: ";
|
||||
legendLength = strlen(legend);
|
||||
strlcpy(buffer, legend, legendLength+1);
|
||||
float frequency = size/m_store->sumOfColumn(1);
|
||||
Float(frequency).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
Float(frequency).convertFloatToText(buffer+legendLength, Float::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, container->preferences()->displayMode());
|
||||
m_bannerView.setLegendAtIndex(buffer, 2);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user