Wt  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | Static Public Attributes
Wt::Chart::WAxis Class Reference

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)
 Sets whether this axis is visible.
bool isVisible () const
 Returns whether this axis is visible.
void setLocation (AxisValue value)
 Sets the axis location.
AxisValue location () const
 Returns the axis location.
void setScale (AxisScale scale)
 Sets the scale of the axis.
AxisScale scale () const
 Returns the scale of the axis.
void setMinimum (double minimum)
 Sets the minimum value displayed on the axis.
double minimum () const
 Returns the minimum value displayed on the axis.
void setMaximum (double maximum)
 Sets the maximum value for the axis displayed on the axis.
double maximum () const
 Returns the maximum value displayed on the axis.
void setRange (double minimum, double maximum)
 Sets the axis range (minimum and maximum values) manually.
void setResolution (double resolution)
 Sets the axis resolution.
double resolution () const
 Returns the axis resolution.
void setAutoLimits (WFlags< AxisValue > locations)
 Let the minimum and/or maximum be calculated from the data.
WFlags< AxisValueautoLimits () const
 Returns the limits that are calculated automatically.
void setBreak (double minimum, double maximum)
 Specify a range that needs to be omitted from the axis.
void setLabelInterval (double labelInterval)
 Sets the label interval.
double labelInterval () const
 Returns the label interval.
void setLabelFormat (const WString &format)
 Sets 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)
 Sets the axis title.
const WStringtitle () const
 Returns the axis title.
void setTitleFont (const WFont &titleFont)
 Sets the axis title font.
const WFonttitleFont () const
 Returns the axis title font.
void setLabelFont (const WFont &labelFont)
 Sets the axis label font.
const WFontlabelFont () const
 Returns the axis label 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

WFlags< AxisValue > Wt::Chart::WAxis::autoLimits ( ) const

Returns the limits that are calculated automatically.

This returns the limits (Chart::MinimumValue and/or Chart::MaximumValue) that are calculated automatically from the data, rather than being specified manually using setMinimum() and/or setMaximum().

See also:
setAutoLimits()
WCartesianChart* Wt::Chart::WAxis::chart ( ) const

Returns the chart to which this axis belongs.

See also:
WCartesianChart::axis()
const WPen& Wt::Chart::WAxis::gridLinesPen ( ) const

Returns the pen used for rendering the grid lines.

See also:
setGridLinesPen(const WPen&)
Axis Wt::Chart::WAxis::id ( ) const

Returns the axis id.

See also:
chart(), WCartesianChart::axis(Axis)
bool Wt::Chart::WAxis::isGridLinesEnabled ( ) const

Returns whether gridlines are displayed for this axis.

See also:
setGridLinesEnabled(bool)
bool Wt::Chart::WAxis::isVisible ( ) const

Returns whether this axis is visible.

See also:
setVisible(bool)
double Wt::Chart::WAxis::labelAngle ( ) const

Returns the label angle.

See also:
setLabelAngle(double)
const WFont& Wt::Chart::WAxis::labelFont ( ) const

Returns the axis label font.

See also:
setLabelFont()
const WString& Wt::Chart::WAxis::labelFormat ( ) const

Returns the label format string.

See also:
setLabelFormat(const WString&)
double Wt::Chart::WAxis::labelInterval ( ) const

Returns the label interval.

See also:
setLabelInterval(double)
AxisValue Wt::Chart::WAxis::location ( ) const

Returns the axis location.

See also:
setLocation(AxisValue)
int Wt::Chart::WAxis::margin ( ) const

Returns the margin between the axis and the plot area.

See also:
setMargin(int)
double Wt::Chart::WAxis::maximum ( ) const

Returns the maximum value displayed on the axis.

This returned the maximum value that was set using setMaximum(), or otherwise the automatically calculated maximum.

The numerical value corresponding to a data point is defined by it's AxisScale type.

See also:
minimum(), setMaximum(double)
double Wt::Chart::WAxis::minimum ( ) const

Returns the minimum value displayed on the axis.

This returned the minimum value that was set using setMinimum(), or otherwise the automatically calculated minimum.

The numerical value corresponding to a data point is defined by it's AxisScale type.

See also:
maximum(), setMinimum(double), setAutoLimits()
const WPen& Wt::Chart::WAxis::pen ( ) const

Returns the pen used for rendering the axis and ticks.

See also:
setPen(const WPen&)
double Wt::Chart::WAxis::resolution ( ) const

Returns the axis resolution.

See also:
setResolution()
AxisScale Wt::Chart::WAxis::scale ( ) const

Returns the scale of the axis.

See also:
setScale(AxisScale)
void Wt::Chart::WAxis::setAutoLimits ( WFlags< AxisValue locations)

Let the minimum and/or maximum be calculated from the data.

Using this method, you can indicate that you want to have automatic limits, rather than limits set manually using setMinimum() or setMaximum().

locations can be Chart::MinimumValue and/or Chart::MaximumValue.

The default value is Chart::MinimumValue | Chart::MaximumValue.

void Wt::Chart::WAxis::setBreak ( double  minimum,
double  maximum 
)

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::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()
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().
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()
void Wt::Chart::WAxis::setLabelFont ( const WFont labelFont)

Sets the axis label font.

The default label font is a 10 point Sans Serif font.

See also:
labelFont()
void Wt::Chart::WAxis::setLabelFormat ( const WString format)

Sets the label format.

Sets 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()
void Wt::Chart::WAxis::setLabelInterval ( double  labelInterval)

Sets 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&)
void Wt::Chart::WAxis::setLocation ( AxisValue  value)

Sets the axis location.

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

The default value is Chart::MinimumValue.

See also:
location()
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()
void Wt::Chart::WAxis::setMaximum ( double  maximum)

Sets 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 numerical value corresponding to a data point is defined by it's AxisScale type.

See also:
minimum(), setMinimum(double)
void Wt::Chart::WAxis::setMinimum ( double  minimum)

Sets 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 numerical value corresponding to a data point is defined by it's AxisScale type.

See also:
minimum(), setMaximum(double)
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&).
void Wt::Chart::WAxis::setRange ( double  minimum,
double  maximum 
)

Sets the axis range (minimum and maximum values) manually.

Specifies both minimum and maximum value for the axis. This automatically disables automatic range calculation.

The numerical value corresponding to a data point is defined by it's AxisScale type.

See also:
setMinimum(double), setMaximum(double)
void Wt::Chart::WAxis::setResolution ( double  resolution)

Sets the axis resolution.

Specifies the axis resolution, in case maximum-minimum < resolution minimum and maximum are modified so the maximum - minimum = resolution

The default resolution is 0, which uses a built-in epsilon.

See also:
resolution()
void Wt::Chart::WAxis::setScale ( AxisScale  scale)

Sets 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()
void Wt::Chart::WAxis::setTitle ( const WString title)

Sets the axis title.

The default title is empty.

See also:
title()
void Wt::Chart::WAxis::setTitleFont ( const WFont titleFont)

Sets the axis title font.

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

See also:
titleFont()
void Wt::Chart::WAxis::setVisible ( bool  visible)

Sets 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).
const WString& Wt::Chart::WAxis::title ( ) const

Returns the axis title.

See also:
setTitle()
const WFont& Wt::Chart::WAxis::titleFont ( ) const

Returns the axis title font.

See also:
setTitleFont()

Member Data Documentation

const double Wt::Chart::WAxis::AUTO_MAXIMUM = DBL_MAX
static

Constant which indicates automatic maximum calculation.

See also:
setMaximum()
const double Wt::Chart::WAxis::AUTO_MINIMUM = -DBL_MAX
static

Constant which indicates automatic minimum calculation.

See also:
setMinimum()

Generated on Sun May 27 2012 for the C++ Web Toolkit (Wt) by doxygen 1.8.1