2018-12-19 00:13:18 +08:00
|
|
|
/*
|
2022-07-19 19:40:43 +08:00
|
|
|
Copyright (c) 2008-2022 Jan W. Krieger (<jan@jkrieger.de>)
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This software is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Lesser General Public License (LGPL) as published by
|
2019-02-08 00:24:46 +08:00
|
|
|
the Free Software Foundation, either version 2.1 of the License, or
|
2018-12-19 00:13:18 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Lesser General Public License (LGPL) for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License (LGPL)
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-04-25 04:07:39 +08:00
|
|
|
#ifndef jkqtpgraphspeakstream_H_INCLUDED
|
|
|
|
#define jkqtpgraphspeakstream_H_INCLUDED
|
|
|
|
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPair>
|
|
|
|
#include "jkqtplotter/jkqtpgraphsbase.h"
|
2019-04-22 19:27:50 +08:00
|
|
|
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
// forward declarations
|
2019-01-20 17:49:29 +08:00
|
|
|
class JKQTBasePlotter;
|
2019-01-20 23:15:10 +08:00
|
|
|
class JKQTPlotter;
|
2019-01-20 17:49:29 +08:00
|
|
|
class JKQTPCoordinateAxis;
|
|
|
|
class JKQTPDatastore;
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*! \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
|
|
|
|
\a baseline and upright lines from baseline to baseline+peakHeight at each position \f$ p_i \f$. This can be used to
|
|
|
|
display a stream of photons with given arrivaltimes \f$ p_i \f$.
|
2022-10-23 03:07:14 +08:00
|
|
|
\ingroup jkqtplotter_eventgraphs
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
\image html JKQTPPeakStreamGraphY.png "yPeaks=true"
|
|
|
|
\image html JKQTPPeakStreamGraphX.png "yPeaks=false"
|
2019-06-13 16:27:06 +08:00
|
|
|
|
|
|
|
\see \ref JKQTPlotterBasicJKQTPDatastoreStatistics
|
2018-12-19 00:13:18 +08:00
|
|
|
*/
|
2019-06-22 20:21:32 +08:00
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPSingleColumnGraph, public JKQTPGraphLineStyleMixin {
|
2018-12-19 00:13:18 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPPeakStreamGraph(JKQTBasePlotter* parent=nullptr);
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPPeakStreamGraph(JKQTPlotter* parent);
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
/** \brief get the maximum and minimum x-value of the graph
|
|
|
|
*
|
|
|
|
* The result is given in the two parameters which are call-by-reference parameters!
|
|
|
|
*/
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
2018-12-19 00:13:18 +08:00
|
|
|
/** \brief get the maximum and minimum y-value of the graph
|
|
|
|
*
|
|
|
|
* The result is given in the two parameters which are call-by-reference parameters!
|
|
|
|
*/
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
/** \brief plots the graph to the plotter object specified as parent */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
2018-12-19 00:13:18 +08:00
|
|
|
/** \brief plots a key marker inside the specified rectangle \a rect */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
2019-04-22 19:27:50 +08:00
|
|
|
/** \brief returns the color to be used for the key label */
|
|
|
|
virtual QColor getKeyLabelColor() const override;
|
|
|
|
/** \brief set symbol color and fill color at the same time */
|
|
|
|
void setColor(QColor col);
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc baseline */
|
2019-04-22 19:27:50 +08:00
|
|
|
void setBaseline(double __value);
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc baseline */
|
2019-04-22 19:27:50 +08:00
|
|
|
double getBaseline() const;
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc peakHeight */
|
2019-04-22 19:27:50 +08:00
|
|
|
void setPeakHeight(double __value);
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc peakHeight */
|
2019-04-22 19:27:50 +08:00
|
|
|
double getPeakHeight() const;
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc yPeaks */
|
2019-04-22 19:27:50 +08:00
|
|
|
void setYPeaks(bool __value);
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc yPeaks */
|
2019-04-22 19:27:50 +08:00
|
|
|
bool getYPeaks() const;
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc drawBaseline */
|
2019-04-22 19:27:50 +08:00
|
|
|
void setDrawBaseline(bool __value);
|
2020-09-21 19:47:54 +08:00
|
|
|
/** \copydoc drawBaseline */
|
2019-04-22 19:27:50 +08:00
|
|
|
bool getDrawBaseline() const;
|
2018-12-19 00:13:18 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/** \brief position of the baseline */
|
|
|
|
double baseline;
|
|
|
|
/** \brief height of each peak */
|
|
|
|
double peakHeight;
|
|
|
|
/** \brief if set \c true the peaks are in Y direction (default: true)*/
|
|
|
|
bool yPeaks;
|
|
|
|
/** \brief indicates whether to draw the basleine (default: \c true ) */
|
|
|
|
bool drawBaseline;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // jkqtpgraphspeakstream_H_INCLUDED
|