SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
seriesstyle.h
Go to the documentation of this file.
1
20#ifndef OPENSWMMVIS_PLOT_SERIESSTYLE_H
21#define OPENSWMMVIS_PLOT_SERIESSTYLE_H
22
23#include "plot/numberformat.h"
24
25#include <QColor>
26#include <QFont>
27#include <QJsonObject>
28#include <QPen>
29#include <QString>
30#include <Qt>
31
32class QXYSeries;
33class QScatterSeries;
34
35namespace openswmmvis::plot {
36
38enum class MarkerShape {
39 Circle,
40 Square,
42 Diamond,
43 Cross,
44 Plus
45};
46
49 // ---- Identity -------------------------------------------------------
50 QColor color = QColor(31, 119, 180); // matplotlib "tab:blue"
51 qreal opacity = 1.0; // 0..1
52 QString legendName; // empty = auto
53
54 // ---- Line -----------------------------------------------------------
55 bool showLine = true;
56 qreal lineWidth = 1.6;
57 Qt::PenStyle dash = Qt::SolidLine;
58 Qt::PenCapStyle capStyle = Qt::FlatCap;
59 Qt::PenJoinStyle joinStyle = Qt::BevelJoin;
60
61 // ---- Markers --------------------------------------------------------
62 bool showMarkers = false;
64 qreal markerSize = 5.0;
65 QColor markerFillColor; // invalid = derive from color
66 QColor markerBorderColor; // invalid = derive from color
67 qreal markerBorderWidth = 0.0;
68
69 // ---- Point labels ---------------------------------------------------
70 bool showPointLabels = false;
71 QFont pointLabelFont; // default = QFont()
72 QColor pointLabelColor; // invalid = derive from color
73 int pointLabelPrecision = 2; // decimals or sig figs (see mode)
75 QString pointLabelFormat; // optional printf override; empty = use mode+precision
76
77 // ---- Area fill ------------------------------------------------------
78 bool showAreaFill = false;
79 QColor areaFillColor; // invalid = derive (semi-transparent color)
80
81 QJsonObject toJson() const;
82 static SeriesStyle fromJson(const QJsonObject& obj);
83
84 QColor effectiveMarkerFillColor() const;
85 QColor effectiveMarkerBorderColor() const;
86 QColor effectivePointLabelColor() const;
87 QColor effectiveAreaFillColor() const; // alpha-baked fallback if invalid
88};
89
92SeriesStyle defaultStyleForCycle(int cycleIndex);
93
96MarkerShape markerShapeFromString(const QString& s);
97
99QString penStyleToString(Qt::PenStyle s);
100Qt::PenStyle penStyleFromString(const QString& s);
101
103QString penCapStyleToString(Qt::PenCapStyle s);
104Qt::PenCapStyle penCapStyleFromString(const QString& s);
105QString penJoinStyleToString(Qt::PenJoinStyle s);
106Qt::PenJoinStyle penJoinStyleFromString(const QString& s);
107
110QPen penForStyle(const SeriesStyle& style);
111
125void applySeriesStyle(const SeriesStyle& style,
126 QXYSeries* series,
127 QScatterSeries* markerOverlay = nullptr);
128
129} // namespace openswmmvis::plot
130
131#endif // OPENSWMMVIS_PLOT_SERIESSTYLE_H
double s
Scene px per model length unit.
Definition inletdrawingview.cpp:82
Definition chartproperties.h:34
Qt::PenCapStyle penCapStyleFromString(const QString &s)
Definition seriesstyle.cpp:119
NumberFormatMode
Interpretation of NumberFormat::count.
Definition numberformat.h:32
@ Decimals
Fixed-point: count digits after the point ('f').
QString penJoinStyleToString(Qt::PenJoinStyle s)
Definition seriesstyle.cpp:126
MarkerShape markerShapeFromString(const QString &s)
Definition seriesstyle.cpp:78
Qt::PenJoinStyle penJoinStyleFromString(const QString &s)
Definition seriesstyle.cpp:137
MarkerShape
Marker shape used when SeriesStyle::showMarkers == true.
Definition seriesstyle.h:38
Qt::PenStyle penStyleFromString(const QString &s)
Definition seriesstyle.cpp:100
QString penStyleToString(Qt::PenStyle s)
String key for Qt::PenStyle (Solid / Dash / Dot / DashDot / DashDotDot).
Definition seriesstyle.cpp:88
QPen penForStyle(const SeriesStyle &style)
Build a QPen from the line-related fields of style. Width / cap / join / dash all wired up; colour wi...
Definition seriesstyle.cpp:270
QString penCapStyleToString(Qt::PenCapStyle s)
String keys for Qt::PenCapStyle and Qt::PenJoinStyle (JSON round-trip).
Definition seriesstyle.cpp:109
QString markerShapeToString(MarkerShape s)
String key for MarkerShape ↔ JSON.
Definition seriesstyle.cpp:65
void applySeriesStyle(const SeriesStyle &style, QXYSeries *series, QScatterSeries *markerOverlay=nullptr)
Apply every field of style to series.
Definition seriesstyle.cpp:364
SeriesStyle defaultStyleForCycle(int cycleIndex)
Returns a default styled cycle position — the 12-color cycle used when new series are added without a...
Definition seriesstyle.cpp:34
Single source of truth for how chart plots render numeric values.
Aggregated rendering parameters for one chart series.
Definition seriesstyle.h:48
QColor effectiveMarkerBorderColor() const
Definition seriesstyle.cpp:47
QFont pointLabelFont
Definition seriesstyle.h:71
QColor effectiveMarkerFillColor() const
Definition seriesstyle.cpp:42
NumberFormatMode pointLabelFormatMode
Definition seriesstyle.h:74
bool showAreaFill
Definition seriesstyle.h:78
QString pointLabelFormat
Definition seriesstyle.h:75
QColor color
Definition seriesstyle.h:50
Qt::PenStyle dash
Definition seriesstyle.h:57
qreal markerBorderWidth
Definition seriesstyle.h:67
QString legendName
Definition seriesstyle.h:52
QColor areaFillColor
Definition seriesstyle.h:79
QColor effectiveAreaFillColor() const
Definition seriesstyle.cpp:57
static SeriesStyle fromJson(const QJsonObject &obj)
Definition seriesstyle.cpp:205
QColor markerBorderColor
Definition seriesstyle.h:66
int pointLabelPrecision
Definition seriesstyle.h:73
qreal markerSize
Definition seriesstyle.h:64
Qt::PenJoinStyle joinStyle
Definition seriesstyle.h:59
bool showLine
Definition seriesstyle.h:55
QColor pointLabelColor
Definition seriesstyle.h:72
MarkerShape shape
Definition seriesstyle.h:63
bool showPointLabels
Definition seriesstyle.h:70
QColor effectivePointLabelColor() const
Definition seriesstyle.cpp:52
qreal opacity
Definition seriesstyle.h:51
QColor markerFillColor
Definition seriesstyle.h:65
qreal lineWidth
Definition seriesstyle.h:56
bool showMarkers
Definition seriesstyle.h:62
QJsonObject toJson() const
Definition seriesstyle.cpp:161
Qt::PenCapStyle capStyle
Definition seriesstyle.h:58