JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtppeakstream.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License (LGPL) as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License (LGPL) for more details.
15
16 You should have received a copy of the GNU Lesser General Public License (LGPL)
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef jkqtpgraphspeakstream_H_INCLUDED
21#define jkqtpgraphspeakstream_H_INCLUDED
22
23
24
25#include <QString>
26#include <QPainter>
27#include <QPair>
28#include "jkqtplotter/jkqtpgraphsbase.h"
29#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
30
31// forward declarations
32class JKQTBasePlotter;
33class JKQTPlotter;
35class JKQTPDatastore;
36
37
38/*! \brief interprets data as a stream of x- or y-positions \f$ p_i \f$ (depending in \a yPeaks ) ans plots a line on the height
39 \a baseline and upright lines from baseline to baseline+peakHeight at each position \f$ p_i \f$. This can be used to
40 display a stream of photons with given arrivaltimes \f$ p_i \f$.
41 \ingroup jkqtplotter_eventgraphs
42
43 \image html JKQTPPeakStreamGraphY.png "yPeaks=true"
44 \image html JKQTPPeakStreamGraphX.png "yPeaks=false"
45
46 \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics
47 */
49 Q_OBJECT
50 public:
51 /** \brief class constructor */
54
55 /** \copydoc JKQTPPlotElement::getXMinMax() */
56 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
57 /** \copydoc JKQTPPlotElement::getYMinMax() */
58 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
59
60
61 /** \brief plots the graph to the plotter object specified as parent */
62 virtual void draw(JKQTPEnhancedPainter& painter) override;
63 /** \brief plots a key marker inside the specified rectangle \a rect */
64 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
65 /** \brief returns the color to be used for the key label */
66 virtual QColor getKeyLabelColor() const override;
67 /** \brief set symbol color and fill color at the same time */
68 void setColor(QColor col);
69 /** \copydoc baseline */
70 void setBaseline(double __value);
71 /** \copydoc baseline */
72 double getBaseline() const;
73 /** \copydoc peakHeight */
74 void setPeakHeight(double __value);
75 /** \copydoc peakHeight */
76 double getPeakHeight() const;
77 /** \copydoc yPeaks */
78 void setYPeaks(bool __value);
79 /** \copydoc yPeaks */
80 bool getYPeaks() const;
81 /** \copydoc drawBaseline */
82 void setDrawBaseline(bool __value);
83 /** \copydoc drawBaseline */
84 bool getDrawBaseline() const;
85
86 protected:
87
88 /** \brief position of the baseline */
89 double baseline;
90 /** \brief height of each peak */
91 double peakHeight;
92 /** \brief if set \c true the peaks are in Y direction (default: true)*/
93 bool yPeaks;
94 /** \brief indicates whether to draw the basleine (default: \c true ) */
96
97};
98
99
100
101
102#endif // jkqtpgraphspeakstream_H_INCLUDED
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.
Definition jkqtpcoordinateaxes.h:181
This class manages data columns (with entries of type double ), used by JKQTPlotter/JKQTBasePlotter t...
Definition jkqtpdatastorage.h:282
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
This Mix-In class provides setter/getter methods, storage and other facilities for the graph line sty...
Definition jkqtpgraphsbasestylingmixins.h:49
interprets data as a stream of x- or y-positions (depending in yPeaks ) ans plots a line on the heig...
Definition jkqtppeakstream.h:48
double getBaseline() const
position of the baseline
double getPeakHeight() const
height of each peak
bool yPeaks
if set true the peaks are in Y direction (default: true)
Definition jkqtppeakstream.h:93
bool getYPeaks() const
if set true the peaks are in Y direction (default: true)
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
void setDrawBaseline(bool __value)
indicates whether to draw the basleine (default: true )
JKQTPPeakStreamGraph(JKQTPlotter *parent)
void setPeakHeight(double __value)
height of each peak
double peakHeight
height of each peak
Definition jkqtppeakstream.h:91
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect) override
plots a key marker inside the specified rectangle rect
void setColor(QColor col)
set symbol color and fill color at the same time
bool getDrawBaseline() const
indicates whether to draw the basleine (default: true )
virtual void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
JKQTPPeakStreamGraph(JKQTBasePlotter *parent=nullptr)
class constructor
virtual QColor getKeyLabelColor() const override
returns the color to be used for the key label
double baseline
position of the baseline
Definition jkqtppeakstream.h:89
void setBaseline(double __value)
position of the baseline
bool drawBaseline
indicates whether to draw the basleine (default: true )
Definition jkqtppeakstream.h:95
void setYPeaks(bool __value)
if set true the peaks are in Y direction (default: true)
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
This virtual JKQTPGraph descendent may be used as base for all graphs that use at least one column of...
Definition jkqtpgraphsbase.h:875
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89