summaryrefslogtreecommitdiffstats
path: root/stats/quartilemarker.cpp
blob: 611737d76b19607d53a7d13765af22f05c76ee1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// SPDX-License-Identifier: GPL-2.0
#include "quartilemarker.h"
#include "statscolors.h"
#include "statsaxis.h"
#include "zvalues.h"

static const double quartileMarkerSize = 15.0;

QuartileMarker::QuartileMarker(StatsView &view, double pos, double value, StatsAxis *xAxis, StatsAxis *yAxis) :
	ChartLineItem(view, ChartZValue::ChartFeatures, quartileMarkerColor, 2.0),
	xAxis(xAxis), yAxis(yAxis),
	pos(pos),
	value(value)
{
	updatePosition();
}

QuartileMarker::~QuartileMarker()
{
}

void QuartileMarker::updatePosition()
{
	if (!xAxis || !yAxis)
		return;
	double x = xAxis->toScreen(pos);
	double y = yAxis->toScreen(value);
	setLine(QPointF(x - quartileMarkerSize / 2.0, y),
		QPointF(x + quartileMarkerSize / 2.0, y));
}