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-18 19:22:46 +08:00
|
|
|
#include "jkqtcommon/jkqtptools.h"
|
|
|
|
#include "jkqtcommon/jkqtp_imexport.h"
|
2018-12-19 00:13:18 +08:00
|
|
|
#include "jkqtplottertools/jkqtpimagetools.h"
|
|
|
|
#include "jkqtplotter/jkqtpgraphsbase.h"
|
2019-02-08 00:24:46 +08:00
|
|
|
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
|
2019-04-22 19:27:50 +08:00
|
|
|
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
2018-12-19 00:13:18 +08:00
|
|
|
#ifndef jkqtpgraphsbarchart_H
|
|
|
|
#define jkqtpgraphsbarchart_H
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \brief This implements a bar graph with bars starting at \f$ y=0 \f$ to \f$ y=f(x) \f$
|
2019-01-13 01:53:16 +08:00
|
|
|
\ingroup jkqtplotter_barssticks
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
This class plots a bargraph. This image explains the parameters:
|
|
|
|
|
|
|
|
\image html bargraph_basics.png
|
|
|
|
|
|
|
|
By default the sift parameter is, so the bar is centered at the x-value. The width is 0.9,
|
|
|
|
so adjacent bars are plotted with a small distance between them. It is possible to use these two parameters
|
2019-04-22 19:27:50 +08:00
|
|
|
to plot multiple bars for every x-value, by having on JKQTPSpecialLineHorizontalGraph object per
|
2018-11-25 21:53:26 +08:00
|
|
|
set of bars that belong together. For example for three bars per x-value one would set:
|
|
|
|
\verbatim
|
|
|
|
width=0.3
|
|
|
|
shift=-0.3 / 0 / +0.3
|
|
|
|
\endverbatim
|
|
|
|
This results in a bargraph, as shown here:
|
|
|
|
|
|
|
|
\image html plot_bargraphverplot.png
|
|
|
|
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
You can use JKQTPlotter::addHorizontalBargraph() to add a series of bargraphs, where the width and shift are determined
|
2018-11-25 21:53:26 +08:00
|
|
|
automatically. The y-columns are given as a QVector<int> to this function.
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
2019-04-22 19:27:50 +08:00
|
|
|
class JKQTP_LIB_EXPORT JKQTPBarVerticalGraph: public JKQTPXYGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
|
2018-11-25 21:53:26 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarVerticalGraph(JKQTBasePlotter* parent=nullptr);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief class constructor */
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarVerticalGraph(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;
|
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
|
|
|
|
|
|
|
/** \brief finds all bar charts of the same orientation and determines width and shift, so they stand side by side
|
|
|
|
*
|
|
|
|
* \param maxWidth the maximum (relative) width, that all bars will span of the (doubled) inter-bar distance
|
|
|
|
* \param shrinkFactor factor, by which the bar are shrinked compared to the available space
|
|
|
|
*
|
2019-01-20 17:49:29 +08:00
|
|
|
* \note This function will scale ALL graphs of the parent plot, which were derived from JKQTPBarHorizontalGraph, that match in orientation (as returned by isHorizontal() ).
|
2018-11-25 21:53:26 +08:00
|
|
|
*/
|
|
|
|
virtual void autoscaleBarWidthAndShift(double maxWidth=0.9, double shrinkFactor=0.8);
|
2019-04-22 19:27:50 +08:00
|
|
|
|
|
|
|
/** \brief equivalent to \c autoscaleBarWidthAndShift(groupWidth,1);
|
|
|
|
*/
|
2018-11-25 21:53:26 +08:00
|
|
|
void autoscaleBarWidthAndShiftSeparatedGroups(double groupWidth=0.75);
|
|
|
|
|
2019-04-22 19:27:50 +08:00
|
|
|
/** \brief retruns \c true, if the bars are horizontal (JKQTPBarHorizontalGraph) and \c false if they are vertical (JKQTPBarVerticalGraph) */
|
2018-11-25 21:53:26 +08:00
|
|
|
virtual bool isHorizontal() const;
|
|
|
|
|
2019-04-22 19:27:50 +08:00
|
|
|
/** \brief set outline and fill color at the same time
|
|
|
|
* \see setFillColor_and_darkenedColor()
|
|
|
|
*/
|
|
|
|
virtual void setColor(QColor c);
|
|
|
|
|
2019-05-19 04:41:38 +08:00
|
|
|
/*! \copydoc shift */
|
2019-04-22 19:27:50 +08:00
|
|
|
void setShift(double __value);
|
2019-05-19 04:41:38 +08:00
|
|
|
/*! \copydoc shift */
|
2019-04-22 19:27:50 +08:00
|
|
|
double getShift() const;
|
2019-05-19 04:41:38 +08:00
|
|
|
/*! \copydoc width */
|
2019-04-22 19:27:50 +08:00
|
|
|
void setWidth(double __value);
|
2019-05-19 04:41:38 +08:00
|
|
|
/*! \copydoc width */
|
2019-04-22 19:27:50 +08:00
|
|
|
double getWidth() const;
|
2019-05-19 04:41:38 +08:00
|
|
|
/*! \copydoc baseline */
|
2019-04-22 19:27:50 +08:00
|
|
|
void setBaseline(double __value);
|
2019-05-19 04:41:38 +08:00
|
|
|
/*! \copydoc baseline */
|
2019-04-22 19:27:50 +08:00
|
|
|
double getBaseline() const;
|
|
|
|
/** \brief sets the fill color and the color together, where fillColor is set to \a fill and the line-color is set to \c fill.darker(colorDarker)
|
|
|
|
* \see setColor()
|
|
|
|
*/
|
2019-01-26 20:00:40 +08:00
|
|
|
void setFillColor_and_darkenedColor(QColor fill, int colorDarker=200);
|
2018-11-25 21:53:26 +08:00
|
|
|
protected:
|
|
|
|
/** \brief the width of the bargraphs, relative to the distance between the current and the next x-value
|
|
|
|
*
|
|
|
|
* See the following graphic to understand this concept:
|
|
|
|
* \image html bargraph_basics.png
|
|
|
|
*/
|
|
|
|
double width;
|
|
|
|
/** \brief the shift of the bargraphs, relative to the distance between the current and the next x-value
|
|
|
|
*
|
|
|
|
* See the following graphic to understand this concept:
|
|
|
|
* \image html bargraph_basics.png
|
|
|
|
*/
|
|
|
|
double shift;
|
|
|
|
|
|
|
|
/** \brief baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!)
|
|
|
|
*/
|
|
|
|
double baseline;
|
|
|
|
|
|
|
|
|
|
|
|
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint
|
|
|
|
*
|
2019-01-20 17:49:29 +08:00
|
|
|
* \note This function returns \a baseline in this implementation. It is implemented in the derived classes JKQTPBarVerticalStackableGraph
|
|
|
|
* and JKQTPBarHorizontalStackableGraph. The function is placed here, so the plotting does not have to be reimplemented in the
|
2018-11-25 21:53:26 +08:00
|
|
|
* derived classes that allow for stacking, but can be implemented once centrally.
|
|
|
|
*/
|
|
|
|
virtual double getStackedMax(int index) const;
|
|
|
|
|
|
|
|
/** \brief calls getStackedMax() on the stack parent (if available)
|
|
|
|
*
|
2019-01-20 17:49:29 +08:00
|
|
|
* \note This function returns \c 0.0 in this implementation. It is implemented in the derived classes JKQTPBarVerticalStackableGraph
|
|
|
|
* and JKQTPBarHorizontalStackableGraph. The function is placed here, so the plotting does not have to be reimplemented in the
|
2018-11-25 21:53:26 +08:00
|
|
|
* derived classes that allow for stacking, but can be implemented once centrally.
|
|
|
|
*/
|
|
|
|
virtual double getParentStackedMax(int index) const;
|
|
|
|
|
|
|
|
/** \brief returns \c true, if a stack parent is set (if available)
|
|
|
|
*
|
2019-01-20 17:49:29 +08:00
|
|
|
* \note This function returns \c false in this implementation. It is implemented in the derived classes JKQTPBarVerticalStackableGraph
|
|
|
|
* and JKQTPBarHorizontalStackableGraph. The function is placed here, so the plotting does not have to be reimplemented in the
|
2018-11-25 21:53:26 +08:00
|
|
|
* derived classes that allow for stacking, but can be implemented once centrally.
|
|
|
|
*/
|
|
|
|
virtual bool hasStackParent() const;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \brief This implements a bar graph with bars starting at \f$ y=0 \f$ to \f$ y=f(x) \f$
|
|
|
|
* Optionally several graphs of this type may be stacked on top of each other
|
2019-01-13 01:53:16 +08:00
|
|
|
* \ingroup jkqtplotter_barssticks
|
2018-11-25 21:53:26 +08:00
|
|
|
*
|
2019-01-26 20:00:40 +08:00
|
|
|
* Draw stacked barcharts by connecting several plots by calling \c setStackedParent(belowPlot) for each plot
|
2019-01-20 17:49:29 +08:00
|
|
|
* \image html JKQTPBarVerticalGraphStacked.png
|
2018-11-25 21:53:26 +08:00
|
|
|
*
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
class JKQTP_LIB_EXPORT JKQTPBarVerticalStackableGraph: public JKQTPBarVerticalGraph {
|
2018-11-25 21:53:26 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarVerticalStackableGraph(JKQTBasePlotter* parent=nullptr);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief class constructor */
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarVerticalStackableGraph(JKQTPlotter* parent);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief stacks this barchart upon the given \a parentGraph */
|
2019-01-20 17:49:29 +08:00
|
|
|
void stackUpon(JKQTPBarVerticalStackableGraph* parentGraph);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief unstacks this graph (i.e. deletes the parent graph in the stack) */
|
|
|
|
void dontStackUpon();
|
|
|
|
/** \brief returns the stack parent graph, or \c nullptr */
|
2019-01-20 17:49:29 +08:00
|
|
|
const JKQTPBarVerticalStackableGraph* getStackParent() const;
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/** \brief if set (!=nullptr), the current plot is drawn stacked onto this plot
|
|
|
|
*
|
2019-01-26 20:00:40 +08:00
|
|
|
* draw stacked barcharts by connecting several plots by calling \c setStackedParent(belowPlot) for each plot
|
2018-11-25 21:53:26 +08:00
|
|
|
*/
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarVerticalStackableGraph* stackParent;
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual double getStackedMax(int index) const override;
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief calls getStackedMax() on the stack parent (if available), or \c 0.0 */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual double getParentStackedMax(int index) const override;
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
/** \brief returns \c true, if a stack parent is set (if available) */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual bool hasStackParent() const override;
|
2018-11-25 21:53:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*! \brief This implements a bar graph with bars starting at \f$ y=0 \f$ to \f$ y=f(x) \f$
|
|
|
|
* and error indicator
|
2019-01-13 01:53:16 +08:00
|
|
|
* \ingroup jkqtplotter_barssticks
|
2018-11-25 21:53:26 +08:00
|
|
|
*
|
2019-01-20 17:49:29 +08:00
|
|
|
* This works much the same as JKQTPBarHorizontalGraph. Here is an example output:
|
2018-11-25 21:53:26 +08:00
|
|
|
* \image html plot_bargraphverploterr.png
|
|
|
|
*
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
class JKQTP_LIB_EXPORT JKQTPBarVerticalErrorGraph: public JKQTPBarVerticalGraph, public JKQTPYGraphErrors {
|
2018-11-25 21:53:26 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarVerticalErrorGraph(JKQTBasePlotter* parent=nullptr);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief class constructor */
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarVerticalErrorGraph(JKQTPlotter* parent);
|
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
|
|
|
/** \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
|
|
|
|
|
|
|
protected:
|
|
|
|
/** \brief this function is used to plot error inidcators before plotting the graphs. */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
|
2018-11-25 21:53:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \brief This implements a bar graph with bars starting at \f$ x=0 \f$ to \f$ x=f(y) \f$
|
2019-01-13 01:53:16 +08:00
|
|
|
\ingroup jkqtplotter_barssticks
|
2018-11-25 21:53:26 +08:00
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
This works much the same as JKQTPBarHorizontalGraph. Here is an example output:
|
2018-11-25 21:53:26 +08:00
|
|
|
\image html plot_bargraphhorplot.png
|
|
|
|
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
class JKQTP_LIB_EXPORT JKQTPBarHorizontalGraph: public JKQTPBarVerticalGraph {
|
2018-11-25 21:53:26 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarHorizontalGraph(JKQTBasePlotter* parent=nullptr);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief class constructor */
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarHorizontalGraph(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 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-28 05:52:00 +08:00
|
|
|
virtual bool isHorizontal() const override;
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \brief This implements a bar graph with bars starting at \f$ y=0 \f$ to \f$ y=f(x) \f$
|
|
|
|
* Optionally several graphs of this type may be stacked on top of each other
|
2019-01-13 01:53:16 +08:00
|
|
|
* \ingroup jkqtplotter_barssticks
|
2018-11-25 21:53:26 +08:00
|
|
|
*
|
2019-01-26 20:00:40 +08:00
|
|
|
* Draw stacked barcharts by connecting several plots by calling \c setStackedParent(belowPlot) for each plot
|
2019-01-20 17:49:29 +08:00
|
|
|
* \image html JKQTPBarHorizontalGraphStacked.png
|
2018-11-25 21:53:26 +08:00
|
|
|
*
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
class JKQTP_LIB_EXPORT JKQTPBarHorizontalStackableGraph: public JKQTPBarHorizontalGraph {
|
2018-11-25 21:53:26 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarHorizontalStackableGraph(JKQTBasePlotter* parent=nullptr);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief class constructor */
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarHorizontalStackableGraph(JKQTPlotter* parent);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief stacks this barchart upon the given \a parentGraph */
|
2019-01-20 17:49:29 +08:00
|
|
|
void stackUpon(JKQTPBarHorizontalStackableGraph* parentGraph);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief unstacks this graph (i.e. deletes the parent graph in the stack) */
|
|
|
|
void dontStackUpon();
|
|
|
|
/** \brief returns the stack parent graph, or \c nullptr */
|
2019-01-20 17:49:29 +08:00
|
|
|
const JKQTPBarHorizontalStackableGraph* getStackParent() const;
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/** \brief if set (!=nullptr), the current plot is drawn stacked onto this plot
|
|
|
|
*
|
2019-01-26 20:00:40 +08:00
|
|
|
* draw stacked barcharts by connecting several plots by calling \c setStackedParent(belowPlot) for each plot
|
2018-11-25 21:53:26 +08:00
|
|
|
*/
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarHorizontalStackableGraph* stackParent;
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual double getStackedMax(int index) const override;
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief calls getStackedMax() on the stack parent (if available), or \c 0.0 */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual double getParentStackedMax(int index) const override;
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
/** \brief returns \c true, if a stack parent is set (if available) */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual bool hasStackParent() const override;
|
2018-11-25 21:53:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*! \brief This implements a bar graph with bars starting at \f$ x=0 \f$ to \f$ x=f(y) \f$
|
|
|
|
* and error indicator
|
2019-01-13 01:53:16 +08:00
|
|
|
* \ingroup jkqtplotter_barssticks
|
2018-11-25 21:53:26 +08:00
|
|
|
*
|
2019-01-20 17:49:29 +08:00
|
|
|
* This works much the same as JKQTPBarHorizontalGraph. Here is an example output:
|
2018-11-25 21:53:26 +08:00
|
|
|
* \image html plot_bargraphhorploterr.png
|
|
|
|
*
|
|
|
|
*/
|
2019-02-03 21:04:48 +08:00
|
|
|
class JKQTP_LIB_EXPORT JKQTPBarHorizontalErrorGraph: public JKQTPBarHorizontalGraph, public JKQTPXGraphErrors {
|
2018-11-25 21:53:26 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarHorizontalErrorGraph(JKQTBasePlotter* parent=nullptr);
|
2018-11-25 21:53:26 +08:00
|
|
|
/** \brief class constructor */
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarHorizontalErrorGraph(JKQTPlotter* parent);
|
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
|
|
|
/** \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
|
|
|
|
|
|
|
protected:
|
|
|
|
/** \brief this function is used to plot error inidcators before plotting the graphs. */
|
2018-12-28 05:52:00 +08:00
|
|
|
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
|
2018-11-25 21:53:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-19 00:13:18 +08:00
|
|
|
#endif // jkqtpgraphsbarchart_H
|