A class to render an axis graduated with numerical values for a given range.
More...
#include <GlQuantitativeAxis.h>
List of all members.
Public Member Functions
- GlQuantitativeAxis (const std::string &axisName, const Coord &axisBaseCoord, const float axisLength, const AxisOrientation &axisOrientation, const Color &axisColor, const float axisWidth=10, const bool addArrow=true, const bool ascendingOrder=true)
- void setAxisParameters (const double min, const double max, const unsigned int nbGraduations, const LabelPosition &axisGradsLabelsPosition=LEFT_OR_BELOW, const bool drawFirstLabel=true)
- void setAxisParameters (const int min, const int max, const unsigned int incrementStep, const LabelPosition &axisGradsLabelsPosition=LEFT_OR_BELOW, const bool drawFirstLabel=true)
- void setNbGraduations (const unsigned int nbGraduations)
- void setLogScale (const bool logScale, const unsigned int logBase=10)
- void setAscendingOrder (const bool ascendingOrder)
- void updateAxis ()
- Coord getAxisPointCoordForValue (double value) const
- double getValueForAxisPoint (const Coord &axisPointCoord)
- bool hasAscendingOrder () const
- double getAxisMinValue () const
- double getAxisMaxValue () const
Detailed Description
A class to render an axis graduated with numerical values for a given range.
This class allows to draw a quantitative axis (i.e. an axis axis graduated with numerical values for a given range)
Constructor & Destructor Documentation
tlp::GlQuantitativeAxis::GlQuantitativeAxis |
( |
const std::string & |
axisName, |
|
|
const Coord & |
axisBaseCoord, |
|
|
const float |
axisLength, |
|
|
const AxisOrientation & |
axisOrientation, |
|
|
const Color & |
axisColor, |
|
|
const float |
axisWidth = 10 , |
|
|
const bool |
addArrow = true , |
|
|
const bool |
ascendingOrder = true |
|
) |
| |
GlQuantitativeAxis constructor. Create an quantitative axis without graduations (need to call setAxisParameters to build them)
- Parameters:
-
axisName | the name of the axis the base coord of the axis (if the axis is horizontal, it is the the left end, if vertical it is the down end) the length of the axis the orientation of the axis, 2 possible values (HORIZONTAL_AXIS or VERTICAL_AXIS) the color of the axis If true, an arrow will be added to one end of the axis according to the axis order (ascending or descending) If true, the min value will be at the bottom end and the max will be at the top end if the axis is vertical (min at the left and max at the right if it is horizontal). If false this positions are switched |
Member Function Documentation
double tlp::GlQuantitativeAxis::getAxisMaxValue |
( |
| ) |
const [inline] |
double tlp::GlQuantitativeAxis::getAxisMinValue |
( |
| ) |
const [inline] |
Coord tlp::GlQuantitativeAxis::getAxisPointCoordForValue |
( |
double |
value | ) |
const |
Method to get the axis point coordinates for a given value
- Parameters:
-
value | the value we want to retrieve axis point coordinates |
double tlp::GlQuantitativeAxis::getValueForAxisPoint |
( |
const Coord & |
axisPointCoord | ) |
|
Method to get the value associated to an axis point
- Parameters:
-
axisPointCoord | the axis point coordinates we want to retrieve associated value |
bool tlp::GlQuantitativeAxis::hasAscendingOrder |
( |
| ) |
const [inline] |
Method to get the order of the values on the axis (ascending or descending)
void tlp::GlQuantitativeAxis::setAscendingOrder |
( |
const bool |
ascendingOrder | ) |
[inline] |
Method to set the order of the values on the axis (ascending or descending). A call to updateAxis has to be done after calling this method to build or update the axis graduations
void tlp::GlQuantitativeAxis::setAxisParameters |
( |
const double |
min, |
|
|
const double |
max, |
|
|
const unsigned int |
nbGraduations, |
|
|
const LabelPosition & |
axisGradsLabelsPosition = LEFT_OR_BELOW , |
|
|
const bool |
drawFirstLabel = true |
|
) |
| |
Method to set the quantitative axis parameters. A call to updateAxis has to be done after calling this method to build or update the axis graduations
- Parameters:
-
min | the min value of the range the axis represents |
max | the max value of the range the axis represents |
nbGraduations | the number of graduations to build |
axisGradsLabelsPosition | the relative position of the axis graduations label. Two possible values : LEFT_OR_BELOW (if the axis is vertical, labels will be on the left of the axis, otherwise below) or RIGHT_OR_ABOVE |
drawFirstLabel | If false, the first graduation label will not be drawn (usefull when some axis have the same base coord to avoid labels overlapping) |
void tlp::GlQuantitativeAxis::setAxisParameters |
( |
const int |
min, |
|
|
const int |
max, |
|
|
const unsigned int |
incrementStep, |
|
|
const LabelPosition & |
axisGradsLabelsPosition = LEFT_OR_BELOW , |
|
|
const bool |
drawFirstLabel = true |
|
) |
| |
void tlp::GlQuantitativeAxis::setLogScale |
( |
const bool |
logScale, |
|
|
const unsigned int |
logBase = 10 |
|
) |
| |
Method to set a logarithmic scale on the axis. A call to updateAxis has to be done after calling this method to build or update the axis graduations
- Parameters:
-
logScale | If true, activate the logarithmic scale on the axis |
logBase | If filled, set the logarithm base |
void tlp::GlQuantitativeAxis::setNbGraduations |
( |
const unsigned int |
nbGraduations | ) |
[inline] |
void tlp::GlQuantitativeAxis::updateAxis |
( |
| ) |
[virtual] |
Method to update the axis drawing. It has to be called when one (or more) of the setters method above has been used. This method redraw the whole axis and the graduations.
Reimplemented from tlp::GlAxis.
|