2018-11-25 21:53:26 +08:00
/*
2019-01-12 23:01:55 +08:00
Copyright ( c ) 2008 - 2019 Jan W . Krieger ( < jan @ jkrieger . de > )
2018-11-25 21:53:26 +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
the Free Software Foundation , either version 2 of the License , or
( 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/>.
*/
2019-01-12 23:01:55 +08:00
/** \file jkqtpgraphsbase.h
2019-01-13 01:53:16 +08:00
* \ ingroup jkqtplotter_basegraphs
2018-11-25 21:53:26 +08:00
*/
# include <QString>
# include <QPainter>
# include <QPair>
2018-12-28 05:52:00 +08:00
# include "jkqtplotter/jkqtpbaseelements.h"
# include "jkqtplotter/jkqtpbaseplotter.h"
2018-11-26 03:25:44 +08:00
# include "jkqtplottertools/jkqtptools.h"
# include "jkqtplottertools/jkqtp_imexport.h"
2018-12-19 00:13:18 +08:00
# include "jkqtplottertools/jkqtpimagetools.h"
2018-11-25 21:53:26 +08:00
2018-12-19 00:13:18 +08:00
# ifndef jkqtpgraphsbase_H
# define jkqtpgraphsbase_H
2018-11-25 21:53:26 +08:00
// forward declarations
2019-01-20 23:15:10 +08:00
class JKQTPlotter ;
2019-01-20 17:49:29 +08:00
class JKQTPDatastore ;
2018-11-25 21:53:26 +08:00
2019-01-20 23:15:10 +08:00
/** \brief this virtual base class of every element, which is part of a JKQTPlotter plot and may appear in its key
2018-12-28 05:52:00 +08:00
* ( basically any type of graph , except overlay elements ! )
2019-01-13 01:53:16 +08:00
* \ ingroup jkqtplotter_basegraphs
2018-11-25 21:53:26 +08:00
*
2018-12-28 05:52:00 +08:00
* Each possible graph is represented by a child of this class . So additional plots may be created by
2019-01-20 17:49:29 +08:00
* deriving new JKQTPGraph classes . To do so implement / overwrite these functions :
2018-11-25 21:53:26 +08:00
* - void draw ( JKQTPEnhancedPainter & painter ) ;
* - void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) ;
* - bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) ;
* - void getGraphsYMinMax ( double & miny , double & maxy ) ;
* - QColor getKeyLabelColor ( ) = 0 ;
2018-12-28 05:52:00 +08:00
* - bool usesColumn ( int column ) const ;
* .
*
* Optionally you may also overwrite these functions to draw elements outside the actual plot area ( like e . g . colorbars ) :
* - void getOutsideSize ( JKQTPEnhancedPainter & painter , int & leftSpace , int & rightSpace , int & topSpace , int & bottomSpace ) ;
* - void drawOutside ( JKQTPEnhancedPainter & painter , QRect leftSpace , QRect rightSpace , QRect topSpace , QRect bottomSpace ) ;
2018-11-25 21:53:26 +08:00
* .
*
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPPlotElement : public QObject {
2018-11-25 21:53:26 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
explicit JKQTPPlotElement ( JKQTBasePlotter * parent = nullptr ) ;
2018-11-25 21:53:26 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
explicit JKQTPPlotElement ( JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/** \brief default wirtual destructor */
2019-01-20 17:49:29 +08:00
virtual ~ JKQTPPlotElement ( ) ;
2018-11-25 21:53:26 +08:00
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw ( JKQTPEnhancedPainter & painter ) = 0 ;
2018-12-28 05:52:00 +08:00
2018-11-25 21:53:26 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) = 0 ;
2018-12-28 05:52:00 +08:00
2018-11-25 21:53:26 +08:00
/** \brief returns an image with a key marker inside */
QImage generateKeyMarker ( QSize size = QSize ( 16 , 16 ) ) ;
/** \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 ) = 0 ;
/** \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 ) = 0 ;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor ( ) = 0 ;
2019-01-26 20:00:40 +08:00
/*! \brief sets the property title ( \copybrief title ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter title is : < BLOCKQUOTE > \ copydoc title < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see title for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setTitle ( const QString & __value )
2019-01-10 04:23:24 +08:00
{
this - > title = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property title ( \copybrief title ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter title is : < BLOCKQUOTE > \ copydoc title < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see title for more information */
2019-01-26 20:00:40 +08:00
inline virtual QString getTitle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > title ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property visible ( \copybrief visible ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter visible is : < BLOCKQUOTE > \ copydoc visible < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see visible for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setVisible ( bool __value )
2019-01-10 04:23:24 +08:00
{
this - > visible = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property visible ( \copybrief visible ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter visible is : < BLOCKQUOTE > \ copydoc visible < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see visible for more information */
2019-01-26 20:00:40 +08:00
inline virtual bool getVisible ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > visible ;
}
2018-11-25 21:53:26 +08:00
/** \brief returns the parent painter class */
2019-01-20 17:49:29 +08:00
inline JKQTBasePlotter * getParent ( ) { return parent ; }
2018-11-25 21:53:26 +08:00
/** \brief sets the parent painter class */
2019-01-20 17:49:29 +08:00
virtual void setParent ( JKQTBasePlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/** \brief sets the parent painter class */
2019-01-20 23:15:10 +08:00
virtual void setParent ( JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
\ note If you want to draw outside , then you ' ll also have to implement drawOutside ( )
*/
virtual void getOutsideSize ( JKQTPEnhancedPainter & painter , int & leftSpace , int & rightSpace , int & topSpace , int & bottomSpace ) ;
/*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
\ note If you want to draw outside , then you ' ll also have to implement getOutsideSize ( ) , so enough space is reserved
The four value supplied tell the method where to draw ( inside one of the rectangles ) .
*/
virtual void drawOutside ( JKQTPEnhancedPainter & painter , QRect leftSpace , QRect rightSpace , QRect topSpace , QRect bottomSpace ) ;
protected :
/** \brief the plotter object this object belongs to */
2019-01-20 17:49:29 +08:00
JKQTBasePlotter * parent ;
2018-12-28 05:52:00 +08:00
/** \brief title of the plot (for display in key!). If no title is supplied, no key entry is drawn. */
QString title ;
/** \brief indicates whether the graph is visible in the plot */
bool visible ;
2018-11-25 21:53:26 +08:00
2018-12-28 05:52:00 +08:00
/** \brief tool routine that transforms an x-coordinate for this plot element */
virtual double transformX ( double x ) const ;
/** \brief tool routine that transforms a y-coordinate for this plot element */
virtual double transformY ( double y ) const ;
/** \brief tool routine that backtransforms an x-coordinate for this plot element */
virtual double backtransformX ( double x ) const ;
/** \brief tool routine that backtransforms a y-coordinate for this plot element */
virtual double backtransformY ( double y ) const ;
2018-11-25 21:53:26 +08:00
/** \brief tool routine that transforms a QPointF according to the parent's transformation rules */
2018-12-28 05:52:00 +08:00
inline QPointF transform ( const QPointF & x ) {
return QPointF ( transformX ( x . x ( ) ) , transformY ( x . y ( ) ) ) ;
}
2018-11-25 21:53:26 +08:00
/** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */
2018-12-28 05:52:00 +08:00
inline QPointF backTransform ( const QPointF & x ) {
return QPointF ( backtransformX ( x . x ( ) ) , backtransformY ( x . y ( ) ) ) ;
}
2018-11-25 21:53:26 +08:00
/** \brief tool routine that transforms a QPointF according to the parent's transformation rules */
inline QPointF transform ( double x , double y ) {
return transform ( QPointF ( x , y ) ) ;
}
/** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */
inline QPointF backTransform ( double x , double y ) {
return backTransform ( QPointF ( x , y ) ) ;
}
/** \brief tool routine that transforms a QVector<QPointF> according to the parent's transformation rules */
QVector < QPointF > transform ( const QVector < QPointF > & x ) ;
/** \brief tool routine that transforms a QVector<QPointF> according to the parent's transformation rules
* and returns a ( non - closed ) path consisting of lines */
QPainterPath transformToLinePath ( const QVector < QPointF > & x ) ;
/** \brief tool routine that transforms a QVector<QPointF> according to the parent's transformation rules
* and returns a polygon */
inline QPolygonF transformToPolygon ( const QVector < QPointF > & x ) {
return QPolygonF ( transform ( x ) ) ;
}
2018-12-28 05:52:00 +08:00
} ;
/** \brief this virtual base class of the (data-column based) graphs,
2019-01-20 23:15:10 +08:00
* which are part of a JKQTPlotter plot and which use the coordinate system
2019-01-26 03:16:04 +08:00
* of the JKQTPlotter ( i . e . the two coordinate axes getXAxis ( ) and getYAxis ( ) )
2018-12-28 05:52:00 +08:00
* as basis for the graphs
2019-01-13 01:53:16 +08:00
* \ ingroup jkqtplotter_basegraphs
2018-12-28 05:52:00 +08:00
*
* This class adds several features to work with data columns . In addition this class adds protected
* functions that do coordinate transforms based on the current coordinate system , of the paren
2019-01-20 23:15:10 +08:00
* JKQTPlotter ( i . e . using the axes JKQTPLott : xAxis and JKQTPlotter : : yAxis as basis for the plotting ) .
2018-12-28 05:52:00 +08:00
*
* There are two properties datarange_start and datarange_end . By default they are - 1 and therefore ignored .
* if they are ! = - 1 the plotter only displays the datapoints with the indexes [ datarange_start . . datarange_end ]
* although there might be more data points available ( range [ 0 . . maxDataPoints ] ) . The datarange is cut at the
* full range , i . e . if datarange_end > maxDataPoints the plotter displays [ datarange_start . . maxDataPoints ] .
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPGraph : public JKQTPPlotElement {
2018-12-28 05:52:00 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
explicit JKQTPGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-28 05:52:00 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
explicit JKQTPGraph ( JKQTPlotter * parent ) ;
2018-12-28 05:52:00 +08:00
/** \brief default wirtual destructor */
2019-01-20 17:49:29 +08:00
virtual ~ JKQTPGraph ( ) ;
2018-12-28 05:52:00 +08:00
2019-01-26 20:00:40 +08:00
/*! \brief sets the property datarange_start ( \copybrief datarange_start ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter datarange_start is : < BLOCKQUOTE > \ copydoc datarange_start < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see datarange_start for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setDatarangeStart ( int __value )
2019-01-10 04:23:24 +08:00
{
this - > datarange_start = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property datarange_start ( \copybrief datarange_start ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter datarange_start is : < BLOCKQUOTE > \ copydoc datarange_start < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see datarange_start for more information */
2019-01-26 20:00:40 +08:00
inline virtual int getDatarangeStart ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > datarange_start ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property datarange_end ( \copybrief datarange_end ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter datarange_end is : < BLOCKQUOTE > \ copydoc datarange_end < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see datarange_end for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setDatarange_end ( int __value )
2019-01-10 04:23:24 +08:00
{
this - > datarange_end = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property datarange_end ( \copybrief datarange_end ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter datarange_end is : < BLOCKQUOTE > \ copydoc datarange_end < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see datarange_end for more information */
2019-01-26 20:00:40 +08:00
inline virtual int getDatarange_end ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > datarange_end ;
}
2018-12-28 05:52:00 +08:00
/** \brief returns \c true if the given column is used by the graph */
virtual bool usesColumn ( int column ) const ;
protected :
/** \brief this function is used to plot error inidcators before plotting the graphs.
*
* By default this function does nothing . But children of this class may overwrite it to implement
* drawing error indicators .
*/
virtual void drawErrorsBefore ( JKQTPEnhancedPainter & /*painter*/ ) ;
/** \brief this function is used to plot error inidcators after plotting the graphs.
*
* By default this function does nothing . But children of this class may overwrite it to implement
* drawing error indicators .
*/
virtual void drawErrorsAfter ( JKQTPEnhancedPainter & /*painter*/ ) ;
2018-11-25 21:53:26 +08:00
/** \brief start of the range of plot data. -1 switches the lower data range border off. */
2018-12-16 21:59:39 +08:00
int datarange_start ;
2018-11-25 21:53:26 +08:00
/** \brief end of the range of plot data. -1 switches the upper data range border off. */
2018-12-16 21:59:39 +08:00
int datarange_end ;
2018-11-25 21:53:26 +08:00
/** \brief get the maximum and minimum value of the given column
*
* The result is given in the two parameters which are call - by - reference parameters !
*/
bool getDataMinMax ( int column , double & minx , double & maxx , double & smallestGreaterZero ) ;
2019-01-20 17:49:29 +08:00
friend class JKQTPGraphErrors ;
2018-11-25 21:53:26 +08:00
} ;
2019-01-20 23:15:10 +08:00
/** \brief this is the virtual base class of all JKQTPPlotElement's in a JKQTPlotter plot that
2018-12-28 05:52:00 +08:00
* represent geometric forms or annotations . They have extended coordinate transform capabilities , because
* in addition to using the plot coordinates , you can also choose to use different other
* coordinate systems
2019-01-13 01:53:16 +08:00
* \ ingroup jkqtplotter_basegraphs
2018-12-28 05:52:00 +08:00
*
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPPlotObject : public JKQTPPlotElement {
2018-12-28 05:52:00 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
explicit JKQTPPlotObject ( JKQTBasePlotter * parent = nullptr ) ;
2018-12-28 05:52:00 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
explicit JKQTPPlotObject ( JKQTPlotter * parent ) ;
2018-12-28 05:52:00 +08:00
/** \brief default wirtual destructor */
2019-01-20 17:49:29 +08:00
virtual ~ JKQTPPlotObject ( ) ;
2018-12-28 05:52:00 +08:00
protected :
} ;
2019-01-20 17:49:29 +08:00
/*! \brief This virtual JKQTPGraph descendent may be used as base for all graphs that use at least two columns
2018-11-25 21:53:26 +08:00
that specify x and y coordinates for the single plot points .
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_basegraphs
2018-11-25 21:53:26 +08:00
This class implements basic management facilities for the data columns and implements the function
- bool getXMinMax ( double & minx , double & maxx , double & smallestGreaterZero ) ;
- bool getYMinMax ( double & miny , double & maxy , double & smallestGreaterZero ) ;
.
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPXYGraph : public JKQTPGraph {
2018-11-25 21:53:26 +08:00
Q_OBJECT
public :
enum DataSortOrder {
Unsorted = 0 ,
SortedX = 1 ,
SortedY = 2
} ;
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPXYGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-11-25 21:53:26 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPXYGraph ( JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +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-11-25 21:53:26 +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-11-25 21:53:26 +08:00
2019-01-20 17:49:29 +08:00
/** \copydoc JKQTPGraph::usesColumn() */
2018-12-28 05:52:00 +08:00
virtual bool usesColumn ( int column ) const override ;
2018-11-25 21:53:26 +08:00
2019-01-26 20:00:40 +08:00
/*! \brief sets the property xColumn ( \copybrief xColumn ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xColumn is : < BLOCKQUOTE > \ copydoc xColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setXColumn ( int __value )
2019-01-10 04:23:24 +08:00
{
this - > xColumn = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property xColumn ( \copybrief xColumn ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xColumn is : < BLOCKQUOTE > \ copydoc xColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual int getXColumn ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xColumn ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property xColumn ( \copybrief xColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xColumn is : < BLOCKQUOTE > \ copydoc xColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setXColumn ( size_t __value ) { this - > xColumn = static_cast < int > ( __value ) ; }
/*! \brief sets the property yColumn ( \copybrief yColumn ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yColumn is : < BLOCKQUOTE > \ copydoc yColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setYColumn ( int __value )
2019-01-10 04:23:24 +08:00
{
this - > yColumn = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property yColumn ( \copybrief yColumn ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yColumn is : < BLOCKQUOTE > \ copydoc yColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual int getYColumn ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yColumn ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property yColumn ( \copybrief yColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yColumn is : < BLOCKQUOTE > \ copydoc yColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setYColumn ( size_t __value ) { this - > yColumn = static_cast < int > ( __value ) ; }
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter sortData is : < BLOCKQUOTE > \ copydoc sortData < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see sortData for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setSortData ( const DataSortOrder & __value )
2019-01-10 04:23:24 +08:00
{
this - > sortData = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property sortData ( \copybrief sortData ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter sortData is : < BLOCKQUOTE > \ copydoc sortData < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see sortData for more information */
2019-01-26 20:00:40 +08:00
inline virtual DataSortOrder getSortData ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > sortData ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value. \details Description of the parameter sortData is: <BLOCKQUOTE>\copydoc sortData </BLOCKQUOTE> \see sortData for more information */
void setSortData ( int __value ) ;
2018-11-25 21:53:26 +08:00
protected :
/** \brief the column that contains the x-component of the datapoints */
int xColumn ;
/** \brief the column that contains the y-component of the datapoints */
int yColumn ;
/** \brief if \c !=Unsorted, the data is sorted before plotting */
DataSortOrder sortData ;
/** \brief this array contains the order of indices, in which to access the data in the data columns */
QVector < int > sortedIndices ;
virtual void intSortData ( ) ;
2018-12-28 05:52:00 +08:00
/** \brief returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
*
* This function can beu used to get the correct datapoint after sorting the datapoints ,
* As sorting is done by sorting an index and not reordering the data in the columns themselves .
* */
2018-11-25 21:53:26 +08:00
inline int getDataIndex ( int i ) {
if ( sortData = = Unsorted ) return i ;
return sortedIndices . value ( i , i ) ;
}
} ;
2019-01-20 17:49:29 +08:00
/*! \brief This virtual JKQTPGraph descendent may be used as base for all graphs that use at least one column
2018-11-25 21:53:26 +08:00
of data
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_basegraphs
2018-11-25 21:53:26 +08:00
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPSingleColumnGraph : public JKQTPGraph {
2018-11-25 21:53:26 +08:00
Q_OBJECT
public :
enum DataSortOrder {
Unsorted = 0 ,
Sorted = 1
} ;
2019-01-20 23:15:10 +08:00
enum class DataDirection {
X ,
Y
} ;
2018-11-25 21:53:26 +08:00
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPSingleColumnGraph ( JKQTBasePlotter * parent = nullptr ) ;
JKQTPSingleColumnGraph ( int dataColumn , JKQTBasePlotter * parent = nullptr ) ;
JKQTPSingleColumnGraph ( int dataColumn , QColor color , Qt : : PenStyle style = Qt : : SolidLine , double lineWidth = 2.0 , JKQTBasePlotter * parent = nullptr ) ;
2019-01-20 23:15:10 +08:00
JKQTPSingleColumnGraph ( JKQTPlotter * parent ) ;
JKQTPSingleColumnGraph ( int dataColumn , JKQTPlotter * parent ) ;
JKQTPSingleColumnGraph ( int dataColumn , QColor color , Qt : : PenStyle style , double lineWidth , JKQTPlotter * parent ) ;
JKQTPSingleColumnGraph ( int dataColumn , QColor color , Qt : : PenStyle style , JKQTPlotter * parent ) ;
JKQTPSingleColumnGraph ( int dataColumn , QColor color , JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor ( ) ;
2019-01-26 20:00:40 +08:00
/*! \brief sets the property dataColumn ( \copybrief dataColumn ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter dataColumn is : < BLOCKQUOTE > \ copydoc dataColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see dataColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setDataColumn ( int __value )
2019-01-10 04:23:24 +08:00
{
this - > dataColumn = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property dataColumn ( \copybrief dataColumn ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter dataColumn is : < BLOCKQUOTE > \ copydoc dataColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see dataColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual int getDataColumn ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > dataColumn ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property dataColumn ( \copybrief dataColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter dataColumn is : < BLOCKQUOTE > \ copydoc dataColumn < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see dataColumn for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setDataColumn ( size_t __value ) { this - > dataColumn = static_cast < int > ( __value ) ; }
/*! \brief sets the property color ( \copybrief color ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter color is : < BLOCKQUOTE > \ copydoc color < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see color for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
this - > color = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property color ( \copybrief color ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter color is : < BLOCKQUOTE > \ copydoc color < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see color for more information */
2019-01-26 20:00:40 +08:00
inline virtual QColor getColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > color ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property style ( \copybrief style ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter style is : < BLOCKQUOTE > \ copydoc style < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see style for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setStyle ( const Qt : : PenStyle & __value )
2019-01-10 04:23:24 +08:00
{
this - > style = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property style ( \copybrief style ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter style is : < BLOCKQUOTE > \ copydoc style < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see style for more information */
2019-01-26 20:00:40 +08:00
inline virtual Qt : : PenStyle getStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > style ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property lineWidth ( \copybrief lineWidth ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter lineWidth is : < BLOCKQUOTE > \ copydoc lineWidth < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see lineWidth for more information */
2019-01-26 03:16:04 +08:00
inline virtual void setLineWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
this - > lineWidth = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property lineWidth ( \copybrief lineWidth ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter lineWidth is : < BLOCKQUOTE > \ copydoc lineWidth < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see lineWidth for more information */
2019-01-26 03:16:04 +08:00
inline virtual double getLineWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > lineWidth ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter sortData is : < BLOCKQUOTE > \ copydoc sortData < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see sortData for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setSortData ( const DataSortOrder & __value )
2019-01-10 04:23:24 +08:00
{
this - > sortData = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property sortData ( \copybrief sortData ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter sortData is : < BLOCKQUOTE > \ copydoc sortData < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see sortData for more information */
2019-01-26 20:00:40 +08:00
inline virtual DataSortOrder getSortData ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > sortData ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value. \details Description of the parameter sortData is: <BLOCKQUOTE>\copydoc sortData </BLOCKQUOTE> \see sortData for more information */
void setSortData ( int __value ) ;
2018-11-25 21:53:26 +08:00
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-11-25 21:53:26 +08:00
protected :
/** \brief the column that contains the datapoints */
int dataColumn ;
2019-01-26 03:16:04 +08:00
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
2018-11-25 21:53:26 +08:00
int parentPlotStyle ;
/** \brief color of the graph */
QColor color ;
/** \brief linestyle of the graph lines */
Qt : : PenStyle style ;
2019-01-20 23:15:10 +08:00
/** \brief width (pt) of the graph, given in pt */
2018-11-25 21:53:26 +08:00
double lineWidth ;
QPen getLinePen ( JKQTPEnhancedPainter & painter ) const ;
/** \brief if \c !=Unsorted, the data is sorted before plotting */
DataSortOrder sortData ;
/** \brief this array contains the order of indices, in which to access the data in the data columns */
QVector < int > sortedIndices ;
virtual void intSortData ( ) ;
2018-12-28 05:52:00 +08:00
/** \brief returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
*
* This function can beu used to get the correct datapoint after sorting the datapoints ,
* As sorting is done by sorting an index and not reordering the data in the columns themselves .
* */
2018-11-25 21:53:26 +08:00
inline int getDataIndex ( int i ) {
if ( sortData = = Unsorted ) return i ;
return sortedIndices . value ( i , i ) ;
}
2018-12-28 05:52:00 +08:00
2018-11-25 21:53:26 +08:00
} ;
/*! \brief Descendents of this class add data fields for error indicators and methods to plot them to a class.
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_basegraphserrors
2018-11-25 21:53:26 +08:00
This class is meant to be used with multiple inheritance . I . e . if you implemented some kind of plot
2019-01-20 17:49:29 +08:00
you may derive an error plot class in which you will have to overwrite the JKQTPGraph : : drawErrorsBefor ( )
2018-11-25 21:53:26 +08:00
or drawErrorsAfter ( ) so it calls the plotErrorIndicators ( ) method from this class . In addition this class
will add some public datamemebers and methods to your class that allow to specify the properties of the
error indicators ( plot properties : color , width , . . . and columns for the data ) .
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPGraphErrors {
2018-11-25 21:53:26 +08:00
public :
/** \brief class contructor */
2019-01-20 17:49:29 +08:00
JKQTPGraphErrors ( QColor graphColor = QColor ( " black " ) ) ;
virtual ~ JKQTPGraphErrors ( ) ;
2018-11-25 21:53:26 +08:00
2019-01-26 20:00:40 +08:00
/*! \brief sets the property errorColor ( \copybrief errorColor ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorColor is : < BLOCKQUOTE > \ copydoc errorColor < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorColor for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setErrorColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
this - > errorColor = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property errorColor ( \copybrief errorColor ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorColor is : < BLOCKQUOTE > \ copydoc errorColor < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorColor for more information */
2019-01-26 20:00:40 +08:00
inline virtual QColor getErrorColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorColor ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property errorStyle ( \copybrief errorStyle ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorStyle is : < BLOCKQUOTE > \ copydoc errorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setErrorStyle ( const Qt : : PenStyle & __value )
2019-01-10 04:23:24 +08:00
{
this - > errorStyle = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property errorStyle ( \copybrief errorStyle ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorStyle is : < BLOCKQUOTE > \ copydoc errorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual Qt : : PenStyle getErrorStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorStyle ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property errorWidth ( \copybrief errorWidth ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorWidth is : < BLOCKQUOTE > \ copydoc errorWidth < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorWidth for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setErrorWidth ( double __value )
2019-01-10 04:23:24 +08:00
{
this - > errorWidth = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property errorWidth ( \copybrief errorWidth ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorWidth is : < BLOCKQUOTE > \ copydoc errorWidth < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorWidth for more information */
2019-01-26 20:00:40 +08:00
inline virtual double getErrorWidth ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorWidth ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property errorFillColor ( \copybrief errorFillColor ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorFillColor is : < BLOCKQUOTE > \ copydoc errorFillColor < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorFillColor for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setErrorFillColor ( const QColor & __value )
2019-01-10 04:23:24 +08:00
{
this - > errorFillColor = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property errorFillColor ( \copybrief errorFillColor ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorFillColor is : < BLOCKQUOTE > \ copydoc errorFillColor < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorFillColor for more information */
2019-01-26 20:00:40 +08:00
inline virtual QColor getErrorFillColor ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorFillColor ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property errorFillStyle ( \copybrief errorFillStyle ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorFillStyle is : < BLOCKQUOTE > \ copydoc errorFillStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorFillStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setErrorFillStyle ( const Qt : : BrushStyle & __value )
2019-01-10 04:23:24 +08:00
{
this - > errorFillStyle = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property errorFillStyle ( \copybrief errorFillStyle ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorFillStyle is : < BLOCKQUOTE > \ copydoc errorFillStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorFillStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual Qt : : BrushStyle getErrorFillStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorFillStyle ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property errorbarSize ( \copybrief errorbarSize ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorbarSize is : < BLOCKQUOTE > \ copydoc errorbarSize < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorbarSize for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setErrorbarSize ( double __value )
2019-01-10 04:23:24 +08:00
{
this - > errorbarSize = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property errorbarSize ( \copybrief errorbarSize ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter errorbarSize is : < BLOCKQUOTE > \ copydoc errorbarSize < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see errorbarSize for more information */
2019-01-26 20:00:40 +08:00
inline virtual double getErrorbarSize ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > errorbarSize ;
}
2018-11-25 21:53:26 +08:00
/** \brief returns true, if the error plots use the given column */
2018-12-28 05:52:00 +08:00
virtual bool errorUsesColumn ( int c ) const ;
2018-11-25 21:53:26 +08:00
void setErrorColorFromGraphColor ( QColor graphColor ) ;
protected :
/** \brief color of the error lines/bars */
QColor errorColor ;
/** \brief linestyle of the error lines/bars */
Qt : : PenStyle errorStyle ;
/** \brief width (pixels) of the error lines/bars */
double errorWidth ;
/** \brief fill color for error polygons */
QColor errorFillColor ;
/** \brief fill style for error polygons */
Qt : : BrushStyle errorFillStyle ;
/** \brief size of the error bar end markers [pixels] */
double errorbarSize ;
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \ a xColumn and \ a yColumn . It is also possible to specify a datarange . This method is called by
2019-01-20 17:49:29 +08:00
* the JKQTPGraph descendents */
virtual void plotErrorIndicators ( JKQTPEnhancedPainter & painter , JKQTBasePlotter * parent , JKQTPGraph * parentGraph , int xColumn , int yColumn , int datarange_start = - 1 , int datarange_end = - 1 , double xrelshift = 0 , double yrelshift = 0.0 , const QVector < int > * dataorder = nullptr ) = 0 ;
2018-11-25 21:53:26 +08:00
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \ a xColumn and \ a yColumn . It is also possible to specify a datarange . */
2019-01-20 17:49:29 +08:00
void intPlotXYErrorIndicators ( JKQTPEnhancedPainter & painter , JKQTBasePlotter * parent , JKQTPGraph * parentGraph , int xColumn , int yColumn , int xErrorColumn , int yErrorColumn , JKQTPErrorPlotstyle xErrorStyle , JKQTPErrorPlotstyle yErrorStyle , int datarange_start = - 1 , int datarange_end = - 1 , int xErrorColumnLower = - 1 , int yErrorColumnLower = - 1 , bool xErrorSymmetric = true , bool yErrorSymmetric = true , double xrelshift = 0 , double yrelshift = 0.0 , const QVector < int > * dataorder = nullptr ) ;
2018-11-25 21:53:26 +08:00
/** \brief this function can be used to set the color of the error indicators automatically
*
* return \ c true and the colors to use , if applicable , the default implementation returns false */
2019-01-20 17:49:29 +08:00
virtual bool intPlotXYErrorIndicatorsGetColor ( JKQTPEnhancedPainter & painter , JKQTBasePlotter * parent , JKQTPGraph * parentGraph , int xColumn , int yColumn , int xErrorColumn , int yErrorColumn , JKQTPErrorPlotstyle xErrorStyle , JKQTPErrorPlotstyle yErrorStyle , int index , QColor & errorColor , QColor & errorFillColor ) ;
2018-11-25 21:53:26 +08:00
2019-01-20 17:49:29 +08:00
virtual double getXErrorU ( int i , JKQTPDatastore * ds ) const ;
virtual double getXErrorL ( int i , JKQTPDatastore * ds ) const ;
virtual double getYErrorU ( int i , JKQTPDatastore * ds ) const ;
virtual double getYErrorL ( int i , JKQTPDatastore * ds ) const ;
2018-11-25 21:53:26 +08:00
//** \brief plot a single error indicator */
2019-01-20 17:49:29 +08:00
//void intPlotXYErrorIndicator(JKQTPEnhancedPainter& painter, double x, double xperror, double xmerror, double y, double yperror, double ymerror, JKQTPErrorPlotstyle xErrorStyle=JKQTPNoError, JKQTPErrorPlotstyle yErrorStyle=JKQTPNoError, double lastx=0, double lastxperror=0, double lastxmerror=0, double lasty=0, double lastyperror=0, double lastymerror=0);
2018-11-25 21:53:26 +08:00
} ;
2019-01-20 17:49:29 +08:00
/*! \brief This class adds data fields for error indicators in x direction to a JKQTPGraph descendent.
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_basegraphserrors
2019-01-20 17:49:29 +08:00
\ see JKQTPGraphErrors
2018-11-25 21:53:26 +08:00
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPXGraphErrors : public JKQTPGraphErrors {
2018-11-25 21:53:26 +08:00
public :
/** \brief class contructor */
2019-01-20 17:49:29 +08:00
JKQTPXGraphErrors ( QColor graphColor = QColor ( " black " ) ) ;
2018-11-25 21:53:26 +08:00
2019-01-26 20:00:40 +08:00
/*! \brief sets the property xErrorSymmetric ( \copybrief xErrorSymmetric ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorSymmetric is : < BLOCKQUOTE > \ copydoc xErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setXErrorSymmetric ( bool __value )
2019-01-10 04:23:24 +08:00
{
this - > xErrorSymmetric = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property xErrorSymmetric ( \copybrief xErrorSymmetric ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorSymmetric is : < BLOCKQUOTE > \ copydoc xErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual bool getXErrorSymmetric ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xErrorSymmetric ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property xErrorColumnLower ( \copybrief xErrorColumnLower ). \details Description of the parameter xErrorColumnLower is: <BLOCKQUOTE>\copydoc xErrorColumnLower </BLOCKQUOTE>. \see xErrorColumnLower for more information */
inline int getXErrorColumnLower ( ) const { return this - > xErrorColumnLower ; }
/*! \brief returns the property xErrorColumn ( \copybrief xErrorColumn ). \details Description of the parameter xErrorColumn is: <BLOCKQUOTE>\copydoc xErrorColumn </BLOCKQUOTE>. \see xErrorColumn for more information */
inline int getXErrorColumn ( ) const { return this - > xErrorColumn ; }
/*! \brief sets the property xErrorStyle ( \copybrief xErrorStyle ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorStyle is : < BLOCKQUOTE > \ copydoc xErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setXErrorStyle ( const JKQTPErrorPlotstyle & __value )
2019-01-10 04:23:24 +08:00
{
this - > xErrorStyle = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property xErrorStyle ( \copybrief xErrorStyle ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorStyle is : < BLOCKQUOTE > \ copydoc xErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual JKQTPErrorPlotstyle getXErrorStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xErrorStyle ;
}
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for x-error indicators */
2019-01-26 20:00:40 +08:00
void setXErrorColumn ( int __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for lower x-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
2019-01-26 20:00:40 +08:00
void setXErrorColumnLower ( int __value ) ;
2018-11-25 21:53:26 +08:00
/** \brief returns true, if the error plots use the given column */
2018-12-28 05:52:00 +08:00
virtual bool errorUsesColumn ( int c ) const override ;
2018-11-25 21:53:26 +08:00
protected :
/** \brief the column that contains the error of the x-component of the datapoints */
int xErrorColumn ;
/** \brief the column that contains the error of the x-component of the datapoints. This is used as the lower error length, if xErrorSymmetric \c ==false. */
int xErrorColumnLower ;
/** \brief indicates whether the x-errors are symmetric (from one column only) */
bool xErrorSymmetric ;
/** \brief how to draw the errors (if available) of the x-value */
2019-01-20 17:49:29 +08:00
JKQTPErrorPlotstyle xErrorStyle ;
2018-11-25 21:53:26 +08:00
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \ a xColumn and \ a yColumn . It is also possible to specify a datarange . */
2019-01-20 17:49:29 +08:00
virtual void plotErrorIndicators ( JKQTPEnhancedPainter & painter , JKQTBasePlotter * parent , JKQTPGraph * parentGraph , int xColumn , int yColumn , int datarange_start = - 1 , int datarange_end = - 1 , double xrelshift = 0 , double yrelshift = 0.0 , const QVector < int > * dataorder = nullptr ) override ;
2018-11-25 21:53:26 +08:00
2019-01-20 17:49:29 +08:00
virtual double getXErrorU ( int i , JKQTPDatastore * ds ) const override ;
virtual double getXErrorL ( int i , JKQTPDatastore * ds ) const override ;
2018-11-25 21:53:26 +08:00
} ;
/*! \brief This class adds data fields for error indicators in y direction to a class.
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_basegraphserrors
2019-01-20 17:49:29 +08:00
\ see JKQTPGraphErrors
2018-11-25 21:53:26 +08:00
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPYGraphErrors : public JKQTPGraphErrors {
2018-11-25 21:53:26 +08:00
public :
/** \brief class contructor */
2019-01-20 17:49:29 +08:00
JKQTPYGraphErrors ( QColor graphColor = QColor ( " black " ) ) ;
2018-11-25 21:53:26 +08:00
2019-01-26 20:00:40 +08:00
/*! \brief sets the property yErrorSymmetric ( \copybrief yErrorSymmetric ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorSymmetric is : < BLOCKQUOTE > \ copydoc yErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setYErrorSymmetric ( bool __value )
2019-01-10 04:23:24 +08:00
{
this - > yErrorSymmetric = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property yErrorSymmetric ( \copybrief yErrorSymmetric ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorSymmetric is : < BLOCKQUOTE > \ copydoc yErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual bool getYErrorSymmetric ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yErrorSymmetric ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property yErrorColumnLower ( \copybrief yErrorColumnLower ). \details Description of the parameter yErrorColumnLower is: <BLOCKQUOTE>\copydoc yErrorColumnLower </BLOCKQUOTE>. \see yErrorColumnLower for more information */
inline int getYErrorColumnLower ( ) const { return this - > yErrorColumnLower ; }
/*! \brief returns the property yErrorColumn ( \copybrief yErrorColumn ). \details Description of the parameter yErrorColumn is: <BLOCKQUOTE>\copydoc yErrorColumn </BLOCKQUOTE>. \see yErrorColumn for more information */
inline int getYErrorColumn ( ) const { return this - > yErrorColumn ; }
/*! \brief sets the property yErrorStyle ( \copybrief yErrorStyle ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorStyle is : < BLOCKQUOTE > \ copydoc yErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setYErrorStyle ( const JKQTPErrorPlotstyle & __value )
2019-01-10 04:23:24 +08:00
{
this - > yErrorStyle = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property yErrorStyle ( \copybrief yErrorStyle ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorStyle is : < BLOCKQUOTE > \ copydoc yErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual JKQTPErrorPlotstyle getYErrorStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yErrorStyle ;
}
2019-01-20 17:49:29 +08:00
/** \copydoc JKQTPGraphErrors::errorUsesColumn() */
2018-12-28 05:52:00 +08:00
virtual bool errorUsesColumn ( int c ) const override ;
2018-11-25 21:53:26 +08:00
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for y-error indicators */
2019-01-26 20:00:40 +08:00
void setYErrorColumn ( int __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for lower y-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
2019-01-26 20:00:40 +08:00
void setYErrorColumnLower ( int __value ) ;
2018-11-25 21:53:26 +08:00
protected :
/** \brief the column that contains the error of the x-component of the datapoints */
int yErrorColumn ;
/** \brief how to draw the errors (if available) of the x-value */
2019-01-20 17:49:29 +08:00
JKQTPErrorPlotstyle yErrorStyle ;
2018-11-25 21:53:26 +08:00
/** \brief indicates whether the y-errors are symmetric (from one column only) */
bool yErrorSymmetric ;
/** \brief the column that contains the error of the y-component of the datapoints. This is used as the lower error length, if yErrorSymmetric \c ==false. */
int yErrorColumnLower ;
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \ a xColumn and \ a yColumn . It is also possible to specify a datarange . */
2019-01-20 17:49:29 +08:00
virtual void plotErrorIndicators ( JKQTPEnhancedPainter & painter , JKQTBasePlotter * parent , JKQTPGraph * parentGraph , int xColumn , int yColumn , int datarange_start = - 1 , int datarange_end = - 1 , double xrelshift = 0 , double yrelshift = 0.0 , const QVector < int > * dataorder = nullptr ) override ;
2018-11-25 21:53:26 +08:00
2019-01-20 17:49:29 +08:00
virtual double getYErrorU ( int i , JKQTPDatastore * ds ) const override ;
virtual double getYErrorL ( int i , JKQTPDatastore * ds ) const override ;
2018-11-25 21:53:26 +08:00
} ;
/*! \brief This class adds data fields for error indicators in x and y direction to a class.
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_basegraphserrors
2019-01-20 17:49:29 +08:00
\ see JKQTPGraphErrors
2018-11-25 21:53:26 +08:00
*/
2019-01-20 17:49:29 +08:00
class LIB_EXPORT JKQTPXYGraphErrors : public JKQTPGraphErrors {
2018-11-25 21:53:26 +08:00
public :
/** \brief class contructor */
2019-01-20 17:49:29 +08:00
JKQTPXYGraphErrors ( QColor graphColor = QColor ( " black " ) ) ;
2019-01-26 20:00:40 +08:00
/*! \brief sets the property xErrorSymmetric ( \copybrief xErrorSymmetric ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorSymmetric is : < BLOCKQUOTE > \ copydoc xErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setXErrorSymmetric ( bool __value )
2019-01-10 04:23:24 +08:00
{
this - > xErrorSymmetric = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property xErrorSymmetric ( \copybrief xErrorSymmetric ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorSymmetric is : < BLOCKQUOTE > \ copydoc xErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual bool getXErrorSymmetric ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xErrorSymmetric ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property yErrorSymmetric ( \copybrief yErrorSymmetric ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorSymmetric is : < BLOCKQUOTE > \ copydoc yErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setYErrorSymmetric ( bool __value )
2019-01-10 04:23:24 +08:00
{
this - > yErrorSymmetric = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property yErrorSymmetric ( \copybrief yErrorSymmetric ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorSymmetric is : < BLOCKQUOTE > \ copydoc yErrorSymmetric < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorSymmetric for more information */
2019-01-26 20:00:40 +08:00
inline virtual bool getYErrorSymmetric ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yErrorSymmetric ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property xErrorColumnLower ( \copybrief xErrorColumnLower ). \details Description of the parameter xErrorColumnLower is: <BLOCKQUOTE>\copydoc xErrorColumnLower </BLOCKQUOTE>. \see xErrorColumnLower for more information */
inline int getXErrorColumnLower ( ) const { return this - > xErrorColumnLower ; }
/*! \brief returns the property xErrorColumn ( \copybrief xErrorColumn ). \details Description of the parameter xErrorColumn is: <BLOCKQUOTE>\copydoc xErrorColumn </BLOCKQUOTE>. \see xErrorColumn for more information */
inline int getXErrorColumn ( ) const { return this - > xErrorColumn ; }
/*! \brief returns the property yErrorColumnLower ( \copybrief yErrorColumnLower ). \details Description of the parameter yErrorColumnLower is: <BLOCKQUOTE>\copydoc yErrorColumnLower </BLOCKQUOTE>. \see yErrorColumnLower for more information */
inline int getYErrorColumnLower ( ) const { return this - > yErrorColumnLower ; }
/*! \brief returns the property yErrorColumn ( \copybrief yErrorColumn ). \details Description of the parameter yErrorColumn is: <BLOCKQUOTE>\copydoc yErrorColumn </BLOCKQUOTE>. \see yErrorColumn for more information */
inline int getYErrorColumn ( ) const { return this - > yErrorColumn ; }
/*! \brief sets the property yErrorStyle ( \copybrief yErrorStyle ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorStyle is : < BLOCKQUOTE > \ copydoc yErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setYErrorStyle ( const JKQTPErrorPlotstyle & __value )
2019-01-10 04:23:24 +08:00
{
this - > yErrorStyle = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property yErrorStyle ( \copybrief yErrorStyle ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter yErrorStyle is : < BLOCKQUOTE > \ copydoc yErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see yErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual JKQTPErrorPlotstyle getYErrorStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > yErrorStyle ;
}
2019-01-26 20:00:40 +08:00
/*! \brief sets the property xErrorStyle ( \copybrief xErrorStyle ) to the specified \a __value.
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorStyle is : < BLOCKQUOTE > \ copydoc xErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual void setXErrorStyle ( const JKQTPErrorPlotstyle & __value )
2019-01-10 04:23:24 +08:00
{
this - > xErrorStyle = __value ;
}
2019-01-26 20:00:40 +08:00
/*! \brief returns the property xErrorStyle ( \copybrief xErrorStyle ).
2019-01-25 05:49:10 +08:00
\ details Description of the parameter xErrorStyle is : < BLOCKQUOTE > \ copydoc xErrorStyle < / BLOCKQUOTE >
2019-01-10 04:23:24 +08:00
\ see xErrorStyle for more information */
2019-01-26 20:00:40 +08:00
inline virtual JKQTPErrorPlotstyle getXErrorStyle ( ) const
2019-01-10 04:23:24 +08:00
{
return this - > xErrorStyle ;
}
2019-01-20 17:49:29 +08:00
/** \copydoc JKQTPGraphErrors::errorUsesColumn() */
2018-12-28 05:52:00 +08:00
virtual bool errorUsesColumn ( int c ) const override ;
2018-11-25 21:53:26 +08:00
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for x-error indicators */
2019-01-26 20:00:40 +08:00
void setXErrorColumn ( int __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for lower x-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
2019-01-26 20:00:40 +08:00
void setXErrorColumnLower ( int __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for x-error indicators */
2019-01-26 20:00:40 +08:00
void setYErrorColumn ( int __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for lower x-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
2019-01-26 20:00:40 +08:00
void setYErrorColumnLower ( int __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for y-error indicators */
2019-01-26 20:00:40 +08:00
void setXErrorColumn ( size_t __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for lower y-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
2019-01-26 20:00:40 +08:00
void setXErrorColumnLower ( size_t __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for y-error indicators */
2019-01-26 20:00:40 +08:00
void setYErrorColumn ( size_t __value ) ;
2018-12-28 05:52:00 +08:00
/** \brief set the column from which to read the error values for lower y-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
2019-01-26 20:00:40 +08:00
void setYErrorColumnLower ( size_t __value ) ;
2018-11-25 21:53:26 +08:00
protected :
/** \brief the column that contains the error of the x-component of the datapoints */
int yErrorColumn ;
/** \brief how to draw the errors (if available) of the x-value */
2019-01-20 17:49:29 +08:00
JKQTPErrorPlotstyle yErrorStyle ;
2018-11-25 21:53:26 +08:00
/** \brief the column that contains the error of the x-component of the datapoints */
int xErrorColumn ;
/** \brief how to draw the errors (if available) of the x-value */
2019-01-20 17:49:29 +08:00
JKQTPErrorPlotstyle xErrorStyle ;
2018-11-25 21:53:26 +08:00
/** \brief indicates whether the x-errors are symmetric (from one column only) */
bool xErrorSymmetric ;
/** \brief indicates whether the y-errors are symmetric (from one column only) */
bool yErrorSymmetric ;
/** \brief the column that contains the error of the x-component of the datapoints. This is used as the lower error length, if xErrorSymmetric \c ==false. */
int xErrorColumnLower ;
/** \brief the column that contains the error of the y-component of the datapoints. This is used as the lower error length, if yErrorSymmetric \c ==false. */
int yErrorColumnLower ;
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \ a xColumn and \ a yColumn . It is also possible to specify a datarange . */
2019-01-20 17:49:29 +08:00
virtual void plotErrorIndicators ( JKQTPEnhancedPainter & painter , JKQTBasePlotter * parent , JKQTPGraph * parentGraph , int xColumn , int yColumn , int datarange_start = - 1 , int datarange_end = - 1 , double xrelshift = 0 , double yrelshift = 0.0 , const QVector < int > * dataorder = nullptr ) override ;
2018-11-25 21:53:26 +08:00
2019-01-20 17:49:29 +08:00
virtual double getXErrorU ( int i , JKQTPDatastore * ds ) const override ;
virtual double getXErrorL ( int i , JKQTPDatastore * ds ) const override ;
virtual double getYErrorU ( int i , JKQTPDatastore * ds ) const override ;
virtual double getYErrorL ( int i , JKQTPDatastore * ds ) const override ;
2018-11-25 21:53:26 +08:00
} ;
2018-12-28 05:52:00 +08:00
2018-12-19 00:13:18 +08:00
# endif // jkqtpgraphsbase_H