mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 23:30:37 +01:00
[apps/stats] Better margins for histogram label displaying
This commit is contained in:
@@ -398,8 +398,20 @@ void HistogramController::initYRangeParameters(int series) {
|
||||
}
|
||||
yMax = yMax/m_store->sumOfOccurrences(series);
|
||||
yMax = yMax < 0 ? 1 : yMax;
|
||||
m_store->setYMin(-Store::k_displayBottomMarginRatio*yMax);
|
||||
m_store->setYMax(yMax*(1.0f+Store::k_displayTopMarginRatio));
|
||||
|
||||
/* Compute YMin:
|
||||
* ratioFloatPixel*(0-yMin) = k_bottomMargin
|
||||
* ratioFloatPixel*(yMax-yMin) = viewHeight
|
||||
*
|
||||
* -ratioFloatPixel*yMin = k_bottomMargin
|
||||
* ratioFloatPixel*yMax-ratioFloatPixel*yMin = viewHeight
|
||||
*
|
||||
* ratioFloatPixel = (viewHeight - k_bottomMargin)/yMax
|
||||
* yMin = -k_bottomMargin/ratioFloatPixel = yMax*k_bottomMargin/(k_bottomMargin - viewHeight)
|
||||
* */
|
||||
|
||||
m_store->setYMin(m_store->yMax()*(float)Store::k_bottomMargin/((float)Store::k_bottomMargin - m_view.histogramViewAtIndex(series)->bounds().height()));
|
||||
}
|
||||
|
||||
void HistogramController::initBarParameters() {
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
constexpr static double k_maxNumberOfBars = 10000.0;
|
||||
constexpr static float k_displayTopMarginRatio = 0.1f;
|
||||
constexpr static float k_displayRightMarginRatio = 0.04f;
|
||||
constexpr static float k_displayBottomMarginRatio = 0.4f;
|
||||
constexpr static int k_bottomMargin = 20;
|
||||
constexpr static float k_displayLeftMarginRatio = 0.04f;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user