From 2e2019dea7087937d7bcc0e9bd2598d61a758b65 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 19 Jan 2021 12:59:56 +0100 Subject: 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 --- stats/informationbox.cpp | 2 -- stats/legend.cpp | 2 -- stats/quartilemarker.cpp | 2 +- stats/regressionitem.cpp | 2 +- stats/statscolors.h | 8 ++++++++ stats/statsview.cpp | 4 ++-- 6 files changed, 12 insertions(+), 8 deletions(-) (limited to 'stats') 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 -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 &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 -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 &dives, if (categoryVariable->type() == StatsVariable::Type::Numeric) { double mean = categoryVariable->mean(dives); if (!std::isnan(mean)) - meanMarker = createChartItem(mean, isHorizontal, Qt::green, xAxis, yAxis); + meanMarker = createChartItem(mean, isHorizontal, meanMarkerColor, xAxis, yAxis); double median = categoryVariable->quartiles(dives).q2; if (!std::isnan(median)) - medianMarker = createChartItem(median, isHorizontal, Qt::red, xAxis, yAxis); + medianMarker = createChartItem(median, isHorizontal, medianMarkerColor, xAxis, yAxis); } } -- cgit v1.2.3-70-g09d2