mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] Change axes drawing order in curve views
This commit is contained in:
@@ -20,10 +20,8 @@ GraphView::GraphView(Store * store, CurveViewCursor * cursor, BannerView * banne
|
||||
void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, KDColorWhite);
|
||||
drawGrid(ctx, rect);
|
||||
drawAxis(ctx, rect, Axis::Horizontal);
|
||||
drawAxis(ctx, rect, Axis::Vertical);
|
||||
drawLabels(ctx, rect, Axis::Horizontal, true);
|
||||
drawLabels(ctx, rect, Axis::Vertical, true);
|
||||
drawAxes(ctx, rect);
|
||||
simpleDrawBothAxesLabels(ctx, rect);
|
||||
for (int series = 0; series < Store::k_numberOfSeries; series++) {
|
||||
if (!m_store->seriesIsEmpty(series)) {
|
||||
KDColor color = Palette::DataColor[series];
|
||||
|
||||
@@ -185,6 +185,11 @@ enum class FloatingPosition : uint8_t {
|
||||
Max
|
||||
};
|
||||
|
||||
void CurveView::simpleDrawBothAxesLabels(KDContext * ctx, KDRect rect) const {
|
||||
drawLabels(ctx, rect, Axis::Vertical, true);
|
||||
drawLabels(ctx, rect, Axis::Horizontal, true);
|
||||
}
|
||||
|
||||
void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly, bool fixCoordinate, KDCoordinate fixedCoordinate, KDColor backgroundColor) const {
|
||||
int numberLabels = numberOfLabels(axis);
|
||||
if (numberLabels <= 1) {
|
||||
@@ -388,6 +393,11 @@ void CurveView::drawGrid(KDContext * ctx, KDRect rect) const {
|
||||
drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->yGridUnit(), Palette::GreyWhite);
|
||||
}
|
||||
|
||||
void CurveView::drawAxes(KDContext * ctx, KDRect rect) const {
|
||||
drawAxis(ctx, rect, Axis::Vertical);
|
||||
drawAxis(ctx, rect, Axis::Horizontal);
|
||||
}
|
||||
|
||||
void CurveView::drawAxis(KDContext * ctx, KDRect rect, Axis axis) const {
|
||||
drawLine(ctx, rect, axis, 0.0f, KDColorBlack, 1);
|
||||
}
|
||||
|
||||
@@ -61,11 +61,13 @@ protected:
|
||||
void drawDot(KDContext * ctx, KDRect rect, float x, float y, KDColor color, bool oversize = false) const;
|
||||
void drawGridLines(KDContext * ctx, KDRect rect, Axis axis, float step, KDColor color) const;
|
||||
void drawGrid(KDContext * ctx, KDRect rect) const;
|
||||
void drawAxes(KDContext * ctx, KDRect rect) const;
|
||||
void drawAxis(KDContext * ctx, KDRect rect, Axis axis) const;
|
||||
void drawCurve(KDContext * ctx, KDRect rect, EvaluateModelWithParameter evaluation, void * model, void * context, KDColor color, bool colorUnderCurve = false, float colorLowerBound = 0.0f, float colorUpperBound = 0.0f, bool continuously = false) const;
|
||||
void drawHistogram(KDContext * ctx, KDRect rect, EvaluateModelWithParameter evaluation, void * model, void * context, float firstBarAbscissa, float barWidth,
|
||||
bool fillBar, KDColor defaultColor, KDColor highlightColor, float highlightLowerBound = INFINITY, float highlightUpperBound = -INFINITY) const;
|
||||
void computeLabels(Axis axis);
|
||||
void simpleDrawBothAxesLabels(KDContext * ctx, KDRect rect) const;
|
||||
void drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly = false, bool fixCoordinate = false, KDCoordinate fixedCoordinate = 0, KDColor backgroundColor = KDColorWhite) const;
|
||||
View * m_bannerView;
|
||||
CurveViewCursor * m_curveViewCursor;
|
||||
|
||||
@@ -22,10 +22,8 @@ FunctionGraphView::FunctionGraphView(InteractiveCurveViewRange * graphRange,
|
||||
void FunctionGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, KDColorWhite);
|
||||
drawGrid(ctx, rect);
|
||||
drawAxis(ctx, rect, Axis::Horizontal);
|
||||
drawAxis(ctx, rect, Axis::Vertical);
|
||||
drawLabels(ctx, rect, Axis::Horizontal, true);
|
||||
drawLabels(ctx, rect, Axis::Vertical, true);
|
||||
drawAxes(ctx, rect);
|
||||
simpleDrawBothAxesLabels(ctx, rect);
|
||||
}
|
||||
|
||||
void FunctionGraphView::setContext(Context * context) {
|
||||
|
||||
@@ -22,10 +22,8 @@ StorageFunctionGraphView::StorageFunctionGraphView(InteractiveCurveViewRange * g
|
||||
void StorageFunctionGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, KDColorWhite);
|
||||
drawGrid(ctx, rect);
|
||||
drawAxis(ctx, rect, Axis::Horizontal);
|
||||
drawAxis(ctx, rect, Axis::Vertical);
|
||||
drawLabels(ctx, rect, Axis::Horizontal, true);
|
||||
drawLabels(ctx, rect, Axis::Vertical, true);
|
||||
drawAxes(ctx, rect);
|
||||
simpleDrawBothAxesLabels(ctx, rect);
|
||||
}
|
||||
|
||||
void StorageFunctionGraphView::setContext(Context * context) {
|
||||
|
||||
Reference in New Issue
Block a user