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 jkqtpgraphsfilledcurve_H
# define jkqtpgraphsfilledcurve_H
2018-12-02 21:08:43 +08:00
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-06-20 22:06:31 +08:00
# include "jkqtplotter/graphs/jkqtpspecialline.h"
2018-12-02 21:08:43 +08:00
2020-09-20 01:17:35 +08:00
/** \brief a Base class for filled curve graphs like e.g. JKQTPFilledCurveXGraph
2022-10-23 03:07:14 +08:00
* \ ingroup jkqtplotter_filledgraphs
2020-09-20 01:17:35 +08:00
*
* \ image html filledgraphs . png
*
2022-08-29 04:48:14 +08:00
*
2020-09-20 01:17:35 +08:00
* \ see JKQTPFilledCurveXGraph , JKQTPFilledCurveYGraph
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPFilledCurveGraphBase : public JKQTPXYBaselineGraph , public JKQTPGraphLineAndFillStyleMixin {
Q_OBJECT
public :
2022-05-12 04:55:23 +08:00
/** \brief specifies how the area below the graph is filled
*
* \ see setFillMode ( ) , getFillMode ( ) , fillStyleBelow ( ) , \ ref JKQTPlotterWigglePlots
*/
enum FillMode {
SingleFilling = 0 , /*!< \brief the whole area is filled with the same color/pattern, generates "simple filled plots", such as \image html filledgraphs_small.png */
TwoColorFilling = 1 /*!< \brief the area above and below baseline with the two different colors/patterns, generates "wiggle plots", such as \image html wiggleplots_small.png */
} ;
Q_ENUM ( FillMode )
2020-09-20 01:17:35 +08:00
/** \brief class constructor */
explicit JKQTPFilledCurveGraphBase ( JKQTBasePlotter * parent = nullptr ) ;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor ( ) const override ;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
2022-05-12 04:55:23 +08:00
/** \copydoc m_fillStyleBelow */
JKQTPGraphFillStyleMixin & fillStyleBelow ( ) ;
/** \copydoc m_fillStyleBelow */
const JKQTPGraphFillStyleMixin & fillStyleBelow ( ) const ;
/** \copydoc m_fillMode */
FillMode getFillMode ( ) const ;
2022-09-11 06:06:47 +08:00
2023-07-22 20:26:02 +08:00
public Q_SLOTS :
2020-09-20 01:17:35 +08:00
/** \brief set line-color, fill color and symbol color */
void setColor ( QColor c ) ;
2022-05-12 04:55:23 +08:00
/** \copydoc m_fillMode */
2022-09-10 19:38:29 +08:00
void setFillMode ( JKQTPFilledCurveGraphBase : : FillMode mode ) ;
2020-09-20 01:17:35 +08:00
protected :
2022-05-12 04:55:23 +08:00
/** \brief specifies how the area of the graph is filles */
FillMode m_fillMode ;
/** \brief if m_fillMode \c ==FillAboveAndBelowDifferently then this fill style is used below the baseline and
* the default fill style is used above */
JKQTPGraphFillStyleMixin m_fillStyleBelow ;
2020-09-20 01:17:35 +08:00
} ;
2018-12-02 21:08:43 +08:00
/*! \brief This implements filled curve plots where the area is filled between the plot line and the x-Axis.
2019-02-03 21:04:48 +08:00
\ ingroup jkqtplotter_filledgraphs
2018-12-02 21:08:43 +08:00
2022-08-29 04:48:14 +08:00
\ image html JKQTPFilledCurveXGraph . png
2019-01-29 05:14:27 +08:00
\ see \ ref JKQTPlotterFilledGraphs
2022-05-12 04:55:23 +08:00
This class also provides the possibility to file above and below the baseline with different style .
Such plots are sometimes called " Wiggle Plots " and are often used ( in their black / white - variety for seismographic
data plotting .
2022-08-29 04:48:14 +08:00
* \ image html JKQTPFilledCurveXGraph_wiggle . png
2022-05-12 04:55:23 +08:00
To generate such a plot , used \ c JKQTPFilledCurveXGraph : : setFillMode ( JKQTPFilledCurveXGraph : : FillMode : : TwoColorFilling )
and then use \ c JKQTPFilledCurveXGraph : : fillStyleBelow ( ) to access the fill style for the area below the baseline
and the default fill style to define the fill style above the baseline .
\ see \ ref JKQTPlotterWigglePlots
2018-12-02 21:08:43 +08:00
*/
2020-09-20 01:17:35 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPFilledCurveXGraph : public JKQTPFilledCurveGraphBase {
2018-12-02 21:08:43 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPFilledCurveXGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-02 21:08:43 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPFilledCurveXGraph ( JKQTPlotter * parent ) ;
2020-09-20 01:17:35 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2022-09-10 19:38:29 +08:00
void draw ( JKQTPEnhancedPainter & painter ) override ;
2022-09-11 06:06:47 +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 !
*/
virtual bool getYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) override ;
2018-12-02 21:08:43 +08:00
} ;
/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis.
2019-02-03 21:04:48 +08:00
\ ingroup jkqtplotter_filledgraphs
2018-12-02 21:08:43 +08:00
2022-09-11 06:06:47 +08:00
\ image html JKQTPFilledCurveXErrorGraph . png
2019-01-29 05:14:27 +08:00
2019-06-13 16:27:06 +08:00
\ see \ ref JKQTPlotterFilledGraphs , jkqtpstatAddXErrorFilledCurveGraph ( )
2018-12-02 21:08:43 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPFilledCurveXErrorGraph : public JKQTPFilledCurveXGraph , public JKQTPYGraphErrors {
2018-12-02 21:08:43 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPFilledCurveXErrorGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-02 21:08:43 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPFilledCurveXErrorGraph ( 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-11 06:06:47 +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 !
*/
virtual bool getYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) override ;
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorSymmetric */
2022-09-11 06:06:47 +08:00
inline void setValueErrorSymmetric ( bool __value ) {
setYErrorSymmetric ( __value ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorSymmetric */
2022-09-11 06:06:47 +08:00
inline bool getValueErrorSymmetric ( ) const {
return getYErrorSymmetric ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorColumnLower */
2022-09-11 06:06:47 +08:00
inline int getValueErrorColumnLower ( ) const {
return getYErrorColumnLower ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorColumn */
2022-09-11 06:06:47 +08:00
inline int getValueErrorColumn ( ) const {
return getYErrorColumn ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorStyle */
2022-09-11 06:06:47 +08:00
inline void setValueErrorStyle ( JKQTPErrorPlotstyle __value ) {
setYErrorStyle ( __value ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorStyle */
2022-09-11 06:06:47 +08:00
inline JKQTPErrorPlotstyle getValueErrorStyle ( ) const {
return getYErrorStyle ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorColumn */
2022-09-11 06:06:47 +08:00
inline void setValueErrorColumn ( int __value ) {
setYErrorColumn ( __value ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPYGraphErrorData::yErrorColumnLower */
2022-09-11 06:06:47 +08:00
inline void setValueErrorColumnLower ( int __value ) {
setYErrorColumnLower ( __value ) ;
}
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 filled curve plots where the area is filled between the plot line and y-Axis
2019-02-03 21:04:48 +08:00
\ ingroup jkqtplotter_filledgraphs
2018-12-02 21:08:43 +08:00
2022-08-29 04:48:14 +08:00
\ image html JKQTPFilledCurveYGraph . png
2019-01-29 05:14:27 +08:00
\ see \ ref JKQTPlotterFilledGraphs
2022-05-12 04:55:23 +08:00
This class also provides the possibility to file above and below the baseline with different style .
Such plots are sometimes called " Wiggle Plots " and are often used ( in their black / white - variety for seismographic
data plotting .
2022-08-29 04:48:14 +08:00
* \ image html JKQTPFilledCurveYGraph_wiggle . png
2022-05-12 04:55:23 +08:00
To generate such a plot , used \ c JKQTPFilledCurveXGraph : : setFillMode ( JKQTPFilledCurveXGraph : : FillMode : : TwoColorFilling )
and then use \ c JKQTPFilledCurveXGraph : : fillStyleBelow ( ) to access the fill style for the area below the baseline
and the default fill style to define the fill style above the baseline .
\ see \ ref JKQTPlotterWigglePlots
2018-12-02 21:08:43 +08:00
*/
2020-09-20 01:17:35 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPFilledCurveYGraph : public JKQTPFilledCurveGraphBase {
2018-12-02 21:08:43 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPFilledCurveYGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-02 21:08:43 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPFilledCurveYGraph ( JKQTPlotter * parent ) ;
2018-12-02 21:08:43 +08:00
2022-09-11 06:06:47 +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 !
*/
virtual bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) override ;
2020-09-20 01:17:35 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2022-09-10 19:38:29 +08:00
void draw ( JKQTPEnhancedPainter & painter ) override ;
/** \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 ;
2023-07-22 20:26:02 +08:00
public Q_SLOTS :
2022-09-10 19:38:29 +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 ;
2019-04-22 19:27:50 +08:00
2018-12-02 21:08:43 +08:00
} ;
/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis.
2019-02-03 21:04:48 +08:00
\ ingroup jkqtplotter_filledgraphs
2018-12-02 21:08:43 +08:00
2022-09-11 06:06:47 +08:00
\ image html JKQTPFilledCurveYErrorGraph . png
2019-01-29 05:14:27 +08:00
2019-06-13 16:27:06 +08:00
\ see \ ref JKQTPlotterFilledGraphs , jkqtpstatAddYErrorFilledCurveGraph ( )
2018-12-02 21:08:43 +08:00
*/
2019-06-22 20:21:32 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPFilledCurveYErrorGraph : public JKQTPFilledCurveYGraph , public JKQTPXGraphErrors {
2018-12-02 21:08:43 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPFilledCurveYErrorGraph ( JKQTBasePlotter * parent = nullptr ) ;
2019-01-20 23:15:10 +08:00
JKQTPFilledCurveYErrorGraph ( 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-11 06:06:47 +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 !
*/
virtual bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) override ;
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorSymmetric */
2022-09-11 06:06:47 +08:00
inline void setValueErrorSymmetric ( bool __value ) {
setXErrorSymmetric ( __value ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorSymmetric */
2022-09-11 06:06:47 +08:00
inline bool getValueErrorSymmetric ( ) const {
return getXErrorSymmetric ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorColumnLower */
2022-09-11 06:06:47 +08:00
inline int getValueErrorColumnLower ( ) const {
return getXErrorColumnLower ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorColumn */
2022-09-11 06:06:47 +08:00
inline int getValueErrorColumn ( ) const {
return getXErrorColumn ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorStyle */
2022-09-11 06:06:47 +08:00
inline void setValueErrorStyle ( JKQTPErrorPlotstyle __value ) {
setXErrorStyle ( __value ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorStyle */
2022-09-11 06:06:47 +08:00
inline JKQTPErrorPlotstyle getValueErrorStyle ( ) const {
return getXErrorStyle ( ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorColumn */
2022-09-11 06:06:47 +08:00
inline void setValueErrorColumn ( int __value ) {
setXErrorColumn ( __value ) ;
}
2022-09-20 03:53:53 +08:00
/** \copydoc JKQTPXGraphErrorData::xErrorColumnLower */
2022-09-11 06:06:47 +08:00
inline void setValueErrorColumnLower ( int __value ) {
setXErrorColumnLower ( __value ) ;
}
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
} ;
2020-09-18 18:24:12 +08:00
/** \brief This implements filled curve plots where the area is filled between two data columns for each x-value
* \ ingroup jkqtplotter_filledgraphs
*
* With \ c setDrawlines ( false ) :
*
* \ image html JKQTPfilledVerticalRangeGraph . png
*
* With \ c setDrawlines ( true ) :
*
* \ image html JKQTPfilledVerticalRangeGraph_WithLines . png
*
2020-09-19 20:41:53 +08:00
* \ see JKQTPFilledHorizontalRangeGraph , \ ref JKQTPlotterDateTimeAxes
2018-12-02 21:08:43 +08:00
*/
2020-09-19 20:41:53 +08:00
class JKQTPLOTTER_LIB_EXPORT JKQTPFilledVerticalRangeGraph : public JKQTPXYYGraph , public JKQTPGraphLineAndFillStyleMixin {
2020-09-18 18:24:12 +08:00
Q_OBJECT
public :
/** \brief class constructor */
JKQTPFilledVerticalRangeGraph ( JKQTBasePlotter * parent = nullptr ) ;
/** \brief class constructor */
JKQTPFilledVerticalRangeGraph ( JKQTPlotter * parent ) ;
2018-12-02 21:08:43 +08:00
2020-09-18 18:24:12 +08:00
/** \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 */
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor ( ) const override ;
2018-12-02 21:08:43 +08:00
2019-04-22 19:27:50 +08:00
2020-09-19 20:41:53 +08:00
protected :
} ;
2019-04-22 19:27:50 +08:00
2018-12-02 21:08:43 +08:00
2019-04-22 19:27:50 +08:00
2020-09-19 20:41:53 +08:00
/** \brief This implements filled curve plots where the area is filled between two data columns for each y-value
* \ ingroup jkqtplotter_filledgraphs
*
* With \ c setDrawlines ( false ) :
*
* \ image html JKQTPFilledHorizontalRangeGraph . png
*
* With \ c setDrawlines ( true ) :
*
* \ image html JKQTPFilledHorizontalRangeGraph_WithLines . png
*
* \ see JKQTPFilledVerticalRangeGraph , \ ref JKQTPlotterDateTimeAxes
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPFilledHorizontalRangeGraph : public JKQTPXXYGraph , public JKQTPGraphLineAndFillStyleMixin {
Q_OBJECT
public :
/** \brief class constructor */
JKQTPFilledHorizontalRangeGraph ( JKQTBasePlotter * parent = nullptr ) ;
/** \brief class constructor */
JKQTPFilledHorizontalRangeGraph ( 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 */
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor ( ) const override ;
protected :
2018-12-02 21:08:43 +08:00
} ;
2018-12-19 00:13:18 +08:00
# endif // jkqtpgraphsfilledcurve_H