Avogadro  1.1.0
Public Member Functions
Avogadro::PlotAxis Class Reference

Axis for PlotWidget. More...

#include <avogadro/plotaxis.h>

List of all members.

Public Member Functions

 PlotAxis (const QString &label=QString())
 ~PlotAxis ()
bool isVisible () const
void setVisible (bool visible)
bool areTickLabelsShown () const
void setTickLabelsShown (bool b)
void setLabel (const QString &label)
QString label () const
QString tickLabel (double value) const
void setTickLabelFormat (char format= 'g', int fieldWidth=0, int precision=-1)
int tickLabelWidth () const
char tickLabelFormat () const
int tickLabelPrecision () const
void setTickMarks (double x0, double length)
QList< double > majorTickMarks () const
QList< double > minorTickMarks () const

Detailed Description

Axis for PlotWidget.

Contains all data for drawing an axis including format specification axis labels.

Author:
Andreas Nicolai
Version:
1.0

Constructor & Destructor Documentation

Avogadro::PlotAxis::PlotAxis ( const QString label = QString()) [explicit]

Constructor, constructs an axis with the label label.

References label().

Destructor.


Member Function Documentation

Returns:
whether tick labels will be drawn for this axis

Referenced by Avogadro::PlotWidget::drawAxes(), and Avogadro::PlotWidget::saveImage().

Returns:
whether the axis is visible or not

Referenced by Avogadro::PlotWidget::drawAxes(), and Avogadro::PlotWidget::saveImage().

Returns:
the label string for this axis

Referenced by Avogadro::PlotWidget::drawAxes(), PlotAxis(), Avogadro::PlotWidget::saveImage(), and setLabel().

Returns:
the list of coordinates of the major tickmarks for this axis
Note:
the positions of tickmarks are automatically computed by setTickMarks().
See also:
setTickMarks()
minorTickMarks()

Referenced by Avogadro::PlotWidget::drawAxes(), and Avogadro::PlotWidget::saveImage().

Returns:
the list with the minor tickmarks
Note:
the positions of tickmarks are automatically computed by setTickMarks().
See also:
setTickMarks()
majorTickMarks()

Referenced by Avogadro::PlotWidget::drawAxes(), and Avogadro::PlotWidget::saveImage().

void Avogadro::PlotAxis::setLabel ( const QString label)

Sets the axis label. Set the label to an empty string to omit the axis label.

Parameters:
labela string describing the data plotted on the axis.

References label().

Referenced by Avogadro::PlotWidget::resetPlot().

void Avogadro::PlotAxis::setTickLabelFormat ( char  format = 'g',
int  fieldWidth = 0,
int  precision = -1 
)

Set the display format for converting the double value of the tick's position to the QString for the tick label.

Normally, the format character is one of 'e', 'E', 'f', 'g', or 'G' (see the documentation for QString::arg(double) for details).

In addition, it is possible to set the format character to 't'; in this case the tickmark value is interpreted as a time in hours, and the ticklabel string will be in "hh:mm" clock format. Note that when the format character is 't', the fieldWidth and prec values are ignored.

Parameters:
formatthe format specification character
fieldWidththe number of characters in the output string. If set to 0, the string will be as wide as it needs to be to fully render the value.
precisionthe number of characters following the decimal point.

Determine whether tick labels will be drawn for this axis.

Parameters:
bif true, tick labels will be drawn.

Referenced by Avogadro::PlotWidget::resetPlot().

void Avogadro::PlotAxis::setTickMarks ( double  x0,
double  length 
)

Determine the positions of major and minor tickmarks for this axis.

Note:
this function is called by PlotWidget whenever the plot's limits are modified.
Parameters:
x0the minimum data coordinate of the axis.
lengththe range covered by the axis, in data units.
See also:
majorTickMarks()
minorTickMarks()

Referenced by Avogadro::PlotWidget::clearSecondaryLimits(), and Avogadro::PlotWidget::setSecondaryLimits().

void Avogadro::PlotAxis::setVisible ( bool  visible)

Sets the "visible" property of the axis.

Parameters:
visibleif true, this axis will be drawn on the PlotWidget
QString Avogadro::PlotAxis::tickLabel ( double  value) const
Returns:
the ticklabel string for the given value, rendered according to the current format specification.
Parameters:
thevalue to be rendered as a tick label.
See also:
setTickLabelFormat()

References QString::arg().

Referenced by Avogadro::PlotWidget::drawAxes(), and Avogadro::PlotWidget::saveImage().

Returns:
the number format of the tick labels
Returns:
the number precision of the tick labels
Returns:
the field width of the tick labels

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