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
jkqtpgraphsbasestylingmixins.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
21#ifndef jkqtpgraphsbasestylingmixins_H
22#define jkqtpgraphsbasestylingmixins_H
23
24
25#include <QString>
26#include <QPainter>
27#include <QPen>
28#include <QBrush>
29#include "jkqtplotter/jkqtptools.h"
30#include "jkqtplotter/jkqtplotter_imexport.h"
31#include "jkqtplotter/jkqtpbaseplotter.h"
32#include "jkqtcommon/jkqtpdrawingtools.h"
33#include "jkqtplotter/jkqtplotter_configmacros.h"
34
35
36class JKQTPlotter; // forward
37
38
39/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph line style
40 \ingroup jkqtplotter_basegraphs_stylemixins
41
42 supported properties:
43 - line color
44 - line width
45 - line style (including custom dash patterns, as in QPen)
46 - line color, when graph is highlighted
47 .
48 */
50#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
51 Q_GADGET
52#endif
53 public:
54 /** \brief class constructor */
56 /** \brief initiaize the line style (from the parent plotter) */
57 void initLineStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default);
59
60 /** \brief set the color of the graph line */
61 void setLineColor(const QColor & __value);
62 /** \brief set the color of the graph line */
63 void setLineColor(const QColor & __value, double alpha);
64 /** \brief get the color of the graph line */
65 QColor getLineColor() const;
66 /** \brief sets the line-color as an inverted version of the given color */
67 void setLineColorInvertedFrom(QColor __noninvertedColor);
68
69 /** \brief set the style of the graph line */
70 void setLineStyle(Qt::PenStyle __value);
71 /** \brief get the style of the graph line */
72 Qt::PenStyle getLineStyle() const;
73
74 /** \brief set the line width of the graph line (in pt) */
75 void setLineWidth(double __value);
76 /** \brief get the line width of the graph line (in pt) */
77 double getLineWidth() const;
78
79 /** \brief sets the dash offset for a custom dash style
80 * \see https://doc.qt.io/qt-5/qpen.html#setDashOffset
81 */
82 void setLineDashOffset(qreal offset);
83 /** \brief returns the dash offset for a custom dash style
84 * \see https://doc.qt.io/qt-5/qpen.html#setDashOffset
85 */
86 qreal getLineDashOffset() const;
87 /** \brief sets the dash pattern for a custom dash style
88 * \see https://doc.qt.io/qt-5/qpen.html#setDashPattern
89 */
90 void setLineDashPattern(const QVector<qreal> &pattern);
91 /** \brief gets the dash pattern for a custom dash style
92 * \see https://doc.qt.io/qt-5/qpen.html#setDashPattern
93 */
94 QVector<qreal> getLineDashPattern() const;
95 /** \brief sets the join style
96 * \see https://doc.qt.io/qt-5/qpen.html#setJoinStyle
97 */
98 void setLineJoinStyle(Qt::PenJoinStyle style);
99 /** \brief returns the join style
100 * \see https://doc.qt.io/qt-5/qpen.html#setJoinStyle
101 */
102 Qt::PenJoinStyle getLineJoinStyle() const;
103 /** \brief sets the cap style
104 * \see https://doc.qt.io/qt-5/qpen.html#setCapStyle
105 */
106 void setLineCapStyle(Qt::PenCapStyle style);
107 /** \brief gets the cap style
108 * \see https://doc.qt.io/qt-5/qpen.html#setCapStyle
109 */
110 Qt::PenCapStyle getLineCapStyle() const;
111 /** \brief sets the brush used to fill the line area
112 * \see https://doc.qt.io/qt-5/qpen.html#setBrush
113 */
114 void setLineBrush(const QBrush& style);
115 /** \brief gets the brush used to fill the line area
116 * \see https://doc.qt.io/qt-5/qpen.html#setBrush
117 */
118 QBrush getLineBrush() const;
119
120
121 /** \brief set the color of the graph line when highlighted */
122 void setHighlightingLineColor(const QColor & __value);
123 /** \brief set the color of the graph line when highlighted */
124 void setHighlightingLineColor(const QColor & __value, double alpha);
125 /** \brief get the color of the graph line when highlighted */
127
128
129
130
131 /** \brief returns the linewidth for drawing lines in a key entry with \a keyRect for the symbol, using \a painter and \a parent . */
132 double getKeyLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent) const;
133
134 /** \brief constructs a QPen from the line styling properties */
135 QPen getLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
136 /** \brief constructs a QPen from the line styling properties, suitable for drawing rectangles with sharp edges */
138 /** \brief constructs a QPen from the line styling properties */
140 /** \brief constructs a QPen from the line styling properties, suitable for drawing rectangle with sharp corners */
142 /** \brief constructs a QPen from the line styling properties, but uses getKeyLineWidthPx() for the width, i.e. constructs a pen for drawing lines in key-symbols */
143 QPen getKeyLinePen(JKQTPEnhancedPainter &painter, const QRectF &rect, JKQTBasePlotter *parent) const;
144
145
146
147#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
148 Q_PROPERTY(QColor highlightingLineColor MEMBER m_highlightingLineColor READ getHighlightingLineColor WRITE setHighlightingLineColor)
149 Q_PROPERTY(QColor lineColor MEMBER m_lineColor READ getLineColor WRITE setLineColor)
150 Q_PROPERTY(Qt::PenStyle lineStyle MEMBER m_lineStyle READ getLineStyle WRITE setLineStyle)
151 Q_PROPERTY(double lineWidth MEMBER m_lineWidth READ getLineWidth WRITE setLineWidth)
152#endif
153 private:
154 /** \brief graph line pen */
156 /** \brief width of the graph lines, given in pt */
158 /** \brief line pen for the highlighted look */
160 protected:
161};
162
163
164
165/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for a line-graph compression algorithm
166 \ingroup jkqtplotter_basegraphs_stylemixins
167
168 supported properties:
169 - activate compression (improves plotting speed, but decreases detail level)
170 - level of retained details
171 .
172
173 \image html JKQTPSimplifyPolyLines_agressive.png
174 */
176#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
177 Q_GADGET
178#endif
179 public:
180 /** \brief class constructor */
182
184
185
186 /** \copydoc useNonvisibleLineCompression */
187 void setUseNonvisibleLineCompression(bool _useNonvisibleLineCompression);
188 /** \copydoc useNonvisibleLineCompression */
190 /** \copydoc useNonvisibleLineCompression */
192 /** \copydoc useNonvisibleLineCompression */
194
195
196#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
197 Q_PROPERTY(bool useNonvisibleLineCompression MEMBER useNonvisibleLineCompression READ getUseNonvisibleLineCompression WRITE setUseNonvisibleLineCompression)
198 Q_PROPERTY(double nonvisibleLineCompressionAgressiveness MEMBER nonvisibleLineCompressionAgressiveness READ getNonvisibleLineCompressionAgressiveness WRITE setNonvisibleLineCompressionAgressiveness)
199#endif
200 private:
201 /** \brief use an optimization algorithm that tries to reduce the number of lines that
202 * overlap each other (i.e. for noisy data or a low zoom) and thus improves
203 * drawing speed
204 *
205 * When the property useNonvisibleLineCompression is activated (\c true ), the graph class
206 * uses the algorithm implemented in JKQTPSimplifyPolyLines() to simplify the task of plotting.
207 *
208 * \image html JKQTPSimplifyPolyLines.png
209 *
210 * \note This option is designed to not alter the plot representation significantly,
211 * but of course it may ...
212 *
213 * \see JKQTPSimplifyPolyLines() setUseNonvisibleLineCompression(), getUseNonvisibleLineCompression()
214 */
216
217 /** \brief this sets the agressiveness of the option useNonvisibleLineCompression
218 *
219 * Basically the compressed groups will have a size of nonvisibleLineCompressionAgressiveness*pen.linewidth
220 *
221 * The default setting is \c 1.0 , larger settings will lead to better compression (and faster plotting), but less detailed
222 * plots, whereas smaller settings will increase the detail-level, but also increase plotting time.
223 *
224 * \image html JKQTPSimplifyPolyLines_agressive.png
225 *
226 * \note This option is designed to not alter the plot representation significantly,
227 * but of course it may ...
228 *
229 * \see JKQTPSimplifyPolyLines() setUseNonvisibleLineCompression(), getUseNonvisibleLineCompression()
230 */
232protected:
233};
234
235
236
237
238/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph line style of lines
239 with a decorator (i.e. an arrow) at their head. It extends JKQTPGraphLineStyleMixin
240 \ingroup jkqtplotter_basegraphs_stylemixins
241
242 supported properties:
243 - head/ arrow style
244 .
245
246 \see JKQTPGraphDecoratedLineStyleMixin for a Mix-In for both ends
247*/
249#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
250 Q_GADGET
251#endif
252public:
253 /** \brief class constructor */
255 /** \brief initiaize the line style (from the parent plotter) */
257
259
260 /** \brief set the head decorator style */
262 /** \brief get the head decorator style */
264
265 /** \copydoc m_headDecoratorSizeFactor */
266 void setHeadDecoratorSizeFactor(const double & __value);
267 /** \copydoc m_headDecoratorSizeFactor */
269
270 /** \brief calculates the tail decorator size from the line width \a line_width, using m_headDecoratorSizeFactor and a non-linear scaling function
271 *
272 * \see JKQTPLineDecoratorStyleCalcDecoratorSize()
273 */
274 double calcHeadDecoratorSize(double line_width) const;
275
276
277
278#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
279 Q_PROPERTY(JKQTPLineDecoratorStyle headDecoratorStyle MEMBER m_headDecoratorStyle READ getHeadDecoratorStyle WRITE setHeadDecoratorStyle)
280 Q_PROPERTY(double headDecoratorSizeFactor MEMBER m_headDecoratorSizeFactor READ getHeadDecoratorSizeFactor WRITE setHeadDecoratorSizeFactor)
281#endif
282private:
283 /** \brief head decorator style */
285 /** \brief head decorator size-factor, used to calculate the size of the arrow from the line width */
287};
288
289
290
291
292
293/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph line style of lines
294 with decorators (i.e. arrows) at their ends. It extends JKQTPGraphLineStyleMixin
295 \ingroup jkqtplotter_basegraphs_stylemixins
296
297 supported properties:
298 - head/tail arrow style
299 .
300
301 \see JKQTPGraphDecoratedHeadLineStyleMixin for a Mix-In for one end (head) only
302*/
304#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
305 Q_GADGET
306#endif
307public:
308 /** \brief class constructor */
310 /** \brief initiaize the line style (from the parent plotter) */
312
314
315 /** \brief set the head decorator style */
317 /** \brief get the head decorator style */
319 /** \brief set the tail decorator style */
321 /** \brief get the tail decorator style */
323
324 /** \copydoc m_headDecoratorSizeFactor */
325 void setHeadDecoratorSizeFactor(const double & __value);
326 /** \copydoc m_headDecoratorSizeFactor */
328 /** \copydoc m_tailDecoratorSizeFactor */
329 void setTailDecoratorSizeFactor(const double & __value);
330 /** \copydoc m_tailDecoratorSizeFactor */
332
333 /** \brief calculates the tail decorator size from the line width \a line_width, using m_tailDecoratorSizeFactor and a non-linear scaling function
334 *
335 * \see JKQTPLineDecoratorStyleCalcDecoratorSize()
336 */
337 double calcTailDecoratorSize(double line_width) const;
338 /** \brief calculates the tail decorator size from the line width \a line_width, using m_headDecoratorSizeFactor and a non-linear scaling function
339 *
340 * \see JKQTPLineDecoratorStyleCalcDecoratorSize()
341 */
342 double calcHeadDecoratorSize(double line_width) const;
343
344
345
346#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
347 Q_PROPERTY(JKQTPLineDecoratorStyle headDecoratorStyle MEMBER m_headDecoratorStyle READ getHeadDecoratorStyle WRITE setHeadDecoratorStyle)
348 Q_PROPERTY(JKQTPLineDecoratorStyle tailDecoratorStyle MEMBER m_tailDecoratorStyle READ getTailDecoratorStyle WRITE setTailDecoratorStyle)
349 Q_PROPERTY(double headDecoratorSizeFactor MEMBER m_headDecoratorSizeFactor READ getHeadDecoratorSizeFactor WRITE setHeadDecoratorSizeFactor)
350 Q_PROPERTY(double tailDecoratorSizeFactor MEMBER m_tailDecoratorSizeFactor READ getTailDecoratorSizeFactor WRITE setTailDecoratorSizeFactor)
351#endif
352private:
353 /** \brief head decorator style */
355 /** \brief tail decorator style */
357 /** \brief head decorator size-factor, used to calculate the size of the arrow from the line width */
359 /** \brief tail decorator size-factor, used to calculate the size of the arrow from the line width */
361};
362
363
364
365
366
367/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph symbols style
368 \ingroup jkqtplotter_basegraphs_stylemixins
369
370 supported properties:
371 - symbol style
372 - symbol size
373 - symbol (outline) color
374 - symbol fill color (not required for all symbols)
375 - symbol (line) width
376 - symbol font name (family) for character symbols \c JKQTPCharacterSymbol+QChar('').unicode()
377 .
378 */
380#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
381 Q_GADGET
382#endif
383 public:
384 /** \brief class constructor */
386 /** \brief initiaize the symbol style (from the parent plotter) */
388
390
391 /** \brief set the type of the graph symbol */
393 /** \brief get the type of the graph symbol */
395
396 /** \brief set the size (=diameter in pt) of the graph symbol (in pt) */
397 void setSymbolSize(double __value);
398 /** \brief get the size (=diameter in pt) of the graph symbol (in pt) */
399 double getSymbolSize() const;
400
401 /** \brief set the color of the graph symbols */
402 void setSymbolColor(const QColor & __value);
403 /** \brief set the color of the graph symbols */
404 void setSymbolColor(const QColor & __value, double alpha);
405 /** \brief set the color of the graph symbols */
406 QColor getSymbolColor() const;
407
408 /** \brief set the color of filling of the graph symbols */
409 void setSymbolFillColor(const QColor & __value);
410 /** \brief set the color of filling of the graph symbols */
411 void setSymbolFillColor(const QColor & __value, double alpha);
412 /** \brief set the color of filling of the graph symbols */
413 QColor getSymbolFillColor() const;
414
415 /** \brief set alpha-value of symbol outline and filling */
416 void setSymbolAlpha(double alpha);
417
418 /** \brief set the line width of the graph symbol outline (in pt) */
419 void setSymbolLineWidth(double __value);
420 /** \brief get the line width of the graph symbol outline (in pt) */
421 double getSymbolLineWidth() const;
422
423 /** \brief set the font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
424 void setSymbolFontName(const QString& __value);
425 /** \brief get the font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
426 QString getSymbolFontName() const;
427
428
429
430#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
431 Q_PROPERTY(JKQTPGraphSymbols symbolType MEMBER m_symbolType READ getSymbolType WRITE setSymbolType)
432 Q_PROPERTY(QColor symbolColor MEMBER m_symbolColor READ getSymbolColor WRITE setSymbolColor)
433 Q_PROPERTY(QColor symbolFillColor MEMBER m_symbolFillColor READ getSymbolFillColor WRITE setSymbolFillColor)
434 Q_PROPERTY(double symbolSize MEMBER m_symbolSize READ getSymbolSize WRITE setSymbolSize)
435 Q_PROPERTY(double symbolLineWidth MEMBER m_symbolLineWidth READ getSymbolLineWidth WRITE setSymbolLineWidth)
436 Q_PROPERTY(QString symbolFontName MEMBER m_symbolFontName READ getSymbolFontName WRITE setSymbolFontName)
437#endif
438 private:
439 /** \brief which symbol to use for the datapoints */
441 /** \brief size (diameter in pt) of the symbol for the data points, given in pt */
443 /** \brief (outline) color of the symbol */
445 /** \brief color of the symbol filling */
447 /** \brief width (in pt) of the lines used to plot the symbol for the data points, given in pt */
449 /** \brief font to be used for character symbols \c JKQTPCharacterSymbol+QChar('').unicode() */
451 protected:
452 /** \brief constructs a QPen from the line styling properties */
453 QPen getSymbolPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
454 /** \brief constructs a QPen from the line styling properties */
455 QBrush getSymbolBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
456 /** \brief generate a QFont for darwing symbols */
457 QFont getSymbolFont() const;
458 /*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
459
460 \param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
461 \param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
462 \param x x-coordinate of the symbol center
463 \param y y-coordinate of the symbol center
464 */
465 inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y) const
466 {
467 JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor, getSymbolFont());
468 }
469 /*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
470
471 \param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
472 \param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
473 \param x x-coordinate of the symbol center
474 \param y y-coordinate of the symbol center
475 \param symbolSize size of the symbol
476 */
477 inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, double symbolSize) const
478 {
479 JKQTPPlotSymbol(painter, x, y,m_symbolType, symbolSize, parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor, getSymbolFont());
480 }
481 /*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
482
483 \param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
484 \param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
485 \param x x-coordinate of the symbol center
486 \param y y-coordinate of the symbol center
487 \param type type of the symbol
488 */
489 inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, JKQTPGraphSymbols type) const
490 {
491 JKQTPPlotSymbol(painter, x, y,type, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor, getSymbolFont());
492 }
493 /*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
494
495 \param parent parent JKQTBasePlotter of the graph that uses this mix-in (used e.g. for line-width transformation)
496 \param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
497 \param x x-coordinate of the symbol center
498 \param y y-coordinate of the symbol center
499 \param color color of the symbol
500 \param fillColor fill color of the symbol
501 */
502 inline void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, QColor color, QColor fillColor) const
503 {
504 JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), color, fillColor, getSymbolFont());
505 }
506 /** \brief returns the symbol linewidth for drawing symbols in a key entry with \a keyRect for the symbol, using \a painter and \a parent . \a maxSymbolSizeFracton specifies the maximum fraction of \a keyRect to be used for the symbol. */
507 double getKeySymbolLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton=0.9) const;
508 /** \brief returns the symbol size for drawing symbols in a key entry with \a keyRect for the symbol, using \a painter and \a parent . \a maxSymbolSizeFracton specifies the maximum fraction of \a keyRect to be used for the symbol. */
509 double getKeySymbolSizePx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton=0.9) const;
510};
511
512
513
514
515
516
517
518
519
520/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph filling (NOT the symbol filling though!)
521 \ingroup jkqtplotter_basegraphs_stylemixins
522
523 supported properties:
524 - fill style
525 - fill color
526 - fill texture/gradient/matrix (if required by fill style)
527 .
528 */
530#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
531 Q_GADGET
532#endif
533 public:
534 /** \brief class constructor */
536
537 /** \brief initiaize the fill style (from the parent plotter) */
538 void initFillStyle(JKQTBasePlotter* parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default);
539 /** \brief initiaize the fill style from another JKQTPGraphFillStyleMixin \a other by inverting its fill color */
541
543
544 /** \brief set the fill style of the graph */
545 void setFillStyle(Qt::BrushStyle __value);
546 /** \brief get the fill style of the graph */
547 Qt::BrushStyle getFillStyle() const;
548
549 /** \brief set the color of the graph filling */
550 void setFillColor(const QColor & __value);
551 /** \brief set the color of the graph filling */
552 void setFillColor(const QColor & __value, double alpha);
553 /** \brief set the color of the graph filling */
554 QColor getFillColor() const;
555
556 /** \brief set the color of the graph filling and sets fill style to Qt::TexturePattern */
557 void setFillTexture(const QPixmap & __value);
558 /** \brief set the color of the graph filling and sets fill style to Qt::TexturePattern */
559 void setFillTexture(const QImage & __value);
560 /** \brief set the color of the graph filling */
561 QPixmap getFillTexture() const;
562 /** \brief set the color of the graph filling */
563 QImage getFillTextureImage() const;
564
565 /** \brief set the filling of the graph to a gradient and sets fill style to a gradient setting */
566 void setFillGradient(const QGradient & __value);
567 /** \brief get the gradient object of the graph filling */
568 const QGradient *getFillGradient() const;
569
570 /** \brief sets a fill brush (overwrites all internal properties!) */
571 void setFillBrush(const QBrush& b);
572 /** \brief sets a fill transformation */
573 void setFillTransform(const QTransform& b);
574
575#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
576 Q_PROPERTY(Qt::BrushStyle fillStyle MEMBER m_fillStyle READ getFillStyle WRITE setFillStyle)
577 Q_PROPERTY(QColor fillColor MEMBER m_fillColor READ getFillColor WRITE setFillColor)
578#endif
579
580 /** \brief constructs a QBrush from the graph fill styling properties */
581 QBrush getFillBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
582 private:
583 /** \brief fill style of the graph */
585 /** \brief last fill color of the graph */
587 protected:
588};
589
590
591
592/** \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph line and fill style
593 * \ingroup jkqtplotter_basegraphs_stylemixins
594*/
596#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
597 Q_GADGET
598#endif
599public:
600 /** \brief class constructor */
602
603 /** \copydoc m_drawLine */
604 void setDrawLine(bool __value);
605 /** \copydoc m_drawLine */
606 bool getDrawLine() const;
607 /** \copydoc m_drawLine */
608 bool doDrawLine() const;
609
610 /** \copydoc m_fillCurve */
611 void setFillCurve(bool __value);
612 /** \copydoc m_fillCurve */
613 bool getFillCurve() const;
614 /** \copydoc m_fillCurve */
615 bool doFillCurve() const;
616
617
618#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
619 Q_PROPERTY(bool drawLine MEMBER m_drawLine READ getDrawLine WRITE setDrawLine)
620 Q_PROPERTY(bool fillCurve MEMBER m_fillCurve READ getFillCurve WRITE setFillCurve)
621#endif
622private:
623 /** \brief indicates whether to draw a line on the circumference of the described area (i.e. along the data points from \c xColumn and \c yColumn as well as \c xColumn and \c yColumn2 or not */
625 /** \brief indicates whether to fill the space between the curve and the x-axis */
627};
628
629
630
631/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for text in graphs
632 \ingroup jkqtplotter_basegraphs_stylemixins
633
634 supported properties:
635 - font name
636 - font size
637 - text color
638 .
639 */
641#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
642 Q_GADGET
643#endif
644 public:
645 /** \brief class constructor */
647
648 /** \brief initiaize the fill style (from the parent plotter) */
649 void initTextStyle(JKQTBasePlotter* parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default);
650
652
653 /** \brief set the base font size of text */
654 void setTextFontSize(double __value);
655 /** \brief get the base font size of text */
656 double getTextFontSize() const;
657
658 /** \brief set the base font name of text */
659 void setTextFontName(const QString& __value);
660 /** \brief get the base font name of text */
661 QString getTextFontName() const;
662
663 /** \brief set the color of the text */
664 void setTextColor(const QColor & __value);
665 /** \brief set the color of the text */
666 void setTextColor(const QColor & __value, double alpha);
667 /** \brief set the color of the text */
668 QColor getTextColor() const;
669
670
671
672#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
673 Q_PROPERTY(QColor textColor MEMBER m_textColor READ getTextColor WRITE setTextColor)
674 Q_PROPERTY(double textFontSize MEMBER m_textFontSize READ getTextFontSize WRITE setTextFontSize)
675 Q_PROPERTY(QString textFontName MEMBER m_textFontName READ getTextFontName WRITE setTextFontName)
676#endif
677 private:
678 /** \brief color of the text */
680
681 /** \brief base font size of text */
683 /** \brief name of the font to be used for the text */
685 protected:
686};
687
688
689
690
691
692#endif // jkqtpgraphsbasestylingmixins_H
base class for 2D plotter classes (used by the plotter widget JKQTPlotter)
Definition jkqtpbaseplotter.h:394
double pt2px(double pt, double dpi) const
returns the given size in DTP points points (1/72inch = 0.353mm) to pixels (with given dots per inch)
Definition jkqtpbaseplotter.h:842
double getLineWidthMultiplier() const
multiplier or the line widths
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:248
double calcHeadDecoratorSize(double line_width) const
calculates the tail decorator size from the line width line_width, using m_headDecoratorSizeFactor an...
JKQTPLineDecoratorStyle m_headDecoratorStyle
head decorator style
Definition jkqtpgraphsbasestylingmixins.h:284
double m_headDecoratorSizeFactor
head decorator size-factor, used to calculate the size of the arrow from the line width
Definition jkqtpgraphsbasestylingmixins.h:286
void initDecoratedHeadLineStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
initiaize the line style (from the parent plotter)
JKQTPLineDecoratorStyle getHeadDecoratorStyle() const
get the head decorator style
void setHeadDecoratorSizeFactor(const double &__value)
head decorator size-factor, used to calculate the size of the arrow from the line width
JKQTPGraphDecoratedHeadLineStyleMixin()
class constructor
void setHeadDecoratorStyle(const JKQTPLineDecoratorStyle &__value)
set the head decorator style
double getHeadDecoratorSizeFactor() const
head decorator size-factor, used to calculate the size of the arrow from the line width
This Mix-In class provides setter/getter methods, storage and other facilities for the graph line sty...
Definition jkqtpgraphsbasestylingmixins.h:303
JKQTPLineDecoratorStyle getHeadDecoratorStyle() const
get the head decorator style
double getHeadDecoratorSizeFactor() const
head decorator size-factor, used to calculate the size of the arrow from the line width
JKQTPLineDecoratorStyle getTailDecoratorStyle() const
get the tail decorator style
void setTailDecoratorSizeFactor(const double &__value)
tail decorator size-factor, used to calculate the size of the arrow from the line width
void setHeadDecoratorStyle(const JKQTPLineDecoratorStyle &__value)
set the head decorator style
JKQTPLineDecoratorStyle m_tailDecoratorStyle
tail decorator style
Definition jkqtpgraphsbasestylingmixins.h:356
double m_tailDecoratorSizeFactor
tail decorator size-factor, used to calculate the size of the arrow from the line width
Definition jkqtpgraphsbasestylingmixins.h:360
JKQTPGraphDecoratedLineStyleMixin()
class constructor
void setTailDecoratorStyle(const JKQTPLineDecoratorStyle &__value)
set the tail decorator style
double calcHeadDecoratorSize(double line_width) const
calculates the tail decorator size from the line width line_width, using m_headDecoratorSizeFactor an...
double calcTailDecoratorSize(double line_width) const
calculates the tail decorator size from the line width line_width, using m_tailDecoratorSizeFactor an...
double m_headDecoratorSizeFactor
head decorator size-factor, used to calculate the size of the arrow from the line width
Definition jkqtpgraphsbasestylingmixins.h:358
double getTailDecoratorSizeFactor() const
tail decorator size-factor, used to calculate the size of the arrow from the line width
void initDecoratedLineStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
initiaize the line style (from the parent plotter)
void setHeadDecoratorSizeFactor(const double &__value)
head decorator size-factor, used to calculate the size of the arrow from the line width
JKQTPLineDecoratorStyle m_headDecoratorStyle
head decorator style
Definition jkqtpgraphsbasestylingmixins.h:354
This Mix-In class provides setter/getter methods, storage and other facilities for the graph filling ...
Definition jkqtpgraphsbasestylingmixins.h:529
const QGradient * getFillGradient() const
get the gradient object of the graph filling
void setFillColor(const QColor &__value, double alpha)
set the color of the graph filling
void initFillStyleInvertedColor(JKQTPGraphFillStyleMixin *other)
initiaize the fill style from another JKQTPGraphFillStyleMixin other by inverting its fill color
JKQTPGraphFillStyleMixin()
class constructor
void setFillTransform(const QTransform &b)
sets a fill transformation
virtual ~JKQTPGraphFillStyleMixin()
void setFillColor(const QColor &__value)
set the color of the graph filling
void initFillStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
initiaize the fill style (from the parent plotter)
void setFillTexture(const QImage &__value)
set the color of the graph filling and sets fill style to Qt::TexturePattern
void setFillGradient(const QGradient &__value)
set the filling of the graph to a gradient and sets fill style to a gradient setting
void setFillBrush(const QBrush &b)
sets a fill brush (overwrites all internal properties!)
QImage getFillTextureImage() const
set the color of the graph filling
QBrush getFillBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
constructs a QBrush from the graph fill styling properties
QBrush m_fillBrush
fill style of the graph
Definition jkqtpgraphsbasestylingmixins.h:584
QPixmap getFillTexture() const
set the color of the graph filling
void setFillStyle(Qt::BrushStyle __value)
set the fill style of the graph
QColor getFillColor() const
set the color of the graph filling
Qt::BrushStyle getFillStyle() const
get the fill style of the graph
void setFillTexture(const QPixmap &__value)
set the color of the graph filling and sets fill style to Qt::TexturePattern
QColor m_fillColor
last fill color of the graph
Definition jkqtpgraphsbasestylingmixins.h:586
This Mix-In class provides setter/getter methods, storage and other facilities for the graph line and...
Definition jkqtpgraphsbasestylingmixins.h:595
bool doDrawLine() const
indicates whether to draw a line on the circumference of the described area (i.e. along the data poin...
bool doFillCurve() const
indicates whether to fill the space between the curve and the x-axis
bool getFillCurve() const
indicates whether to fill the space between the curve and the x-axis
void setDrawLine(bool __value)
indicates whether to draw a line on the circumference of the described area (i.e. along the data poin...
bool m_drawLine
indicates whether to draw a line on the circumference of the described area (i.e. along the data poin...
Definition jkqtpgraphsbasestylingmixins.h:624
bool getDrawLine() const
indicates whether to draw a line on the circumference of the described area (i.e. along the data poin...
bool m_fillCurve
indicates whether to fill the space between the curve and the x-axis
Definition jkqtpgraphsbasestylingmixins.h:626
void setFillCurve(bool __value)
indicates whether to fill the space between the curve and the x-axis
JKQTPGraphLineAndFillStyleMixin()
class constructor
This Mix-In class provides setter/getter methods, storage and other facilities for the graph line sty...
Definition jkqtpgraphsbasestylingmixins.h:49
void setLineJoinStyle(Qt::PenJoinStyle style)
sets the join style
double getLineWidth() const
get the line width of the graph line (in pt)
void setLineWidth(double __value)
set the line width of the graph line (in pt)
void setLineBrush(const QBrush &style)
sets the brush used to fill the line area
QPen getHighlightingLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
constructs a QPen from the line styling properties, suitable for drawing rectangle with sharp corners
QPen getLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
constructs a QPen from the line styling properties, suitable for drawing rectangles with sharp edges
QPen getHighlightingLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
constructs a QPen from the line styling properties
QPen getLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
constructs a QPen from the line styling properties
virtual ~JKQTPGraphLineStyleMixin()
QVector< qreal > getLineDashPattern() const
gets the dash pattern for a custom dash style
void setLineColor(const QColor &__value, double alpha)
set the color of the graph line
void setHighlightingLineColor(const QColor &__value)
set the color of the graph line when highlighted
Qt::PenStyle getLineStyle() const
get the style of the graph line
QPen m_linePen
graph line pen
Definition jkqtpgraphsbasestylingmixins.h:155
QPen getKeyLinePen(JKQTPEnhancedPainter &painter, const QRectF &rect, JKQTBasePlotter *parent) const
constructs a QPen from the line styling properties, but uses getKeyLineWidthPx() for the width,...
void setLineColorInvertedFrom(QColor __noninvertedColor)
sets the line-color as an inverted version of the given color
void setHighlightingLineColor(const QColor &__value, double alpha)
set the color of the graph line when highlighted
JKQTPGraphLineStyleMixin()
class constructor
Qt::PenCapStyle getLineCapStyle() const
gets the cap style
QColor m_highlightingLineColor
line pen for the highlighted look
Definition jkqtpgraphsbasestylingmixins.h:159
void initLineStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
initiaize the line style (from the parent plotter)
QBrush getLineBrush() const
gets the brush used to fill the line area
void setLineColor(const QColor &__value)
set the color of the graph line
double m_lineWidth
width of the graph lines, given in pt
Definition jkqtpgraphsbasestylingmixins.h:157
qreal getLineDashOffset() const
returns the dash offset for a custom dash style
void setLineDashPattern(const QVector< qreal > &pattern)
sets the dash pattern for a custom dash style
void setLineDashOffset(qreal offset)
sets the dash offset for a custom dash style
void setLineStyle(Qt::PenStyle __value)
set the style of the graph line
double getKeyLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent) const
returns the linewidth for drawing lines in a key entry with keyRect for the symbol,...
void setLineCapStyle(Qt::PenCapStyle style)
sets the cap style
Qt::PenJoinStyle getLineJoinStyle() const
returns the join style
QColor getLineColor() const
get the color of the graph line
QColor getHighlightingLineColor() const
get the color of the graph line when highlighted
This Mix-In class provides setter/getter methods, storage and other facilities for a line-graph compr...
Definition jkqtpgraphsbasestylingmixins.h:175
bool getUseNonvisibleLineCompression() const
void setUseNonvisibleLineCompression(bool _useNonvisibleLineCompression)
bool m_useNonvisibleLineCompression
use an optimization algorithm that tries to reduce the number of lines that overlap each other (i....
Definition jkqtpgraphsbasestylingmixins.h:215
double m_nonvisibleLineCompressionAgressiveness
this sets the agressiveness of the option useNonvisibleLineCompression
Definition jkqtpgraphsbasestylingmixins.h:231
void setNonvisibleLineCompressionAgressiveness(double Agressiveness)
double getNonvisibleLineCompressionAgressiveness() const
JKQTPGraphLinesCompressionMixin()
class constructor
This Mix-In class provides setter/getter methods, storage and other facilities for the graph symbols ...
Definition jkqtpgraphsbasestylingmixins.h:379
void setSymbolColor(const QColor &__value, double alpha)
set the color of the graph symbols
void plotStyledSymbol(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, double x, double y) const
plot a symbol at location x,y (in painter coordinates), using the current style
Definition jkqtpgraphsbasestylingmixins.h:465
void setSymbolFillColor(const QColor &__value)
set the color of filling of the graph symbols
double getSymbolSize() const
get the size (=diameter in pt) of the graph symbol (in pt)
void setSymbolLineWidth(double __value)
set the line width of the graph symbol outline (in pt)
void setSymbolAlpha(double alpha)
set alpha-value of symbol outline and filling
JKQTPGraphSymbols getSymbolType() const
get the type of the graph symbol
QPen getSymbolPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
constructs a QPen from the line styling properties
JKQTPGraphSymbols m_symbolType
which symbol to use for the datapoints
Definition jkqtpgraphsbasestylingmixins.h:440
QColor getSymbolFillColor() const
set the color of filling of the graph symbols
double getKeySymbolSizePx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton=0.9) const
returns the symbol size for drawing symbols in a key entry with keyRect for the symbol,...
QString m_symbolFontName
font to be used for character symbols JKQTPCharacterSymbol+QChar('').unicode()
Definition jkqtpgraphsbasestylingmixins.h:450
void plotStyledSymbol(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, double x, double y, JKQTPGraphSymbols type) const
plot a symbol at location x,y (in painter coordinates), using the current style
Definition jkqtpgraphsbasestylingmixins.h:489
double getKeySymbolLineWidthPx(JKQTPEnhancedPainter &painter, const QRectF &keyRect, const JKQTBasePlotter *parent, double maxSymbolSizeFracton=0.9) const
returns the symbol linewidth for drawing symbols in a key entry with keyRect for the symbol,...
QString getSymbolFontName() const
get the font to be used for character symbols JKQTPCharacterSymbol+QChar('').unicode()
void plotStyledSymbol(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, double x, double y, double symbolSize) const
plot a symbol at location x,y (in painter coordinates), using the current style
Definition jkqtpgraphsbasestylingmixins.h:477
void setSymbolFontName(const QString &__value)
set the font to be used for character symbols JKQTPCharacterSymbol+QChar('').unicode()
QColor getSymbolColor() const
set the color of the graph symbols
void setSymbolSize(double __value)
set the size (=diameter in pt) of the graph symbol (in pt)
void initSymbolStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
initiaize the symbol style (from the parent plotter)
double m_symbolSize
size (diameter in pt) of the symbol for the data points, given in pt
Definition jkqtpgraphsbasestylingmixins.h:442
void setSymbolColor(const QColor &__value)
set the color of the graph symbols
QFont getSymbolFont() const
generate a QFont for darwing symbols
double m_symbolLineWidth
width (in pt) of the lines used to plot the symbol for the data points, given in pt
Definition jkqtpgraphsbasestylingmixins.h:448
JKQTPGraphSymbolStyleMixin()
class constructor
QColor m_symbolColor
(outline) color of the symbol
Definition jkqtpgraphsbasestylingmixins.h:444
double getSymbolLineWidth() const
get the line width of the graph symbol outline (in pt)
void plotStyledSymbol(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, double x, double y, QColor color, QColor fillColor) const
plot a symbol at location x,y (in painter coordinates), using the current style
Definition jkqtpgraphsbasestylingmixins.h:502
virtual ~JKQTPGraphSymbolStyleMixin()
QColor m_symbolFillColor
color of the symbol filling
Definition jkqtpgraphsbasestylingmixins.h:446
void setSymbolFillColor(const QColor &__value, double alpha)
set the color of filling of the graph symbols
void setSymbolType(JKQTPGraphSymbols __value)
set the type of the graph symbol
QBrush getSymbolBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
constructs a QPen from the line styling properties
This Mix-In class provides setter/getter methods, storage and other facilities for text in graphs.
Definition jkqtpgraphsbasestylingmixins.h:640
void setTextFontSize(double __value)
set the base font size of text
double m_textFontSize
base font size of text
Definition jkqtpgraphsbasestylingmixins.h:682
QColor getTextColor() const
set the color of the text
virtual ~JKQTPGraphTextStyleMixin()
double getTextFontSize() const
get the base font size of text
void initTextStyle(JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
initiaize the fill style (from the parent plotter)
QString m_textFontName
name of the font to be used for the text
Definition jkqtpgraphsbasestylingmixins.h:684
QString getTextFontName() const
get the base font name of text
QColor m_textColor
color of the text
Definition jkqtpgraphsbasestylingmixins.h:679
void setTextFontName(const QString &__value)
set the base font name of text
void setTextColor(const QColor &__value, double alpha)
set the color of the text
JKQTPGraphTextStyleMixin(JKQTBasePlotter *parent)
class constructor
void setTextColor(const QColor &__value)
set the color of the text
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
JKQTPPlotStyleType
used to specify teh type of graph when calling getPlotStyle()
Definition jkqtptools.h:68
void JKQTPPlotSymbol(TPainter &painter, double x, double y, JKQTPGraphSymbols symbol, double size, double symbolLineWidth, QColor color, QColor fillColor, QFont symbolFont)
plot the specified symbol at pixel position x,y, thread-safe
Definition jkqtpdrawingtools.h:661
JKQTPLineDecoratorStyle
symbols that can be used to plot a datapoint for a graph
Definition jkqtpdrawingtools.h:365
JKQTPGraphSymbols
symbols that can be used to plot a datapoint for a graph
Definition jkqtpdrawingtools.h:143