Files
Upsilon/apps/statistics/box_view.h
Romain Goyet 2bf83c43a8 [apps/shared] Factorize CurveView::label
There was a lot of code duplication.
I removed the initialization of xLabel{} and yLabels{} because those are
scratch buffers that shouldn't be accessed before being written to
anyway.
2020-03-11 09:51:33 +01:00

52 lines
1.2 KiB
C++

#ifndef STATISTICS_BOX_VIEW_H
#define STATISTICS_BOX_VIEW_H
#include <escher.h>
#include "store.h"
#include "box_range.h"
#include "../constant.h"
#include "../shared/curve_view.h"
namespace Statistics {
class BoxController;
class BoxView : public Shared::CurveView {
public:
enum class Quantile : int {
None = -1,
Min = 0,
FirstQuartile = 1,
Median = 2,
ThirdQuartile = 3,
Max = 4
};
BoxView(Store * store, int series, Shared::BannerView * bannerView, Quantile * selectedQuantile, KDColor color, KDColor lightColor);
Quantile selectedQuantile() const { return *m_selectedQuantile; }
bool selectQuantile(int selectedQuantile);
int series() const { return m_series; }
void reloadQuantile();
// CurveView
void reload() override;
// View
void drawRect(KDContext * ctx, KDRect rect) const override;
private:
static constexpr KDCoordinate k_boxHeight = 40;
static constexpr KDCoordinate k_quantileBarWidth = 2;
KDCoordinate boxLowerBoundPixel() const;
KDCoordinate boxUpperBoundPixel() const;
Store * m_store;
BoxRange m_boxRange;
int m_series;
Quantile * m_selectedQuantile;
KDColor m_selectedHistogramColor;
KDColor m_selectedHistogramLightColor;
};
}
#endif