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

This Mix-In class provides setter/getter methods, storage and other facilities for value labels in graphs. More...

#include <jkqtpgraphlabelstylemixin.h>

Inheritance diagram for JKQTPGraphValueLabelStyleMixin:
[legend]
Collaboration diagram for JKQTPGraphValueLabelStyleMixin:
[legend]

Classes

struct  LabelGeometry
 describes details about the geometry of a label, used by calcLabelGeometry() More...
 

Public Member Functions

 JKQTPGraphValueLabelStyleMixin (JKQTBasePlotter *parent)
 class constructor
 
virtual ~JKQTPGraphValueLabelStyleMixin ()
 
void drawLabel (JKQTPEnhancedPainter &painter, const QPointF &xDataPixel, const QPointF &xData, const QString &contents, JKQTBasePlotter *parent, double baselineX, double baselineY) const
 draws a label, including its box
 
bool drawsLabelBoxFrame () const
 indicates whether to draw a frame around the box *
 
double getLabelBoxRounding () const
 rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]
 
JKQTPGraphLabelBoxType getLabelBoxType () const
 type or style of the box surrounding the label text
 
double getLabelOffset () const
 offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and is a rather close distance (e.g. JKQTPGLSimpleBox)
 
double getLabelOffsetWithConnector () const
 offset of the box rectangle to the actual data point location [pt], this variant is used when a visible connector is shown (e.g. JKQTPGLSimpleBoxAndLine)
 
JKQTPGraphLabelPosition getLabelPosition () const
 position of the label
 
double getLabelXPadding () const
 padding in x-direction between label and surrounding box [pt]
 
double getLabelYPadding () const
 padding in y-direction between label and surrounding box [pt] *
 
double getUsedLabelOffset () const
 determines, whether to use getLabelOffset() or getLabelOffsetWithConnector() (or something else) and returns it
 
void initValueLabelStyle (JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
 initiaize the fill style (from the parent plotter)
 
bool isLabelPositioningGrowingInX () const
 determines whether a label is positioned left of the mininmum, or right of the maxinmum datapoint (true )

 
bool isLabelPositioningGrowingInY () const
 determines whether a label is positioned below the mininmum, or above the maxinmum datapoint (true )

 
void setDrawLabelBoxFrame (bool r)
 indicates whether to draw a frame around the box *
 
void setLabelBoxRounding (double r)
 rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]
 
void setLabelBoxType (JKQTPGraphLabelBoxType r)
 type or style of the box surrounding the label text
 
void setLabelOffset (double r)
 offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and is a rather close distance (e.g. JKQTPGLSimpleBox)
 
void setLabelOffsetWithConnector (double r)
 offset of the box rectangle to the actual data point location [pt], this variant is used when a visible connector is shown (e.g. JKQTPGLSimpleBoxAndLine)
 
void setLabelPosition (JKQTPGraphLabelPosition r)
 position of the label
 
void setLabelXPadding (double r)
 padding in x-direction between label and surrounding box [pt]
 
void setLabelYPadding (double r)
 padding in y-direction between label and surrounding box [pt] *
 
- Public Member Functions inherited from JKQTPGraphTextStyleMixin
 JKQTPGraphTextStyleMixin (JKQTBasePlotter *parent)
 class constructor
 
virtual ~JKQTPGraphTextStyleMixin ()
 
QColor getTextColor () const
 set the color of the text
 
QString getTextFontName () const
 get the base font name of text
 
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)
 
void setTextColor (const QColor &__value)
 set the color of the text
 
void setTextColor (const QColor &__value, double alpha)
 set the color of the text
 
void setTextFontName (const QString &__value)
 set the base font name of text
 
void setTextFontSize (double __value)
 set the base font size of text
 
- Public Member Functions inherited from JKQTPGraphLineStyleMixin
 JKQTPGraphLineStyleMixin ()
 class constructor
 
virtual ~JKQTPGraphLineStyleMixin ()
 
QColor getHighlightingLineColor () const
 get the color of the graph line when highlighted
 
QPen getHighlightingLinePen (JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
 constructs a QPen from the line styling properties
 
QPen getHighlightingLinePenForRects (JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
 constructs a QPen from the line styling properties, suitable for drawing rectangle with sharp corners
 
QPen getKeyLinePen (JKQTPEnhancedPainter &painter, const QRectF &rect, JKQTBasePlotter *parent) const
 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
 
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, using painter and parent .
 
QBrush getLineBrush () const
 gets the brush used to fill the line area
 
Qt::PenCapStyle getLineCapStyle () const
 gets the cap style
 
QColor getLineColor () const
 get the color of the graph line
 
qreal getLineDashOffset () const
 returns the dash offset for a custom dash style
 
QVector< qreal > getLineDashPattern () const
 gets the dash pattern for a custom dash style
 
Qt::PenJoinStyle getLineJoinStyle () const
 returns the join style
 
QPen getLinePen (JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
 constructs a QPen from the line styling properties
 
QPen getLinePenForRects (JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
 constructs a QPen from the line styling properties, suitable for drawing rectangles with sharp edges
 
Qt::PenStyle getLineStyle () const
 get the style of the graph line
 
double getLineWidth () const
 get the line width of the graph line (in pt)
 
void initLineStyle (JKQTBasePlotter *parent, int &parentPlotStyle, JKQTPPlotStyleType styletype=JKQTPPlotStyleType::Default)
 initiaize the line style (from the parent plotter)
 
void setHighlightingLineColor (const QColor &__value)
 set the color of the graph line when highlighted
 
void setHighlightingLineColor (const QColor &__value, double alpha)
 set the color of the graph line when highlighted
 
void setLineBrush (const QBrush &style)
 sets the brush used to fill the line area
 
void setLineCapStyle (Qt::PenCapStyle style)
 sets the cap style
 
void setLineColor (const QColor &__value)
 set the color of the graph line
 
void setLineColor (const QColor &__value, double alpha)
 set the color of the graph line
 
void setLineColorInvertedFrom (QColor __noninvertedColor)
 sets the line-color as an inverted version of the given color
 
void setLineDashOffset (qreal offset)
 sets the dash offset for a custom dash style
 
void setLineDashPattern (const QVector< qreal > &pattern)
 sets the dash pattern for a custom dash style
 
void setLineJoinStyle (Qt::PenJoinStyle style)
 sets the join style
 
void setLineStyle (Qt::PenStyle __value)
 set the style of the graph line
 
void setLineWidth (double __value)
 set the line width of the graph line (in pt)
 
- Public Member Functions inherited from JKQTPGraphFillStyleMixin
 JKQTPGraphFillStyleMixin ()
 class constructor
 
virtual ~JKQTPGraphFillStyleMixin ()
 
QBrush getFillBrush (JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
 constructs a QBrush from the graph fill styling properties
 
QColor getFillColor () const
 set the color of the graph filling
 
const QGradient * getFillGradient () const
 get the gradient object of the graph filling
 
Qt::BrushStyle getFillStyle () const
 get the fill style of the graph
 
QPixmap getFillTexture () const
 set the color of the graph filling
 
QImage getFillTextureImage () const
 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 initFillStyleInvertedColor (JKQTPGraphFillStyleMixin *other)
 initiaize the fill style from another JKQTPGraphFillStyleMixin other by inverting its fill color
 
void setFillBrush (const QBrush &b)
 sets a fill brush (overwrites all internal properties!)
 
void setFillColor (const QColor &__value)
 set the color of the graph filling
 
void setFillColor (const QColor &__value, double alpha)
 set the color of the graph filling
 
void setFillGradient (const QGradient &__value)
 set the filling of the graph to a gradient and sets fill style to a gradient setting
 
void setFillStyle (Qt::BrushStyle __value)
 set the fill style of the graph
 
void setFillTexture (const QImage &__value)
 set the color of the graph filling and sets fill style to Qt::TexturePattern
 
void setFillTexture (const QPixmap &__value)
 set the color of the graph filling and sets fill style to Qt::TexturePattern
 
void setFillTransform (const QTransform &b)
 sets a fill transformation
 

Protected Member Functions

LabelGeometry calcLabelGeometry (JKQTPEnhancedPainter &painter, const QPointF &xDataPixel, const QPointF &xData, const QString &contents, JKQTBasePlotter *parent, double baselineX, double baselineY) const
 calculate everything that is necessary to draw a label, including its box
 

Properties

bool drawLabelBoxFrame
 
double labelBoxRounding
 
JKQTPGraphLabelBoxType labelBoxType
 
double labelOffset
 
double labelOffsetWithConnector
 
JKQTPGraphLabelPosition labelPosition
 
double labelXPadding
 
double labelYPadding
 
- Properties inherited from JKQTPGraphTextStyleMixin
QColor textColor
 
QString textFontName
 
double textFontSize
 
- Properties inherited from JKQTPGraphLineStyleMixin
QColor highlightingLineColor
 
QColor lineColor
 
Qt::PenStyle lineStyle
 
double lineWidth
 
- Properties inherited from JKQTPGraphFillStyleMixin
QColor fillColor
 
Qt::BrushStyle fillStyle
 

Private Attributes

bool m_drawLabelBoxFrame
 indicates whether to draw a frame around the box *
 
double m_labelBoxRounding
 rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]
 
JKQTPGraphLabelBoxType m_labelBoxType
 type or style of the box surrounding the label text
 
double m_labelOffset
 offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and is a rather close distance (e.g. JKQTPGLSimpleBox)
 
double m_labelOffsetWithConnector
 offset of the box rectangle to the actual data point location [pt], this variant is used when a visible connector is shown (e.g. JKQTPGLSimpleBoxAndLine)
 
JKQTPGraphLabelPosition m_labelPosition
 position of the label
 
double m_labelXPadding
 padding in x-direction between label and surrounding box [pt]
 
double m_labelYPadding
 padding in y-direction between label and surrounding box [pt] *
 

Detailed Description

This Mix-In class provides setter/getter methods, storage and other facilities for value labels in graphs.

in addition to all properties of JKQTPGraphTextStyleMixin for the actual label text, JKQTPGraphLineStyleMixin & JKQTPGraphFillStyleMixin for a box around the label, it also supports properties for positioning and further sryling the labels.

supported properties:

  • padding from actual label to border
  • distance of label to actual datapoint
  • positioning of the label
  • styling for the box around the label
See also
JKQTPGraphTextStyleMixin, JKQTPGraphLineStyleMixin, JKQTPGraphFillStyleMixin, JKQTPXYGraphLabels

Constructor & Destructor Documentation

◆ JKQTPGraphValueLabelStyleMixin()

JKQTPGraphValueLabelStyleMixin::JKQTPGraphValueLabelStyleMixin ( JKQTBasePlotter parent)

class constructor

◆ ~JKQTPGraphValueLabelStyleMixin()

virtual JKQTPGraphValueLabelStyleMixin::~JKQTPGraphValueLabelStyleMixin ( )
virtual

Member Function Documentation

◆ calcLabelGeometry()

LabelGeometry JKQTPGraphValueLabelStyleMixin::calcLabelGeometry ( JKQTPEnhancedPainter painter,
const QPointF &  xDataPixel,
const QPointF &  xData,
const QString &  contents,
JKQTBasePlotter parent,
double  baselineX,
double  baselineY 
) const
protected

calculate everything that is necessary to draw a label, including its box

painter the JKQTPEnhancedPainter to use for drawing

xDataPixel position of the labeled datapoint in (screen) pixels

xData x- and y-coordinate of the datapoint (needed for some JKQTPGraphLabelPosition)

contents the text to be rendered

parent the JKQTPBasePlotter in whos context we are drawing (e.g. needed to render contents )

baselineX baseline (in graph coordinate system, not pixels) of the graph in x-direction (typically 0), needed for JKQTPGLabelHalfwaysToYAxis

baselineY baseline (in graph coordinate system, not pixels) of the graph in y-direction (typically 0), needed for JKQTPGLabelHalfwaysToXAxis

◆ drawLabel()

void JKQTPGraphValueLabelStyleMixin::drawLabel ( JKQTPEnhancedPainter painter,
const QPointF &  xDataPixel,
const QPointF &  xData,
const QString &  contents,
JKQTBasePlotter parent,
double  baselineX,
double  baselineY 
) const

draws a label, including its box

painter the JKQTPEnhancedPainter to use for drawing

xDataPixel position of the labeled datapoint in (screen) pixels

xData x- and y-coordinate of the datapoint (needed for some JKQTPGraphLabelPosition)

contents the text to be rendered

parent the JKQTPBasePlotter in whos context we are drawing (e.g. needed to render contents )

baselineX baseline (in graph coordinate system, not pixels) of the graph in x-direction (typically 0), needed for JKQTPGLabelHalfwaysToYAxis

baselineY baseline (in graph coordinate system, not pixels) of the graph in y-direction (typically 0), needed for JKQTPGLabelHalfwaysToXAxis

◆ drawsLabelBoxFrame()

bool JKQTPGraphValueLabelStyleMixin::drawsLabelBoxFrame ( ) const

indicates whether to draw a frame around the box *

◆ getLabelBoxRounding()

double JKQTPGraphValueLabelStyleMixin::getLabelBoxRounding ( ) const

rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]

◆ getLabelBoxType()

JKQTPGraphLabelBoxType JKQTPGraphValueLabelStyleMixin::getLabelBoxType ( ) const

type or style of the box surrounding the label text

See also
JKQTPGraphLabelBoxType for details on available options

◆ getLabelOffset()

double JKQTPGraphValueLabelStyleMixin::getLabelOffset ( ) const

offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and is a rather close distance (e.g. JKQTPGLSimpleBox)

See also
setLabelOffset(), getLabelOffset(), setLabelOffsetWithConnector(), getLabelOffsetWithConnector()

◆ getLabelOffsetWithConnector()

double JKQTPGraphValueLabelStyleMixin::getLabelOffsetWithConnector ( ) const

offset of the box rectangle to the actual data point location [pt], this variant is used when a visible connector is shown (e.g. JKQTPGLSimpleBoxAndLine)

See also
setLabelOffsetWithConnector(), getLabelOffsetWithConnector(), setLabelOffset(), getLabelOffset()

◆ getLabelPosition()

JKQTPGraphLabelPosition JKQTPGraphValueLabelStyleMixin::getLabelPosition ( ) const

position of the label

See also
JKQTPGraphLabelPosition for details on available options

◆ getLabelXPadding()

double JKQTPGraphValueLabelStyleMixin::getLabelXPadding ( ) const

padding in x-direction between label and surrounding box [pt]

◆ getLabelYPadding()

double JKQTPGraphValueLabelStyleMixin::getLabelYPadding ( ) const

padding in y-direction between label and surrounding box [pt] *

◆ getUsedLabelOffset()

double JKQTPGraphValueLabelStyleMixin::getUsedLabelOffset ( ) const

determines, whether to use getLabelOffset() or getLabelOffsetWithConnector() (or something else) and returns it

◆ initValueLabelStyle()

void JKQTPGraphValueLabelStyleMixin::initValueLabelStyle ( JKQTBasePlotter parent,
int &  parentPlotStyle,
JKQTPPlotStyleType  styletype = JKQTPPlotStyleType::Default 
)

initiaize the fill style (from the parent plotter)

◆ isLabelPositioningGrowingInX()

bool JKQTPGraphValueLabelStyleMixin::isLabelPositioningGrowingInX ( ) const

determines whether a label is positioned left of the mininmum, or right of the maxinmum datapoint (true )

◆ isLabelPositioningGrowingInY()

bool JKQTPGraphValueLabelStyleMixin::isLabelPositioningGrowingInY ( ) const

determines whether a label is positioned below the mininmum, or above the maxinmum datapoint (true )

◆ setDrawLabelBoxFrame()

void JKQTPGraphValueLabelStyleMixin::setDrawLabelBoxFrame ( bool  r)

indicates whether to draw a frame around the box *

◆ setLabelBoxRounding()

void JKQTPGraphValueLabelStyleMixin::setLabelBoxRounding ( double  r)

rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]

◆ setLabelBoxType()

void JKQTPGraphValueLabelStyleMixin::setLabelBoxType ( JKQTPGraphLabelBoxType  r)

type or style of the box surrounding the label text

See also
JKQTPGraphLabelBoxType for details on available options

◆ setLabelOffset()

void JKQTPGraphValueLabelStyleMixin::setLabelOffset ( double  r)

offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and is a rather close distance (e.g. JKQTPGLSimpleBox)

See also
setLabelOffset(), getLabelOffset(), setLabelOffsetWithConnector(), getLabelOffsetWithConnector()

◆ setLabelOffsetWithConnector()

void JKQTPGraphValueLabelStyleMixin::setLabelOffsetWithConnector ( double  r)

offset of the box rectangle to the actual data point location [pt], this variant is used when a visible connector is shown (e.g. JKQTPGLSimpleBoxAndLine)

See also
setLabelOffsetWithConnector(), getLabelOffsetWithConnector(), setLabelOffset(), getLabelOffset()

◆ setLabelPosition()

void JKQTPGraphValueLabelStyleMixin::setLabelPosition ( JKQTPGraphLabelPosition  r)

position of the label

See also
JKQTPGraphLabelPosition for details on available options

◆ setLabelXPadding()

void JKQTPGraphValueLabelStyleMixin::setLabelXPadding ( double  r)

padding in x-direction between label and surrounding box [pt]

◆ setLabelYPadding()

void JKQTPGraphValueLabelStyleMixin::setLabelYPadding ( double  r)

padding in y-direction between label and surrounding box [pt] *

Member Data Documentation

◆ m_drawLabelBoxFrame

bool JKQTPGraphValueLabelStyleMixin::m_drawLabelBoxFrame
private

indicates whether to draw a frame around the box *

◆ m_labelBoxRounding

double JKQTPGraphValueLabelStyleMixin::m_labelBoxRounding
private

rounding radius of the box rectangle (<=0 -> no rounded rectangle) [pt]

◆ m_labelBoxType

JKQTPGraphLabelBoxType JKQTPGraphValueLabelStyleMixin::m_labelBoxType
private

type or style of the box surrounding the label text

See also
JKQTPGraphLabelBoxType for details on available options

◆ m_labelOffset

double JKQTPGraphValueLabelStyleMixin::m_labelOffset
private

offset of the box rectangle to the actual data point location [pt], this is used for simple boxes and is a rather close distance (e.g. JKQTPGLSimpleBox)

See also
setLabelOffset(), getLabelOffset(), setLabelOffsetWithConnector(), getLabelOffsetWithConnector()

◆ m_labelOffsetWithConnector

double JKQTPGraphValueLabelStyleMixin::m_labelOffsetWithConnector
private

offset of the box rectangle to the actual data point location [pt], this variant is used when a visible connector is shown (e.g. JKQTPGLSimpleBoxAndLine)

See also
setLabelOffsetWithConnector(), getLabelOffsetWithConnector(), setLabelOffset(), getLabelOffset()

◆ m_labelPosition

JKQTPGraphLabelPosition JKQTPGraphValueLabelStyleMixin::m_labelPosition
private

position of the label

See also
JKQTPGraphLabelPosition for details on available options

◆ m_labelXPadding

double JKQTPGraphValueLabelStyleMixin::m_labelXPadding
private

padding in x-direction between label and surrounding box [pt]

◆ m_labelYPadding

double JKQTPGraphValueLabelStyleMixin::m_labelYPadding
private

padding in y-direction between label and surrounding box [pt] *

Property Documentation

◆ drawLabelBoxFrame

bool JKQTPGraphValueLabelStyleMixin::drawLabelBoxFrame
readwrite

◆ labelBoxRounding

double JKQTPGraphValueLabelStyleMixin::labelBoxRounding
readwrite

◆ labelBoxType

JKQTPGraphLabelBoxType JKQTPGraphValueLabelStyleMixin::labelBoxType
readwrite

◆ labelOffset

double JKQTPGraphValueLabelStyleMixin::labelOffset
readwrite

◆ labelOffsetWithConnector

double JKQTPGraphValueLabelStyleMixin::labelOffsetWithConnector
readwrite

◆ labelPosition

JKQTPGraphLabelPosition JKQTPGraphValueLabelStyleMixin::labelPosition
readwrite

◆ labelXPadding

double JKQTPGraphValueLabelStyleMixin::labelXPadding
readwrite

◆ labelYPadding

double JKQTPGraphValueLabelStyleMixin::labelYPadding
readwrite

The documentation for this class was generated from the following file: