JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches
jkqtpimpulses.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>)
3
4
5
6 This software is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License (LGPL) as published by
8 the Free Software Foundation, either version 2.1 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License (LGPL) for more details.
15
16 You should have received a copy of the GNU Lesser General Public License (LGPL)
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef jkqtpgraphsimpulses_H
21#define jkqtpgraphsimpulses_H
22
23#include "jkqtplotter/jkqtplotter_imexport.h"
24#include "jkqtplotter/jkqtpgraphsbase.h"
25#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
26#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
27
28
29
30/** \brief This is a base class for all impulse graphs
31 * \ingroup jkqtplotter_sticks
32 *
33 * \image html JKQTPImpulsesVerticalGraph.png "default style for impulse graphs"
34 *
35 * \image html JKQTPImpulsesVerticalGraph_Symbols.png "setDrawSymbols(true);"
36 *
37 * \image html JKQTPImpulsesVerticalGraphBaseline.png "setDrawBaseline(true);"
38 *
39 * \see JKQTPImpulsesHorizontalGraph, JKQTPImpulsesVerticalGraph
40 */
42 Q_OBJECT
43public:
44 /** \brief class constructor */
46
47
48 /** \brief returns the color to be used for the key label */
49 virtual QColor getKeyLabelColor() const override;
50 /** \copydoc drawSymbols */
51 bool getDrawSymbols() const;
52 /** \copydoc m_drawBaseline */
53 bool getDrawBaseline() const;
54 /** \copydoc m_baselineStyle */
56 /** \copydoc m_baselineStyle */
58
59
60public Q_SLOTS:
61 /** \brief color of symbols and impulses in one call */
62 virtual void setColor(QColor c);
63
64 /** \copydoc drawSymbols */
65 void setDrawSymbols(bool __value);
66 /** \copydoc m_drawBaseline */
67 void setDrawBaseline(bool __value);
68
69protected:
70
71 /** \brief indicates whether to draw symbols at the top of the impulse
72 *
73 * \image html JKQTPImpulsesVerticalGraph_Symbols.png "setDrawSymbols(true)"
74 */
76 /** \brief if m_drawBaseline \c ==true then this style is used to draw the baseline
77 *
78 * \see baselineStyle() , setDrawBaseline() , m_drawBaseline
79 */
81 /** \brief indicates whether to draw a line with style m_baselineStyle at the baseline-value
82 *
83 * \image html JKQTPImpulsesVerticalGraphBaseline.png "setDrawBaseline(true);"
84 * \image html JKQTPImpulsesVerticalGraphNoBaseline.png "setDrawBaseline(false);"
85 *
86 * \see baselineStyle() , setDrawBaseline() , m_baselineStyle
87 */
89
90 /** \brief get the maximum and minimum value in the impulse-elongation (i.e. value) direction of the graph
91 *
92 * The result is given in the two parameters which are call-by-reference parameters!
93 */
94 bool getValuesMinMax(double& mmin, double& mmax, double& smallestGreaterZero) ;
95 /** \brief get the maximum and minimum value of the impulse positions of the graph
96 *
97 * The result is given in the two parameters which are call-by-reference parameters!
98 */
99 bool getPositionsMinMax(double& mmin, double& mmax, double& smallestGreaterZero) ;
100
101};
102
103
104/** \brief This implements an impulse plot with horizontal impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
105 * \ingroup jkqtplotter_sticks
106 *
107 * \image html JKQTPImpulsesHorizontalGraph.png
108 *
109 * \see JKQTPImpulsesVerticalGraph, \ref JKQTPlotterImpulsePlots
110 */
112 Q_OBJECT
113public:
114 /** \brief class constructor */
116 /** \brief class constructor */
118
119 /** \brief plots the graph to the plotter object specified as parent */
120 virtual void draw(JKQTPEnhancedPainter& painter) override;
121 /** \brief plots a key marker inside the specified rectangle \a rect */
122 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
123 /** \brief returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
124 virtual int getKeyColumn() const override;
125 /** \brief returns the column used as "value" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
126 virtual int getValueColumn() const override;
127
128
129 /** \copydoc JKQTPPlotElement::getXMinMax() */
130 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
131 /** \copydoc JKQTPPlotElement::getYMinMax() */
132 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
133
134public Q_SLOTS:
135 /** \brief sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
136 virtual void setKeyColumn(int __value) override;
137 /** \brief sets the column used as "value" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
138 virtual void setValueColumn(int __value) override;
139
140protected:
141};
142
143
144
145/** \brief This implements an impulse plot with horizontal impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
146 * \ingroup jkqtplotter_sticks
147 *
148 * \image html JKQTPImpulsesHorizontalErrorGraph.png
149 *
150 * \see jkqtpstatAddXErrorImpulsesGraph(), JKQTPImpulsesHorizontalGraph, \ref JKQTPlotterImpulsePlots
151 */
153 Q_OBJECT
154 public:
155 /** \brief class constructor */
158 /** \copydoc JKQTPGraph::usesColumn() */
159 virtual bool usesColumn(int c) const override;
160
161 /** \copydoc JKQTPPlotElement::getXMinMax() */
162 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
163
164 /** \brief returns the column that contains the bar height errors */
165 int getErrorColumn() const;
166 /** \brief returns the column that contains the lower bar height errors */
168 /** \brief returns the error style of the bar */
170 /** \brief returns whether the errors of the bars are symmetric */
171 bool getErrorSymmetric() const;
172
173 public Q_SLOTS:
174 /** \brief sets whether the errors of the bars are symmetric */
175 void setErrorSymmetric(bool __value);
176 /** \brief sets the error style of the bar */
178 /** \brief sets the column that contains the bar height errors */
179 void setErrorColumn(int column) ;
180
181 /** \brief sets the column that contains the bar height errors */
182 void setErrorColumn(size_t column) ;
183 /** \brief sets the column that contains the bar height errors */
184 void setErrorColumnLower(int column) ;
185
186 /** \brief sets the column that contains the bar height errors */
187 void setErrorColumnLower(size_t column) ;
188 protected:
189 /** \brief this function is used to plot error inidcators before plotting the graphs. */
190 virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override ;
191
192};
193
194
195
196
197/*! \brief This implements an impulse plot with impulses in direction of the Y axis (i.e. from y=0 to y=f(x) )
198 \ingroup jkqtplotter_sticks
199
200 \image html JKQTPImpulsesVerticalGraph.png
201 \image html JKQTPImpulsesVerticalGraph_Symbols.png "generated by setting setDrawSymbols(true)"
202
203 \see JKQTPImpulsesGraphBase, JKQTPImpulsesVerticalErrorGraph, \ref JKQTPlotterImpulsePlots
204 */
206 Q_OBJECT
207 public:
208 /** \brief class constructor */
210 /** \brief class constructor */
212
213 /** \brief plots the graph to the plotter object specified as parent */
214 virtual void draw(JKQTPEnhancedPainter& painter) override;
215 /** \brief plots a key marker inside the specified rectangle \a rect */
216 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
217 /** \copydoc JKQTPPlotElement::getXMinMax() */
218 virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
219 /** \copydoc JKQTPPlotElement::getYMinMax() */
220 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
221};
222
223
224
225/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
226 \ingroup jkqtplotter_sticks
227
228 \image html JKQTPImpulsesVerticalErrorGraph.png
229
230 \see JKQTPImpulsesVerticalGraph, jkqtpstatAddYErrorImpulsesGraph(), \ref JKQTPlotterImpulsePlots
231 */
233 Q_OBJECT
234 public:
235 /** \brief class constructor */
237 /** \brief class constructor */
239 /** \copydoc JKQTPGraph::usesColumn() */
240 virtual bool usesColumn(int c) const override;
241 /** \copydoc JKQTPXYGraph::getYMinMax() */
242 virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
243
244 /** \brief returns the column that contains the bar height errors */
245 int getErrorColumn() const;
246 /** \brief returns the column that contains the lower bar height errors */
248 /** \brief returns the error style of the bar */
250 /** \brief returns whether the errors of the bars are symmetric */
251 bool getErrorSymmetric() const;
252
253 public Q_SLOTS:
254 /** \brief sets whether the errors of the bars are symmetric */
255 void setErrorSymmetric(bool __value);
256 /** \brief sets the error style of the bar */
258 /** \brief sets the column that contains the bar height errors */
259 void setErrorColumn(int column) ;
260
261 /** \brief sets the column that contains the bar height errors */
262 void setErrorColumn(size_t column) ;
263 /** \brief sets the column that contains the bar height errors */
264 void setErrorColumnLower(int column) ;
265
266 /** \brief sets the column that contains the bar height errors */
267 void setErrorColumnLower(size_t column);
268 protected:
269 /** \brief this function is used to plot error inidcators before plotting the graphs. */
270 virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override ;
271
272};
273
274
275
276
277#endif // jkqtpgraphsimpulses_H
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
This Mix-In class provides setter/getter methods, storage and other facilities for the graph line sty...
Definition jkqtpgraphsbasestylingmixins.h:49
This Mix-In class provides setter/getter methods, storage and other facilities for the graph symbols ...
Definition jkqtpgraphsbasestylingmixins.h:379
This is a base class for all impulse graphs.
Definition jkqtpimpulses.h:41
bool getDrawBaseline() const
indicates whether to draw a line with style m_baselineStyle at the baseline-value
virtual void setColor(QColor c)
color of symbols and impulses in one call
JKQTPImpulsesGraphBase(JKQTBasePlotter *parent=nullptr)
class constructor
bool drawSymbols
indicates whether to draw symbols at the top of the impulse
Definition jkqtpimpulses.h:75
bool getPositionsMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
get the maximum and minimum value of the impulse positions of the graph
bool getDrawSymbols() const
indicates whether to draw symbols at the top of the impulse
virtual QColor getKeyLabelColor() const override
returns the color to be used for the key label
bool m_drawBaseline
indicates whether to draw a line with style m_baselineStyle at the baseline-value
Definition jkqtpimpulses.h:88
void setDrawBaseline(bool __value)
indicates whether to draw a line with style m_baselineStyle at the baseline-value
JKQTPGraphLineStyleMixin & baselineStyle()
if m_drawBaseline ==true then this style is used to draw the baseline
JKQTPGraphLineStyleMixin m_baselineStyle
if m_drawBaseline ==true then this style is used to draw the baseline
Definition jkqtpimpulses.h:80
void setDrawSymbols(bool __value)
indicates whether to draw symbols at the top of the impulse
const JKQTPGraphLineStyleMixin & baselineStyle() const
if m_drawBaseline ==true then this style is used to draw the baseline
bool getValuesMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
get the maximum and minimum value in the impulse-elongation (i.e. value) direction of the graph
This implements an impulse plot with horizontal impulses in direction of the X axis (i....
Definition jkqtpimpulses.h:152
void setErrorStyle(JKQTPErrorPlotstyle __value)
sets the error style of the bar
void setErrorSymmetric(bool __value)
sets whether the errors of the bars are symmetric
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
int getErrorColumn() const
returns the column that contains the bar height errors
JKQTPErrorPlotstyle getErrorStyle() const
returns the error style of the bar
JKQTPImpulsesHorizontalErrorGraph(JKQTBasePlotter *parent=nullptr)
class constructor
void setErrorColumnLower(size_t column)
sets the column that contains the bar height errors
virtual void drawErrorsAfter(JKQTPEnhancedPainter &painter) override
this function is used to plot error inidcators before plotting the graphs.
JKQTPImpulsesHorizontalErrorGraph(JKQTPlotter *parent)
void setErrorColumnLower(int column)
sets the column that contains the bar height errors
void setErrorColumn(size_t column)
sets the column that contains the bar height errors
bool getErrorSymmetric() const
returns whether the errors of the bars are symmetric
int getErrorColumnLower() const
returns the column that contains the lower bar height errors
virtual bool usesColumn(int c) const override
returns true if the given column is used by the graph
void setErrorColumn(int column)
sets the column that contains the bar height errors
This implements an impulse plot with horizontal impulses in direction of the X axis (i....
Definition jkqtpimpulses.h:111
virtual int getKeyColumn() const override
returns the column used as "key" for the current graph (typically this call getXColumn(),...
virtual int getValueColumn() const override
returns the column used as "value" for the current graph (typically this call getXColumn(),...
virtual void setKeyColumn(int __value) override
sets the column used as "key" for the current graph (typically this call setXColumn(),...
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect) override
plots a key marker inside the specified rectangle rect
JKQTPImpulsesHorizontalGraph(JKQTBasePlotter *parent=nullptr)
class constructor
JKQTPImpulsesHorizontalGraph(JKQTPlotter *parent)
class constructor
virtual void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
virtual void setValueColumn(int __value) override
sets the column used as "value" for the current graph (typically this call setXColumn(),...
This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
Definition jkqtpimpulses.h:232
int getErrorColumn() const
returns the column that contains the bar height errors
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
void setErrorColumnLower(int column)
sets the column that contains the bar height errors
JKQTPImpulsesVerticalErrorGraph(JKQTPlotter *parent)
class constructor
virtual bool usesColumn(int c) const override
returns true if the given column is used by the graph
void setErrorSymmetric(bool __value)
sets whether the errors of the bars are symmetric
JKQTPImpulsesVerticalErrorGraph(JKQTBasePlotter *parent=nullptr)
class constructor
void setErrorColumn(int column)
sets the column that contains the bar height errors
virtual void drawErrorsAfter(JKQTPEnhancedPainter &painter) override
this function is used to plot error inidcators before plotting the graphs.
void setErrorColumn(size_t column)
sets the column that contains the bar height errors
int getErrorColumnLower() const
returns the column that contains the lower bar height errors
void setErrorColumnLower(size_t column)
sets the column that contains the bar height errors
void setErrorStyle(JKQTPErrorPlotstyle __value)
sets the error style of the bar
bool getErrorSymmetric() const
returns whether the errors of the bars are symmetric
JKQTPErrorPlotstyle getErrorStyle() const
returns the error style of the bar
This implements an impulse plot with impulses in direction of the Y axis (i.e. from y=0 to y=f(x) )
Definition jkqtpimpulses.h:205
virtual bool getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) override
get the maximum and minimum y-value of the graph
virtual bool getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) override
get the maximum and minimum x-value of the graph
JKQTPImpulsesVerticalGraph(JKQTPlotter *parent)
class constructor
JKQTPImpulsesVerticalGraph(JKQTBasePlotter *parent=nullptr)
class constructor
virtual void draw(JKQTPEnhancedPainter &painter) override
plots the graph to the plotter object specified as parent
virtual void drawKeyMarker(JKQTPEnhancedPainter &painter, const QRectF &rect) override
plots a key marker inside the specified rectangle rect
This class is the base class for graphs that only display error indicators in x-direction.
Definition jkqtpgraphsbaseerrors.h:299
This virtual JKQTPGraph descendent extends JKQTPXYGraph adds a baseline-property, which is necessary,...
Definition jkqtpgraphsbase.h:712
This class is the base class for graphs that only display error indicators in y-direction.
Definition jkqtpgraphsbaseerrors.h:323
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
QFlags< JKQTPErrorPlotstyleElements > JKQTPErrorPlotstyle
specifies the plot styles for the error information, e.g. error bars, boxes, lines ....
Definition jkqtptools.h:728
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89