- improved/breaking change: reworked class hierarchy of range plot elements (JKQTPVerticalRange and JKQTPHorizontalRange)

- improved their documentation
This commit is contained in:
jkriege2 2020-09-19 19:58:50 +02:00
parent 9e48a2e59e
commit f4767072a4
9 changed files with 354 additions and 253 deletions

View File

@ -451,12 +451,28 @@ This group assembles graphs that show their data with symbols and optionally wit
<tr>
<td>\image html geo_chords_small.png
<td> JKQTPGeoChord
</table>
Examples:
- \ref JKQTPlotterGeometricGraphs
.
\defgroup jkqtplotter_annotations Graph Annotations
\ingroup jkqtplotter_graphsgroup
<table>
<tr>
<td>\image html geo_boxplot_small.png
<td> JKQTPBoxplotVerticalElement, JKQTPBoxplotHorizontalElement
<th> Screenshot
<th> Classes
<tr>
<td>\image html JKQTPViolinplotVerticalElement_small.png
<td> JKQTPViolinplotVerticalElement, JKQTPViolinplotHorizontalElement
<td>\image html symbol_filled_diamond.png
<td> JKQTPGeoSymbol
<tr>
<td>\image html geo_text_small.png
<td> JKQTPGeoText
<tr>
<td>\image html JKQTPHorizontalRange_small.png
<td> JKQTPHorizontalRange, JKQTPVerticalRange
</table>
Examples:
@ -470,12 +486,15 @@ Examples:
<tr>
<th> Screenshot
<th> Classes
<tr>
<td>\image html JKQTPHorizontalRange_small.png
<td> JKQTPHorizontalRange, JKQTPVerticalRange
<tr>
<td>\image html JKQTPPeakStreamGraphY_small.png
<td> JKQTPPeakStreamGraph
<tr>
<td>\image html geo_boxplot_small.png
<td> JKQTPBoxplotVerticalElement, JKQTPBoxplotHorizontalElement
<tr>
<td>\image html JKQTPViolinplotVerticalElement_small.png
<td> JKQTPViolinplotVerticalElement, JKQTPViolinplotHorizontalElement
</table>
\defgroup jkqtplotter_imagelots Matrix/Image Plotting

View File

@ -30,6 +30,7 @@ Changes, compared to \ref page_whatsnew_V2019_11 "v2019.11" include:
<li>improved/breaking change: reworked class hierarchy of range charts.</li>
<li>improved/breaking change: reworked class hierarchy of special line (step) graphs.</li>
<li>improved/breaking change: reworked class hierarchy of filled line graphs.</li>
<li>improved/breaking change: reworked class hierarchy of range plot elements (JKQTPVerticalRange and JKQTPHorizontalRange).</li>
<li>improved/breaking change: reworked graph Base-Classes (promoted several setters to slots, added Q_PROPERTY- and Q_ENUM-declarations...)</li>
<li>improved/breaking change: made more functions and function parameters const</li>
<li>bugfixed/improved: aspect ratio handling in JKQTPlotter.</li>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -290,7 +290,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBoxplotHorizontalGraph: public JKQTPBoxplotVer
/*! \brief This implements a single vertical <a href="http://en.wikipedia.org/wiki/Box_plot">(notched) boxplot</a> as a "geometric element",
where the data is directly given to the object and not stored in a column, as in JKQTPBoxplotVerticalGraph
\ingroup jkqtplotter_statgraphs
\ingroup jkqtplotter_geoplots
\ingroup jkqtplotter_diverse
@ -421,7 +421,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject
/*! \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
object and not stored in a column, as in JKQTPBoxplotVerticalGraph
\ingroup jkqtplotter_statgraphs
\ingroup jkqtplotter_geoplots
\ingroup jkqtplotter_diverse
the x position is given in pos. All other data are given in the median, min, max,
percentile25 and percentile75.

View File

@ -34,7 +34,7 @@
/*! \brief This virtual JKQTPGraph descendent may be used to display a single symbol (marker).
\ingroup jkqtplotter_geoplots
\ingroup jkqtplotter_annotations
\see \ref JKQTPlotterGeometricGraphs
@ -101,7 +101,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQT
/*! \brief This JKQTPPlotObject is used to display text. It uses the JKQTMathText
class in order to display LaTeX formulas.
\ingroup jkqtplotter_geoplots
\ingroup jkqtplotter_annotations
\see \ref JKQTPlotterGeometricGraphs
*/

View File

@ -34,8 +34,8 @@
JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTBasePlotter* parent):
JKQTPGraph(parent)
JKQTPRangeBase::JKQTPRangeBase(JKQTBasePlotter* parent):
JKQTPPlotElement(parent)
{
centerColor=QColor("red");
centerStyle=Qt::SolidLine;
@ -62,6 +62,185 @@ JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTBasePlotter* parent):
fillRange=true;
}
QColor JKQTPRangeBase::getKeyLabelColor() const
{
return centerColor;
}
void JKQTPRangeBase::setDrawCenterLineOnly()
{
plotCenterLine=true;
plotRange=false;
}
void JKQTPRangeBase::setColor(QColor c)
{
setLineColor(c);
centerColor=c;
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
}
void JKQTPRangeBase::setCenterColor(const QColor &__value)
{
this->centerColor = __value;
}
QColor JKQTPRangeBase::getCenterColor() const
{
return this->centerColor;
}
void JKQTPRangeBase::setCenterStyle(Qt::PenStyle __value)
{
this->centerStyle = __value;
}
Qt::PenStyle JKQTPRangeBase::getCenterStyle() const
{
return this->centerStyle;
}
void JKQTPRangeBase::setCenterLineWidth(double __value)
{
this->centerLineWidth = __value;
}
double JKQTPRangeBase::getCenterLineWidth() const
{
return this->centerLineWidth;
}
void JKQTPRangeBase::setRangeMin(double __value)
{
this->rangeMin = __value;
}
double JKQTPRangeBase::getRangeMin() const
{
return this->rangeMin;
}
void JKQTPRangeBase::setRangeMax(double __value)
{
this->rangeMax = __value;
}
double JKQTPRangeBase::getRangeMax() const
{
return this->rangeMax;
}
void JKQTPRangeBase::setSizeMin(double __value)
{
this->unlimitedSizeMin=false;
this->sizeMin = __value;
}
double JKQTPRangeBase::getSizeMin() const
{
return this->sizeMin;
}
void JKQTPRangeBase::setSizeMax(double __value)
{
this->unlimitedSizeMax=false;
this->sizeMax = __value;
}
double JKQTPRangeBase::getSizeMax() const
{
return this->sizeMax;
}
void JKQTPRangeBase::setUnlimitedSizeMin(bool __value)
{
this->unlimitedSizeMin = __value;
}
bool JKQTPRangeBase::getUnlimitedSizeMin() const
{
return this->unlimitedSizeMin;
}
void JKQTPRangeBase::setUnlimitedSizeMax(bool __value)
{
this->unlimitedSizeMax = __value;
}
bool JKQTPRangeBase::getUnlimitedSizeMax() const
{
return this->unlimitedSizeMax;
}
void JKQTPRangeBase::setRangeCenter(double __value)
{
this->rangeCenter = __value;
}
double JKQTPRangeBase::getRangeCenter() const
{
return this->rangeCenter;
}
void JKQTPRangeBase::setPlotCenterLine(bool __value)
{
this->plotCenterLine = __value;
}
bool JKQTPRangeBase::getPlotCenterLine() const
{
return this->plotCenterLine;
}
void JKQTPRangeBase::setInvertedRange(bool __value)
{
this->invertedRange = __value;
}
bool JKQTPRangeBase::getInvertedRange() const
{
return this->invertedRange;
}
void JKQTPRangeBase::setPlotRange(bool __value)
{
this->plotRange = __value;
}
bool JKQTPRangeBase::getPlotRange() const
{
return this->plotRange;
}
void JKQTPRangeBase::setFillRange(bool __value)
{
this->fillRange = __value;
}
bool JKQTPRangeBase::getFillRange() const
{
return this->fillRange;
}
void JKQTPRangeBase::setPlotRangeLines(bool __value)
{
this->plotRangeLines = __value;
}
bool JKQTPRangeBase::getPlotRangeLines() const
{
return this->plotRangeLines;
}
JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTBasePlotter* parent):
JKQTPRangeBase(parent)
{
}
JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTPlotter* parent):
JKQTPHorizontalRange(parent->getPlotter())
@ -175,175 +354,6 @@ bool JKQTPHorizontalRange::getYMinMax(double &miny, double &maxy, double &smalle
return true;
}
QColor JKQTPHorizontalRange::getKeyLabelColor() const
{
return centerColor;
}
void JKQTPHorizontalRange::setDrawCenterLineOnly()
{
plotCenterLine=true;
plotRange=false;
}
void JKQTPHorizontalRange::setColor(QColor c)
{
setLineColor(c);
centerColor=c;
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
}
void JKQTPHorizontalRange::setCenterColor(const QColor &__value)
{
this->centerColor = __value;
}
QColor JKQTPHorizontalRange::getCenterColor() const
{
return this->centerColor;
}
void JKQTPHorizontalRange::setCenterStyle(Qt::PenStyle __value)
{
this->centerStyle = __value;
}
Qt::PenStyle JKQTPHorizontalRange::getCenterStyle() const
{
return this->centerStyle;
}
void JKQTPHorizontalRange::setCenterLineWidth(double __value)
{
this->centerLineWidth = __value;
}
double JKQTPHorizontalRange::getCenterLineWidth() const
{
return this->centerLineWidth;
}
void JKQTPHorizontalRange::setRangeMin(double __value)
{
this->rangeMin = __value;
}
double JKQTPHorizontalRange::getRangeMin() const
{
return this->rangeMin;
}
void JKQTPHorizontalRange::setRangeMax(double __value)
{
this->rangeMax = __value;
}
double JKQTPHorizontalRange::getRangeMax() const
{
return this->rangeMax;
}
void JKQTPHorizontalRange::setSizeMin(double __value)
{
this->sizeMin = __value;
}
double JKQTPHorizontalRange::getSizeMin() const
{
return this->sizeMin;
}
void JKQTPHorizontalRange::setSizeMax(double __value)
{
this->sizeMax = __value;
}
double JKQTPHorizontalRange::getSizeMax() const
{
return this->sizeMax;
}
void JKQTPHorizontalRange::setUnlimitedSizeMin(bool __value)
{
this->unlimitedSizeMin = __value;
}
bool JKQTPHorizontalRange::getUnlimitedSizeMin() const
{
return this->unlimitedSizeMin;
}
void JKQTPHorizontalRange::setUnlimitedSizeMax(bool __value)
{
this->unlimitedSizeMax = __value;
}
bool JKQTPHorizontalRange::getUnlimitedSizeMax() const
{
return this->unlimitedSizeMax;
}
void JKQTPHorizontalRange::setRangeCenter(double __value)
{
this->rangeCenter = __value;
}
double JKQTPHorizontalRange::getRangeCenter() const
{
return this->rangeCenter;
}
void JKQTPHorizontalRange::setPlotCenterLine(bool __value)
{
this->plotCenterLine = __value;
}
bool JKQTPHorizontalRange::getPlotCenterLine() const
{
return this->plotCenterLine;
}
void JKQTPHorizontalRange::setInvertedRange(bool __value)
{
this->invertedRange = __value;
}
bool JKQTPHorizontalRange::getInvertedRange() const
{
return this->invertedRange;
}
void JKQTPHorizontalRange::setPlotRange(bool __value)
{
this->plotRange = __value;
}
bool JKQTPHorizontalRange::getPlotRange() const
{
return this->plotRange;
}
void JKQTPHorizontalRange::setFillRange(bool __value)
{
this->fillRange = __value;
}
bool JKQTPHorizontalRange::getFillRange() const
{
return this->fillRange;
}
void JKQTPHorizontalRange::setPlotRangeLines(bool __value)
{
this->plotRangeLines = __value;
}
bool JKQTPHorizontalRange::getPlotRangeLines() const
{
return this->plotRangeLines;
}
@ -354,12 +364,12 @@ bool JKQTPHorizontalRange::getPlotRangeLines() const
JKQTPVerticalRange::JKQTPVerticalRange(JKQTBasePlotter* parent):
JKQTPHorizontalRange(parent)
JKQTPRangeBase(parent)
{
}
JKQTPVerticalRange::JKQTPVerticalRange(JKQTPlotter* parent):
JKQTPHorizontalRange(parent)
JKQTPVerticalRange(parent->getPlotter())
{
}

View File

@ -44,119 +44,145 @@ class JKQTPDatastore;
/*! \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
or a range of interest, or the range of good values, ...
\ingroup jkqtplotter_diverse
\image html JKQTPHorizontalRange.png
/** \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
* or a range of interest, or the range of good values, ...
* \ingroup jkqtplotter_annotations
*
* \image html JKQTPRangeBase.png
*
* You can also invert the range, i.e. everything outside the range will be filled (\c setInvertedRange() ):
*
* \image html JKQTPRangeBase_Inverted.png
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPHorizontalRange: public JKQTPGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
class JKQTPLOTTER_LIB_EXPORT JKQTPRangeBase: public JKQTPPlotElement, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
Q_OBJECT
public:
/** \brief class constructor */
JKQTPHorizontalRange(JKQTBasePlotter* parent=nullptr);
/** \brief class constructor */
JKQTPHorizontalRange(JKQTPlotter* parent);
JKQTPRangeBase(JKQTBasePlotter* parent=nullptr);
/** \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 get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \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!
*/
bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() const override;
/** \brief disables all drawing features except the centerline */
void setDrawCenterLineOnly();
/*! \brief set the color of the graph (all lines and filling) */
virtual void setColor(QColor c);
/*! \copydoc centerColor */
void setCenterColor(const QColor & __value);
/*! \copydoc centerColor */
QColor getCenterColor() const;
/*! \copydoc centerStyle */
void setCenterStyle(Qt::PenStyle __value);
/*! \copydoc centerStyle */
Qt::PenStyle getCenterStyle() const;
/*! \copydoc centerLineWidth */
void setCenterLineWidth(double __value);
/*! \copydoc centerLineWidth */
double getCenterLineWidth() const;
/*! \copydoc rangeMin */
void setRangeMin(double __value);
/*! \copydoc rangeMin */
double getRangeMin() const;
/*! \copydoc rangeMax */
void setRangeMax(double __value);
/*! \copydoc rangeMax */
double getRangeMax() const;
/*! \copydoc sizeMin */
void setSizeMin(double __value);
/*! \copydoc sizeMin */
double getSizeMin() const;
/*! \copydoc sizeMax */
void setSizeMax(double __value);
/*! \copydoc sizeMax */
double getSizeMax() const;
/*! \copydoc unlimitedSizeMin */
void setUnlimitedSizeMin(bool __value);
/*! \copydoc unlimitedSizeMin */
bool getUnlimitedSizeMin() const;
/*! \copydoc unlimitedSizeMax */
void setUnlimitedSizeMax(bool __value);
/*! \copydoc unlimitedSizeMax */
bool getUnlimitedSizeMax() const;
/*! \copydoc rangeCenter */
void setRangeCenter(double __value);
/*! \copydoc rangeCenter */
double getRangeCenter() const;
/*! \copydoc plotCenterLine */
void setPlotCenterLine(bool __value);
/*! \copydoc plotCenterLine */
bool getPlotCenterLine() const;
/*! \copydoc invertedRange */
void setInvertedRange(bool __value);
/*! \copydoc invertedRange */
bool getInvertedRange() const;
/*! \copydoc plotRange */
void setPlotRange(bool __value);
/*! \copydoc plotRange */
bool getPlotRange() const;
/*! \copydoc fillRange */
void setFillRange(bool __value);
/*! \copydoc fillRange */
bool getFillRange() const;
/*! \copydoc plotRangeLines */
void setPlotRangeLines(bool __value);
/*! \copydoc plotRangeLines */
bool getPlotRangeLines() const;
public slots:
/*! \brief set the color of the graph (all lines and filling) */
virtual void setColor(QColor c);
/** \brief disables all drawing features except the centerline */
void setDrawCenterLineOnly();
/*! \copydoc centerColor */
void setCenterColor(const QColor & __value);
/*! \copydoc centerStyle */
void setCenterStyle(Qt::PenStyle __value);
/*! \copydoc plotRangeLines */
void setPlotRangeLines(bool __value);
/*! \copydoc fillRange */
void setFillRange(bool __value);
/*! \copydoc plotRange */
void setPlotRange(bool __value);
/*! \copydoc invertedRange */
void setInvertedRange(bool __value);
/*! \copydoc rangeCenter */
void setRangeCenter(double __value);
/*! \copydoc plotCenterLine */
void setPlotCenterLine(bool __value);
/*! \copydoc unlimitedSizeMax */
void setUnlimitedSizeMax(bool __value);
/*! \copydoc unlimitedSizeMin */
void setUnlimitedSizeMin(bool __value);
/** \copydoc sizeMax
*
* \note this also sets unlimitedSizeMax to \c true
* \see unlimitedSizeMax
*/
void setSizeMax(double __value);
/** \copydoc sizeMin
*
* \note this also sets unlimitedSizeMin to \c true
* \see unlimitedSizeMin
*/
void setSizeMin(double __value);
/** \copydoc rangeMax*/
void setRangeMax(double __value);
/** \copydoc rangeMin*/
void setRangeMin(double __value);
protected:
/** \brief min-value of range */
/** \brief min-value of range
* \image html JKQTPRangeBase.png
*/
double rangeMin;
/** \brief max-value of range */
/** \brief max-value of range
* \image html JKQTPRangeBase.png
*/
double rangeMax;
/** \brief where to plot the center line */
/** \brief where to plot the center line
* \image html JKQTPRangeBase.png
*/
double rangeCenter;
/** \brief if \c unlimitedSizeMin==false, then the range rectangle only extends to this value on the axis perpendicular to the range axis (towards smaller numbers)
*
* \image html JKQTPRangeBase.png
* \see unlimitedSizeMin
*/
double sizeMin;
/** \brief if \c unlimitedSizeMax==false, then the range rectangle only extends to this value on the axis perpendicular to the range axis (towards larger numbers)
*
* \image html JKQTPRangeBase.png
* \see unlimitedSizeMax
*/
double sizeMax;
/** \brief if \c true, the range elongates infinitely in the direction perpendicular to the range axis and towards smaller numbers, otherwise the range rectangle stops at rangeMin
*
* \image html JKQTPRangeBase.png
* \see sizeMin
*/
bool unlimitedSizeMin;
/** \brief if \c true, the range elongates infinitely in the direction perpendicular to the range axis and towards larger numbers, otherwise the range rectangle stops at rangeMin
*
* \image html JKQTPRangeBase.png
* \see sizeMax
*/
bool unlimitedSizeMax;
/** \brief indicates whether to plot a center line */
bool plotCenterLine;
/** \brief if \c true, fills the parts outside the given range */
/** \brief if \c true, fills the parts outside the given range
*
* \image html JKQTPRangeBase_Inverted.png
*/
bool invertedRange;
/** \brief if \c true, the range is plotted, if \c false, only the center line is plotted (if \a plotCenterLine is \c true ) */
bool plotRange;
@ -177,14 +203,59 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPHorizontalRange: public JKQTPGraph, public JKQ
/*! \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
or a range of interest, or the range of good values, ...
\ingroup jkqtplotter_diverse
\image html JKQTPVerticalRange.png
/** \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
* or a range of interest, or the range of good values, ...
* \ingroup jkqtplotter_annotations
*
* \image html JKQTPHorizontalRange.png
*
* \see JKQTPVerticalRange
*
* <b>Explanation of basic features:</b>
*
* \copydetails JKQTPRangeBase
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPVerticalRange: public JKQTPHorizontalRange {
class JKQTPLOTTER_LIB_EXPORT JKQTPHorizontalRange: public JKQTPRangeBase {
Q_OBJECT
public:
/** \brief class constructor */
JKQTPHorizontalRange(JKQTBasePlotter* parent=nullptr);
/** \brief class constructor */
JKQTPHorizontalRange(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 get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \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!
*/
bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
};
/** \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
* or a range of interest, or the range of good values, ...
* \ingroup jkqtplotter_annotations
*
* \image html JKQTPVerticalRange.png
*
* \see JKQTPHorizontalRange
*
* <b>Explanation of basic features (using the example of JKQTPHorizontalRange):</b>
*
* \copydetails JKQTPRangeBase
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPVerticalRange: public JKQTPRangeBase {
Q_OBJECT
public:
/** \brief class constructor */

View File

@ -35,7 +35,7 @@
/*! \brief This implements a single vertical <a href="https://en.wikipedia.org/wiki/Violin_plot">Violin Plot</a> as a "geometric element"
\ingroup jkqtplotter_statgraphs
\ingroup jkqtplotter_geoplots
\ingroup jkqtplotter_diverse
Draws a vertical violin plot in one of the following styles:
@ -167,7 +167,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPViolinplotVerticalElement: public JKQTPPlotObj
/*! \brief This implements a single horizontal <a href="https://en.wikipedia.org/wiki/Violin_plot">Violin Plot</a> as a "geometric element"
\ingroup jkqtplotter_statgraphs
\ingroup jkqtplotter_geoplots
\ingroup jkqtplotter_diverse
Draws a horizontal violin plot in one of the following styles: