mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/stats] Series name in the box banner
This commit is contained in:
@@ -3,18 +3,19 @@
|
||||
namespace Statistics {
|
||||
|
||||
BoxBannerView::BoxBannerView() :
|
||||
m_seriesName(KDText::FontSize::Small, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_calculationName(KDText::FontSize::Small, I18n::Message::Minimum, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
|
||||
m_calculationValue(KDText::FontSize::Small, 1.0f, 0.5f, KDColorBlack, Palette::GreyMiddle)
|
||||
{
|
||||
}
|
||||
|
||||
TextView * BoxBannerView::textViewAtIndex(int index) const {
|
||||
const TextView * textViews[2] = {&m_calculationName, &m_calculationValue};
|
||||
const TextView * textViews[3] = {&m_seriesName, &m_calculationName, &m_calculationValue};
|
||||
return (TextView *)textViews[index];
|
||||
}
|
||||
|
||||
MessageTextView * BoxBannerView::messageTextViewAtIndex(int index) const {
|
||||
return index == 0 ? (MessageTextView *)&m_calculationName : nullptr;
|
||||
return index == 1 ? (MessageTextView *)&m_calculationName : nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,10 @@ class BoxBannerView : public Shared::BannerView {
|
||||
public:
|
||||
BoxBannerView();
|
||||
private:
|
||||
int numberOfSubviews() const override { return 2; }
|
||||
int numberOfSubviews() const override { return 3; }
|
||||
TextView * textViewAtIndex(int i) const override;
|
||||
MessageTextView * messageTextViewAtIndex(int i) const override;
|
||||
BufferTextView m_seriesName;
|
||||
MessageTextView m_calculationName;
|
||||
BufferTextView m_calculationValue;
|
||||
};
|
||||
|
||||
@@ -38,9 +38,15 @@ void BoxController::reloadBannerView() {
|
||||
|
||||
int selectedQuantile = (int)m_view.dataViewAtIndex(selectedSeries())->selectedQuantile();
|
||||
|
||||
// Set series name
|
||||
char seriesChar = '0' + selectedSeries() + 1;
|
||||
char bufferName[] = {'V', seriesChar, '/', 'N', seriesChar, 0};
|
||||
m_view.editableBannerView()->setLegendAtIndex(bufferName, 0);
|
||||
|
||||
|
||||
// Set calculation name
|
||||
I18n::Message calculationName[5] = {I18n::Message::Minimum, I18n::Message::FirstQuartile, I18n::Message::Median, I18n::Message::ThirdQuartile, I18n::Message::Maximum};
|
||||
m_view.editableBannerView()->setMessageAtIndex(calculationName[selectedQuantile], 0);
|
||||
m_view.editableBannerView()->setMessageAtIndex(calculationName[selectedQuantile], 1);
|
||||
|
||||
// Set calculation result
|
||||
char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
|
||||
@@ -48,7 +54,7 @@ void BoxController::reloadBannerView() {
|
||||
&Store::maxValue};
|
||||
double calculation = (m_store->*calculationMethods[selectedQuantile])(selectedSeries());
|
||||
PrintFloat::convertFloatToText<double>(calculation, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
m_view.editableBannerView()->setLegendAtIndex(buffer, 1);
|
||||
m_view.editableBannerView()->setLegendAtIndex(buffer, 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user