Wt::Chart::WAxis Class Reference
[Chart library]

Class which represents an axis of a cartesian chart. More...

#include <Wt/Chart/WAxis>

List of all members.

Public Member Functions

Axis id () const
 Returns the axis id.
void setVisible (bool visible)
 Set whether this axis is visible.
bool isVisible () const
 Returns whether this axis is visible.
void setLocation (AxisLocation location)
 Set the axis location.
AxisLocation location () const
 Returns the axis location.
void setScale (AxisScale scale)
 Set the scale of the axis.
AxisScale scale () const
 Returns the scale of the axis.
void setMinimum (double min)
 Set the minimum value displayed on the axis.
double minimum () const
 Returns the minimum value displayed on the axis.
void setMaximum (double max)
 Set the maximum value for the axis displayed on the axis.
double maximum () const
 Returns the maximum value displayed on the axis.
void setRange (double min, double max)
 Set the axis range (minimum and maximum values).
void setBreak (double min, double max)
 Specify a range that needs to be omitted from the axis.
void setLabelInterval (double labelInterval)
 Set the label interval.
double labelInterval () const
 Returns the label interval.
void setLabelFormat (const WString &format)
 Set the label format.
const WStringlabelFormat () const
 Returns the label format string.
void setLabelAngle (double angle)
 Sets the label angle.
double labelAngle () const
 Returns the label angle.
void setGridLinesEnabled (bool enabled)
 Sets whether gridlines are displayed for this axis.
bool isGridLinesEnabled () const
 Returns whether gridlines are displayed for this axis.
void setPen (const WPen &pen)
 Changes the pen used for rendering the axis and ticks.
const WPenpen () const
 Returns the pen used for rendering the axis and ticks.
void setGridLinesPen (const WPen &pen)
 Changes the pen used for rendering the grid lines.
const WPengridLinesPen () const
 Returns the pen used for rendering the grid lines.
void setMargin (int pixels)
 Sets the margin between the axis and the plot area.
int margin () const
 Returns the margin between the axis and the plot area.
void setTitle (const WString &title)
 Set the axis title.
const WStringtitle () const
 Returns the axis title.
void setTitleFont (const WFont &titleFont)
 Set the axis title font.
const WFonttitleFont () const
 Returns the axis title font.
WCartesianChartchart () const
 Returns the chart to which this axis belongs.

Static Public Attributes

static const double AUTO_MINIMUM = DBL_MAX
 Constant which indicates automatic minimum calculation.
static const double AUTO_MAXIMUM = -DBL_MAX
 Constant which indicates automatic maximum calculation.


Detailed Description

Class which represents an axis of a cartesian chart.

A cartesian chart has two or three axes: an X axis (XAxis), a Y axis (YAxis) and optionally a second Y axis (Y2Axis). Each of the up to three axes in a cartesian chart has a unique id() that identifies which of these three axes it is in the enclosing chart().

Use setVisible(bool) to change the visibility of an axis, setGridLinesEnabled(bool) to show grid lines for an axis. The pen styles for rendering the axis or grid lines may be changed using setPen() and setGridLinesPen(). A margin between the axis and the main plot area may be configured using setMargin().

By default, the axis will automatically adjust its range so that all data will be visible. You may manually specify a range using setMinimum(), setMaximum or setRange(). The interval between labels is by default automatically adjusted depending on the axis length and the range, but may be manually specified using setLabelInterval().

The axis has support for being "broken", to support displaying data with a few outliers which would otherwise swamp the chart. This is not done automatically, but instead you need to use setBreak() to specify the value range that needs to be omitted from the axis. The omission is rendered in the axis and in bars that cross the break.

The labels are shown using a "%.4g" format string for numbers, and "dd/MM/yyyy" (for DateScale). The format may be customized using setLabelFormat(). The angle of the label text may be changed using setLabelAngle(double). By default, all labels are printed horizontally.

See also:
WCartesianChart

Member Function Documentation

Axis Wt::Chart::WAxis::id (  )  const [inline]

Returns the axis id.

See also:
chart(), WCartesianChart::axis(Axis)

void Wt::Chart::WAxis::setVisible ( bool  visible  ) 

Set whether this axis is visible.

Changes whether the axis is displayed, including ticks and labels. The rendering of the grid lines is controlled seperately by setGridLinesEnabled(bool).

The default value is true for the X axis and first Y axis, but false for the second Y axis.

See also:
setGridLinesEnabled(bool).

bool Wt::Chart::WAxis::isVisible (  )  const [inline]

Returns whether this axis is visible.

See also:
setVisible(bool)

void Wt::Chart::WAxis::setLocation ( AxisLocation  location  ) 

Set the axis location.

Configures the location of the axis, relative to values on the other values (i.e. Y values for the X axis, and X values for the Y axis).

The default value is Chart::MinimumValue.

See also:
location()

AxisLocation Wt::Chart::WAxis::location (  )  const [inline]

Returns the axis location.

See also:
setLocation(AxisLocation)

void Wt::Chart::WAxis::setScale ( AxisScale  scale  ) 

Set the scale of the axis.

For the X scale in a CategoryChart, the scale should be left unchanged to CategoryScale.

For all other axes, the default value is LinearScale, but this may be changed to LogScale or DateScale. DateScale is only useful for the X axis in a ScatterPlot which contains WDate values.

See also:
scale()

AxisScale Wt::Chart::WAxis::scale (  )  const [inline]

Returns the scale of the axis.

See also:
setScale(AxisScale)

void Wt::Chart::WAxis::setMinimum ( double  min  ) 

Set the minimum value displayed on the axis.

Specify the minimum value to be displayed on the axis. By default, the minimum and maximum values are determined automatically so that all the data can be displayed.

The default value is AUTO_MINIMUM, which indicates that the value must be determined automatically.

See also:
minimum(), setMaximum(double)

double Wt::Chart::WAxis::minimum (  )  const

Returns the minimum value displayed on the axis.

See also:
maximum(), setMinimum(double)

void Wt::Chart::WAxis::setMaximum ( double  max  ) 

Set the maximum value for the axis displayed on the axis.

Specify the maximum value to be displayed on the axis. By default, the minimum and maximum values are determined automatically so that all the data can be displayed.

The default value is AUTO_MAXIMUM, which indicates that the value must be determined automatically.

See also:
minimum(), setMinimum(double)

double Wt::Chart::WAxis::maximum (  )  const

Returns the maximum value displayed on the axis.

See also:
minimum(), setMaximum(double)

void Wt::Chart::WAxis::setRange ( double  min,
double  max 
)

Set the axis range (minimum and maximum values).

Specify both minimum and maximum value for the axis.

See also:
setMinimum(double), setMaximum(double).

void Wt::Chart::WAxis::setBreak ( double  min,
double  max 
)

Specify a range that needs to be omitted from the axis.

This is useful to display data with a few outliers which would otherwise swamp the chart. This is not done automatically, but instead you need to use setBreak() to specify the value range that needs to be omitted from the axis. The omission is rendered in the axis and in BarSeries that cross the break.

void Wt::Chart::WAxis::setLabelInterval ( double  labelInterval  ) 

Set the label interval.

Specifies the interval for displaying labels (and ticks) on the axis. The default value is 0.0, and indicates that the interval should be computed automatically.

See also:
setLabelFormat(const WString&)

double Wt::Chart::WAxis::labelInterval (  )  const [inline]

Returns the label interval.

See also:
setLabelInterval(double)

void Wt::Chart::WAxis::setLabelFormat ( const WString format  ) 

Set the label format.

Set a format string which is used to format values, both for the axis labels as well as data series values (see WDataSeries::setLabelsEnabled(Axis, bool)).

For an axis with a LinearScale or LogScale scale, the format string must be a format string that is accepted by snprintf() and which formats one double. If the format string is an empty string, "%.4g" is used.

For an axis with a DateScale scale, the format string must be a format string accepted by WDate::toString(const WString&), to format a date. If the format string is an empty string, "dd/MM/yyyy", "MMM yy" or "yyyy" is used depending on the situation.

The default value is an empty string ("").

See also:
labelFormat()

const WString& Wt::Chart::WAxis::labelFormat (  )  const [inline]

Returns the label format string.

See also:
setLabelFormat(const WString&)

void Wt::Chart::WAxis::setLabelAngle ( double  angle  ) 

Sets the label angle.

Sets the angle used for displaying the labels (in degrees). A 0 angle corresponds to horizontal text. Note that this option is only supported by the InlineSvgVml renderers, but not by HtmlCanvas.

The default value is 0.0 ("horizontal text").

See also:
labelAngle()

double Wt::Chart::WAxis::labelAngle (  )  const [inline]

Returns the label angle.

See also:
setLabelAngle(double)

void Wt::Chart::WAxis::setGridLinesEnabled ( bool  enabled  ) 

Sets whether gridlines are displayed for this axis.

When enabled, gird lines are drawn for each tick on this axis, using the gridLinesPen().

Unlike all other visual aspects of an axis, rendering of the gridlines is not controlled by setDisplayEnabled(bool).

See also:
setGridLinesPen(const WPen&), isGridLinesEnabled()

bool Wt::Chart::WAxis::isGridLinesEnabled (  )  const [inline]

Returns whether gridlines are displayed for this axis.

See also:
setGridLinesEnabled(bool)

void Wt::Chart::WAxis::setPen ( const WPen pen  ) 

Changes the pen used for rendering the axis and ticks.

The default value is a black pen of 0 width.

See also:
setGridLinesPen(const WPen&).

const WPen& Wt::Chart::WAxis::pen (  )  const [inline]

Returns the pen used for rendering the axis and ticks.

See also:
setPen(const WPen&)

void Wt::Chart::WAxis::setGridLinesPen ( const WPen pen  ) 

Changes the pen used for rendering the grid lines.

The default value is a gray pen of 0 width.

See also:
setPen(const WPen&), gridLinesPen().

const WPen& Wt::Chart::WAxis::gridLinesPen (  )  const [inline]

Returns the pen used for rendering the grid lines.

See also:
setGridLinesPen(const WPen&)

void Wt::Chart::WAxis::setMargin ( int  pixels  ) 

Sets the margin between the axis and the plot area.

The margin is defined in pixels.

The default value is 0.

See also:
margin()

int Wt::Chart::WAxis::margin (  )  const [inline]

Returns the margin between the axis and the plot area.

See also:
setMargin(int)

void Wt::Chart::WAxis::setTitle ( const WString title  ) 

Set the axis title.

The default title is empty.

See also:
title()

const WString& Wt::Chart::WAxis::title (  )  const [inline]

Returns the axis title.

See also:
setTitle()

void Wt::Chart::WAxis::setTitleFont ( const WFont titleFont  ) 

Set the axis title font.

The default title font is a 12 point Sans Serif font.

See also:
titleFont()

const WFont& Wt::Chart::WAxis::titleFont (  )  const [inline]

Returns the axis title font.

See also:
setTitle()

WCartesianChart* Wt::Chart::WAxis::chart (  )  const [inline]

Returns the chart to which this axis belongs.

See also:
WCartesianChart::axis()


Member Data Documentation

const double Wt::Chart::WAxis::AUTO_MINIMUM = DBL_MAX [static]

Constant which indicates automatic minimum calculation.

See also:
setMinimum()

const double Wt::Chart::WAxis::AUTO_MAXIMUM = -DBL_MAX [static]

Constant which indicates automatic maximum calculation.

See also:
setMaximum()


Generated on Tue Nov 3 15:34:34 2009 for Wt by doxygen 1.5.6