statistics: move colors to statscolors.h

Most colors were already collected there, but a few were dispersed
throughout the source files.

For future themeability, move the remaining colors to this common
place.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-01-19 12:59:56 +01:00 committed by bstoeger
parent ba259fb1d6
commit 2e2019dea7
6 changed files with 12 additions and 8 deletions

View file

@ -5,8 +5,6 @@
#include <QFontMetrics>
static const QColor informationBorderColor(Qt::black);
static const QColor informationColor(0xff, 0xff, 0x00, 192); // Note: fourth argument is opacity
static const int informationBorder = 2;
static const double informationBorderRadius = 4.0; // Radius of rounded corners
static const int distanceFromPointer = 10; // Distance to place box from mouse pointer or scatter item

View file

@ -12,8 +12,6 @@ static const double legendBoxBorderSize = 1.0;
static const double legendBoxBorderRadius = 4.0; // radius of rounded corners
static const double legendBoxScale = 0.8; // 1.0: text-height of the used font
static const double legendInternalBorderSize = 2.0;
static const QColor legendColor(0x00, 0x8e, 0xcc, 192); // Note: fourth argument is opacity
static const QColor legendBorderColor(Qt::black);
Legend::Legend(StatsView &view, const std::vector<QString> &names) :
ChartRectItem(view, ChartZValue::Legend,

View file

@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
#include "quartilemarker.h"
#include "statscolors.h"
#include "statsaxis.h"
#include "zvalues.h"
static const QColor quartileMarkerColor(Qt::red);
static const double quartileMarkerSize = 15.0;
QuartileMarker::QuartileMarker(StatsView &view, double pos, double value, StatsAxis *xAxis, StatsAxis *yAxis) :

View file

@ -1,11 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
#include "regressionitem.h"
#include "statsaxis.h"
#include "statscolors.h"
#include "zvalues.h"
#include <cmath>
static const QColor regressionItemColor(Qt::red);
static const double regressionLineWidth = 2.0;
RegressionItem::RegressionItem(StatsView &view, regression_data reg,

View file

@ -14,6 +14,14 @@ inline const QColor darkLabelColor(Qt::black);
inline const QColor lightLabelColor(Qt::white);
inline const QColor axisColor(Qt::black);
inline const QColor gridColor(0xcc, 0xcc, 0xcc);
inline const QColor informationBorderColor(Qt::black);
inline const QColor informationColor(0xff, 0xff, 0x00, 192); // Note: fourth argument is opacity
inline const QColor legendColor(0x00, 0x8e, 0xcc, 192); // Note: fourth argument is opacity
inline const QColor legendBorderColor(Qt::black);
inline const QColor quartileMarkerColor(Qt::red);
inline const QColor regressionItemColor(Qt::red);
inline const QColor meanMarkerColor(Qt::green);
inline const QColor medianMarkerColor(Qt::red);
QColor binColor(int bin, int numBins);
QColor labelColor(int bin, size_t numBins);

View file

@ -956,10 +956,10 @@ void StatsView::plotHistogramCountChart(const std::vector<dive *> &dives,
if (categoryVariable->type() == StatsVariable::Type::Numeric) {
double mean = categoryVariable->mean(dives);
if (!std::isnan(mean))
meanMarker = createChartItem<HistogramMarker>(mean, isHorizontal, Qt::green, xAxis, yAxis);
meanMarker = createChartItem<HistogramMarker>(mean, isHorizontal, meanMarkerColor, xAxis, yAxis);
double median = categoryVariable->quartiles(dives).q2;
if (!std::isnan(median))
medianMarker = createChartItem<HistogramMarker>(median, isHorizontal, Qt::red, xAxis, yAxis);
medianMarker = createChartItem<HistogramMarker>(median, isHorizontal, medianMarkerColor, xAxis, yAxis);
}
}