2021-01-14 07:48:56 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include "quartilemarker.h"
|
|
|
|
#include "statsaxis.h"
|
2021-02-16 16:05:39 +00:00
|
|
|
#include "statscolors.h"
|
|
|
|
#include "statsview.h"
|
2021-01-14 07:48:56 +00:00
|
|
|
#include "zvalues.h"
|
|
|
|
|
|
|
|
static const double quartileMarkerSize = 15.0;
|
|
|
|
|
|
|
|
QuartileMarker::QuartileMarker(StatsView &view, double pos, double value, StatsAxis *xAxis, StatsAxis *yAxis) :
|
2021-02-16 16:05:39 +00:00
|
|
|
ChartLineItem(view, ChartZValue::ChartFeatures, view.getCurrentTheme().quartileMarkerColor, 2.0),
|
2021-01-14 07:48:56 +00:00
|
|
|
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));
|
|
|
|
}
|