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

this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter. More...

#include <jkqtpcoordinateaxes.h>

Inheritance diagram for JKQTPCoordinateAxis:
Collaboration diagram for JKQTPCoordinateAxis:

Public Slots

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...
 

Public Member Functions

 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...
 
virtual void drawAxes (JKQTPEnhancedPainter &painter)=0
 draw axes
More...
 
virtual void drawGrids (JKQTPEnhancedPainter &painter)=0
 draw grids
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...
 
virtual QSizeF getSize1 (JKQTPEnhancedPainter &painter)=0
 returns the size of the left/bottom axis in pt More...
 
virtual QSizeF getSize2 (JKQTPEnhancedPainter &painter)=0
 returns the size of the right/top axis in pt 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

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...
 
virtual bool getParentOtheraxisInverted () const =0
 is other (perpendicular) axis inverted (needed for grids) More...
 
virtual double getParentOtheraxisOffset () const =0
 pixel offset of (perpendicular) other axis (needed for grids) More...
 
virtual double getParentOtheraxisWidth () const =0
 width of other (perpendicular) axis (needed for grids) More...
 
virtual double getParentPlotOffset () const =0
 offset of the plot in the direction of the axis More...
 
virtual double getParentPlotWidth () const =0
 width of the plot in the direction of the axis More...
 
void redrawPlot ()
 simply calls the redrawPlot method of the parent plotter class More...
 

Protected Attributes

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

this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.

This class implements all the functionality needed for a coordinate axis:

  • transform world to screen coordinates and vice versa
  • draw the axis (implemented by child classes!) with these elements: axis lines, JKQTPCoordinateAxisStyle::ticks, tick labels, axis label, x/y=0 axis
  • measure the axes in screen coordinates
  • load and save the settings to an ini file

Most of the actual draw and measure functions have to be implemented in descendents of this class (namely JKQTPHorizontalAxis and JKQTPVerticalAxis, as they are specific to whether the axis is drawn horizontally or vertically.

Each axis is split up into several parts, as depicted in this image:

Which parts to actually draw is set by the diverse properties.

Coordinate Systems and Transformations

The plot itself is positioned inside the widget (see Plot Sizes & Borders for details). You simply supply the widget dimensions and the border widths between the plot and the widget. The Object then calculates the size of the plot:

The plot shows the parameter range xmin ... xmax and ymin ... ymax. Note that if you plot logarithmic plots you may only plot positive (>0) values. Any other value may lead to an error or unpredictable behaviour.

From these parameters the object calculates the scaling laws for plotting pints to the screen. The next paragraphs show all calculations for x- and y-coordinates, ahough this class only implements a generic form. The actual calculation is also influenced by the parameters set in the child classes!

  1. width = xmax - xmin
  2. height = ymax - ymin
  3. plotWidth = widgetWidth - plotBorderLeft - plotBorderRight
  4. plotHeight = widgetHeight - plotBorderTop - plotBorderBottom
  5. xPlotOffset = plotBorderLeft
  6. yPlotOffset = plotBorderTop

These parameters are common to all scaling laws. The next image explains these formulas:

The actual scaling laws $ (x_p(x), y_p(y)) $ may be derived from these equations:

\[ x_p(\mbox{xmin})=\mbox{xPlotOffset},\ \ \ \ \ x_p(\mbox{xmax})=\mbox{xPlotOffset}+\mbox{plotWidth} \]

\[ y_p(\mbox{ymax})=\mbox{yPlotOffset},\ \ \ \ \ y_p(\mbox{ymin})=\mbox{yPlotOffset}+\mbox{plotHeight} \]

Here $ (x_p, y_p) $ denotes a point in pixel coordinates (green coordinate system) and $ (x,y) $ denotes a point in the plotting coordinate system.

If you assume a linear scaling law.

\[ x_p(x)=\mbox{xoffset}+x\cdot\mbox{xscale} \ \ \ \ \ \ \ \ \ y_p(y)=\mbox{yoffset}-y\cdot\mbox{yscale} \]

you can derive:

\[ \mbox{xscale}=\frac{\mbox{plotWidth}}{\mbox{xwidth}},\ \ \ \ \ \ \mbox{xoffset}=\mbox{xPlotOffset}-\mbox{xmin}\cdot\mbox{xscale} \]

\[ \mbox{yscale}=\frac{\mbox{plotHeight}}{\mbox{ywidth}},\ \ \ \ \ \ \mbox{yoffset}=\mbox{yPlotOffset}+\mbox{ymax}\cdot\mbox{yscale} \]

If you have a logarithmic axis (i.e. we plot $ \log_b(x) $ insetad of $ x $ for a given base $ b $ ) we get the same formulas, but with $ x $ exchanged by $ \log_b(x) $. If we use the equation $ \log_b(x)=\log(x)/\log(b) $ we finally get the scaling laws:

\[ x_p(x)=\mbox{xoffset}+\frac{\log(x)}{\log(\mbox{logXAxisBase})}\cdot\mbox{xscale} \ \ \ \ \ \ \ \ \ y_p(y)=\mbox{yoffset}-\frac{\log(y)}{\log(\mbox{logYAxisBase})}\cdot\mbox{yscale} \]

From these we can calculate their parameters with the same defining equations as above:

\[ \mbox{xscale}=\frac{\mbox{plotWidth}\cdot\log(\mbox{logXAxisBase})}{\log(\mbox{xmax})-\log(\mbox{xmin})},\ \ \ \ \ \ \mbox{xoffset}=\mbox{xPlotOffset}-\frac{\log(\mbox{xmin})}{\log(\mbox{logXAxisBase})}\cdot\mbox{xscale} \]

\[ \mbox{yscale}=\frac{\mbox{plotHeight}\cdot\log(\mbox{logYAxisBase})}{\log(\mbox{ymax})-\log(\mbox{ymin})},\ \ \ \ \ \ \mbox{yoffset}=\mbox{yPlotOffset}+\frac{\log(\mbox{ymax})}{\log(\mbox{logYAxisBase})}\cdot\mbox{yscale} \]

The object implements the above coordinate transformations in the (inline) method x2p(). The inverse transformations are implemented in p2x(). They can be used to show the system coordinates of the current mouse position.

Inverted Coordinate Axes

In some cases it may be necessary to invert the direction of increasing coordinates on an axis. One such case is image analysis, as computer images usually have coordinates starting with (0,0) at the top left and increasing to the right (x) and down (y). You can invert any axis by setting setInverted(true).

See also
You can find example here: Example (JKQTPlotter): QImage as a Graph and Example (JKQTPlotter): Simple RGB image plot, showing a 3-channel OpenCV cv::Mat

Axis JKQTPCoordinateAxisStyle::Ticks and Grids

This section explains how this component draws the JKQTPCoordinateAxisStyle::ticks on coordinate axes and the grids that may be drawn below the plots. In principle both - grids and axes - are drawn the same way, i.e. with the same step widths. There are two types of JKQTPCoordinateAxisStyle::ticks and grids: The major and the minor JKQTPCoordinateAxisStyle::ticks/grids. The major JKQTPCoordinateAxisStyle::ticks also show a label that denotes the value they represent. Between two major JKQTPCoordinateAxisStyle::ticks the axis shows JKQTPCoordinateAxisStyle::minorTicks small JKQTPCoordinateAxisStyle::ticks that are not accompanied by a label. The next image shows an example of an axis:

For the labels this class also uses an algorithm that extimates the number of valid digits (after the comma) that are needed so that two adjacent labels do not show the same text, so if you plot the range 1.10 .. 1.15 The algorithm will show at least two valid digits, as with one digit the labels would be 1.1, 1.1, 1.1, 1.1, 1.1, 1.1. With two digits they are 1.10, 1.11, 1.12, 1.13, 1.14, 1.15. The class may also use a method that can write 1m instead of 0.001 and 1k instead of 1000 (the algorithm supports the "exponent letters" f, p, n, u, m, k, M, G, T, P. The latter option may (de)activated by using showXExponentCharacter and showYExponentCharacter.

For grids applies the same. There are two grids that are drawn in different styles (often the major grid is drawn thicker and darker than the minor grid).

The minor JKQTPCoordinateAxisStyle::ticks and grid lines are generated automatically, depending in the setting of JKQTPCoordinateAxisStyle::minorTicks. These properties give the number of minor JKQTPCoordinateAxisStyle::ticks between two major JKQTPCoordinateAxisStyle::ticks, so if the major JKQTPCoordinateAxisStyle::ticks are at 1,2,3,... and you want minor JKQTPCoordinateAxisStyle::ticks at 1.1, 1.2, 1.3,... then you will have to set JKQTPCoordinateAxisStyle::minorTicks=9 as there are nine JKQTPCoordinateAxisStyle::ticks between two major JKQTPCoordinateAxisStyle::ticks. So the minor tick spacing is calculated as:

\[ \Delta\mbox{MinorTicks}=\frac{\Delta\mbox{ticks}}{\mbox{minorTicks}+1} \]

The same applies for logarithmic axes. If the major JKQTPCoordinateAxisStyle::ticks are at 1,10,100,... and you set JKQTPCoordinateAxisStyle::minorTicks=9 the program will generate 9 equally spaced minor JKQTPCoordinateAxisStyle::ticks in between, so you have minor JKQTPCoordinateAxisStyle::ticks at 2,3,4,...,11,12,13,... This results in a standard logarithmic axis. If you set JKQTPCoordinateAxisStyle::minorTicks=1 then you will get minor JKQTPCoordinateAxisStyle::ticks at 5,15,150,...

The major tick-tick distances of linear axes may be calculated automatically in a way that the axis shows at least a given number of JKQTPCoordinateAxisStyle::ticks JKQTPCoordinateAxisStyle::minTicks. The algorithm takes that tick spacing that will give a number of JKQTPCoordinateAxisStyle::ticks per axis nearest but ">=" to the given JKQTPCoordinateAxisStyle::minTicks. The Algorithm is described in detail with the function calcLinearTickSpacing(). To activate this automatic tick spacing you have to set autoAxisSpacing=true.

Constructor & Destructor Documentation

◆ JKQTPCoordinateAxis()

JKQTPCoordinateAxis::JKQTPCoordinateAxis ( JKQTBasePlotter parent)
explicit

class constructor

◆ ~JKQTPCoordinateAxis()

virtual JKQTPCoordinateAxis::~JKQTPCoordinateAxis ( )
virtual

class destructor

Member Function Documentation

◆ addAxisTickLabel()

void JKQTPCoordinateAxis::addAxisTickLabel ( double  x,
const QString &  label 
)

add a new tick label to the axis

◆ addAxisTickLabels() [1/4]

void JKQTPCoordinateAxis::addAxisTickLabels ( const double *  x,
const QString *  label,
int  items 
)

add a new tick label to the axis

◆ addAxisTickLabels() [2/4]

void JKQTPCoordinateAxis::addAxisTickLabels ( const double *  x,
const QStringList &  label 
)

add a new tick label to the axis

◆ addAxisTickLabels() [3/4]

void JKQTPCoordinateAxis::addAxisTickLabels ( const QVector< double > &  x,
const QString *  label 
)

add a new tick label to the axis

◆ addAxisTickLabels() [4/4]

void JKQTPCoordinateAxis::addAxisTickLabels ( const QVector< double > &  x,
const QStringList &  label 
)

add a new tick label to the axis

◆ calcLinearTickSpacing()

double JKQTPCoordinateAxis::calcLinearTickSpacing ( )
protected

calculates the tick spacing for a linear axis that spans awidth and that should show at least JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks.

The algorithm used in here works as follows:

There is only a limited subset of allowed tick distances. These distances are 1 (resulting in 10 JKQTPCoordinateAxisStyle::ticks per decade, i.e. 0,1,2,3,4,...), 2 (5 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,2,4,...), 2.5 (4 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,2.5,5,...) and 5 (2 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,5,10,15,...). So the axis is divided into decades that each is divided into JKQTPCoordinateAxisStyle::ticks, as defined above. With these preconditions the algorithm tries to find a tick increment $ \Delta\mbox{tick} $ which is one of the above distances multiplied by a power $ \rho $ of 10. This increment is determined in a way, that the axis contains at least JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks:

\[ \Delta\mbox{tick}=f\cdot 10^\rho,\ \ \ \ \ f\in\{1, 2, 2.5, 5\} \]

  1. The algorithm starts by finding a start exponent $ \rho_s=\left\lfloor\log_{10}(\mbox{awidth})\right\rfloor+3 $. This is a good (over)estimate for the biggest possible power $ \rho $.
  2. now we set $ \rho=\rho_0 $ and $ f=10 $.
  3. now the algorithm cycles through all possible factors $ f\in\{1, 2, 2.5, 5, 10\} $ (starting from 10) and calculates $ \Delta\mbox{tick}=f\cdot 10^\rho $. Then it checks whether $ \mbox{tickcount}=\mbox{round}\left(\frac{\mbox{awidth}}{\Delta\mbox{tick}}\right) $ is smaller than JKQTPCoordinateAxisStyle::minTicks (if yes the algorithm reached its end and $ \Delta\mbox{tick} $ can be used.
  4. if $ f=1 $ is reached and checked false, then the algorithm decreases the exponent $ \rho \leftarrow \rho-1 $ and returns to step 3.

◆ calcLinearUnitDigits()

int JKQTPCoordinateAxis::calcLinearUnitDigits ( )
protected

Calculate the number of digits needed for the labels of an axis that starts at minval and where the tick spacing is tickSpacing.

This method determines how many digits to output for the labels on a coordinate axis. This is done by testing different digit numbers and comparing subsequent labels. If two labels are equal, then we need more valid digits to distinguish them.

◆ calcLogTickSpacing()

double JKQTPCoordinateAxis::calcLogTickSpacing ( )
protected

same as calcLinearTickSpacing(), but for logarithmic scaling

See also
calcLinearTickSpacing()

◆ calcPlotScaling()

void JKQTPCoordinateAxis::calcPlotScaling ( bool  force = false)

calculate the scaling and offset values from axis min/max values

This is only executed when paramChanged==true, as otherwise the data has to be still correct. recalculating may be forced by caling calcPlotScaing(true);

◆ clearAxisTickLabels()

void JKQTPCoordinateAxis::clearAxisTickLabels ( )

clear axis tick labels. This switches back to automatic labels mode for the axis.

◆ drawAxes()

virtual void JKQTPCoordinateAxis::drawAxes ( JKQTPEnhancedPainter painter)
pure virtual

draw axes

Implemented in JKQTPHorizontalAxis, and JKQTPVerticalAxis.

◆ drawGrids()

virtual void JKQTPCoordinateAxis::drawGrids ( JKQTPEnhancedPainter painter)
pure virtual

draw grids

Implemented in JKQTPHorizontalAxis, and JKQTPVerticalAxis.

◆ floattolabel() [1/2]

QString JKQTPCoordinateAxis::floattolabel ( double  data)
protected

convert a float to a tick label string

◆ floattolabel() [2/2]

QString JKQTPCoordinateAxis::floattolabel ( double  data,
int  past_comma 
)
protected

convert a float to a tick label string with a given precision

◆ getAbsoluteMax()

double JKQTPCoordinateAxis::getAbsoluteMax ( ) const
inline

returns the current absolute max

◆ getAbsoluteMin()

double JKQTPCoordinateAxis::getAbsoluteMin ( ) const
inline

returns the current absolute min

◆ getAutoAxisSpacing()

bool JKQTPCoordinateAxis::getAutoAxisSpacing ( ) const
inline

calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )

See also
calcPlotScaling(), calcTickSpacing()

◆ getAutoLabelDigits()

bool JKQTPCoordinateAxis::getAutoLabelDigits ( ) const
inline

when true, the digits of the labels are calculated automatically

◆ getAxisColor()

QColor JKQTPCoordinateAxis::getAxisColor ( ) const
inline

color of the axis (labels, ticks, axis itself ...)

◆ getAxisLabel()

QString JKQTPCoordinateAxis::getAxisLabel ( ) const
inline

axis label of the axis

◆ getCurrentAxisStyle()

◆ getDoUpdateScaling()

bool JKQTPCoordinateAxis::getDoUpdateScaling ( ) const
inline

◆ getDrawGrid()

bool JKQTPCoordinateAxis::getDrawGrid ( ) const
inline

indicates whether to draw the major grid lines

◆ getDrawMinorGrid()

bool JKQTPCoordinateAxis::getDrawMinorGrid ( ) const
inline

indicates whether to draw the minor grid lines

◆ getDrawMode1()

JKQTPCADrawMode JKQTPCoordinateAxis::getDrawMode1 ( ) const
inline

draw mode of the main (left/bottom) axis

◆ getDrawMode2()

JKQTPCADrawMode JKQTPCoordinateAxis::getDrawMode2 ( ) const
inline

draw mode of the secondary (right/top) axis

◆ getGridColor()

QColor JKQTPCoordinateAxis::getGridColor ( ) const
inline

color of the grid

◆ getGridStyle()

Qt::PenStyle JKQTPCoordinateAxis::getGridStyle ( ) const
inline

line stye of the grid lines

◆ getGridWidth()

double JKQTPCoordinateAxis::getGridWidth ( ) const
inline

width of the grid lines (in pixel)

◆ getInverted()

bool JKQTPCoordinateAxis::getInverted ( ) const
inline

indicates whether the axis is to be inverted or not

◆ getLabelDigits()

int JKQTPCoordinateAxis::getLabelDigits ( ) const
inline

digits used for tick labels

◆ getLabelDistance()

double JKQTPCoordinateAxis::getLabelDistance ( ) const
inline

distance between tick label and axis label in pt

◆ getLabelFontSize()

double JKQTPCoordinateAxis::getLabelFontSize ( ) const
inline

fontsize of the axis labels

◆ getLabelPosition()

JKQTPLabelPosition JKQTPCoordinateAxis::getLabelPosition ( ) const
inline

position of the axis label

◆ getLabelType()

JKQTPCALabelType JKQTPCoordinateAxis::getLabelType ( ) const
inline

indicates how to draw the labels

◆ getLineWidth()

double JKQTPCoordinateAxis::getLineWidth ( ) const
inline

line width of axis in pt

◆ getLineWidthZeroAxis()

double JKQTPCoordinateAxis::getLineWidthZeroAxis ( ) const
inline

line width of 0-line in pt

◆ getLogAxis()

bool JKQTPCoordinateAxis::getLogAxis ( ) const
inline

indicates whether the y axis has a logarithmic scale

◆ getLogAxisBase()

double JKQTPCoordinateAxis::getLogAxisBase ( ) const
inline

the base for a logarithmic x axis

◆ getMax()

double JKQTPCoordinateAxis::getMax ( ) const
inline

returns the current max

◆ getMaxTickLabelSize()

QSizeF JKQTPCoordinateAxis::getMaxTickLabelSize ( JKQTPEnhancedPainter painter,
double *  ascent = nullptr,
double *  descent = nullptr 
)
protected

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-

◆ getMin()

double JKQTPCoordinateAxis::getMin ( ) const
inline

returns the current min

◆ getMinorGridColor()

QColor JKQTPCoordinateAxis::getMinorGridColor ( ) const
inline

color of the minor grid lines

◆ getMinorGridStyle()

Qt::PenStyle JKQTPCoordinateAxis::getMinorGridStyle ( ) const
inline

line stye of the minor grid lines

◆ getMinorGridWidth()

double JKQTPCoordinateAxis::getMinorGridWidth ( ) const
inline

width of the minor grid lines (in pixel)

◆ getMinorTickLabelFontSize()

double JKQTPCoordinateAxis::getMinorTickLabelFontSize ( ) const
inline

fontsize of the minor axis tick labels

◆ getMinorTickLabelFullNumber()

bool JKQTPCoordinateAxis::getMinorTickLabelFullNumber ( ) const
inline

indicates whether the minor tick labels should be full numbers, or just a number between 0..10

◆ getMinorTickLabelsEnabled()

bool JKQTPCoordinateAxis::getMinorTickLabelsEnabled ( ) const
inline

if true, the plotter displays minor axis labels as number between 1 and 10 in some cases

◆ getMinorTickOutsideLength()

double JKQTPCoordinateAxis::getMinorTickOutsideLength ( ) const
inline

length of a minor axis tick outside the plot border in pt

◆ getMinorTicks()

unsigned int JKQTPCoordinateAxis::getMinorTicks ( ) const
inline

number of minor grid lines per axis tick interval

◆ getMinorTickWidth()

double JKQTPCoordinateAxis::getMinorTickWidth ( ) const
inline

line width of minor ticks in pt

◆ getMinTicks()

unsigned int JKQTPCoordinateAxis::getMinTicks ( ) const
inline

minimum number of axis ticks

◆ getNextLabel()

bool JKQTPCoordinateAxis::getNextLabel ( double &  x,
QString &  label,
bool  init = false 
)
protected

calculates the next label from the given parameters.

Returns
true on success and false if there is no more label
Parameters
xbefore call: the position of the label for which the text should be returned (or JKQTPCoordinateAxisStyle::tickStart for first call), after call: position of the next label (given in world coordinates!)
labelafter call: text of the (input) tick label This is an empty string, if the label is not visible!
initcall this function with init=true to obtain the first label (at JKQTPCoordinateAxisStyle::tickStart)

◆ getNextLabelDistance()

double JKQTPCoordinateAxis::getNextLabelDistance ( double  x)
protected

returns the distance from the current tick position (x before call) to the next tick position

◆ getParent() [1/2]

JKQTBasePlotter* JKQTPCoordinateAxis::getParent ( )
inline

parent plotter class

◆ getParent() [2/2]

const JKQTBasePlotter* JKQTPCoordinateAxis::getParent ( ) const
inline

parent plotter class

◆ getParentMathText()

virtual JKQTMathText* JKQTPCoordinateAxis::getParentMathText ( )
protectedvirtual

retun parents JKQTMathText* object

◆ getParentOtheraxisInverted()

virtual bool JKQTPCoordinateAxis::getParentOtheraxisInverted ( ) const
protectedpure virtual

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

Implemented in JKQTPHorizontalIndependentAxis, JKQTPHorizontalAxis, JKQTPVerticalIndependentAxis, and JKQTPVerticalAxis.

◆ getParentOtheraxisOffset()

virtual double JKQTPCoordinateAxis::getParentOtheraxisOffset ( ) const
protectedpure virtual

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

Implemented in JKQTPHorizontalIndependentAxis, JKQTPHorizontalAxis, JKQTPVerticalIndependentAxis, and JKQTPVerticalAxis.

◆ getParentOtheraxisWidth()

virtual double JKQTPCoordinateAxis::getParentOtheraxisWidth ( ) const
protectedpure virtual

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

Implemented in JKQTPHorizontalIndependentAxis, JKQTPHorizontalAxis, JKQTPVerticalIndependentAxis, and JKQTPVerticalAxis.

◆ getParentPlotOffset()

virtual double JKQTPCoordinateAxis::getParentPlotOffset ( ) const
protectedpure virtual

offset of the plot in the direction of the axis

Implemented in JKQTPHorizontalIndependentAxis, JKQTPHorizontalAxis, JKQTPVerticalIndependentAxis, and JKQTPVerticalAxis.

◆ getParentPlotWidth()

virtual double JKQTPCoordinateAxis::getParentPlotWidth ( ) const
protectedpure virtual

width of the plot in the direction of the axis

Implemented in JKQTPHorizontalIndependentAxis, JKQTPHorizontalAxis, JKQTPVerticalIndependentAxis, and JKQTPVerticalAxis.

◆ getShowZeroAxis()

bool JKQTPCoordinateAxis::getShowZeroAxis ( ) const
inline

indicates whether to draw a thick axis line at x=0 (zero axis)

◆ getSize1()

virtual QSizeF JKQTPCoordinateAxis::getSize1 ( JKQTPEnhancedPainter painter)
pure virtual

returns the size of the left/bottom axis in pt

Implemented in JKQTPHorizontalAxis, and JKQTPVerticalAxis.

◆ getSize2()

virtual QSizeF JKQTPCoordinateAxis::getSize2 ( JKQTPEnhancedPainter painter)
pure virtual

returns the size of the right/top axis in pt

Implemented in JKQTPHorizontalAxis, and JKQTPVerticalAxis.

◆ getTickDateFormat()

QString JKQTPCoordinateAxis::getTickDateFormat ( ) const
inline

format string for date tick labels, see see QDateTime::toString() documentation for details on format strings

◆ getTickDateTimeFormat()

QString JKQTPCoordinateAxis::getTickDateTimeFormat ( ) const
inline

format string for datetime tick labels, see see QDateTime::toString() documentation for details on format strings

◆ getTickLabelAngle()

double JKQTPCoordinateAxis::getTickLabelAngle ( ) const
inline

rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal)

◆ getTickLabelDistance()

double JKQTPCoordinateAxis::getTickLabelDistance ( ) const
inline

distance between tick end and label start in pt

◆ getTickLabelFontSize()

double JKQTPCoordinateAxis::getTickLabelFontSize ( ) const
inline

fontsize of the axis tick labels

◆ getTickMode()

JKQTPLabelTickMode JKQTPCoordinateAxis::getTickMode ( ) const
inline

mode of the major ticks

◆ getTickOutsideLength()

double JKQTPCoordinateAxis::getTickOutsideLength ( ) const
inline

length of an axis tick outside the plot border in pt

◆ getTickSpacing()

double JKQTPCoordinateAxis::getTickSpacing ( ) const
inline

calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes.

See also
calcPlotScaling(), calcTickSpacing()

◆ getTickTimeFormat()

QString JKQTPCoordinateAxis::getTickTimeFormat ( ) const
inline

format string for time tick labels, see see QDateTime::toString() documentation for details on format strings

◆ getTickWidth()

double JKQTPCoordinateAxis::getTickWidth ( ) const
inline

line width of ticks in pt

◆ getUserLogTickSpacing()

double JKQTPCoordinateAxis::getUserLogTickSpacing ( ) const
inline

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.

◆ getUserTickSpacing()

double JKQTPCoordinateAxis::getUserTickSpacing ( ) const
inline

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.

◆ isLogAxis()

bool JKQTPCoordinateAxis::isLogAxis ( ) const

returns whether this axis uses logarithmic scaling

◆ loadCurrentAxisStyle()

void JKQTPCoordinateAxis::loadCurrentAxisStyle ( const QSettings &  settings,
const QString &  group = "plot/axes/" 
)

replace the current style properties for this JKQTBasePlotter with properties loaded from settings

Parameters
settingsthe QSettings object to read from
groupgroup in settings to read from
See also
JKQTPCoordinateAxisStyle getCurrentAxisStyle(), JKQTPlotter Styling System

◆ loadSettings()

virtual void JKQTPCoordinateAxis::loadSettings ( const QSettings &  settings,
const QString &  group = QString("plots/axes/") 
)
virtual

loads the plot properties from a QSettings object

◆ p2x()

double JKQTPCoordinateAxis::p2x ( double  x) const
inline

return time coordinate coordinate from x-pixel

◆ redrawPlot()

void JKQTPCoordinateAxis::redrawPlot ( )
protected

simply calls the redrawPlot method of the parent plotter class

◆ saveCurrentAxisStyle()

void JKQTPCoordinateAxis::saveCurrentAxisStyle ( QSettings &  settings,
const QString &  group = "plot/axes/" 
) const

store the current style properties for this JKQTBasePlotter with properties loaded from settings

Parameters
settingsthe QSettings object to write to
groupgroup in settings to write to
See also
JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), JKQTPlotter Styling System

◆ saveSettings()

virtual void JKQTPCoordinateAxis::saveSettings ( QSettings &  settings,
const QString &  group = QString("plots/axes/") 
) const
virtual

saves the plot properties into a QSettings object.

This method only saves those properties that differ from their default value.

◆ setAbsoluteRange

void JKQTPCoordinateAxis::setAbsoluteRange ( double  aamin,
double  aamax 
)
slot

set absolute range of plot axis

◆ setAutoAxisSpacing

void JKQTPCoordinateAxis::setAutoAxisSpacing ( bool  __value)
slot

calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )

See also
calcPlotScaling(), calcTickSpacing()

◆ setAutoLabelDigits()

void JKQTPCoordinateAxis::setAutoLabelDigits ( bool  __value)
inline

when true, the digits of the labels are calculated automatically

◆ setAxisColor

void JKQTPCoordinateAxis::setAxisColor ( const QColor &  __value)
slot

color of the axis (labels, ticks, axis itself ...)

◆ setAxisLabel

void JKQTPCoordinateAxis::setAxisLabel ( const QString &  __value)
slot

axis label of the axis

◆ setAxisMinWidth

void JKQTPCoordinateAxis::setAxisMinWidth ( double  __value)
slot

absolute minimum range width, feature switched off when <0

◆ setCurrentAxisStyle()

void JKQTPCoordinateAxis::setCurrentAxisStyle ( const JKQTPCoordinateAxisStyle style)

◆ setDoUpdateScaling()

void JKQTPCoordinateAxis::setDoUpdateScaling ( bool  __value)
inline

◆ setDrawGrid

void JKQTPCoordinateAxis::setDrawGrid ( bool  __value)
slot

indicates whether to draw the major grid lines

◆ setDrawMinorGrid

void JKQTPCoordinateAxis::setDrawMinorGrid ( bool  __value)
slot

indicates whether to draw the minor grid lines

◆ setDrawMode1

void JKQTPCoordinateAxis::setDrawMode1 ( JKQTPCADrawMode  __value)
slot

draw mode of the main (left/bottom) axis

◆ setDrawMode2

void JKQTPCoordinateAxis::setDrawMode2 ( JKQTPCADrawMode  __value)
slot

draw mode of the secondary (right/top) axis

◆ setGridColor

void JKQTPCoordinateAxis::setGridColor ( const QColor &  __value)
slot

color of the grid

◆ setGridStyle

void JKQTPCoordinateAxis::setGridStyle ( Qt::PenStyle  __value)
slot

line stye of the grid lines

◆ setGridWidth

void JKQTPCoordinateAxis::setGridWidth ( double  __value)
slot

width of the grid lines (in pixel)

◆ setInverted

void JKQTPCoordinateAxis::setInverted ( bool  __value)
slot

indicates whether the axis is to be inverted or not

◆ setLabelDigits

void JKQTPCoordinateAxis::setLabelDigits ( int  __value)
slot

digits used for tick labels

◆ setLabelDistance

void JKQTPCoordinateAxis::setLabelDistance ( double  __value)
slot

distance between tick label and axis label in pt

◆ setLabelFontSize

void JKQTPCoordinateAxis::setLabelFontSize ( double  __value)
slot

fontsize of the axis labels

◆ setLabelPosition

void JKQTPCoordinateAxis::setLabelPosition ( JKQTPLabelPosition  __value)
slot

position of the axis label

◆ setLabelType

void JKQTPCoordinateAxis::setLabelType ( JKQTPCALabelType  __value)
slot

indicates how to draw the labels

◆ setLineWidth

void JKQTPCoordinateAxis::setLineWidth ( double  __value)
slot

line width of axis in pt

◆ setLineWidthZeroAxis

void JKQTPCoordinateAxis::setLineWidthZeroAxis ( double  __value)
slot

line width of 0-line in pt

◆ setLogAxis

void JKQTPCoordinateAxis::setLogAxis ( bool  __value)
slot

indicates whether the y axis has a logarithmic scale

◆ setLogAxisBase

void JKQTPCoordinateAxis::setLogAxisBase ( double  __value)
slot

the base for a logarithmic x axis

◆ setMinorGridColor

void JKQTPCoordinateAxis::setMinorGridColor ( const QColor &  __value)
slot

color of the minor grid lines

◆ setMinorGridStyle

void JKQTPCoordinateAxis::setMinorGridStyle ( Qt::PenStyle  __value)
slot

line stye of the minor grid lines

◆ setMinorGridWidth

void JKQTPCoordinateAxis::setMinorGridWidth ( double  __value)
slot

width of the minor grid lines (in pixel)

◆ setMinorTickInsideLength

void JKQTPCoordinateAxis::setMinorTickInsideLength ( double  __value)
slot

length of a minor axis tick inside the plot border in pt

◆ setMinorTickLabelFontSize

void JKQTPCoordinateAxis::setMinorTickLabelFontSize ( double  __value)
slot

fontsize of the minor axis tick labels

◆ setMinorTickLabelFullNumber

void JKQTPCoordinateAxis::setMinorTickLabelFullNumber ( bool  __value)
slot

indicates whether the minor tick labels should be full numbers, or just a number between 0..10

◆ setMinorTickLabelsEnabled

void JKQTPCoordinateAxis::setMinorTickLabelsEnabled ( bool  __value)
slot

if true, the plotter displays minor axis labels as number between 1 and 10 in some cases

◆ setMinorTickOutsideLength

void JKQTPCoordinateAxis::setMinorTickOutsideLength ( double  __value)
slot

length of a minor axis tick outside the plot border in pt

◆ setMinorTicks [1/2]

void JKQTPCoordinateAxis::setMinorTicks ( int  __value)
slot

number of minor grid lines per axis tick interval

◆ setMinorTicks [2/2]

void JKQTPCoordinateAxis::setMinorTicks ( unsigned int  __value)
slot

number of minor grid lines per axis tick interval

◆ setMinorTickWidth

void JKQTPCoordinateAxis::setMinorTickWidth ( double  __value)
slot

line width of minor ticks in pt

◆ setMinTicks

void JKQTPCoordinateAxis::setMinTicks ( unsigned int  __value)
slot

minimum number of axis ticks

◆ setNoAbsoluteRange

void JKQTPCoordinateAxis::setNoAbsoluteRange ( )
slot

do not use an absolute range of plot axis

◆ setParent()

virtual void JKQTPCoordinateAxis::setParent ( JKQTBasePlotter parent)
virtual

◆ setRange

void JKQTPCoordinateAxis::setRange ( double  amin,
double  amax 
)
slot

set range of plot axis

◆ setShowZeroAxis

void JKQTPCoordinateAxis::setShowZeroAxis ( bool  __value)
slot

indicates whether to draw a thick axis line at x=0 (zero axis)

◆ setTickDateFormat

void JKQTPCoordinateAxis::setTickDateFormat ( const QString &  __value)
slot

format string for date tick labels, see see QDateTime::toString() documentation for details on format strings

◆ setTickDateTimeFormat

void JKQTPCoordinateAxis::setTickDateTimeFormat ( const QString &  __value)
slot

format string for datetime tick labels, see see QDateTime::toString() documentation for details on format strings

◆ setTickInsideLength

void JKQTPCoordinateAxis::setTickInsideLength ( double  __value)
slot

length of an axis tick inside the plot border in pt

◆ setTickLabelAngle

void JKQTPCoordinateAxis::setTickLabelAngle ( double  __value)
slot

rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal)

◆ setTickLabelDistance

void JKQTPCoordinateAxis::setTickLabelDistance ( double  __value)
slot

distance between tick end and label start in pt

◆ setTickLabelFontSize

void JKQTPCoordinateAxis::setTickLabelFontSize ( double  __value)
slot

fontsize of the axis tick labels

◆ setTickMode [1/2]

void JKQTPCoordinateAxis::setTickMode ( int  __value)
slot

mode of the major ticks

◆ setTickMode [2/2]

void JKQTPCoordinateAxis::setTickMode ( JKQTPLabelTickMode  __value)
slot

mode of the major ticks

◆ setTickOutsideLength

void JKQTPCoordinateAxis::setTickOutsideLength ( double  __value)
slot

length of an axis tick outside the plot border in pt

◆ setTickSpacing

void JKQTPCoordinateAxis::setTickSpacing ( double  __value)
slot

calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes.

See also
calcPlotScaling(), calcTickSpacing()

◆ setTickTimeFormat

void JKQTPCoordinateAxis::setTickTimeFormat ( const QString &  __value)
slot

format string for time tick labels, see see QDateTime::toString() documentation for details on format strings

◆ setTickWidth

void JKQTPCoordinateAxis::setTickWidth ( double  __value)
slot

line width of ticks in pt

◆ setUserLogTickSpacing

void JKQTPCoordinateAxis::setUserLogTickSpacing ( double  __value)
slot

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.

◆ setUserTickSpacing

void JKQTPCoordinateAxis::setUserTickSpacing ( double  __value)
slot

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.

◆ x2p()

double JKQTPCoordinateAxis::x2p ( double  x) const
inline

return x-pixel coordinate from time coordinate

Member Data Documentation

◆ autoAxisSpacing

bool JKQTPCoordinateAxis::autoAxisSpacing
protected

calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )

See also
calcPlotScaling(), calcTickSpacing()

◆ axisabsoultemax

double JKQTPCoordinateAxis::axisabsoultemax
protected

absoulte maximum of axis (axismin/axismax xan not be set above this)

◆ axisabsoultemin

double JKQTPCoordinateAxis::axisabsoultemin
protected

absoulte minimum of axis (axismin/axismax xan not be set below this)

◆ axisLabel

QString JKQTPCoordinateAxis::axisLabel
protected

axis label of the axis

◆ axismax

double JKQTPCoordinateAxis::axismax
protected

current view: maximum of time axis

◆ axismin

double JKQTPCoordinateAxis::axismin
protected

current view: minimum of time axis

◆ axisMinWidth

double JKQTPCoordinateAxis::axisMinWidth
protected

absolute minimum range width, feature switched off when <0

◆ axisPrefix

QString JKQTPCoordinateAxis::axisPrefix
protected

axis prefix for storage of parameters

◆ axisStyle

JKQTPCoordinateAxisStyle JKQTPCoordinateAxis::axisStyle
protected

◆ doUpdateScaling

bool JKQTPCoordinateAxis::doUpdateScaling
protected

◆ inverted

bool JKQTPCoordinateAxis::inverted
protected

indicates whether the axis is to be inverted or not

◆ logAxis

bool JKQTPCoordinateAxis::logAxis
protected

indicates whether the y axis has a logarithmic scale

◆ logAxisBase

double JKQTPCoordinateAxis::logAxisBase
protected

the base for a logarithmic x axis

◆ offset

double JKQTPCoordinateAxis::offset
protected

calculated property: time axis offset (calculated by calcPlotScaling() )

See also
calcPlotScaling(), calcTickSpacing()

◆ paramsChanged

bool JKQTPCoordinateAxis::paramsChanged
protected

indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ...

◆ parent

JKQTBasePlotter* JKQTPCoordinateAxis::parent
protected

parent plotter class

◆ scale

double JKQTPCoordinateAxis::scale
protected

calculated property: time axis scaling factor (calculated by calcPlotScaling() )

See also
calcPlotScaling(), calcTickSpacing()

◆ scaleSign

double JKQTPCoordinateAxis::scaleSign
protected

this is used by x2p() and p2x() to determine the sign

◆ tickLabels

QVector<QPair<double, QString> > JKQTPCoordinateAxis::tickLabels
protected

a list of tick labels.

If this list contains items, this class will NOT plot a standard x-axis, but only mark the positions in this list. Every item is a x-position together with the label to be plotted there. The label may contain LaTeX markup.

◆ tickSpacing

double JKQTPCoordinateAxis::tickSpacing
protected

calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes.

See also
calcPlotScaling(), calcTickSpacing()

◆ tickSpacingLog

double JKQTPCoordinateAxis::tickSpacingLog
protected

calculated property: axis tick spacing for logarithmic JKQTPCoordinateAxisStyle::ticks (calculated by calcPlotScaling() and calcTickSpacing() ) axes.

See also
calcPlotScaling()

◆ tickStart

double JKQTPCoordinateAxis::tickStart
protected

calculated property: x position of the first tick (calculated by calcPlotScaling() ). Given in system coordinates, not pixel coordinates.

See also
calcPlotScaling(), calcTickSpacing()

◆ userLogTickSpacing

double JKQTPCoordinateAxis::userLogTickSpacing
protected

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.

◆ userTickSpacing

double JKQTPCoordinateAxis::userTickSpacing
protected

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.

◆ width

double JKQTPCoordinateAxis::width
protected

calculated property: width of plot on time axis (calculated by calcPlotScaling() )

See also
calcPlotScaling(), calcTickSpacing()

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