summaryrefslogtreecommitdiffstats
path: root/stats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-19 12:59:56 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2021-01-20 08:47:18 +0100
commit2e2019dea7087937d7bcc0e9bd2598d61a758b65 (patch)
tree032ba3da052a6a8afb1c789ee1b3bf62a3a39c6a /stats
parentba259fb1d66c242d9503ba9695ce55826370267e (diff)
downloadsubsurface-2e2019dea7087937d7bcc0e9bd2598d61a758b65.tar.gz
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>
Diffstat (limited to 'stats')
-rw-r--r--stats/informationbox.cpp2
-rw-r--r--stats/legend.cpp2
-rw-r--r--stats/quartilemarker.cpp2
-rw-r--r--stats/regressionitem.cpp2
-rw-r--r--stats/statscolors.h8
-rw-r--r--stats/statsview.cpp4
6 files changed, 12 insertions, 8 deletions
diff --git a/stats/informationbox.cpp b/stats/informationbox.cpp
index 02fdb9e97..29731acc6 100644
--- a/stats/informationbox.cpp
+++ b/stats/informationbox.cpp
@@ -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
diff --git a/stats/legend.cpp b/stats/legend.cpp
index d0a5c19b1..fc8656828 100644
--- a/stats/legend.cpp
+++ b/stats/legend.cpp
@@ -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,
diff --git a/stats/quartilemarker.cpp b/stats/quartilemarker.cpp
index ace019df5..611737d76 100644
--- a/stats/quartilemarker.cpp
+++ b/stats/quartilemarker.cpp
@@ -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) :
diff --git a/stats/regressionitem.cpp b/stats/regressionitem.cpp
index cd817c9eb..362bf1fe1 100644
--- a/stats/regressionitem.cpp
+++ b/stats/regressionitem.cpp
@@ -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,
diff --git a/stats/statscolors.h b/stats/statscolors.h
index 050b8a3ab..e1800b550 100644
--- a/stats/statscolors.h
+++ b/stats/statscolors.h
@@ -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);
diff --git a/stats/statsview.cpp b/stats/statsview.cpp
index 714f3ee1a..feb5a276e 100644
--- a/stats/statsview.cpp
+++ b/stats/statsview.cpp
@@ -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);
}
}