Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Examples  

QSAxis Class Reference

Single axis which can be added to QSAxes. More...

#include <qsaxis.h>

Inheritance diagram for QSAxis:

Inheritance graph
[legend]
List of all members.

Public Types

enum  AxisScale { LinearScale, LogScale }
enum  AxisRange { RangeSet, RangeVisible, RangeData }
enum  AxisType {
  XAxisType, YAxisType, ZAxisType, VAxisType,
  UnknownAxisType
}
enum  Channels { TicsChannel = 0, LineStyles = 1, FontStyles = 2, FillStyles = 3 }
enum  LineElement { AxisLine = 0, MajorGridLine, MinorGridLine }
enum  FontElement { TitleFont = 0, TicsFont }

Public Methods

 QSAxis (AxisType type, QSAxes *parentAxes, const char *name=0)
virtual ~QSAxis ()
double dataToWorld (double value) const
double worldToData (double value) const
AxisType type () const
void setVisible (bool enabled)
void setOppositePosition (bool enabled)
void setDefaultPosition (bool enabled)
void setReversed (bool reversed)
void setScrollable (bool enabled)
bool visible () const
bool oppositePosition () const
bool defaultPosition () const
bool reversed () const
bool scrollable () const
void setArrow1 (const QSGArrow &arrow)
void setArrow2 (const QSGArrow &arrow)
QSGArrow arrow1 () const
QSGArrow arrow2 () const
void setRange (double min, double max)
void setRangeMin (double min)
void setRangeMax (double max)
void setScale (AxisScale scale, double base=10.0)
void setScaleType (int scale)
void setScaleBase (double base)
void setPosition (double pos)
double min (AxisRange type=RangeSet) const
double max (AxisRange type=RangeSet) const
double rangeMin () const
double rangeMax () const
double scaleBase () const
int scaleType () const
double position () const
void setGridStep (double major=-4.0, double minor=-20.0)
void setMajorGridStep (double step)
void setMinorGridStep (double step)
double majorGridStep () const
double minorGridStep () const
const list< QSAxisTic > * tics () const
const QSAxisTic & lastTic () const
void setTicsVisible (bool visible)
void setTicsOuter (bool enabled)
void setTicsFormat (const QString &format)
void setTicsAngle (int angle)
void setRoundRangeToTicStep (bool enabled)
QString ticsFormat () const
int ticsAngle () const
bool ticsVisible () const
bool ticsOuter () const
bool roundRangeToTicStep () const
void setTicLabelPos1 (double pos)
void setTicLabelPos2 (double pos)
double ticLabelPos1 () const
double ticLabelPos2 () const
void setTitlePosition (double value)
void setTitleDistance (double value)
double titlePosition () const
double titleDistance () const
void sprintfTic (QString &buffer, double value, const QString &format=QString::null)
virtual void rememberCurrentView (int index)
virtual void setRememberedView (int index)
void set_arrow1_property (const QString &data)
void set_arrow2_property (const QString &data)
QString arrow1_property () const
QString arrow2_property () const
virtual ColumnType columnType (int channel, int column) const
virtual void loadStateFromStream (QDataStream &stream, QSObjectFactory *factory)
virtual void saveStateToStream (QDataStream &stream, QSObjectFactory *factory)

Static Public Methods

void sprintfTic (QString &buffer, const QString &format, double value, double factor, double base, double exponent)

Public Attributes

axis_remembered_view_t rememberedViews [3]

Static Public Attributes

const double minLogValue
const double minScaleBase
const double minRangeValue
const double maxRangeValue
const double minRange

Protected Methods

virtual void initAxis (double dataMin, double dataMax, bool isData=true)

Detailed Description

Single axis which can be added to QSAxes.

Axis. Its main funtion is to map values from data coordinates to world coordinates ( visible range on the axis is mapped to <0,1> ) - see dataToWorld() and from world coordinates to data - see worldToData(). It can also calculate its auto range and tic mark positions, see tics(). initAxis() forces to recalculate all parameters. QSAxes object holds a list of QSAxis child objects. See also QSAxes::CoordinateSystem

Author:
Kamil Dobkowski


Member Enumeration Documentation

enum QSAxis::AxisRange
 

Requested axis range. See min()

enum QSAxis::AxisScale
 

The axis scale.

enum QSAxis::AxisType
 

Type of the axis.

enum QSAxis::Channels
 

Channels.

enum QSAxis::FontElement
 

Font elements.

enum QSAxis::LineElement
 

Line elements.


Constructor & Destructor Documentation

QSAxis::QSAxis (  AxisType    type,
QSAxes *    parentAxes,
const char *    name = 0
) 
 

Constructor. You have to add the axis to the parent child list immediately - see QSAxes::axisAdd()

virtual QSAxis::~QSAxis (    )  [virtual]
 

Destructor


Member Function Documentation

QSGArrow QSAxis::arrow1 (    )  const [inline]
 

Returns a begging arrow style

QSGArrow QSAxis::arrow2 (    )  const [inline]
 

Sets an ending arrow style.

virtual ColumnType QSAxis::columnType (  int    channel,
int    column
)  const [virtual]
 

Metadata - type of the given column. It should be reimplemented in derived classes. Used to create editors in sheet

Reimplemented from QSData.

double QSAxis::dataToWorld (  double    value )  const
 

Maps value from an visible axis range to <0,1>. See QSAxes::CoordinateSystem

bool QSAxis::defaultPosition (    )  const [inline]
 

Returns if axis is placed at a default position.

virtual void QSAxis::initAxis (  double    dataMin,
double    dataMax,
bool    isData = true
)  [protected, virtual]
 

This function is called by parent axes each time plot is repainted. It should calculate range, coordinate mappings and tic positions.

const QSAxisTic& QSAxis::lastTic (    )  const [inline]
 

For internal use. Only

virtual void QSAxis::loadStateFromStream (  QDataStream &    stream,
QSObjectFactory *    factory
)  [virtual]
 

Restores all graphics atributes

Reimplemented from QSGraphicalData.

double QSAxis::majorGridStep (    )  const [inline]
 

Returns a major grid step/density.

double QSAxis::max (  AxisRange    type = RangeSet )  const
 

Returns the axis range . See min()

double QSAxis::min (  AxisRange    type = RangeSet )  const
 

Returns the axis range . Notice that 'RangeSet' may be different from 'RangeVisible'. If you set range to <-10, 10> and turn on 'LogScale' the visible range will be <minLogValue,10>. 'RangeVisible' and 'RangeData' are calculated when plot is redrawn the first time ( parent axes object calls initAxis() ), so returned values may be invalid sometimes. You can call parentAxes()->initMappings() to force recalculation of ranges immediately.

double QSAxis::minorGridStep (    )  const [inline]
 

Returns a minor grid step/density.

bool QSAxis::oppositePosition (    )  const [inline]
 

Returns whether the axis is placed on the opposite side.

double QSAxis::position (    )  const [inline]
 

Returns the current position.

double QSAxis::rangeMax (    )  const [inline]
 

Returns the axis range . See min()

double QSAxis::rangeMin (    )  const [inline]
 

Returns the axis range . See min()

virtual void QSAxis::rememberCurrentView (  int    index )  [virtual]
 

Remembered view contains such parameters as axis min ,axis max, axis scale, axis reversed. Up to four different views can be remembered ( index must be in 0-3 ).

bool QSAxis::reversed (    )  const [inline]
 

Turns on a reversed direction on a given axis.

bool QSAxis::roundRangeToTicStep (    )  const [inline]
 

Returns the adjust setting.

virtual void QSAxis::saveStateToStream (  QDataStream &    stream,
QSObjectFactory *    factory
)  [virtual]
 

Saves all graphics attributes

Reimplemented from QSGraphicalData.

double QSAxis::scaleBase (    )  const [inline]
 

Returns the current scale base.

int QSAxis::scaleType (    )  const [inline]
 

Returns the current scale type.

bool QSAxis::scrollable (    )  const [inline]
 

Returns a scrollable state

void QSAxis::setArrow1 (  const QSGArrow &    arrow ) 
 

Sets a beginng arrow style.

void QSAxis::setArrow2 (  const QSGArrow &    arrow ) 
 

Sets an ending arrow style

void QSAxis::setDefaultPosition (  bool    enabled ) 
 

Places an axis at a default position ( opposite or not ).

void QSAxis::setGridStep (  double    major = -4.0,
double    minor = -20.0
) 
 

Sets a new grid density.

void QSAxis::setMajorGridStep (  double    step ) 
 

Sets a new grid step/density.

void QSAxis::setMinorGridStep (  double    step ) 
 

Sets a new grid step/density.

void QSAxis::setOppositePosition (  bool    enabled ) 
 

Places an axis on the opposite side.

void QSAxis::setPosition (  double    pos ) 
 

Sets a position of the given axis in world coordinates.

void QSAxis::setRange (  double    min,
double    max
) 
 

Sets the range of the given axis to '< min, max >'. If 'min' == 'max', auto range is turned on.

void QSAxis::setRangeMax (  double    max ) 
 

Sets the range of the given axis to '< min, max >'. If 'min' == 'max', auto range is turned on.

void QSAxis::setRangeMin (  double    min ) 
 

Sets the range of the given axis to '< min, max >'. If 'min' == 'max', auto range is turned on.

virtual void QSAxis::setRememberedView (  int    index )  [virtual]
 

Sets the view properties

void QSAxis::setReversed (  bool    reversed ) 
 

Reverse direction of an axis.

void QSAxis::setRoundRangeToTicStep (  bool    enabled ) 
 

Adjust range for the given axis to contain an whole number of tic marks.

void QSAxis::setScale (  AxisScale    scale,
double    base = 10.0
) 
 

Sets the axis scale type.

void QSAxis::setScaleBase (  double    base ) 
 

Sets the axis scale type.

void QSAxis::setScaleType (  int    scale ) 
 

Sets the axis scale type.

void QSAxis::setScrollable (  bool    enabled ) 
 

Sets if this axis should be scrolled when scrollbars are moved in a plot view..

void QSAxis::setTicLabelPos1 (  double    pos ) 
 

Sets the distance from the axis of the odd tic labels.

void QSAxis::setTicLabelPos2 (  double    pos ) 
 

Sets the distance from the axis of the even tic labels.

void QSAxis::setTicsAngle (  int    angle ) 
 

Sets the angle of the tic label.

void QSAxis::setTicsFormat (  const QString &    format ) 
 

Sets the tics print format for the given axis.

void QSAxis::setTicsOuter (  bool    enabled ) 
 

Outer or inner tic marks..

void QSAxis::setTicsVisible (  bool    visible ) 
 

Sets lengths of tics.

void QSAxis::setTitleDistance (  double    value ) 
 

Sets the distance of the title from the axis

void QSAxis::setTitlePosition (  double    value ) 
 

Sets the position of the title ( parallel to the axis )

void QSAxis::setVisible (  bool    enabled ) 
 

Hides/shows an axis

void QSAxis::sprintfTic (  QString &    buffer,
const QString &    format,
double    value,
double    factor,
double    base,
double    exponent
)  [static]
 

Makes a text of the tic with value 'value' with format 'format' and writes it to 'buffer'.

void QSAxis::sprintfTic (  QString &    buffer,
double    value,
const QString &    format = QString::null
) 
 

Makes a text of the tic with value 'value' on axis 'axis' and writes it to 'buffer'.

double QSAxis::ticLabelPos1 (    )  const [inline]
 

Returns the distance from the axis of the odd tic labels.

double QSAxis::ticLabelPos2 (    )  const [inline]
 

Returns the distance from the axis of the even tic labels.

const list<QSAxisTic>* QSAxis::tics (    )  const [inline]
 

Tics are generated each time 'initAxis' is called.

int QSAxis::ticsAngle (    )  const [inline]
 

Returns the tic label angle

QString QSAxis::ticsFormat (    )  const [inline]
 

Returns the label format.

bool QSAxis::ticsOuter (    )  const [inline]
 

Outer or inner tic marks

bool QSAxis::ticsVisible (    )  const [inline]
 

Returns a major tic's length.

double QSAxis::titleDistance (    )  const [inline]
 

Returns the distance of the title from the axis

double QSAxis::titlePosition (    )  const [inline]
 

Returns the position of the title ( parallel to the axis )

AxisType QSAxis::type (    )  const [inline]
 

Returns the axis type.

bool QSAxis::visible (    )  const [inline]
 

Returns if the axis is visible

double QSAxis::worldToData (  double    value )  const
 

Maps a value from <0,1> to visible axis range. See QSAxes::CoordinateSystem


Member Data Documentation

const double QSAxis::maxRangeValue [static]
 

Maximum value shown on the axis. Default is 1e200

const double QSAxis::minLogValue [static]
 

Minimum logarithm value. Default is 1e-200

const double QSAxis::minRange [static]
 

Minimum rangeMax-rangeMin Default 1e-200

const double QSAxis::minRangeValue [static]
 

Minimum value shown on the axis. Default is -1e200

const double QSAxis::minScaleBase [static]
 

Minimum value of the logarithm base. Default is 1.001


The documentation for this class was generated from the following file:
Generated on Mon Mar 18 19:16:37 2002 for KMatplot library by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002