mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[apps] statistics: improve box rendering
This commit is contained in:
committed by
EmilieNumworks
parent
9dd637f7c3
commit
4e699dc27c
@@ -52,15 +52,10 @@ void BoxView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
// Draw the main box
|
||||
KDCoordinate firstQuartilePixels = std::round(floatToPixel(Axis::Horizontal, m_store->firstQuartile()));
|
||||
KDCoordinate thirdQuartilePixels = std::round(floatToPixel(Axis::Horizontal, m_store->thirdQuartile()));
|
||||
KDCoordinate lowBoundPixel = floatToPixel(Axis::Vertical, upBound);
|
||||
KDCoordinate upBoundPixel = floatToPixel(Axis::Vertical, lowBound);
|
||||
KDCoordinate lowBoundPixel = std::round(floatToPixel(Axis::Vertical, upBound));
|
||||
KDCoordinate upBoundPixel = std::round(floatToPixel(Axis::Vertical, lowBound));
|
||||
ctx->fillRect(KDRect(firstQuartilePixels, lowBoundPixel, thirdQuartilePixels - firstQuartilePixels+2,
|
||||
upBoundPixel-lowBoundPixel), Palette::GreyWhite);
|
||||
// Add 'shadows' to the box
|
||||
if (thirdQuartilePixels-firstQuartilePixels > 2) {
|
||||
ctx->fillRect(KDRect(firstQuartilePixels, upBoundPixel-1, thirdQuartilePixels-firstQuartilePixels, 1), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(firstQuartilePixels, upBoundPixel, thirdQuartilePixels-firstQuartilePixels, 1), Palette::GreyMiddle);
|
||||
}
|
||||
// Draw the horizontal lines linking the box to the extreme bounds
|
||||
drawSegment(ctx, rect, Axis::Horizontal, 0.5f, m_store->minValue(), m_store->firstQuartile(), Palette::GreyDark);
|
||||
drawSegment(ctx, rect, Axis::Horizontal, 0.5f, m_store->thirdQuartile(), m_store->maxValue(), Palette::GreyDark);
|
||||
|
||||
Reference in New Issue
Block a user