2019-04-22 19:27:50 +08:00
|
|
|
/*
|
2020-08-26 18:58:23 +08:00
|
|
|
Copyright (c) 2008-2020 Jan W. Krieger (<jan@jkrieger.de>)
|
2019-04-22 19:27:50 +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.1 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/>.
|
|
|
|
*/
|
|
|
|
|
2022-04-25 04:07:39 +08:00
|
|
|
#ifndef jkqtpgraphsspecialline_H
|
|
|
|
#define jkqtpgraphsspecialline_H
|
|
|
|
|
2019-04-22 19:27:50 +08:00
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QPair>
|
2019-05-30 04:40:02 +08:00
|
|
|
#include "jkqtplotter/jkqtptools.h"
|
2019-06-22 20:21:32 +08:00
|
|
|
#include "jkqtplotter/jkqtplotter_imexport.h"
|
2019-05-30 04:40:02 +08:00
|
|
|
#include "jkqtcommon/jkqtpdrawingtools.h"
|
2019-04-22 19:27:50 +08:00
|
|
|
#include "jkqtplotter/jkqtpgraphsbase.h"
|
2019-05-30 04:40:02 +08:00
|
|
|
#include "jkqtcommon/jkqtpenhancedpainter.h"
|
2019-04-22 19:27:50 +08:00
|
|
|
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
|
2019-06-20 22:06:31 +08:00
|
|
|
#include "jkqtplotter/graphs/jkqtprange.h"
|
2019-04-22 19:27:50 +08:00
|
|
|
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
|
|
|
|
|
|
|
// forward declarations
|
|
|
|
class JKQTBasePlotter;
|
|
|
|
class JKQTPlotter;
|
|
|
|
class JKQTPCoordinateAxis;
|
|
|
|
class JKQTPDatastore;
|
2019-05-30 04:40:02 +08:00
|
|
|
//class JKQTPColorPaletteStyleAndToolsMixin;
|
2019-04-22 19:27:50 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 01:06:01 +08:00
|
|
|
/** \brief a Base class for special line graphs (steps ...) like e.g. JKQTPSpecialLineHorizontalGraph
|
|
|
|
* \ingroup jkqtplotter_linesymbolgraphs_simple
|
|
|
|
*
|
|
|
|
* \image html stepplots.png
|
|
|
|
*
|
|
|
|
* \see JKQTPSpecialLineHorizontalGraph, JKQTPSpecialLineVerticalGraph
|
2019-04-22 19:27:50 +08:00
|
|
|
*/
|
2020-09-20 01:06:01 +08:00
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPSpecialLineGraphBase: public JKQTPXYBaselineGraph, public JKQTPGraphLineAndFillStyleMixin, public JKQTPGraphSymbolStyleMixin {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
|
|
|
explicit JKQTPSpecialLineGraphBase(JKQTBasePlotter* parent=nullptr);
|
|
|
|
|
|
|
|
/** \brief returns the color to be used for the key label */
|
|
|
|
virtual QColor getKeyLabelColor() const override;
|
|
|
|
/** \brief plots a key marker inside the specified rectangle \a rect */
|
|
|
|
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
|
|
|
|
|
|
|
|
|
|
|
/** \copydoc m_drawSymbols */
|
|
|
|
bool getDrawSymbols() const;
|
|
|
|
/** \copydoc m_specialLineType */
|
|
|
|
JKQTPSpecialLineType getSpecialLineType() const;
|
|
|
|
|
|
|
|
Q_PROPERTY(bool drawSymbols READ getDrawSymbols WRITE setDrawSymbols)
|
|
|
|
Q_PROPERTY(JKQTPSpecialLineType specialLineType READ getSpecialLineType WRITE setSpecialLineType)
|
|
|
|
public slots:
|
|
|
|
/** \brief set line-color, fill color and symbol color */
|
|
|
|
void setColor(QColor c);
|
|
|
|
/** \copydoc m_drawSymbols */
|
|
|
|
void setDrawSymbols(bool __value);
|
|
|
|
/** \copydoc m_specialLineType */
|
|
|
|
void setSpecialLineType(const JKQTPSpecialLineType & __value);
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/** \brief indicates whether to draw a symbols at the datapoints, or not */
|
|
|
|
bool m_drawSymbols;
|
|
|
|
/** \brief type of connecting (step)lines */
|
|
|
|
JKQTPSpecialLineType m_specialLineType;
|
2019-04-22 19:27:50 +08:00
|
|
|
|
|
|
|
|
2020-09-20 01:06:01 +08:00
|
|
|
};
|
2020-09-19 20:55:46 +08:00
|
|
|
|
2020-09-19 21:08:32 +08:00
|
|
|
|
2020-09-20 01:06:01 +08:00
|
|
|
/** \brief This implements a step plot with values \f$ \left(x, f(x) \right) \f$
|
|
|
|
* \ingroup jkqtplotter_linesymbolgraphs_simple
|
|
|
|
*
|
|
|
|
* \image html stepplots.png
|
|
|
|
*
|
|
|
|
* \see JKQTPSpecialLineVerticalGraph, \ref JKQTPlotterSpecialStepLinePlot
|
|
|
|
*/
|
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPSpecialLineHorizontalGraph: public JKQTPSpecialLineGraphBase {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
|
|
|
JKQTPSpecialLineHorizontalGraph(JKQTBasePlotter* parent=nullptr);
|
|
|
|
/** \brief class constructor */
|
|
|
|
JKQTPSpecialLineHorizontalGraph(JKQTPlotter* parent);
|
2020-09-19 20:55:46 +08:00
|
|
|
|
2020-09-20 01:06:01 +08:00
|
|
|
/** \brief plots the graph to the plotter object specified as parent */
|
|
|
|
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
2020-09-19 21:08:32 +08:00
|
|
|
|
2020-09-20 01:06:01 +08:00
|
|
|
protected:
|
2019-04-22 19:27:50 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \brief This implements a step plot with values \f$ \left(f(y), y \right) \f$
|
|
|
|
\ingroup jkqtplotter_linesymbolgraphs_simple
|
|
|
|
|
2019-06-21 04:24:47 +08:00
|
|
|
\image html stepplots_vertical.png
|
2019-04-22 19:27:50 +08:00
|
|
|
|
2020-09-20 01:06:01 +08:00
|
|
|
\see JKQTPSpecialLineHorizontalGraph, \ref JKQTPlotterSpecialStepLinePlot
|
2019-04-22 19:27:50 +08:00
|
|
|
*/
|
2020-09-20 01:06:01 +08:00
|
|
|
class JKQTPLOTTER_LIB_EXPORT JKQTPSpecialLineVerticalGraph: public JKQTPSpecialLineGraphBase {
|
2019-04-22 19:27:50 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
/** \brief class constructor */
|
|
|
|
JKQTPSpecialLineVerticalGraph(JKQTBasePlotter* parent=nullptr);
|
|
|
|
/** \brief class constructor */
|
|
|
|
JKQTPSpecialLineVerticalGraph(JKQTPlotter* parent);
|
|
|
|
|
|
|
|
/** \brief plots the graph to the plotter object specified as parent */
|
|
|
|
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // jkqtpgraphsspecialline_H
|