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
jkqtpbarchartbase.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 jkqtpgraphsbarchartbase_H
21#define jkqtpgraphsbarchartbase_H
22
23#include <QString>
24#include <QPainter>
25#include <QPair>
26#include <functional>
27#include "jkqtplotter/jkqtptools.h"
28#include "jkqtplotter/jkqtplotter_imexport.h"
29#include "jkqtplotter/jkqtpgraphsbase.h"
30#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
31
32
33/** \brief This is a base-class for all bar graphs with vertical or horizontal orientation (the orientation is implemented in dervied classes!)
34 * \ingroup jkqtplotter_barcharts
35 *
36 * This class provides basic properties and functionality for plotting a bargraph.
37 * The latter is defined by a series of datapoints \c (x,y=f(x)) .
38 * Bars are then drawn fromm a baseline (often \c =0 ) to the value \c y=f(x) at each position \c x.
39 * Thus the class is derived from JKQTPXYBaselineGraph, which provides a baseline as well as columns for \c x and \c y values.
40 *
41 * The width of each bar is determined from its distance to its direct neighbors. It occupies a fraction "width" (JKQTPBarGraphBase::setWidth(), JKQTPBarGraphBase::getWidth() )
42 * of the available space. Typically \c width=0.9 so the bars occupy most space, but do not touch:
43 *
44 * \image html bargraph_basics_width.png
45 *
46 * \see JKQTPBarHorizontalGraph, JKQTPBarVerticalGraph for implementations of this virtual base class.
47 *
48 *
49 * \section JKQTPBarGraphBase_SideBySide several JKQTPBarGraphBase side-by-side
50 *
51 * If you draw several JKQTPBarGraphBase of the same orientation (vertical or honrizontal) into the same plot, these will by default
52 * overlap, if all of the use the same x-values and have the same initial width parameter.
53 * Typically in such a case, you want to group the bars by x-values and ensure they are drawn side-by-side and do not overlap (or overlap slightly in a controlled way).
54 *
55 * To achieve this, an addition shift parameter (JKQTPBarGraphBase::setShift(), JKQTPBarGraphBase::getShift() ) was introduced, which moves each bar inside the available space:
56 *
57 * \image html bargraph_basics.png
58 *
59 * By default the shift parameter (see JKQTPBarGraphBase::setShift() ) is, so the bar is centered at the x-value (i.e. \c shift=0 ).
60 *
61 * You can now use shift to separate three JKQTPBarGraphBase in a graph, by setting e.g.:
62 * \verbatim
63 * width=0.3
64 * shift=-0.3 / 0 / +0.3
65 * \endverbatim
66 *
67 * For convenience, two functions are provided (JKQTPBarGraphBase::autoscaleBarWidthAndShift(), JKQTPBarGraphBase::autoscaleBarWidthAndShiftSeparatedGroups() )
68 * that can be applied to any JKQTPBarGraphBase in the plot and will calculate all bargraphs' shift and width parameter
69 * in such a way that the graphs appear tidied up into groups as above. With these functions you don't have to calculate
70 * the shift and width values by hand! A call always only affects the JKQTPBarGraphBase in the plot with the same orientation
71 * (vertical or horizontal).
72 *
73 * This results in a bargraph, as shown here:
74 *
75 * \image html JKQTPBarVerticalGraph.png
76 *
77 * \section JKQTPBarGraphBaseStyling Basic Bargraph Styling
78 *
79 * There are several options that allow to style the barchraph. The most direct way is to use the setters from
80 * - JKQTPGraphLineStyleMixin
81 * - JKQTPGraphFillStyleMixin
82 * .
83 * that are available in the class and that allow directly chaning the appearance.
84 * It is also possibly to draw the baseline itself (\c JKQTPBarGraphBase::setDrawBaseline(true) ).
85 * Its style is defined in JKQTPBarGraphBase::baselineStyle() .
86 *
87 * Several convenience functions allow to set these properties in a simplified way:
88 * - JKQTPBarGraphBase::setFillColor_and_darkenedColor()
89 * .
90 *
91 * By default this class will draw boxes for each bar. They can be rounded at the corners by setting:
92 * - JKQTPBarGraphBase::setRectRadiusAtValue()
93 * - JKQTPBarGraphBase::setRectRadiusAtBaseline()
94 * - JKQTPBarGraphBase::setRectRadius()
95 * .
96 *
97 *
98 *
99 * \section JKQTPBarGraphBaseDataDependentFilling Data-Dependent Styling of Bargraphs
100 *
101 * You can also use <code>JKQTPBarGraphBase::setFillMode(JKQTPBarGraphBase::FillMode::TwoColorFilling)</code>,
102 * which uses different fill styles for bars above and below the baseline of the graph:
103 *
104 * \image html JKQTPBarVerticalGraphTwoColorFilling.png
105 *
106 * The styles for above the baseline is set by the inherited JKQTPGraphLineStyleMixin and JKQTPGraphFillStyleMixin.
107 * The alternate "below" style, can be modified using
108 * - JKQTPBarGraphBase::fillStyleBelow()
109 * - the line-style is the same as from the inherited JKQTPGraphLineStyleMixin
110 * .
111 *
112 * If you use <code>JKQTPBarGraphBase::setFillMode(JKQTPBarGraphBase::FillMode::FunctorFilling)</code> you can specify
113 * the fill style (in the form of a QBruch) for each bar by a custom functor, e.g.
114 * \code
115 * graph->setFillMode(JKQTPBarGraphBase::FillMode::FunctorFilling);
116 * graph->setFillBrushFunctor(
117 * [](double key, double value) -> QBrush {
118 * return QBrush(QColor::fromHsvF(key/12.0, 1.0, 1.0));
119 * }
120 * );
121 * \endcode
122 *
123 * The result may look like this:
124 *
125 * \image html JKQTPBarVerticalGraphFunctorFilling.png
126 *
127 *
128 *
129 * \section JKQTPBarGraphBaseCustomStyling Custom Bargraph Drawing
130 *
131 * You can also completely customize the drawing by defining a custom draw functor. This allows to draw other shapes than the typical bars:
132 * \code
133 * graph->setCustomDrawingFunctor(
134 * [](JKQTPEnhancedPainter& painter, const QRectF& bar_px, const QPointF& datapoint, Qt::Orientation orientation, JKQTPBarGraphBase* graph) {
135 * // draw the bar (if required), pen and brush are already set properly
136 * painter.drawRect(bar_px);
137 * // now we can add some decoration or replace the instruction above:
138 * // ........
139 * }
140 * );
141 * // enable usage of cutom draw functor
142 * graph->setUseCustomDrawFunctor(true);
143 * \endcode
144 *
145 * See \ref JKQTPlotterBarchartsCustomDrawFunctor for a detailed example.
146 *
147 * The result may look like this:
148 *
149 * \image html JKQTPBarVerticalGraphCustomDrawFunctor.png
150 *
151 */
153 Q_OBJECT
154 public:
155 /** \brief a type of functor for FillMode::FunctorFilling
156 *
157 * \see setFillBrushFunctor(), getFillBrushFunctor()
158 */
159 typedef std::function<QBrush(double key, double value,JKQTPEnhancedPainter &painter, JKQTPBarGraphBase* graph)> FillBrushFunctor;
160 /** \brief a simplified type of functor for FillMode::FunctorFilling
161 *
162 * \see setFillBrushFunctor(), getFillBrushFunctor()
163 */
164 typedef std::function<QBrush(double key, double value)> SimpleFillBrushFunctor;
165
166 /** \brief functor for custom drawing of bars */
167 typedef std::function<void(JKQTPEnhancedPainter& painter, const QRectF& bar_px, const QPointF& datapoint, Qt::Orientation orientation, JKQTPBarGraphBase* graph)> CustomDrawingFunctor;
168 /** \brief specifies how the area below the graph is filled
169 *
170 * \see setFillMode(), getFillMode(), fillStyleBelow(), \ref JKQTPlotterWigglePlots
171 */
172 enum FillMode {
173 SingleFilling=0, /*!< \brief the whole area is filled with the same color/pattern \image html JKQTPBarVerticalGraph.png */
174 TwoColorFilling=1, /*!< \brief the area above and below baseline with the two different colors/pattern \image html JKQTPBarVerticalGraphTwoColorFilling.png */
175 FunctorFilling=2, /*!< \brief a functor (use setFillBrushFunctor() to define one) is used to determine the fill color\image html JKQTPBarVerticalGraphFunctorFilling.png */
176 };
177 Q_ENUM(FillMode)
178
179 /** \brief class constructor */
181 /** \brief class constructor */
183
184 /** \copydoc JKQTPXYBaselineGraph::drawKeyMarker() */
185 virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, const QRectF& rect) override;
186 /** \copydoc JKQTPXYBaselineGraph::getKeyLabelColor() */
187 virtual QColor getKeyLabelColor() const override;
188
189
190
191 /** \copydoc shift */
192 double getShift() const;
193 /** \copydoc width */
194 double getWidth() const;
195
196 /** \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)
197 * \see setColor()
198 */
199 void setFillColor_and_darkenedColor(QColor fill, int colorDarker=200);
200
201 /** \brief returns xColumn or yColumn, whichever is used for the position of the bars (depending on whether the barchart is vertical or horizontal \see getBarHeightColumn(), xColumn, yColumn */
202 int getBarPositionColumn() const;
203
204 /** \brief returns xColumn or yColumn, whichever is used for the height of the bars (depending on whether the barchart is vertical or horizontal \see getBarPositionColumn(), xColumn, yColumn */
205 int getBarHeightColumn() const;
206 /** \copydoc m_fillStyleBelow */
207 JKQTPGraphFillStyleMixin &fillStyleBelow();
208 /** \copydoc m_fillStyleBelow */
209 const JKQTPGraphFillStyleMixin& fillStyleBelow() const;
210 /** \copydoc m_fillMode */
211 FillMode getFillMode() const;
212 /** \copydoc rectRadiusAtValue */
213 double getRectRadiusAtValue() const;
214 /** \copydoc rectRadiusAtBaseline */
215 double getRectRadiusAtBaseline() const;
216 /** \copydoc m_fillBrushFunctor */
217 FillBrushFunctor& getFillBrushFunctor();
218 /** \copydoc m_fillBrushFunctor */
219 const FillBrushFunctor& getFillBrushFunctor() const;
220 /** \copydoc m_lineColorDerivationModeForSpecialFill */
221 JKQTPColorDerivationMode getLineColorDerivationModeForSpecialFill() const;
222 /** \copydoc m_useCustomDrawFunctor */
223 bool usesCustomDrawFunctor() const;
224 /** \copydoc m_drawBaseline */
225 bool getDrawBaseline() const;
226 /** \copydoc m_stackSeparation */
227 double getStackSeparation() const;
228 /** \copydoc m_baselineStyle */
229 JKQTPGraphLineStyleMixin &baselineStyle();
230 /** \copydoc m_baselineStyle */
231 const JKQTPGraphLineStyleMixin& baselineStyle() const;
232
233 public Q_SLOTS:
234 /** \copydoc m_fillMode */
235 void setFillMode(JKQTPBarGraphBase::FillMode mode);
236
237 /** \copydoc m_fillBrushFunctor */
238 void setFillBrushFunctor(const JKQTPBarGraphBase::FillBrushFunctor& f);
239 /** \copydoc m_fillBrushFunctor */
240 void setFillBrushFunctor(JKQTPBarGraphBase::FillBrushFunctor&& f);
241
242 /** \copydoc m_fillBrushFunctor */
243 void setFillBrushFunctor(const JKQTPBarGraphBase::SimpleFillBrushFunctor& f);
244 /** \copydoc m_fillBrushFunctor */
245 void setFillBrushFunctor(JKQTPBarGraphBase::SimpleFillBrushFunctor&& f);
246
247 /** \copydoc m_customDrawFunctor */
248 void setCustomDrawingFunctor(JKQTPBarGraphBase::CustomDrawingFunctor&& f);
249 /** \copydoc m_customDrawFunctor */
250 void setCustomDrawingFunctor(const JKQTPBarGraphBase::CustomDrawingFunctor& f);
251 /** \copydoc m_useCustomDrawFunctor */
252 void setUseCustomDrawFunctor(bool enabled);
253
254 /** \brief finds all bar charts of the same orientation and determines width and shift, so they stand side by side
255 *
256 * \param maxWidth the maximum (relative) width, that all bars will span of the (doubled) inter-bar distance
257 * \param shrinkFactor factor, by which the bar are shrinked compared to the available space
258 *
259 * \note This function will scale ALL graphs of the parent plot, which were derived from JKQTPBarHorizontalGraph, that match in orientation (as returned by isHorizontal() ).
260 *
261 * Using \c autoscaleBarWidthAndSHift(0.75,1.0) You can separate the different groups by soe distance, but the bars touch each other:
262 *
263 * \image html JKQTPBarVerticalAutoscaleMaxWidthOnly.png
264 *
265 * On the other hand, using the other extreme \c autoscaleBarWidthAndSHift(1.0,0.9) there is no grouping of the bars, but they have a slight distance between each other.
266 *
267 * \image html JKQTPBarVerticalAutoscaleShrinkOnly.png
268 *
269 * Finally the default parameters \c autoscaleBarWidthAndSHift(0.75,0.9) will lead to a separation of the bars AND a grouping:
270 *
271 * \image html JKQTPBarVerticalGraph.png
272 *
273 */
274 virtual void autoscaleBarWidthAndShift(double maxWidth=0.75, double shrinkFactor=0.9);
275
276 /** \brief equivalent to \c autoscaleBarWidthAndShift(groupWidth,0.9);
277 *
278 * The default parameters \c autoscaleBarWidthAndShiftSeparatedGroups(0.75) will lead to a separation of the bars AND a grouping:
279 *
280 * \image html JKQTPBarVerticalGraph.png
281 *
282 * On the other hand, using \c autoscaleBarWidthAndShiftSeparatedGroups(1.0) there is no grouping of the bars, but they have a slight distance between each other.
283 *
284 * \image html JKQTPBarVerticalAutoscaleShrinkOnly.png
285 */
286 void autoscaleBarWidthAndShiftSeparatedGroups(double groupWidth=0.75);
287 /** \copydoc shift */
288 void setShift(double __value);
289 /** \copydoc width */
290 void setWidth(double __value);
291 /** \copydoc m_drawBaseline */
292 void setDrawBaseline(bool __value);
293
294 /** \copydoc m_stackSeparation */
295 void setStackSeparation(double __value);
296 /** \copydoc rectRadiusAtValue */
297 void setRectRadiusAtValue(double __value);
298 /** \copydoc rectRadiusAtBaseline */
299 void setRectRadiusAtBaseline(double __value);
300 /** \brief sets the corner radius of the bars for both ends */
301 void setRectRadius(double all);
302 /** \brief sets the corner radius of the bars for both ends */
303 void setRectRadius(double atValue, double atBaseline);
304
305 /** \copydoc m_lineColorDerivationModeForSpecialFill */
306 void setLineColorDerivationModeForSpecialFill(const JKQTPColorDerivationMode& m);
307
308 /** \brief set outline and fill color at the same time
309 * \see setFillColor_and_darkenedColor()
310 */
311 virtual void setColor(QColor c);
312
313
314 /** \brief returns xColumn or yColumn, whichever is used for the position of the bars (depending on whether the barchart is vertical or horizontal \see getBarHeightColumn(), xColumn, yColumn */
315 void setBarPositionColumn(int column) ;
316
317 /** \brief returns xColumn or yColumn, whichever is used for the position of the bars (depending on whether the barchart is vertical or horizontal \see getBarHeightColumn(), xColumn, yColumn */
318 void setBarPositionColumn(size_t column) ;
319
320 /** \brief returns xColumn or yColumn, whichever is used for the height of the bars (depending on whether the barchart is vertical or horizontal \see getBarPositionColumn(), xColumn, yColumn */
321 void setBarHeightColumn(int column) ;
322
323 /** \brief returns xColumn or yColumn, whichever is used for the height of the bars (depending on whether the barchart is vertical or horizontal \see getBarPositionColumn(), xColumn, yColumn */
324 void setBarHeightColumn(size_t column) ;
325 protected:
326
327 /** \brief the width of the bargraphs, relative to the distance between the current and the next x-value
328 *
329 * See the following graphic to understand this concept:
330 * \image html bargraph_basics_width.png
331 *
332 * \note this parameter can be combined with shift !
333 *
334 * \see setWidth(), getWidth(), setShift(), getShift(), shift, autoscaleBarWidthAndShift(), autoscaleBarWidthAndShiftSeparatedGroups()
335 */
336 double width;
337 /** \brief the shift of the bargraphs, relative to the distance between the current and the next x-value
338 *
339 * See the following graphic to understand this concept:
340 * \image html bargraph_basics.png
341 *
342 * \see setShift(), getShift(), setWidth(), getWidth(), autoscaleBarWidthAndShift(), autoscaleBarWidthAndShiftSeparatedGroups()
343 */
344 double shift;
345 /** \brief corner radius (in pt) for bars at the "value" end */
346 double rectRadiusAtValue;
347 /** \brief corner radius (in pt) for bars at the "baseline" end */
348 double rectRadiusAtBaseline;
349 /** \brief if m_drawBaseline \c ==true then this style is used to draw the baseline
350 *
351 * \see baselineStyle() , setDrawBaseline() , m_drawBaseline
352 */
354 /** \brief indicates whether to draw a line with style m_baselineStyle at the baseline-value
355 *
356 * \image html JKQTPBarVerticalGraphBaseline.png "setDrawBaseline(true);"
357 *
358 * \image html JKQTPBarVerticalGraphNoBaseline.png "setDrawBaseline(false);"
359 *
360 * \see baselineStyle() , setDrawBaseline() , m_baselineStyle
361 */
362 bool m_drawBaseline;
363 /** \brief separation (in pt) between two bars in a stack of bars */
364 double m_stackSeparation;
365 /** \brief specifies how the area of the graph is filles
366 *
367 * \note If any fill style other than FillStyle::SingleFill is used, the peroperty m_lineColorDerivationModeForSpecialFill
368 * is used to derive the color of the bars' outlines from the fill color.
369 *
370 * \see setFillMode(), getFillMode(), m_fillStyleBelow, m_fillBrushFunctor, m_lineColorDerivationModeForSpecialFill
371 */
372 FillMode m_fillMode;
373 /** \brief if m_fillMode \c ==FillAboveAndBelowDifferently then this fill style is used below the baseline and
374 * the default fill style is used above
375 *
376 * \see fillStyleBelow() , setFillMode()
377 */
378 JKQTPGraphFillStyleMixin m_fillStyleBelow;
379 /** \brief defines how to derive the line color in m_fillMode!=SingleFilling
380 *
381 * \see setLineColorDerivationModeForSpecialFill(), setFillMode(), getLineColorDerivationModeForSpecialFill(), FillMode
382 */
383 JKQTPColorDerivationMode m_lineColorDerivationModeForSpecialFill;
384
385 /** \brief adapter that converts a SimpleFillBrushFunctor to a FillBrushFunctor */
390 inline QBrush operator()(double key, double value,JKQTPEnhancedPainter &, JKQTPBarGraphBase*) { return m_f(key,value);}
391 };
392
393 /** \brief functor, used to determine the color in m_fillMode==FunctorFilling
394 *
395 * If you use FillMode::FunctorFilling you can specify the fill style by a functor, e.g.
396 * \code
397 * graph->setFillMode(JKQTPBarGraphBase::FillMode::FunctorFilling);
398 * graph->setFillBrushFunctor(
399 * [](double key, double value) {
400 * return QBrush(QColor::fromHsvF(key/12.0, 1.0, 1.0));
401 * }
402 * );
403 * \endcode
404 *
405 * The result may look like this:
406 *
407 * \image html JKQTPBarVerticalGraphFunctorFilling.png
408 *
409 * \see setFillBrushFunctor(), getFillBrushFunctor(), m_fillMode
410 */
412 /** \brief this allows to provide custom drawing code for the bars.
413 * It is called for every visible bar if activated by \c setUseCustomDrawFunctor(true) .
414 *
415 * Here is an example for a custom draw functor:
416 * \code
417 * graph->setCustomDrawingFunctor(
418 * [](JKQTPEnhancedPainter& painter, const QRectF& bar_px, const QPointF& datapoint, Qt::Orientation orientation, JKQTPBarGraphBase* graph) {
419 * // draw the bar (if required), pen and brush are already set properly
420 * painter.drawRect(bar_px);
421 * // now we can add some decoration or replace the instruction above:
422 * // ........
423 * }
424 * );
425 * // enable usage of cutom draw functor
426 * graph->setUseCustomDrawFunctor(true);
427 * \endcode
428 *
429 *
430 * The result may look like this:
431 *
432 * \image html JKQTPBarVerticalGraphCustomDrawFunctor.png
433 *
434 * \see CustomDrawingFunctor, m_useCustomDrawFunctor, setUseCustomDrawFunctor(), \ref JKQTPlotterBarchartsCustomDrawFunctor for a detailed example
435 */
437 /** \brief enabled custom drawing by m_customDrawFunctor
438 *
439 * \see m_customDrawFunctor
440 */
442
443 /** \brief returns a FillBrushFunctor that is appropriate for the currently selected m_fillMode */
445
446 /** \brief this function is used by autoscaleBarWidthAndShift() to determine whether a given graph shall be taken into account when autoscaling.
447 * Typically this returns \c true for all JKQTPBarGraphBase-derived objects with the same orientation (horizontal or vertical). For stacked
448 * graphs it excludes everything except the bottom of the stack
449 */
450 virtual bool considerForAutoscaling( JKQTPBarGraphBase* other) const=0;
451
452 /** \brief used to generate stacked plots: returns the upper boundary of the parent plot in a stack, for the index-th datapoint */
453 virtual double getParentStackedMax(int index) const ;
454
455 /** \brief returns \c true, if a stack parent is set (if available) */
456 virtual bool hasStackParent() const ;
457
458 /** \brief get the maximum and minimum value in the box-elongation (i.e. value) direction of the graph
459 *
460 * The result is given in the two parameters which are call-by-reference parameters!
461 */
462 bool getValuesMinMax(double& mmin, double& mmax, double& smallestGreaterZero) ;
463 /** \brief get the maximum and minimum value of the box positions of the graph
464 *
465 * The result is given in the two parameters which are call-by-reference parameters!
466 */
467 bool getPositionsMinMax(double& mmin, double& mmax, double& smallestGreaterZero) ;
468};
469
470
471
472/** \brief This is an interface-class for all stackable bargraphs ... it is used internally for autoscaling only
473 * \ingroup jkqtplotter_barcharts
474 *
475 * \c dynamic_cast 'ing to this indicates that a barchart is stackable.
476 *
477 *
478 */
480public:
482protected:
483
484 /** \brief returns the barchart at the bottom of this stack (i.e. traverses the stack until there are no more parents */
486
487 friend class JKQTPBarGraphBase;
488};
489
490
491
492#endif // jkqtpgraphsbarchartbase_H
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
This is a base-class for all bar graphs with vertical or horizontal orientation (the orientation is i...
Definition jkqtpbarchartbase.h:152
virtual double getParentStackedMax(int index) const
used to generate stacked plots: returns the upper boundary of the parent plot in a stack,...
bool m_useCustomDrawFunctor
enabled custom drawing by m_customDrawFunctor
Definition jkqtpbarchartbase.h:441
CustomDrawingFunctor m_customDrawFunctor
this allows to provide custom drawing code for the bars. It is called for every visible bar if activa...
Definition jkqtpbarchartbase.h:436
std::function< void(JKQTPEnhancedPainter &painter, const QRectF &bar_px, const QPointF &datapoint, Qt::Orientation orientation, JKQTPBarGraphBase *graph)> CustomDrawingFunctor
functor for custom drawing of bars
Definition jkqtpbarchartbase.h:167
FillBrushFunctor m_fillBrushFunctor
functor, used to determine the color in m_fillMode==FunctorFilling
Definition jkqtpbarchartbase.h:411
std::function< QBrush(double key, double value, JKQTPEnhancedPainter &painter, JKQTPBarGraphBase *graph)> FillBrushFunctor
a type of functor for FillMode::FunctorFilling
Definition jkqtpbarchartbase.h:159
bool getPositionsMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
get the maximum and minimum value of the box positions of the graph
bool getValuesMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
get the maximum and minimum value in the box-elongation (i.e. value) direction of the graph
virtual bool considerForAutoscaling(JKQTPBarGraphBase *other) const =0
this function is used by autoscaleBarWidthAndShift() to determine whether a given graph shall be take...
virtual FillBrushFunctor constructFillBrushFunctor() const
returns a FillBrushFunctor that is appropriate for the currently selected m_fillMode
std::function< QBrush(double key, double value)> SimpleFillBrushFunctor
a simplified type of functor for FillMode::FunctorFilling
Definition jkqtpbarchartbase.h:164
virtual bool hasStackParent() const
returns true, if a stack parent is set (if available)
FillMode
specifies how the area below the graph is filled
Definition jkqtpbarchartbase.h:172
This is an interface-class for all stackable bargraphs ... it is used internally for autoscaling only...
Definition jkqtpbarchartbase.h:479
virtual ~JKQTPBarGraphStackInternalInterface()
Definition jkqtpbarchartbase.h:481
virtual JKQTPBarGraphBase * getBottomOfStack()=0
returns the barchart at the bottom of this stack (i.e. traverses the stack until there are no more pa...
this class extends the QPainter
Definition jkqtpenhancedpainter.h:33
This Mix-In class provides setter/getter methods, storage and other facilities for the graph filling ...
Definition jkqtpgraphsbasestylingmixins.h:529
This Mix-In class provides setter/getter methods, storage and other facilities for the graph line sty...
Definition jkqtpgraphsbasestylingmixins.h:49
This virtual JKQTPGraph descendent extends JKQTPXYGraph adds a baseline-property, which is necessary,...
Definition jkqtpgraphsbase.h:712
plotter widget for scientific plots (uses JKQTBasePlotter to do the actual drawing)
Definition jkqtplotter.h:364
#define JKQTPLOTTER_LIB_EXPORT
Definition jkqtplotter_imexport.h:89
adapter that converts a SimpleFillBrushFunctor to a FillBrushFunctor
Definition jkqtpbarchartbase.h:386
QBrush operator()(double key, double value, JKQTPEnhancedPainter &, JKQTPBarGraphBase *)
Definition jkqtpbarchartbase.h:390
SimpleFillBrushFunctorAdaptor(const SimpleFillBrushFunctor &f)
Definition jkqtpbarchartbase.h:387
SimpleFillBrushFunctorAdaptor(SimpleFillBrushFunctor &&f)
Definition jkqtpbarchartbase.h:388
SimpleFillBrushFunctor m_f
Definition jkqtpbarchartbase.h:389
Specifies how a fill-color is derived from a given color.
Definition jkqtptools.h:262