2018-12-02 21:08:43 +08:00
/*
2022-07-19 19:40:43 +08:00
Copyright ( c ) 2008 - 2022 Jan W . Krieger ( < jan @ jkrieger . de > )
2018-12-02 21:08:43 +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-02 21:08:43 +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 jkqtpgraphsimpulses_H
# define jkqtpgraphsimpulses_H
2019-06-22 20:21:32 +08:00
# include "jkqtplotter/jkqtplotter_imexport.h"
2018-12-19 00:13:18 +08:00
# include "jkqtplotter/jkqtpgraphsbase.h"
2019-02-08 00:24:46 +08:00
# include "jkqtplotter/jkqtpgraphsbaseerrors.h"
2019-04-22 19:27:50 +08:00
# include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
2018-12-02 21:08:43 +08:00
2020-09-19 21:21:33 +08:00
/** \brief This is a base class for all impulse graphs
2022-10-23 03:07:14 +08:00
* \ ingroup jkqtplotter_sticks
2020-09-19 21:21:33 +08:00
*
2022-11-01 03:34:01 +08:00
* \ image html JKQTPImpulsesVerticalGraph . png " default style for impulse graphs "
*
* \ image html JKQTPImpulsesVerticalGraph_Symbols . png " setDrawSymbols(true); "
*
* \ image html JKQTPImpulsesVerticalGraphBaseline . png " setDrawBaseline(true); "
2022-09-26 08:08:01 +08:00
*
2020-09-19 21:21:33 +08:00
* \ see JKQTPImpulsesHorizontalGraph , JKQTPImpulsesVerticalGraph
2018-12-02 21:08:43 +08:00
*/
2020-09-19 21:21:33 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesGraphBase : public JKQTPXYBaselineGraph , public JKQTPGraphLineStyleMixin , public JKQTPGraphSymbolStyleMixin {
Q_OBJECT
public :
/** \brief class constructor */
JKQTPImpulsesGraphBase ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-02 21:08:43 +08:00
2019-04-22 19:27:50 +08:00
2020-09-19 21:21:33 +08:00
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor ( ) const override ;
2020-09-21 19:47:54 +08:00
/** \copydoc drawSymbols */
2020-09-19 21:21:33 +08:00
bool getDrawSymbols ( ) const ;
2022-11-01 03:34:01 +08:00
/** \copydoc m_drawBaseline */
bool getDrawBaseline ( ) const ;
/** \copydoc m_baselineStyle */
JKQTPGraphLineStyleMixin & baselineStyle ( ) ;
/** \copydoc m_baselineStyle */
const JKQTPGraphLineStyleMixin & baselineStyle ( ) const ;
2019-04-22 19:27:50 +08:00
2023-07-22 20:26:02 +08:00
public Q_SLOTS :
2020-09-21 19:47:54 +08:00
/** \brief color of symbols and impulses in one call */
2020-09-19 21:21:33 +08:00
virtual void setColor ( QColor c ) ;
2018-12-02 21:08:43 +08:00
2020-09-21 19:47:54 +08:00
/** \copydoc drawSymbols */
2020-09-19 21:21:33 +08:00
void setDrawSymbols ( bool __value ) ;
2022-11-01 03:34:01 +08:00
/** \copydoc m_drawBaseline */
void setDrawBaseline ( bool __value ) ;
2020-09-19 21:21:33 +08:00
protected :
2018-12-02 21:08:43 +08:00
2020-09-19 21:21:33 +08:00
/** \brief indicates whether to draw symbols at the top of the impulse
2022-11-01 03:34:01 +08:00
*
* \ image html JKQTPImpulsesVerticalGraph_Symbols . png " setDrawSymbols(true) "
*/
2020-09-19 21:21:33 +08:00
bool drawSymbols ;
2022-11-01 03:34:01 +08:00
/** \brief if m_drawBaseline \c ==true then this style is used to draw the baseline
*
* \ see baselineStyle ( ) , setDrawBaseline ( ) , m_drawBaseline
*/
JKQTPGraphLineStyleMixin m_baselineStyle ;
/** \brief indicates whether to draw a line with style m_baselineStyle at the baseline-value
*
* \ image html JKQTPImpulsesVerticalGraphBaseline . png " setDrawBaseline(true); "
* \ image html JKQTPImpulsesVerticalGraphNoBaseline . png " setDrawBaseline(false); "
*
* \ see baselineStyle ( ) , setDrawBaseline ( ) , m_baselineStyle
*/
bool m_drawBaseline ;
2022-09-26 08:08:01 +08:00
/** \brief get the maximum and minimum value in the impulse-elongation (i.e. value) direction of the graph
*
* The result is given in the two parameters which are call - by - reference parameters !
*/
bool getValuesMinMax ( double & mmin , double & mmax , double & smallestGreaterZero ) ;
/** \brief get the maximum and minimum value of the impulse positions of the graph
*
* The result is given in the two parameters which are call - by - reference parameters !
*/
bool getPositionsMinMax ( double & mmin , double & mmax , double & smallestGreaterZero ) ;
2018-12-02 21:08:43 +08:00
} ;
2022-09-26 08:08:01 +08:00
/** \brief This implements an impulse plot with horizontal impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
2022-10-23 03:07:14 +08:00
* \ ingroup jkqtplotter_sticks
2020-09-19 21:21:33 +08:00
*
2022-09-26 08:08:01 +08:00
* \ image html JKQTPImpulsesHorizontalGraph . png
2020-09-19 21:21:33 +08:00
*
* \ see JKQTPImpulsesVerticalGraph , \ ref JKQTPlotterImpulsePlots
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesHorizontalGraph : public JKQTPImpulsesGraphBase {
Q_OBJECT
public :
/** \brief class constructor */
JKQTPImpulsesHorizontalGraph ( JKQTBasePlotter * parent = nullptr ) ;
/** \brief class constructor */
JKQTPImpulsesHorizontalGraph ( JKQTPlotter * parent ) ;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
/** \brief plots a key marker inside the specified rectangle \a rect */
2023-12-19 05:24:59 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , const QRectF & rect ) override ;
2022-09-26 08:08:01 +08:00
/** \brief returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
virtual int getKeyColumn ( ) const override ;
/** \brief returns the column used as "value" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
virtual int getValueColumn ( ) const override ;
/** \copydoc JKQTPXYGraph::getXMinMax() */
virtual bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) override ;
/** \copydoc JKQTPXYGraph::getYMinMax() */
virtual bool getYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) override ;
2023-07-22 20:26:02 +08:00
public Q_SLOTS :
2022-09-26 08:08:01 +08:00
/** \brief sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
virtual void setKeyColumn ( int __value ) override ;
/** \brief sets the column used as "value" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
virtual void setValueColumn ( int __value ) override ;
2020-09-19 21:21:33 +08:00
protected :
} ;
2018-12-02 21:08:43 +08:00
2019-06-13 16:27:06 +08:00
2022-09-26 08:08:01 +08:00
/** \brief This implements an impulse plot with horizontal impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
2022-10-23 03:07:14 +08:00
* \ ingroup jkqtplotter_sticks
2020-09-19 21:21:33 +08:00
*
2022-09-26 08:08:01 +08:00
* \ image html JKQTPImpulsesHorizontalErrorGraph . png
2020-09-19 21:21:33 +08:00
*
* \ see jkqtpstatAddXErrorImpulsesGraph ( ) , JKQTPImpulsesHorizontalGraph , \ ref JKQTPlotterImpulsePlots
2018-12-02 21:08:43 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesHorizontalErrorGraph : public JKQTPImpulsesHorizontalGraph , public JKQTPXGraphErrors {
2018-12-02 21:08:43 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPImpulsesHorizontalErrorGraph ( JKQTBasePlotter * parent = nullptr ) ;
2019-01-20 23:15:10 +08:00
JKQTPImpulsesHorizontalErrorGraph ( JKQTPlotter * parent ) ;
2019-01-20 17:49:29 +08:00
/** \copydoc JKQTPGraph::usesColumn() */
2018-12-28 05:52:00 +08:00
virtual bool usesColumn ( int c ) const override ;
2018-12-02 21:08:43 +08:00
2022-09-26 08:08:01 +08:00
/** \copydoc JKQTPXYGraph::getXMinMax() */
virtual bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) override ;
/** \brief returns the column that contains the bar height errors */
int getErrorColumn ( ) const ;
/** \brief returns the column that contains the lower bar height errors */
int getErrorColumnLower ( ) const ;
/** \brief returns the error style of the bar */
JKQTPErrorPlotstyle getErrorStyle ( ) const ;
/** \brief returns whether the errors of the bars are symmetric */
bool getErrorSymmetric ( ) const ;
2023-07-22 20:26:02 +08:00
public Q_SLOTS :
2022-09-26 08:08:01 +08:00
/** \brief sets whether the errors of the bars are symmetric */
void setErrorSymmetric ( bool __value ) ;
/** \brief sets the error style of the bar */
void setErrorStyle ( JKQTPErrorPlotstyle __value ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumn ( int column ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumn ( size_t column ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower ( int column ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower ( size_t column ) ;
2018-12-02 21:08:43 +08:00
protected :
/** \brief this function is used to plot error inidcators before plotting the graphs. */
2018-12-28 05:52:00 +08:00
virtual void drawErrorsAfter ( JKQTPEnhancedPainter & painter ) override ;
2018-12-02 21:08:43 +08:00
} ;
/*! \brief This implements an impulse plot with impulses in direction of the Y axis (i.e. from y=0 to y=f(x) )
2022-10-23 03:07:14 +08:00
\ ingroup jkqtplotter_sticks
2018-12-02 21:08:43 +08:00
2022-09-26 08:08:01 +08:00
\ image html JKQTPImpulsesVerticalGraph . png
\ image html JKQTPImpulsesVerticalGraph_Symbols . png " generated by setting setDrawSymbols(true) "
2019-06-13 16:27:06 +08:00
2022-09-26 08:08:01 +08:00
\ see JKQTPImpulsesGraphBase , JKQTPImpulsesVerticalErrorGraph , \ ref JKQTPlotterImpulsePlots
2018-12-02 21:08:43 +08:00
*/
2020-09-19 21:21:33 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesVerticalGraph : public JKQTPImpulsesGraphBase {
2018-12-02 21:08:43 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPImpulsesVerticalGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-02 21:08:43 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPImpulsesVerticalGraph ( JKQTPlotter * parent ) ;
2018-12-02 21:08:43 +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 ;
2020-09-19 21:21:33 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2023-12-19 05:24:59 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , const QRectF & rect ) override ;
2022-09-26 08:08:01 +08:00
/** \copydoc JKQTPXYGraph::getXMinMax() */
virtual bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) override ;
/** \copydoc JKQTPXYGraph::getYMinMax() */
virtual bool getYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) override ;
2018-12-02 21:08:43 +08:00
} ;
/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
2022-10-23 03:07:14 +08:00
\ ingroup jkqtplotter_sticks
2018-12-02 21:08:43 +08:00
2022-09-26 08:08:01 +08:00
\ image html JKQTPImpulsesVerticalErrorGraph . png
2019-06-13 16:27:06 +08:00
\ see JKQTPImpulsesVerticalGraph , jkqtpstatAddYErrorImpulsesGraph ( ) , \ ref JKQTPlotterImpulsePlots
2018-12-02 21:08:43 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesVerticalErrorGraph : public JKQTPImpulsesVerticalGraph , public JKQTPYGraphErrors {
2018-12-02 21:08:43 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPImpulsesVerticalErrorGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-02 21:08:43 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPImpulsesVerticalErrorGraph ( JKQTPlotter * parent ) ;
2019-01-20 17:49:29 +08:00
/** \copydoc JKQTPGraph::usesColumn() */
2018-12-28 05:52:00 +08:00
virtual bool usesColumn ( int c ) const override ;
2022-09-26 08:08:01 +08:00
/** \copydoc JKQTPXYGraph::getYMinMax() */
virtual bool getYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) override ;
/** \brief returns the column that contains the bar height errors */
int getErrorColumn ( ) const ;
/** \brief returns the column that contains the lower bar height errors */
int getErrorColumnLower ( ) const ;
/** \brief returns the error style of the bar */
JKQTPErrorPlotstyle getErrorStyle ( ) const ;
/** \brief returns whether the errors of the bars are symmetric */
bool getErrorSymmetric ( ) const ;
2023-07-22 20:26:02 +08:00
public Q_SLOTS :
2022-09-26 08:08:01 +08:00
/** \brief sets whether the errors of the bars are symmetric */
void setErrorSymmetric ( bool __value ) ;
/** \brief sets the error style of the bar */
void setErrorStyle ( JKQTPErrorPlotstyle __value ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumn ( int column ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumn ( size_t column ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower ( int column ) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower ( size_t column ) ;
2018-12-02 21:08:43 +08:00
protected :
/** \brief this function is used to plot error inidcators before plotting the graphs. */
2018-12-28 05:52:00 +08:00
virtual void drawErrorsAfter ( JKQTPEnhancedPainter & painter ) override ;
2018-12-02 21:08:43 +08:00
} ;
2018-12-19 00:13:18 +08:00
# endif // jkqtpgraphsimpulses_H