mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/statistics] Forbid to set histogram paramaters which would draw
too many bars Change-Id: I94c79a7e91ff02510eb5b00039a27ccdfc181d91
This commit is contained in:
@@ -50,12 +50,18 @@ float HistogramParameterController::parameterAtIndex(int index) {
|
||||
bool HistogramParameterController::setParameterAtIndex(int parameterIndex, float f) {
|
||||
assert(parameterIndex >= 0 && parameterIndex < k_numberOfCells);
|
||||
if (parameterIndex == 0) {
|
||||
if (f <= 0.0f) {
|
||||
float newNumberOfBars = ceilf((m_store->maxValue() - m_store->firstDrawnBarAbscissa())/f);
|
||||
if (f <= 0.0f || newNumberOfBars > Store::k_maxNumberOfBars) {
|
||||
app()->displayWarning(I18n::Message::ForbiddenValue);
|
||||
return false;
|
||||
}
|
||||
m_store->setBarWidth(f);
|
||||
} else {
|
||||
float newNumberOfBars = ceilf((m_store->maxValue() - f)/m_store->barWidth());
|
||||
if (newNumberOfBars > Store::k_maxNumberOfBars) {
|
||||
app()->displayWarning(I18n::Message::ForbiddenValue);
|
||||
return false;
|
||||
}
|
||||
m_store->setFirstDrawnBarAbscissa(f);
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user