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
2019-02-08 00:24:46 +08:00
the Free Software Foundation , either version 2.1 of the License , or
2018-11-25 21:53:26 +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/>.
*/
# include <QString>
# include <QPainter>
# include <QPair>
2019-05-30 04:40:02 +08:00
# include "jkqtplotter/jkqtptools.h"
2019-05-18 19:22:46 +08:00
# include "jkqtcommon/jkqtp_imexport.h"
2019-05-30 04:40:02 +08:00
# include "jkqtplotter/jkqtpimagetools.h"
2018-12-19 00:13:18 +08:00
# include "jkqtplotter/jkqtpgraphsbase.h"
2019-05-11 21:56:11 +08:00
# include "jkqtplotter/jkqtpgraphsboxplotstylingmixins.h"
2019-04-22 23:19:52 +08:00
# include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
2018-11-25 21:53:26 +08:00
2018-12-19 00:13:18 +08:00
# ifndef jkqtpgraphsboxplot_H
# define jkqtpgraphsboxplot_H
2018-11-25 21:53:26 +08:00
2019-04-22 23:19:52 +08:00
2019-05-11 21:56:11 +08:00
/*! \brief This implements vertical <a href="http://en.wikipedia.org/wiki/Box_plot">boxplots</a>, optionally also a notched boxplot
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_statgraphs
2018-11-25 21:53:26 +08:00
2019-01-20 23:15:10 +08:00
The x position is given in posColumn . All other data are given in the medianColumn , minColumn , maxColumn ,
2018-11-25 21:53:26 +08:00
percentile25Column and percentile75Column .
\ image html plot_boxplotvertical . png
2019-01-20 23:15:10 +08:00
2019-05-11 21:56:11 +08:00
2019-01-20 23:15:10 +08:00
The different features of a boxplot are :
2019-05-11 21:56:11 +08:00
\ image html plot_boxplotverticalelement . png
The example \ ref JKQTPlotterBoxplotStyling discusses different options to style boxplots :
\ image html test_styledboxplot . png
2019-01-20 23:15:10 +08:00
2019-05-06 01:31:20 +08:00
This class also implements hitTest ( ) in a way that displays all data of the boxplot in the tooltips :
\ image html tooltip_boxplot . png
2019-01-20 23:15:10 +08:00
\ note There are additional classes to draw a single boxplot element : JKQTPBoxplotHorizontalElement and JKQTPBoxplotVerticalElement .
In these you can set the data values , as they are NOT drawn from a data column . This can be useful , if you e . g . want to
draw the statistical properties of a distribution .
\ section BoxplotOutliers Outliers
If you also want to display outliers , as shown here with circles :
\ image html boxplot_outliers . png
You need to add them as ( x , y ) - pairs to the datastore and add a separate JKQTPXYLineGraph that shows these . See \ ref JKQTPlotterBoxplotsGraphs for details . Here is an example code - snippet :
\ code
// 4. create a graph of vertical boxplots:
JKQTPBoxplotVerticalGraph * graph = new JKQTPBoxplotVerticalGraph ( & plot ) ;
2019-04-22 23:19:52 +08:00
graph - > setPositionColumn ( columnPOS ) ;
2019-01-26 20:00:40 +08:00
graph - > setMinColumn ( columnMIN ) ;
graph - > setPercentile25Column ( columnQ25 ) ;
graph - > setMedianColumn ( columnMEDIAN ) ;
graph - > setMeanColumn ( columnMEAN ) ;
graph - > setPercentile75Column ( columnQ75 ) ;
graph - > setMaxColumn ( columnMAX ) ;
graph - > setTitle ( " vertical Boxplots " ) ;
2019-01-20 23:15:10 +08:00
// 5. outliers need to be drawn separately
JKQTPXYLineGraph * graphOutliers = new JKQTPXYLineGraph ( & plot ) ;
2019-01-26 20:00:40 +08:00
graphOutliers - > setXColumn ( columnOUTLIERSX ) ;
graphOutliers - > setYColumn ( columnOUTLIERSY ) ;
graphOutliers - > setTitle ( " outliers " ) ;
2019-01-20 23:15:10 +08:00
// make the color a darker shade of the color of graph
2019-01-26 20:00:40 +08:00
graphOutliers - > setColor ( graph - > getColor ( ) . darker ( ) ) ;
graphOutliers - > setFillColor ( QColor ( " white " ) ) ;
2019-01-20 23:15:10 +08:00
// draw outliers as small circles, without lines
2019-04-22 19:27:50 +08:00
graphOutliers - > setSymbolType ( JKQTPCircle ) ;
2019-01-26 20:00:40 +08:00
graphOutliers - > setDrawLine ( false ) ;
graphOutliers - > setSymbolSize ( 7 ) ;
2019-01-20 23:15:10 +08:00
\ endcode
\ see \ ref JKQTPlotterBoxplotsGraphs
2018-11-25 21:53:26 +08:00
*/
2019-04-22 23:19:52 +08:00
class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph : public JKQTPGraph , public JKQTPGraphBoxplotStyleMixin {
2018-11-25 21:53:26 +08:00
Q_OBJECT
public :
2019-05-30 04:40:02 +08:00
/** \brief Sort order in a JKQTPBoxplotVerticalGraph (or one of its child classes) */
2018-11-25 21:53:26 +08:00
enum DataSortOrder {
Unsorted = 0 ,
Sorted = 1
} ;
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPBoxplotVerticalGraph ( JKQTBasePlotter * parent = nullptr ) ;
2018-11-25 21:53:26 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPBoxplotVerticalGraph ( JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2019-04-22 23:19:52 +08:00
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
2018-11-25 21:53:26 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2019-04-22 23:19:52 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
2018-11-25 21:53:26 +08:00
/** \brief returns the color to be used for the key label */
2019-04-22 19:27:50 +08:00
virtual QColor getKeyLabelColor ( ) const override ;
2019-04-22 23:19:52 +08:00
/*! \brief set the color of the graph (colors all elements, based on the given color \a c )*/
virtual void setColor ( QColor c ) ;
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 c ) const override ;
2018-11-25 21:53:26 +08:00
2019-05-19 04:41:38 +08:00
/*! \copydoc sortData */
2019-04-22 23:19:52 +08:00
void setDataSortOrder ( DataSortOrder __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc sortData */
2019-04-22 23:19:52 +08:00
DataSortOrder getDataSortOrder ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc sortData */
2019-02-03 21:04:48 +08:00
void setDataSortOrder ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc posColumn */
2019-04-22 23:19:52 +08:00
void setPositionColumn ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc posColumn */
2019-04-22 23:19:52 +08:00
int getPositionColumn ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc posColumn */
2019-04-22 23:19:52 +08:00
void setPositionColumn ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc medianColumn */
2019-04-22 23:19:52 +08:00
void setMedianColumn ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc medianColumn */
2019-04-22 23:19:52 +08:00
int getMedianColumn ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc medianColumn */
2019-04-22 23:19:52 +08:00
void setMedianColumn ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc meanColumn */
2019-04-22 23:19:52 +08:00
void setMeanColumn ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc meanColumn */
2019-04-22 23:19:52 +08:00
int getMeanColumn ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc meanColumn */
2019-04-22 23:19:52 +08:00
void setMeanColumn ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc minColumn */
2019-04-22 23:19:52 +08:00
void setMinColumn ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc minColumn */
2019-04-22 23:19:52 +08:00
int getMinColumn ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc minColumn */
2019-04-22 23:19:52 +08:00
void setMinColumn ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc maxColumn */
2019-04-22 23:19:52 +08:00
void setMaxColumn ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc maxColumn */
2019-04-22 23:19:52 +08:00
int getMaxColumn ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc maxColumn */
2019-04-22 23:19:52 +08:00
void setMaxColumn ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile25Column */
2019-04-22 23:19:52 +08:00
void setPercentile25Column ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile25Column */
2019-04-22 23:19:52 +08:00
int getPercentile25Column ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile25Column */
2019-04-22 23:19:52 +08:00
void setPercentile25Column ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile75Column */
2019-04-22 23:19:52 +08:00
void setPercentile75Column ( int __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile75Column */
2019-04-22 23:19:52 +08:00
int getPercentile75Column ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile75Column */
2019-04-22 23:19:52 +08:00
void setPercentile75Column ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc medianConfidenceColumn */
2019-05-11 21:56:11 +08:00
int getMedianConfidenceColumn ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc medianConfidenceColumn */
2019-05-11 21:56:11 +08:00
void setMedianConfidenceColumn ( size_t __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc boxWidthRelative */
2019-05-11 21:56:11 +08:00
void setBoxWidthRelative ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc boxWidthRelative */
2019-05-11 21:56:11 +08:00
double getBoxWidthRelative ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc useRelativeBoxWidth */
2019-05-11 21:56:11 +08:00
void setUseRelativeBoxWidth ( bool __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc useRelativeBoxWidth */
2019-05-11 21:56:11 +08:00
bool getUseRelativeBoxWidth ( ) const ;
2018-11-25 21:53:26 +08:00
protected :
2019-05-11 21:56:11 +08:00
/** \brief width of box in percent of distance between the current two posColumn values
* if we only plot one box & whiskers then JKQTPGraphBoxplotStyleMixin : : boxWidthAbsolute in pt is used */
double boxWidthRelative ;
/** \brief if set \c true, boxplot widths are calculated automatically, based on boxWidthRelative,
* otherwise JKQTPGraphBoxplotStyleMixin : : boxWidthAbsolute is used . */
bool useRelativeBoxWidth ;
2018-11-25 21:53:26 +08:00
/** \brief the column that contains the x-component of the datapoints */
int posColumn ;
/** \brief the column that contains the median-component of the datapoints */
int medianColumn ;
2019-05-11 21:56:11 +08:00
/** \brief the column that contains the confidence interval width of the median (e.g. 1.57*IQR/sqrt(n) ). This is used to draw a notch in the plot (if set) */
int medianConfidenceColumn ;
2018-11-25 21:53:26 +08:00
/** \brief the column that contains the median-component of the datapoints. \note This column is strictly optional. */
int meanColumn ;
/** \brief the column that contains the minimum-component of the datapoints */
int minColumn ;
/** \brief the column that contains the maximum-component of the datapoints */
int maxColumn ;
/** \brief the column that contains the 25% percentile-component of the datapoints */
int percentile25Column ;
/** \brief the column that contains the 75% percentile-component of the datapoints */
int percentile75Column ;
/** \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 ;
2019-04-22 23:19:52 +08:00
2018-12-28 05:52:00 +08:00
virtual void intSortData ( ) ;
2019-04-22 23:19:52 +08:00
2018-11-25 21:53:26 +08:00
inline int getDataIndex ( int i ) {
if ( sortData = = Unsorted ) return i ;
return sortedIndices . value ( i , i ) ;
}
} ;
2019-05-11 21:56:11 +08:00
/*! \brief This implements horizontal <a href="http://en.wikipedia.org/wiki/Box_plot">boxplots</a>, optionally also a notched boxplot
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_statgraphs
2018-11-25 21:53:26 +08:00
the x position is given in posColumn . All other data are given in the medianColumn , minColumn , maxColumn ,
percentile25Column and percentile75Column .
2019-01-20 17:49:29 +08:00
\ image html plot_boxplothoricontal . png
2019-01-20 23:15:10 +08:00
\ note See the documentation of JKQTPBoxplotVerticalGraph for details on the properties of this class !
\ see JKQTPBoxplotVerticalGraph \ ref JKQTPlotterBoxplotsGraphs
2018-11-25 21:53:26 +08:00
*/
2019-02-03 21:04:48 +08:00
class JKQTP_LIB_EXPORT JKQTPBoxplotHorizontalGraph : public JKQTPBoxplotVerticalGraph {
2018-11-25 21:53:26 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPBoxplotHorizontalGraph ( JKQTBasePlotter * parent = nullptr ) ;
2019-01-20 23:15:10 +08:00
JKQTPBoxplotHorizontalGraph ( JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2018-12-28 05:52:00 +08:00
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
2018-11-25 21:53:26 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2018-12-28 05:52:00 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
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-05-11 21:56:11 +08:00
/*! \brief This implements a single vertical <a href="http://en.wikipedia.org/wiki/Box_plot">(notched) boxplot</a> as a "geometric element",
2019-01-20 23:15:10 +08:00
where the data is directly given to the object and not stored in a column , as in JKQTPBoxplotVerticalGraph
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_statgraphs
2019-01-20 17:49:29 +08:00
\ ingroup jkqtplotter_geoplots
2018-11-25 21:53:26 +08:00
2019-01-20 23:15:10 +08:00
2018-11-25 21:53:26 +08:00
the x position is given in posColumn . All other data are given in the median , min , max ,
percentile25 and percentile75 .
2019-01-20 23:15:10 +08:00
The different features of a boxplot are :
2019-05-11 21:56:11 +08:00
\ image html plot_boxplotverticalelement . png
The example \ ref JKQTPlotterBoxplotStyling discusses different options to style boxplots :
\ image html test_styledboxplot . png
2018-11-25 21:53:26 +08:00
*/
2019-04-22 23:19:52 +08:00
class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement : public JKQTPPlotObject , public JKQTPGraphBoxplotStyleMixin {
2018-11-25 21:53:26 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPBoxplotVerticalElement ( JKQTBasePlotter * parent = nullptr ) ;
2018-11-25 21:53:26 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPBoxplotVerticalElement ( JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2018-12-28 05:52:00 +08:00
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
2018-11-25 21:53:26 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2018-12-28 05:52:00 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
2018-11-25 21:53:26 +08:00
/** \brief returns the color to be used for the key label */
2019-04-22 19:27:50 +08:00
virtual QColor getKeyLabelColor ( ) const override ;
2019-05-30 04:40:02 +08:00
/*! \brief set the color of the graph (colors all elements, based on the given color \a c )*/
virtual void setColor ( QColor c ) ;
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-05-19 04:41:38 +08:00
/*! \copydoc pos */
2019-04-22 23:19:52 +08:00
void setPos ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc pos */
2019-04-22 23:19:52 +08:00
double getPos ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc median */
2019-04-22 23:19:52 +08:00
void setMedian ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc median */
2019-04-22 23:19:52 +08:00
double getMedian ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc mean */
2019-04-22 23:19:52 +08:00
void setMean ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc mean */
2019-04-22 23:19:52 +08:00
double getMean ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc min */
2019-04-22 23:19:52 +08:00
void setMin ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc min */
2019-04-22 23:19:52 +08:00
double getMin ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc max */
2019-04-22 23:19:52 +08:00
void setMax ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc max */
2019-04-22 23:19:52 +08:00
double getMax ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile25 */
2019-04-22 23:19:52 +08:00
void setPercentile25 ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile25 */
2019-04-22 23:19:52 +08:00
double getPercentile25 ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile75 */
2019-04-22 23:19:52 +08:00
void setPercentile75 ( double __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc percentile75 */
2019-04-22 23:19:52 +08:00
double getPercentile75 ( ) const ;
2019-01-10 04:23:24 +08:00
2019-05-19 04:41:38 +08:00
/*! \copydoc drawMean */
2019-04-22 23:19:52 +08:00
void setDrawMean ( bool __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc drawMean */
2019-04-22 23:19:52 +08:00
bool getDrawMean ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc drawMedian */
2019-04-22 23:19:52 +08:00
void setDrawMedian ( bool __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc drawMedian */
2019-04-22 23:19:52 +08:00
bool getDrawMedian ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc drawMinMax */
2019-04-22 23:19:52 +08:00
void setDrawMinMax ( bool __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc drawMinMax */
2019-04-22 23:19:52 +08:00
bool getDrawMinMax ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc drawNotch */
2019-05-11 21:56:11 +08:00
void setDrawNotch ( bool __value ) ;
2019-05-19 04:41:38 +08:00
/*! \copydoc drawNotch */
2019-05-11 21:56:11 +08:00
bool getDrawNotch ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc medianConfidenceIntervalWidth */
2019-05-11 21:56:11 +08:00
double getMedianConfidenceIntervalWidth ( ) const ;
2019-05-19 04:41:38 +08:00
/*! \copydoc medianConfidenceIntervalWidth */
2019-05-11 21:56:11 +08:00
void setMedianConfidenceIntervalWidth ( double __value ) ;
2018-11-25 21:53:26 +08:00
protected :
2019-05-11 21:56:11 +08:00
/** \brief the position of the boxplot on the "other" axis */
2018-11-25 21:53:26 +08:00
double pos ;
2019-05-11 21:56:11 +08:00
/** \brief the median value to be used for the boxplot */
2018-11-25 21:53:26 +08:00
double median ;
2019-05-11 21:56:11 +08:00
/** \brief the width of the confidence interval around the median */
double medianConfidenceIntervalWidth ;
/** \brief indicates whether to draw a notch with width medianConfidenceIntervalWidth */
bool drawNotch ;
/** \brief the mean value to be used for the boxplot */
2018-11-25 21:53:26 +08:00
double mean ;
/** \brief indicates whether to draw the mean */
bool drawMean ;
/** \brief indicates whether to draw the median */
bool drawMedian ;
/** \brief indicates whether to draw the percentiles */
bool drawMinMax ;
2019-05-11 21:56:11 +08:00
/** \brief the minimum value to be used for the boxplot */
2018-11-25 21:53:26 +08:00
double min ;
2019-05-11 21:56:11 +08:00
/** \brief the maximum value to be used for the boxplot */
2018-11-25 21:53:26 +08:00
double max ;
2019-05-11 21:56:11 +08:00
/** \brief the 25% percentile value to be used for the boxplot */
2018-11-25 21:53:26 +08:00
double percentile25 ;
2019-05-11 21:56:11 +08:00
/** \brief the 75% percentile value to be used for the boxplot */
2018-11-25 21:53:26 +08:00
double percentile75 ;
} ;
2019-05-11 21:56:11 +08:00
/*! \brief This implements a horizontal <a href="http://en.wikipedia.org/wiki/Box_plot">(notched) boxplot</a> where the data is directly given to the
2019-01-20 17:49:29 +08:00
object and not stored in a column , as in JKQTPBoxplotVerticalGraph
2019-01-13 01:53:16 +08:00
\ ingroup jkqtplotter_statgraphs
2019-01-20 17:49:29 +08:00
\ ingroup jkqtplotter_geoplots
2018-11-25 21:53:26 +08:00
the x position is given in pos . All other data are given in the median , min , max ,
percentile25 and percentile75 .
2019-01-20 17:49:29 +08:00
\ image html plot_boxplothorizontalelement . png
2019-01-20 23:15:10 +08:00
\ note See JKQTPBoxplotVerticalElement for a detailed documentation
\ see JKQTPBoxplotVerticalElement
2018-11-25 21:53:26 +08:00
*/
2019-02-03 21:04:48 +08:00
class JKQTP_LIB_EXPORT JKQTPBoxplotHorizontalElement : public JKQTPBoxplotVerticalElement {
2018-11-25 21:53:26 +08:00
Q_OBJECT
public :
/** \brief class constructor */
2019-01-20 17:49:29 +08:00
JKQTPBoxplotHorizontalElement ( JKQTBasePlotter * parent = nullptr ) ;
2018-11-25 21:53:26 +08:00
/** \brief class constructor */
2019-01-20 23:15:10 +08:00
JKQTPBoxplotHorizontalElement ( JKQTPlotter * parent ) ;
2018-11-25 21:53:26 +08:00
/** \brief plots the graph to the plotter object specified as parent */
2018-12-28 05:52:00 +08:00
virtual void draw ( JKQTPEnhancedPainter & painter ) override ;
2018-11-25 21:53:26 +08:00
/** \brief plots a key marker inside the specified rectangle \a rect */
2018-12-28 05:52:00 +08:00
virtual void drawKeyMarker ( JKQTPEnhancedPainter & painter , QRectF & rect ) override ;
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
} ;
2018-12-19 00:13:18 +08:00
# endif // jkqtpgraphsboxplot_H