JKQTPlotter
an extensive Qt4/Qt5 Plotter framework (including a fast variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies

implements a vertical axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis). More...

#include <jkqtpcoordinateaxes.h>

Inheritance diagram for JKQTPVerticalAxis:
Collaboration diagram for JKQTPVerticalAxis:

Public Member Functions

 JKQTPVerticalAxis (JKQTBasePlotter *parent)
 class constructor More...
 
virtual void drawAxes (JKQTPEnhancedPainter &painter) override
 draw axes More...
 
virtual void drawGrids (JKQTPEnhancedPainter &painter) override
 draw grids
More...
 
virtual QSizeF getSize1 (JKQTPEnhancedPainter &painter) override
 returns the size of the left/bottom axis in pt More...
 
virtual QSizeF getSize2 (JKQTPEnhancedPainter &painter) override
 returns the size of the right/top axis in pt More...
 
- Public Member Functions inherited from JKQTPCoordinateAxis
 JKQTPCoordinateAxis (JKQTBasePlotter *parent)
 class constructor More...
 
virtual ~JKQTPCoordinateAxis ()
 class destructor More...
 
void addAxisTickLabel (double x, const QString &label)
 add a new tick label to the axis More...
 
void addAxisTickLabels (const double *x, const QString *label, int items)
 add a new tick label to the axis More...
 
void addAxisTickLabels (const double *x, const QStringList &label)
 add a new tick label to the axis More...
 
void addAxisTickLabels (const QVector< double > &x, const QString *label)
 add a new tick label to the axis More...
 
void addAxisTickLabels (const QVector< double > &x, const QStringList &label)
 add a new tick label to the axis More...
 
void calcPlotScaling (bool force=false)
 calculate the scaling and offset values from axis min/max values More...
 
void clearAxisTickLabels ()
 clear axis tick labels. This switches back to automatic labels mode for the axis. More...
 
double getAbsoluteMax () const
 returns the current absolute max More...
 
double getAbsoluteMin () const
 returns the current absolute min More...
 
bool getAutoAxisSpacing () const
 calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() ) More...
 
bool getAutoLabelDigits () const
 when true, the digits of the labels are calculated automatically More...
 
QColor getAxisColor () const
 color of the axis (labels, ticks, axis itself ...) More...
 
QString getAxisLabel () const
 axis label of the axis More...
 
const JKQTPCoordinateAxisStylegetCurrentAxisStyle () const
 current style properties for this JKQTBasePlotter More...
 
bool getDoUpdateScaling () const
 
bool getDrawGrid () const
 indicates whether to draw the major grid lines More...
 
bool getDrawMinorGrid () const
 indicates whether to draw the minor grid lines More...
 
JKQTPCADrawMode getDrawMode1 () const
 draw mode of the main (left/bottom) axis More...
 
JKQTPCADrawMode getDrawMode2 () const
 draw mode of the secondary (right/top) axis More...
 
QColor getGridColor () const
 color of the grid More...
 
Qt::PenStyle getGridStyle () const
 line stye of the grid lines More...
 
double getGridWidth () const
 width of the grid lines (in pixel) More...
 
bool getInverted () const
 indicates whether the axis is to be inverted or not More...
 
int getLabelDigits () const
 digits used for tick labels More...
 
double getLabelDistance () const
 distance between tick label and axis label in pt More...
 
double getLabelFontSize () const
 fontsize of the axis labels More...
 
JKQTPLabelPosition getLabelPosition () const
 position of the axis label More...
 
JKQTPCALabelType getLabelType () const
 indicates how to draw the labels More...
 
double getLineWidth () const
 line width of axis in pt More...
 
double getLineWidthZeroAxis () const
 line width of 0-line in pt More...
 
bool getLogAxis () const
 indicates whether the y axis has a logarithmic scale More...
 
double getLogAxisBase () const
 the base for a logarithmic x axis More...
 
double getMax () const
 returns the current max More...
 
double getMin () const
 returns the current min More...
 
QColor getMinorGridColor () const
 color of the minor grid lines More...
 
Qt::PenStyle getMinorGridStyle () const
 line stye of the minor grid lines More...
 
double getMinorGridWidth () const
 width of the minor grid lines (in pixel) More...
 
double getMinorTickLabelFontSize () const
 fontsize of the minor axis tick labels More...
 
bool getMinorTickLabelFullNumber () const
 indicates whether the minor tick labels should be full numbers, or just a number between 0..10 More...
 
bool getMinorTickLabelsEnabled () const
 if true, the plotter displays minor axis labels as number between 1 and 10 in some cases More...
 
double getMinorTickOutsideLength () const
 length of a minor axis tick outside the plot border in pt More...
 
unsigned int getMinorTicks () const
 number of minor grid lines per axis tick interval More...
 
double getMinorTickWidth () const
 line width of minor ticks in pt More...
 
unsigned int getMinTicks () const
 minimum number of axis ticks More...
 
JKQTBasePlottergetParent ()
 parent plotter class More...
 
const JKQTBasePlottergetParent () const
 parent plotter class More...
 
bool getShowZeroAxis () const
 indicates whether to draw a thick axis line at x=0 (zero axis) More...
 
QString getTickDateFormat () const
 format string for date tick labels, see see QDateTime::toString() documentation for details on format strings More...
 
QString getTickDateTimeFormat () const
 format string for datetime tick labels, see see QDateTime::toString() documentation for details on format strings More...
 
double getTickLabelAngle () const
 rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal) More...
 
double getTickLabelDistance () const
 distance between tick end and label start in pt More...
 
double getTickLabelFontSize () const
 fontsize of the axis tick labels More...
 
JKQTPLabelTickMode getTickMode () const
 mode of the major ticks More...
 
double getTickOutsideLength () const
 length of an axis tick outside the plot border in pt More...
 
double getTickSpacing () const
 calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes. More...
 
QString getTickTimeFormat () const
 format string for time tick labels, see see QDateTime::toString() documentation for details on format strings More...
 
double getTickWidth () const
 line width of ticks in pt More...
 
double getUserLogTickSpacing () const
 if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which is editable by use of public access methods. More...
 
double getUserTickSpacing () const
 if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which is editable by use of public access methods. More...
 
bool isLogAxis () const
 returns whether this axis uses logarithmic scaling More...
 
void loadCurrentAxisStyle (const QSettings &settings, const QString &group="plot/axes/")
 replace the current style properties for this JKQTBasePlotter with properties loaded from settings More...
 
virtual void loadSettings (const QSettings &settings, const QString &group=QString("plots/axes/"))
 loads the plot properties from a QSettings object More...
 
double p2x (double x) const
 return time coordinate coordinate from x-pixel More...
 
void saveCurrentAxisStyle (QSettings &settings, const QString &group="plot/axes/") const
 store the current style properties for this JKQTBasePlotter with properties loaded from settings More...
 
virtual void saveSettings (QSettings &settings, const QString &group=QString("plots/axes/")) const
 saves the plot properties into a QSettings object. More...
 
void setAutoLabelDigits (bool __value)
 when true, the digits of the labels are calculated automatically More...
 
void setCurrentAxisStyle (const JKQTPCoordinateAxisStyle &style)
 replace the current style properties for this JKQTBasePlotter More...
 
void setDoUpdateScaling (bool __value)
 
virtual void setParent (JKQTBasePlotter *parent)
 
double x2p (double x) const
 return x-pixel coordinate from time coordinate More...
 

Protected Member Functions

virtual void drawTickLabel1 (JKQTPEnhancedPainter &painter, double xx, double yy, const QString &label, double fontSize)
 
virtual void drawTickLabel2 (JKQTPEnhancedPainter &painter, double xx, double yy, const QString &label, double fontSize)
 
virtual bool getParentOtheraxisInverted () const override
 is other (perpendicular) axis inverted (needed for grids) More...
 
virtual double getParentOtheraxisOffset () const override
 pixel offset of (perpendicular) other axis (needed for grids) More...
 
virtual double getParentOtheraxisWidth () const override
 pixel of other (perpendicular) axis (needed for grids) More...
 
virtual double getParentPlotOffset () const override
 offset of the plot in the direction of the axis More...
 
virtual double getParentPlotWidth () const override
 width of the plot in the direction of the axis More...
 
- Protected Member Functions inherited from JKQTPCoordinateAxis
double calcLinearTickSpacing ()
 calculates the tick spacing for a linear axis that spans awidth and that should show at least JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks. More...
 
int calcLinearUnitDigits ()
 Calculate the number of digits needed for the labels of an axis that starts at minval and where the tick spacing is tickSpacing. More...
 
double calcLogTickSpacing ()
 same as calcLinearTickSpacing(), but for logarithmic scaling More...
 
QString floattolabel (double data)
 convert a float to a tick label string More...
 
QString floattolabel (double data, int past_comma)
 convert a float to a tick label string with a given precision More...
 
QSizeF getMaxTickLabelSize (JKQTPEnhancedPainter &painter, double *ascent=nullptr, double *descent=nullptr)
 calculates the maximum width and height (returned as QSize) of all tick labels. Ascent and descent may also be returned in the two additional pointer arguments- More...
 
bool getNextLabel (double &x, QString &label, bool init=false)
 calculates the next label from the given parameters. More...
 
double getNextLabelDistance (double x)
 returns the distance from the current tick position (x before call) to the next tick position More...
 
virtual JKQTMathTextgetParentMathText ()
 retun parents JKQTMathText* object More...
 
void redrawPlot ()
 simply calls the redrawPlot method of the parent plotter class More...
 

Additional Inherited Members

- Public Slots inherited from JKQTPCoordinateAxis
void setAbsoluteRange (double aamin, double aamax)
 set absolute range of plot axis More...
 
void setAutoAxisSpacing (bool __value)
 calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() ) More...
 
void setAxisColor (const QColor &__value)
 color of the axis (labels, ticks, axis itself ...) More...
 
void setAxisLabel (const QString &__value)
 axis label of the axis More...
 
void setAxisMinWidth (double __value)
 absolute minimum range width, feature switched off when <0 More...
 
void setDrawGrid (bool __value)
 indicates whether to draw the major grid lines More...
 
void setDrawMinorGrid (bool __value)
 indicates whether to draw the minor grid lines More...
 
void setDrawMode1 (JKQTPCADrawMode __value)
 draw mode of the main (left/bottom) axis More...
 
void setDrawMode2 (JKQTPCADrawMode __value)
 draw mode of the secondary (right/top) axis More...
 
void setGridColor (const QColor &__value)
 color of the grid More...
 
void setGridStyle (Qt::PenStyle __value)
 line stye of the grid lines More...
 
void setGridWidth (double __value)
 width of the grid lines (in pixel) More...
 
void setInverted (bool __value)
 indicates whether the axis is to be inverted or not More...
 
void setLabelDigits (int __value)
 digits used for tick labels More...
 
void setLabelDistance (double __value)
 distance between tick label and axis label in pt More...
 
void setLabelFontSize (double __value)
 fontsize of the axis labels More...
 
void setLabelPosition (JKQTPLabelPosition __value)
 position of the axis label More...
 
void setLabelType (JKQTPCALabelType __value)
 indicates how to draw the labels More...
 
void setLineWidth (double __value)
 line width of axis in pt More...
 
void setLineWidthZeroAxis (double __value)
 line width of 0-line in pt More...
 
void setLogAxis (bool __value)
 indicates whether the y axis has a logarithmic scale More...
 
void setLogAxisBase (double __value)
 the base for a logarithmic x axis More...
 
void setMinorGridColor (const QColor &__value)
 color of the minor grid lines More...
 
void setMinorGridStyle (Qt::PenStyle __value)
 line stye of the minor grid lines More...
 
void setMinorGridWidth (double __value)
 width of the minor grid lines (in pixel) More...
 
void setMinorTickInsideLength (double __value)
 length of a minor axis tick inside the plot border in pt More...
 
void setMinorTickLabelFontSize (double __value)
 fontsize of the minor axis tick labels More...
 
void setMinorTickLabelFullNumber (bool __value)
 indicates whether the minor tick labels should be full numbers, or just a number between 0..10 More...
 
void setMinorTickLabelsEnabled (bool __value)
 if true, the plotter displays minor axis labels as number between 1 and 10 in some cases More...
 
void setMinorTickOutsideLength (double __value)
 length of a minor axis tick outside the plot border in pt More...
 
void setMinorTicks (int __value)
 number of minor grid lines per axis tick interval More...
 
void setMinorTicks (unsigned int __value)
 number of minor grid lines per axis tick interval More...
 
void setMinorTickWidth (double __value)
 line width of minor ticks in pt More...
 
void setMinTicks (unsigned int __value)
 minimum number of axis ticks More...
 
void setNoAbsoluteRange ()
 do not use an absolute range of plot axis More...
 
void setRange (double amin, double amax)
 set range of plot axis More...
 
void setShowZeroAxis (bool __value)
 indicates whether to draw a thick axis line at x=0 (zero axis) More...
 
void setTickDateFormat (const QString &__value)
 format string for date tick labels, see see QDateTime::toString() documentation for details on format strings More...
 
void setTickDateTimeFormat (const QString &__value)
 format string for datetime tick labels, see see QDateTime::toString() documentation for details on format strings More...
 
void setTickInsideLength (double __value)
 length of an axis tick inside the plot border in pt More...
 
void setTickLabelAngle (double __value)
 rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal) More...
 
void setTickLabelDistance (double __value)
 distance between tick end and label start in pt More...
 
void setTickLabelFontSize (double __value)
 fontsize of the axis tick labels More...
 
void setTickMode (int __value)
 mode of the major ticks More...
 
void setTickMode (JKQTPLabelTickMode __value)
 mode of the major ticks More...
 
void setTickOutsideLength (double __value)
 length of an axis tick outside the plot border in pt More...
 
void setTickSpacing (double __value)
 calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes. More...
 
void setTickTimeFormat (const QString &__value)
 format string for time tick labels, see see QDateTime::toString() documentation for details on format strings More...
 
void setTickWidth (double __value)
 line width of ticks in pt More...
 
void setUserLogTickSpacing (double __value)
 if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which is editable by use of public access methods. More...
 
void setUserTickSpacing (double __value)
 if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which is editable by use of public access methods. More...
 
- Protected Attributes inherited from JKQTPCoordinateAxis
bool autoAxisSpacing
 calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() ) More...
 
double axisabsoultemax
 absoulte maximum of axis (axismin/axismax xan not be set above this) More...
 
double axisabsoultemin
 absoulte minimum of axis (axismin/axismax xan not be set below this) More...
 
QString axisLabel
 axis label of the axis More...
 
double axismax
 current view: maximum of time axis More...
 
double axismin
 current view: minimum of time axis More...
 
double axisMinWidth
 absolute minimum range width, feature switched off when <0 More...
 
QString axisPrefix
 axis prefix for storage of parameters More...
 
JKQTPCoordinateAxisStyle axisStyle
 current style properties for this coordinate axis instance More...
 
bool doUpdateScaling
 
bool inverted
 indicates whether the axis is to be inverted or not More...
 
bool logAxis
 indicates whether the y axis has a logarithmic scale More...
 
double logAxisBase
 the base for a logarithmic x axis More...
 
double offset
 calculated property: time axis offset (calculated by calcPlotScaling() ) More...
 
bool paramsChanged
 indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ... More...
 
JKQTBasePlotterparent
 parent plotter class More...
 
double scale
 calculated property: time axis scaling factor (calculated by calcPlotScaling() ) More...
 
double scaleSign
 this is used by x2p() and p2x() to determine the sign More...
 
QVector< QPair< double, QString > > tickLabels
 a list of tick labels. More...
 
double tickSpacing
 calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes. More...
 
double tickSpacingLog
 calculated property: axis tick spacing for logarithmic JKQTPCoordinateAxisStyle::ticks (calculated by calcPlotScaling() and calcTickSpacing() ) axes. More...
 
double tickStart
 calculated property: x position of the first tick (calculated by calcPlotScaling() ). Given in system coordinates, not pixel coordinates. More...
 
double userLogTickSpacing
 if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which is editable by use of public access methods. More...
 
double userTickSpacing
 if autoXAxisSpacing is false then this value is used for xTickSpacing. So this is the property which is editable by use of public access methods. More...
 
double width
 calculated property: width of plot on time axis (calculated by calcPlotScaling() ) More...
 

Detailed Description

implements a vertical axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).

Constructor & Destructor Documentation

◆ JKQTPVerticalAxis()

JKQTPVerticalAxis::JKQTPVerticalAxis ( JKQTBasePlotter parent)

class constructor

Member Function Documentation

◆ drawAxes()

virtual void JKQTPVerticalAxis::drawAxes ( JKQTPEnhancedPainter painter)
overridevirtual

draw axes

Implements JKQTPCoordinateAxis.

◆ drawGrids()

virtual void JKQTPVerticalAxis::drawGrids ( JKQTPEnhancedPainter painter)
overridevirtual

draw grids

Implements JKQTPCoordinateAxis.

◆ drawTickLabel1()

virtual void JKQTPVerticalAxis::drawTickLabel1 ( JKQTPEnhancedPainter painter,
double  xx,
double  yy,
const QString &  label,
double  fontSize 
)
protectedvirtual

◆ drawTickLabel2()

virtual void JKQTPVerticalAxis::drawTickLabel2 ( JKQTPEnhancedPainter painter,
double  xx,
double  yy,
const QString &  label,
double  fontSize 
)
protectedvirtual

◆ getParentOtheraxisInverted()

virtual bool JKQTPVerticalAxis::getParentOtheraxisInverted ( ) const
overrideprotectedvirtual

is other (perpendicular) axis inverted (needed for grids)

Implements JKQTPCoordinateAxis.

Reimplemented in JKQTPVerticalIndependentAxis.

◆ getParentOtheraxisOffset()

virtual double JKQTPVerticalAxis::getParentOtheraxisOffset ( ) const
overrideprotectedvirtual

pixel offset of (perpendicular) other axis (needed for grids)

Implements JKQTPCoordinateAxis.

Reimplemented in JKQTPVerticalIndependentAxis.

◆ getParentOtheraxisWidth()

virtual double JKQTPVerticalAxis::getParentOtheraxisWidth ( ) const
overrideprotectedvirtual

pixel of other (perpendicular) axis (needed for grids)

Implements JKQTPCoordinateAxis.

Reimplemented in JKQTPVerticalIndependentAxis.

◆ getParentPlotOffset()

virtual double JKQTPVerticalAxis::getParentPlotOffset ( ) const
overrideprotectedvirtual

offset of the plot in the direction of the axis

Implements JKQTPCoordinateAxis.

Reimplemented in JKQTPVerticalIndependentAxis.

◆ getParentPlotWidth()

virtual double JKQTPVerticalAxis::getParentPlotWidth ( ) const
overrideprotectedvirtual

width of the plot in the direction of the axis

Implements JKQTPCoordinateAxis.

Reimplemented in JKQTPVerticalIndependentAxis.

◆ getSize1()

virtual QSizeF JKQTPVerticalAxis::getSize1 ( JKQTPEnhancedPainter painter)
overridevirtual

returns the size of the left/bottom axis in pt

Implements JKQTPCoordinateAxis.

◆ getSize2()

virtual QSizeF JKQTPVerticalAxis::getSize2 ( JKQTPEnhancedPainter painter)
overridevirtual

returns the size of the right/top axis in pt

Implements JKQTPCoordinateAxis.


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