Reference documentation
Public Member Functions | List of all members
AbstractAxis Class Referenceabstract

The Thistle::AbstractAxis class provides an abstract base for every charts axis. More...

Inheritance diagram for AbstractAxis:
OrthogonalAxis RadarAxis RadialAxis

Public Member Functions

QPen axisPen () const
 Returns the QPen used to paint the axis.
 
void calculateBounds ()
 Calculates the model data bounds. More...
 
long calculateOrder (qreal value) const
 Calculates the order of the given value.
 
QRect & chartRect ()
 Returns the bounding rect where the whole chart should be painted.
 
QFont font () const
 Returns the font using to write labels on axis.
 
qreal max () const
 Returns the maximum value in the model data.
 
qreal maxBound () const
 Returns the maximum bound for model data.
 
qreal min () const
 Returns the minimum value in the model data.
 
qreal minBound () const
 Returns the minimum bound for model data.
 
QAbstractItemModel * model () const
 Returns the QAbstractItemModel used by the chart.
 
int nbDigits () const
 Returns the number of digits allowed to paint the Y-axis values.
 
int nbTicks () const
 Returns the number of ticks.
 
long order () const
 Returns the values order.
 
virtual QPointF origin () const =0
 Returns the axis origin.
 
virtual void paintBack (QPainter &painter) const =0
 Paints the part of the axis in the background of the chart such as ticks.
 
virtual void paintFront (QPainter &painter) const =0
 Paints the part of the axis in the foreground of the chart such as labels.
 
void setAxisPen (const QPen &p)
 Sets the QPen used to draw axis.
 
void setChartRect (const QRect &r)
 Sets the bounding rect where the whole chart should be painted.
 
void setFont (const QFont &f)
 Sets the QFont used to write the labels.
 
void setMax (qreal b)
 Sets the maximum value in the model data.
 
void setMaxBound (qreal b)
 Sets the maximum bound of the model data.
 
void setMin (qreal b)
 Sets the minimum value in the model data.
 
void setMinBound (qreal b)
 Sets the minimum bound of the model data.
 
void setModel (QAbstractItemModel *m)
 Sets the QAbstractItemModel to use. More...
 
void setNbDigits (int n)
 Sets the number of digits for the labels on the Y axis.
 
void setNbTicks (int n)
 Sets the mumber of ticks to paint.
 
void setOrder (long o)
 Sets the order of the model data.
 
void setTextPen (const QPen &p)
 Sets the QPen used to write labels.
 
void setTickPen (const QPen &p)
 Sets the QPen used to draw the ticks.
 
void setTickSize (qreal t)
 Sets the tick size on Y-axis.
 
void setValuesRect (const QRect &r)
 Sets the bounding rect where the items should be painted.
 
void setXLabelsLength (int l)
 Sets the maximum length allowed to paint the labels on the X-axis.
 
void setYLabelsLength (int l)
 Sets the maximum length allowed to paint the labels on the X-axis.
 
virtual qreal stepSize () const =0
 Returns the step size on the X axis.
 
QPen textPen () const
 Returns the QPen used to write labels.
 
QPen tickPen () const
 Returns the QPen used to paint the ticks.
 
qreal tickSize () const
 Returns the tick size on Y-axis.
 
virtual void update ()=0
 Ask to the axis for painting.
 
QRect & valuesRect ()
 Returns the bounding rect where the items should be painted.
 
virtual QPointF valueToPoint (qreal value, int axisNumber) const =0
 Returns the position in the view of value relative to the axisNumber (used by the chart using multiple axis such as RadarChart).
 
qreal xLabelsLength () const
 Returns the maximum length allowed to paint the labels on the X-axis.
 
qreal yLabelsLength () const
 Returns the maximum length in pixels allowed to paint the labels on the Y-axis.
 

Detailed Description

The Thistle::AbstractAxis class provides an abstract base for every charts axis.

The Thistle::AbstractAxis class provides the basic functionality for every axis. It is a abstract class and cannot be instancied itself. Thistle::AbstractAxis provides a standard interface to define item position and axis painting. It reimplements basic logic for positionning items in the view.

See Also
Thistle::OrthogonalAxis and Thistle::RadialAxis

Member Function Documentation

void calculateBounds ( )

Calculates the model data bounds.

Calculates the min() bounds and the max() bounds (i.e., the min() and the max() displayed on the chart). Calculates the order() and the tick size(delta between two ticks on the Y axis) of the charts values. If the min() is equal to the max(), the minBound() is equal to min() - 1 and the maxBound() to max() + 1

See Also
minBounds(), maxBounds, min(), max(), setMinBounds(), setMaxBounds, setMin() and setMax()
void setModel ( QAbstractItemModel *  m)
inline

Sets the QAbstractItemModel to use.

The model should be the same than the chart view.