JKQTPVerticalAxisBase (JKQTBasePlotter *parent )
class constructor
virtual void drawAxes (JKQTPEnhancedPainter &painter, int move1=0, int move2=0) override
virtual void drawGrids (JKQTPEnhancedPainter &painter) override
QSizeF getQSize1 (JKQTPEnhancedPainter &painter)
QSizeF getQSize2 (JKQTPEnhancedPainter &painter)
virtual AxisElementsSizeDescription getSize1 (JKQTPEnhancedPainter &painter) override
returns the size of the left axis in pixels
virtual AxisElementsSizeDescription getSize2 (JKQTPEnhancedPainter &painter) override
returns the size of the right axis in pixels
JKQTPCoordinateAxis (JKQTBasePlotter *parent )
class constructor
virtual ~JKQTPCoordinateAxis ()
class destructor
void addAxisTickLabel (double x, const QString &label)
add a new tick label to the axis
void addAxisTickLabels (const double *x, const QString *label, int items)
add a new tick label to the axis
void addAxisTickLabels (const double *x, const QStringList &label)
add a new tick label to the axis
void addAxisTickLabels (const QVector< double > &x, const QString *label)
add a new tick label to the axis
void addAxisTickLabels (const QVector< double > &x, const QStringList &label)
add a new tick label to the axis
void calcPlotScaling (bool force=false)
calculate the scaling and offset values from axis min/max values
void clearAxisTickLabels ()
clear axis tick labels. This switches back to automatic labels mode for the axis.
QString floattolabel (double data) const
convert a float to a tick label string
QString floattolabel (double data, int past_comma) const
convert a float to a tick label string with a given precision
double getAbsoluteMax () const
returns the current absolute max
double getAbsoluteMin () const
returns the current absolute min
double getArrowSizeFactor () const
factor used to calculate the size of line arrows
bool getAutoAxisSpacing () const
calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )
bool getAutoLabelDigits () const
when true
, the digits of the labels are calculated automatically
QColor getAxisColor () const
color of the axis (labels, ticks, axis itself ...)
QString getAxisLabel () const
axis label of the axis
const JKQTPCoordinateAxisStyle & getCurrentAxisStyle () const
current style properties for this JKQTBasePlotter
bool getDoUpdateScaling () const
can be used to switch off calcPlotScaling() temporarily, while modifying some properties
bool getDrawGrid () const
indicates whether to draw the major grid lines
bool getDrawMinorGrid () const
indicates whether to draw the major grid lines
JKQTPCADrawMode getDrawMode0 () const
draw mode of the zero axis
JKQTPCADrawMode getDrawMode1 () const
draw mode of the main (left/bottom) axis
JKQTPCADrawMode getDrawMode2 () const
draw mode of the secondary (right/top) axis
QColor getGridColor () const
color of the grid
Qt::PenStyle getGridStyle () const
line stye of the grid lines
double getGridWidth () const
width of the grid lines (in pixel)
bool getInverted () const
indicates whether the axis is to be inverted or not
QColor getLabelColor () const
color of the axis label
int getLabelDigits () const
digits used for tick labels
double getLabelDistance () const
distance between tick label and axis label in pt
double getLabelFontSize () const
fontsize of the axis labels
JKQTPLabelPosition getLabelPosition () const
position of the axis label
double getLineWidth () const
line width of axis in pt
double getLineWidthZeroAxis () const
line width of 0-line in pt
bool getLogAxis () const
indicates whether the y axis has a logarithmic scale
double getLogAxisBase () const
the base for a logarithmic x axis
double getMax () const
returns the current max
double getMin () const
returns the current min
QColor getMinorGridColor () const
color of the grid
Qt::PenStyle getMinorGridStyle () const
line stye of the grid lines
double getMinorGridWidth () const
width of the grid lines (in pixel)
QColor getMinorTickColor () const
color of minor ticks
QColor getMinorTickLabelColor () const
color of minor tick labels
double getMinorTickLabelFontSize () const
fontsize of the minor axis tick labels
bool getMinorTickLabelFullNumber () const
indicates whether the minor tick labels should be full numbers, or just a number between 0..10
bool getMinorTickLabelsEnabled () const
if true
, the plotter displays minor axis labels as number between 1 and 10 in some cases
double getMinorTickOutsideLength () const
length of a minor axis tick outside the plot border in pt
unsigned int getMinorTicks () const
number of minor grid lines per (major) axis tick interval
double getMinorTickWidth () const
line width of minor ticks in pt
unsigned int getMinTicks () const
minimum number of axis ticks
JKQTBasePlotter * getParent ()
parent plotter class
const JKQTBasePlotter * getParent () const
parent plotter class
virtual bool getParentOtheraxisInverted () const =0
is other (perpendicular) axis inverted (needed for grids)
virtual double getParentOtheraxisOffset () const =0
pixel offset of (perpendicular) other axis (needed for grids)
virtual double getParentOtheraxisWidth () const =0
width of other (perpendicular) axis (needed for grids)
virtual double getParentPlotOffset () const =0
offset of the plot in the direction of the axis
virtual double getParentPlotWidth () const =0
width of the plot in the direction of the axis
bool getShowZeroAxis () const
indicates whether to draw a thick axis line at x=0 (zero axis)
QColor getTickColor () const
color of axis ticks
QString getTickDateFormat () const
format string for date tick labels, see QDateTime::toString() documentation for details on format strings
QString getTickDateTimeFormat () const
format string for datetime tick labels, see QDateTime::toString() documentation for details on format strings
QString getTickFormatfFormat () const
format string for std::format tick labels, (see e.g. https://en.cppreference.com/w/cpp/utility/format/formatter#Standard_format_specification ). The first data parameter is the tick value as double
an the second is tickUnitName as string. The following image shows an example for "\\texttt{{ y={:*^+8.1f}}}"
:
double getTickLabelAngle () const
rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal)
QColor getTickLabelColor () const
color of axis tick labels
double getTickLabelDistance () const
distance between tick end and label start in pt
double getTickLabelFontSize () const
fontsize of the axis tick labels
JKQTPCALabelType getTickLabelType () const
indicates how to draw the labels
JKQTPLabelTickMode getTickMode () const
mode of the major ticks
double getTickOutsideLength () const
length of an axis tick outside the plot border in pt
QString getTickPrintfFormat () const
format string for printf tick labels, see https://en.wikipedia.org/wiki/Printf_format_string documentation for details on format strings The first data parameter is the tick value as double
an the second is tickUnitName as string. The following image shows an example for "y=%+.2f"
:
double getTickSpacing () const
calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes.
QString getTickTimeFormat () const
format string for time tick labels, see QDateTime::toString() documentation for details on format strings
double getTickUnitFactor () const
tick values are the actual x/y-coordiniate, divided by this value (e.g. pu to have an axis with values 0, pi, 2pi, 3pi ...
)
QString getTickUnitName () const
name of the factor tickUnitFactor. This string is used in tick-labels to write e.g. "2pi"
instead of 6.28...
double getTickWidth () const
line width of ticks in pt
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.
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.
bool isAxisRangeFixed () const
returns whether the axis range is fixed, i.e. may not change!
bool isLinearAxis () const
returns whether this axis uses linear scaling (is false e.g. for isLogAxis() ==true)
bool isLogAxis () const
returns whether this axis uses logarithmic scaling
void loadCurrentAxisStyle (const QSettings &settings, const QString &group="plot/axes/")
replace the current style properties for this JKQTBasePlotter with properties loaded from settings
virtual void loadSettings (const QSettings &settings, const QString &group=QString("plots/axes/"))
loads the plot properties from a QSettings object
double p2x (double x) const
return x coordinate from x-pixel
virtual double parentOtherAxisX2P (double x) const =0
calls x2p() of the other axis (or returns NAN
if the other axis does not exist
void saveCurrentAxisStyle (QSettings &settings, const QString &group="plot/axes/") const
store the current style properties for this JKQTBasePlotter with properties loaded from settings
virtual void saveSettings (QSettings &settings, const QString &group=QString("plots/axes/")) const
saves the plot properties into a QSettings object.
void setAutoLabelDigits (bool __value)
when true
, the digits of the labels are calculated automatically
void setCurrentAxisStyle (const JKQTPCoordinateAxisStyle &style)
replace the current style properties for this JKQTBasePlotter
void setDoUpdateScaling (bool __value)
can be used to switch off calcPlotScaling() temporarily, while modifying some properties
virtual void setParent (JKQTBasePlotter *parent )
double x2p (double x) const
return x-pixel coordinate from x coordinate
void drawAxisLabel1 (JKQTPEnhancedPainter &painter, double left, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode)
draw the axis label using painter for axis 1 at x=
left and y=
bottom . labelMax is the maximum Size of all tick labels
void drawAxisLabel2 (JKQTPEnhancedPainter &painter, double right, double bottom, QSizeF labelMax, JKQTPCADrawMode drawMode)
draw the axis label using painter for axis 2 at x=
right and y=
bottom . labelMax is the maximum Size of all tick labels
void drawTickLabel1 (JKQTPEnhancedPainter &painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false)
draw a tick label on the left axis 1 with text label (with optional rotation) at ( xx , yy ) (in pixel)
void drawTickLabel2 (JKQTPEnhancedPainter &painter, double xx, double yy, double labelOffset, const QString &label, double fontSize, bool isMinor=false)
draw a tick label on the right axis 2 with text label (with optional rotation) at ( xx , yy ) (in pixel)
virtual Axis0ElementsSizeDescription getSize0 (JKQTPEnhancedPainter &painter) override
double calcLinearTickSpacing ()
calculates the tick spacing for a linear axis that spans awidth and that should show at least JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks.
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 .
double calcLogTickSpacing ()
same as calcLinearTickSpacing() , but for logarithmic scaling
void drawAxisLine (JKQTPEnhancedPainter &painter, const QLineF &l, JKQTPCADrawMode drawMode) const
draw the axis line l (pointing from axismin to axismax) optionally decorated as specified by drawMode using JKQTPEnhancedPainter painter
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-
bool getNextLabel (double &x, QString &label, bool init=false)
calculates the next label from the given parameters.
double getNextLabelDistance (double x)
returns the distance from the current tick position (x before call) to the next tick position
JKQTMathText * getParentMathText ()
retun parents JKQTMathText* object
const JKQTMathText * getParentMathText () const
retun parents JKQTMathText* object
double getZeroAxisPos (bool *drawZeroAxis=nullptr)
calculate the position of the zero-axis (and whether to draw it or not)
virtual bool isSecondaryAxis () const
figures out (possibly by probing the parent JKQTBasePlotter ), whether this axis is a secondary axis
void redrawPlot ()
simply calls the redrawPlot method of the parent plotter class
void resetTickUnit ()
resets tickUnitFactor and tickUnitName in one call
void setAbsoluteRange (double aamin, double aamax)
sets absolutely limiting range of the plot
void setArrowSizeFactor (double f)
factor used to calculate the size of line arrows
void setAutoAxisSpacing (bool __value)
calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )
void setAxisColor (const QColor &__value)
color of the axis (labels, ticks, axis itself ...)
void setAxisLabel (const QString &__value)
axis label of the axis
void setAxisMinWidth (double __value)
absolute minimum range width, feature switched off when <0
void setColor (QColor c)
sets all colors (line, ticks, label, ...) of the axis
void setDrawGrid (bool __value)
indicates whether to draw the major grid lines
void setDrawMinorGrid (bool __value)
indicates whether to draw the major grid lines
void setDrawMode0 (JKQTPCADrawMode __value)
draw mode of the zero axis
void setDrawMode1 (JKQTPCADrawMode __value)
draw mode of the main (left/bottom) axis
void setDrawMode2 (JKQTPCADrawMode __value)
draw mode of the secondary (right/top) axis
void setGridColor (const QColor &__value)
color of the grid
void setGridColor (const QColor &__value, double alpha)
color of the grid
void setGridStyle (Qt::PenStyle __value)
line stye of the grid lines
void setGridWidth (double __value)
width of the grid lines (in pixel)
void setInverted (bool __value)
indicates whether the axis is to be inverted or not
void setLabelColor (QColor c)
color of the axis label
void setLabelDigits (int __value)
digits used for tick labels
void setLabelDistance (double __value)
distance between tick label and axis label in pt
void setLabelFontSize (double __value)
fontsize of the axis labels
void setLabelPosition (JKQTPLabelPosition __value)
position of the axis label
void setLineWidth (double __value)
line width of axis in pt
void setLineWidthZeroAxis (double __value)
line width of 0-line in pt
void setLogAxis (bool __value)
indicates whether the y axis has a logarithmic scale
void setLogAxisBase (double __value)
the base for a logarithmic x axis
void setMax (double amax)
set axis minimum range of plot axis
void setMin (double amin)
set axis minimum range of plot axis
void setMinorGridColor (const QColor &__value)
color of the grid
void setMinorGridColor (const QColor &__value, double alpha)
color of the grid
void setMinorGridStyle (Qt::PenStyle __value)
line stye of the grid lines
void setMinorGridWidth (double __value)
width of the grid lines (in pixel)
void setMinorTickColor (QColor c)
color of minor ticks
void setMinorTickInsideLength (double __value)
length of a minor axis tick inside the plot border in pt
void setMinorTickLabelColor (QColor c)
color of minor tick labels
void setMinorTickLabelFontSize (double __value)
fontsize of the minor axis tick labels
void setMinorTickLabelFullNumber (bool __value)
indicates whether the minor tick labels should be full numbers, or just a number between 0..10
void setMinorTickLabelsEnabled (bool __value)
if true
, the plotter displays minor axis labels as number between 1 and 10 in some cases
void setMinorTickOutsideLength (double __value)
length of a minor axis tick outside the plot border in pt
void setMinorTicks (int __value)
number of minor grid lines per (major) axis tick interval
void setMinorTicks (unsigned int __value)
number of minor grid lines per (major) axis tick interval
void setMinorTickWidth (double __value)
line width of minor ticks in pt
void setMinTicks (unsigned int __value)
minimum number of axis ticks
void setNoAbsoluteRange ()
do not use an absolute range of plot axis
void setRange (double amin, double amax)
set range of plot axis
void setRangeFixed (bool fixed)
fixes/ufixes the axis
void setShowZeroAxis (bool __value)
indicates whether to draw a thick axis line at x=0 (zero axis)
void setTickColor (QColor c)
color of axis ticks
void setTickDateFormat (const QString &__value)
format string for date tick labels, see QDateTime::toString() documentation for details on format strings
void setTickDateTimeFormat (const QString &__value)
format string for datetime tick labels, see QDateTime::toString() documentation for details on format strings
void setTickFormatFormat (const QString &__value)
format string for std::format tick labels, (see e.g. https://en.cppreference.com/w/cpp/utility/format/formatter#Standard_format_specification ). The first data parameter is the tick value as double
an the second is tickUnitName as string. The following image shows an example for "\\texttt{{ y={:*^+8.1f}}}"
:
void setTickInsideLength (double __value)
length of an axis tick inside the plot border in pt
void setTickLabelAngle (double __value)
rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal)
void setTickLabelColor (QColor c)
color of axis tick labels
void setTickLabelDistance (double __value)
distance between tick end and label start in pt
void setTickLabelFontSize (double __value)
fontsize of the axis tick labels
void setTickLabelType (JKQTPCALabelType __value)
indicates how to draw the labels
void setTickMode (int __value)
mode of the major ticks
void setTickMode (JKQTPLabelTickMode __value)
mode of the major ticks
void setTickOutsideLength (double __value)
length of an axis tick outside the plot border in pt
void setTickPrintfFormat (const QString &__value)
format string for printf tick labels, see https://en.wikipedia.org/wiki/Printf_format_string documentation for details on format strings The first data parameter is the tick value as double
an the second is tickUnitName as string. The following image shows an example for "y=%+.2f"
:
void setTickTimeFormat (const QString &__value)
format string for time tick labels, see QDateTime::toString() documentation for details on format strings
void setTickUnit (double factor, const QString &name)
sets tickUnitFactor and tickUnitName in one call
void setTickUnitFactor (double __value)
tick values are the actual x/y-coordiniate, divided by this value (e.g. pu to have an axis with values 0, pi, 2pi, 3pi ...
)
void setTickUnitName (const QString &__value)
name of the factor tickUnitFactor. This string is used in tick-labels to write e.g. "2pi"
instead of 6.28...
void setTickUnitPi ()
sets pi-scaling for tickUnitFactor and tickUnitName in one call
void setTickWidth (double __value)
line width of ticks in pt
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.
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.
bool autoAxisSpacing
calculated property: indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )
double axisabsoultemax
absoulte maximum of axis (axismin/axismax xan not be set above this)
double axisabsoultemin
absoulte minimum of axis (axismin/axismax xan not be set below this)
QString axisLabel
axis label of the axis
double axismax
current view: maximum of axis
double axismin
current view: minimum of axis
double axisMinWidth
absolute minimum range width, feature switched off when <0
QString axisPrefix
axis prefix for storage of parameters
bool axisRangeFixed
indicates whether this axis is fixed, i.e. axismin and axismax are frozen to their current values
JKQTPCoordinateAxisStyle axisStyle
current style properties for this coordinate axis instance
bool doUpdateScaling
can be used to switch off calcPlotScaling() temporarily, while modifying some properties
bool inverted
indicates whether the axis is to be inverted or not
bool logAxis
indicates whether the y axis has a logarithmic scale
double logAxisBase
the base for a logarithmic x axis
double offset
calculated property: axis offset (calculated by calcPlotScaling() )
bool paramsChanged
indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ...
JKQTBasePlotter * parent
parent plotter class
double scale
calculated property: axis scaling factor (calculated by calcPlotScaling() )
double scaleSign
this is used by x2p() and p2x() to determine the sign
QVector< QPair< double, QString > > tickLabels
a list of tick labels.
double tickSpacing
calculated property: axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes.
double tickSpacingLog
calculated property: axis tick spacing for logarithmic JKQTPCoordinateAxisStyle::ticks (calculated by calcPlotScaling() and calcTickSpacing() ) axes.
double tickStart
calculated property: x position of the first tick (calculated by calcPlotScaling() ). Given in system coordinates, not pixel coordinates.
double tickUnitFactor
tick values are the actual x/y-coordiniate, divided by this value (e.g. pu to have an axis with values 0, pi, 2pi, 3pi ...
)
QString tickUnitName
name of the factor tickUnitFactor. This string is used in tick-labels to write e.g. "2pi"
instead of 6.28...
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.
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.
double width
calculated property: width of plot on axis (calculated by calcPlotScaling() )