Wt: Wt::Chart::WAxis Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Wt::Chart::WAxis Class Reference
Charts (Wt::Chart)

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

`#include <Wt/Chart/WAxis.h>`

## Classes
struct | TickLabel
| Represents a label/tick on the axis. More...

## Public Types
typedef std::function< double(double)> | LabelTransform
| A label transform function.

## Public Member Functions
| WAxis ()
| Constructor.
virtual | ~WAxis ()
| Destructor.
Axis | id () const
| Returns the axis id.
int | xAxisId () const
| Returns the X axis id.
int | yAxisId () const
| Returns the Y 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< AxisValue > | autoLimits () const
| Returns the limits that are calculated automatically.
void | setRoundLimits (WFlags< AxisValue > locations)
| Specifies whether limits should be rounded.
WFlags< AxisValue > | roundLimits () const
| Returns whether limits should be rounded.
void | setBreak (double minimum, double maximum)
| Specifies 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 | setLabelBasePoint (double point)
| Sets a point to be included as one of the labels (if possible).
double | labelBasePoint () const
| Returns the base point for labels.
void | setLabelFormat (const WString &format)
| Sets the label format.
WString | labelFormat () const
| Returns the label format string.
void | setLabelAngle (double angle)
| Sets the label angle.
double | labelAngle () const
| Returns the label angle.
void | setTitleOrientation (const Orientation &orientation)
| Sets the title orientation.
const Orientation & | titleOrientation () const
| Returns the title orientation.
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 WPen & | pen () const
| Returns the pen used for rendering the axis and ticks.
void | setTextPen (const WPen &pen)
| Changes the pen used for rendering labels for this axis.
const WPen & | textPen () const
| Returns the pen used for rendering labels for this axis.
void | setGridLinesPen (const WPen &pen)
| Changes the pen used for rendering the grid lines.
const WPen & | gridLinesPen () 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 WString & | title () const
| Returns the axis title.
void | setTitleFont (const WFont &titleFont)
| Sets the axis title font.
const WFont & | titleFont () const
| Returns the axis title font.
void | setTitleOffset (double offset)
| Sets the offset from the axis for the title label.
double | titleOffset () const
| Returns the title offset.
void | setLabelFont (const WFont &labelFont)
| Sets the axis label font.
const WFont & | labelFont () const
| Returns the axis label font.
virtual WString | label (double u) const
| Returns the label for a value.
void | setZoomRange (double minimum, double maximum)
| Set the range to zoom to on this axis.
double | zoomMinimum () const
| Get the zoom range minimum for this axis.
double | zoomMaximum () const
| Get the zoom range maximum for this axis.
Signal< double, double > & | zoomRangeChanged ()
| A signal triggered when the zoom range is changed on the client side.
void | setZoom (double zoom)
| Sets the zoom level for this axis.
double | zoom () const
| Get the zoom level for this axis.
void | setMaxZoom (double maxZoom)
| Sets the maximum zoom level for this axis.
double | maxZoom () const
| Get the maximum zoom level for this axis.
void | setMinimumZoomRange (double size)
| Sets the minimum zoom range for this axis.
double | minimumZoomRange () const
| Get the minimum zoom range for this axis.
void | setMaximumZoomRange (double size)
| Sets the maximum zoom range for this axis.
double | maximumZoomRange () const
| Get the maximum zoom range for this axis.
void | setMinZoom (double minZoom)
| Sets the minimum zoom level for this axis.
double | minZoom () const
| Get the minimum zoom level for this axis.
void | setPan (double pan)
| Sets the value to pan to for this axis.
double | pan () const
| Get the value to pan to for this axis, when pan is enabled on the chart.
void | setPadding (int padding)
| Sets the padding between the chart area and this axis.
int | padding () const
| Returns the padding between the chart area and this axis.
void | setTickDirection (TickDirection direction)
| Sets the direction that the axis ticks should point to.
TickDirection | tickDirection () const
| Gets the direction that the axis ticks point to.
void | setSoftLabelClipping (bool enabled)
| Enables soft clipping of axis labels.
bool | softLabelClipping () const
| Returns whether soft label clipping is enabled.
void | setInverted (bool inverted=true)
| Set whether this axis should be inverted.
bool | inverted () const
| Get whether this axis is inverted.
void | setLabelTransform (const LabelTransform &transform, AxisValue side)
| Set the transform function to apply to a given side.
LabelTransform | labelTransform (AxisValue side) const
| Get the label transform configured for the given side.

## Static Public Attributes
static const double | AUTO_MINIMUM
| Constant which indicates automatic minimum calculation.
static const double | AUTO_MAXIMUM
| Constant which indicates automatic maximum calculation.

## Protected Member Functions
virtual void | getLabelTicks (std::vector< TickLabel > &ticks, int segment, AxisConfig config) const
| Returns the label (and ticks) information for this axis.
virtual WString | autoDateFormat (const WDateTime &dt, DateTimeUnit unit, bool atTick) const
| Returns the Date format.

## Detailed Description

Class which represents an axis of a cartesian chart.

A cartesian chart has two or three axes: an X axis (Axis::X), a Y axis (Axis::Y) and optionally a second Y axis (Axis::Y2). 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() to change the visibility of an axis, setGridLinesEnabled() 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 a suitable format for AxisScale::Date or AxisScale::DateTime scales, based on heuristics. The format may be customized using setLabelFormat(). The angle of the label text may be changed using setLabelAngle(). By default, all labels are printed horizontally.

See also
  WCartesianChart

## Member Typedef Documentation

## ◆ LabelTransform

std::function<double (double)> Wt::Chart::WAxis::LabelTransform

A label transform function.

The label transform is a function from double to double.

See also
  WAxis::setLabelTransform()

## Member Function Documentation

## ◆ autoLimits()

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

Returns the limits that are calculated automatically.

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

See also
  setAutoLimits()

## ◆ gridLinesPen()

const WPen & Wt::Chart::WAxis::gridLinesPen | ( |  | ) | const

Returns the pen used for rendering the grid lines.

See also
  setGridLinesPen()

## ◆ id()

Axis Wt::Chart::WAxis::id | ( |  | ) | const

Returns the axis id.

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

## ◆ inverted()

bool Wt::Chart::WAxis::inverted | ( |  | ) | const

Get whether this axis is inverted.

See also
  setInverted()

## ◆ isGridLinesEnabled()

bool Wt::Chart::WAxis::isGridLinesEnabled | ( |  | ) | const

Returns whether gridlines are displayed for this axis.

See also
  setGridLinesEnabled()

## ◆ isVisible()

bool Wt::Chart::WAxis::isVisible | ( |  | ) | const

Returns whether this axis is visible.

See also
  setVisible()

## ◆ label()

virtual WString Wt::Chart::WAxis::label | ( | double | u | ) | const
| virtual

Returns the label for a value.

This returns the label text that corresponds to a given value.

The default implementation uses the labelFormat() to properly represent the value.

## ◆ labelAngle()

double Wt::Chart::WAxis::labelAngle | ( |  | ) | const

Returns the label angle.

See also
  setLabelAngle()

## ◆ labelBasePoint()

double Wt::Chart::WAxis::labelBasePoint | ( |  | ) | const

Returns the base point for labels.

See also
  setLabelBasePoint()

## ◆ labelFont()

const WFont & Wt::Chart::WAxis::labelFont | ( |  | ) | const

Returns the axis label font.

See also
  setLabelFont()

## ◆ labelFormat()

WString Wt::Chart::WAxis::labelFormat | ( |  | ) | const

Returns the label format string.

See also
  setLabelFormat()

## ◆ labelInterval()

double Wt::Chart::WAxis::labelInterval | ( |  | ) | const

Returns the label interval.

See also
  setLabelInterval()

## ◆ labelTransform()

LabelTransform Wt::Chart::WAxis::labelTransform | ( | AxisValue | side | ) | const

Get the label transform configured for the given side.

If no transform is configured for the given side, the identity function is returned.

See also
  setLabelTransform()

## ◆ location()

AxisValue Wt::Chart::WAxis::location | ( |  | ) | const

Returns the axis location.

See also
  setLocation()

## ◆ margin()

int Wt::Chart::WAxis::margin | ( |  | ) | const

Returns the margin between the axis and the plot area.

See also
  setMargin()

## ◆ maximum()

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 (and rounded) maximum.

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

See also
  setMaximum(), setAutoLimits(), setRoundLimits()

## ◆ maximumZoomRange()

double Wt::Chart::WAxis::maximumZoomRange | ( |  | ) | const

Get the maximum zoom range for this axis.

Only applies to a WCartesianChart in interactive mode.

See also
  setMaximumZoomRange()

## ◆ maxZoom()

double Wt::Chart::WAxis::maxZoom | ( |  | ) | const

Get the maximum zoom level for this axis.

Only applies to a WCartesianChart in interactive mode.

See also
  setMaxZoom()

Deprecated
  Use minimumZoomRange() instead

## ◆ minimum()

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 (and rounded) minimum.

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

See also
  setMinimum(), setAutoLimits(), setRoundLimits()

## ◆ minimumZoomRange()

double Wt::Chart::WAxis::minimumZoomRange | ( |  | ) | const

Get the minimum zoom range for this axis.

Only applies to a WCartesianChart in interactive mode.

See also
  setMinimumZoomRange()

## ◆ minZoom()

double Wt::Chart::WAxis::minZoom | ( |  | ) | const

Get the minimum zoom level for this axis.

Only applies to a WCartesianChart in interactive mode.

See also
  setMinZoom()

Deprecated
  Use maximumZoomRange() instead

## ◆ padding()

int Wt::Chart::WAxis::padding | ( |  | ) | const

Returns the padding between the chart area and this axis.

See also
  setPadding()

## ◆ pan()

double Wt::Chart::WAxis::pan | ( |  | ) | const

Get the value to pan to for this axis, when pan is enabled on the chart.

Only applies to a WCartesianChart in interactive mode.

See also
  setPan()

Deprecated
  Use zoomMinimum() instead.

## ◆ pen()

const WPen & Wt::Chart::WAxis::pen | ( |  | ) | const

Returns the pen used for rendering the axis and ticks.

See also
  setPen()

## ◆ resolution()

double Wt::Chart::WAxis::resolution | ( |  | ) | const

Returns the axis resolution.

See also
  setResolution()

## ◆ roundLimits()

WFlags< AxisValue > Wt::Chart::WAxis::roundLimits | ( |  | ) | const

Returns whether limits should be rounded.

See also
  setRoundLimits()

## ◆ scale()

AxisScale Wt::Chart::WAxis::scale | ( |  | ) | const

Returns the scale of the axis.

See also
  setScale()

## ◆ setAutoLimits()

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::AxisValue::Minimum and/or Chart::AxisValue::Maximum.

The default value is Chart::AxisValue::Minimum | Chart::AxisValue::Maximum.

## ◆ setBreak()

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

Specifies 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 SeriesType::Bar that cross the break.

Note
  This feature is incompatible with the interactive features of WCartesianChart.

## ◆ setGridLinesEnabled()

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().

See also
  setGridLinesPen(), isGridLinesEnabled()

## ◆ setGridLinesPen()

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

Changes the pen used for rendering the grid lines.

The default value is a StandardColor::Gray pen of 0 width.

See also
  setPen(), gridLinesPen().

## ◆ setInverted()

void Wt::Chart::WAxis::setInverted | ( | bool | inverted = true | ) |

Set whether this axis should be inverted.

When inverted, the axis will be drawn in the opposite direction, e.g. if normally, the low values are on the left and high values on the right, when inverted, the low values will be on the right and high values on the left.

## ◆ setLabelAngle()

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.

The default value is 0.0.

See also
  labelAngle()

## ◆ setLabelBasePoint()

void Wt::Chart::WAxis::setLabelBasePoint | ( | double | point | ) |

Sets a point to be included as one of the labels (if possible).

The given point will be included as one of the labels, by adjusting the minimum value on the axis, if that minimum is auto-computed. This is only applicable to a Linear scale axis.

The default value is 0.0.

See also
  setRoundLimits()

## ◆ setLabelFont()

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()

## ◆ setLabelFormat()

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()).

For an axis with a AxisScale::Linear or AxisScale::Log 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, then WLocale::toString() is used.

For an axis with a AxisScale::Date scale, the format string must be a format string accepted by WDate::toString(), to format a date. If the format string is an empty string, a suitable format is chosen based on heuristics.

For an axis with a AxisScale::DateTime scale, the format string must be a format string accepted by WDateTime::toString(), to format a date. If the format string is an empty string, a suitable format is chosen based on heuristics.

The default value is "%.4g" for a numeric axis, and a suitable format for date(time) scales based on a heuristic taking into account the current axis range.

See also
  labelFormat()

## ◆ setLabelInterval()

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.

The unit for the label interval is in logical units (i.e. the same as minimum or maximum).

See also
  setLabelFormat()

## ◆ setLabelTransform()

void Wt::Chart::WAxis::setLabelTransform | ( | const LabelTransform & | transform,
|  | AxisValue | side )

Set the transform function to apply to a given side.

The label transform must be a function from double to double, and will be applied on the double value of the model coordinate of every axis tick.

The label transform will not move the position of the axis ticks, only change the labels displayed at the ticks.

This can be useful in combination with a location() set to AxisValue::Both, to show different labels on each side.

If AxisScale::Date or AxisScale::DateTime are used, the double value will be in seconds since the Epoch (00:00:00 UTC, January 1, 1970).

Only AxisValue::Minimum, AxisValue::Zero and AxisValue::Maximum are accepted for side. If you set a label transform for another side, the label transform will not be used.

The label transform will not be used if the scale() is AxisScale::Discrete.

## ◆ setLocation()

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::AxisValue::Minimum.

See also
  location()

## ◆ setMargin()

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()

## ◆ setMaximum()

void Wt::Chart::WAxis::setMaximum | ( | double | maximum | ) |

Sets the maximum value for the axis 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
  setMinimum(), setAutoLimits()

## ◆ setMaximumZoomRange()

void Wt::Chart::WAxis::setMaximumZoomRange | ( | double | size | ) |

Sets the maximum zoom range for this axis.

Only applies to a WCartesianChart in interactive mode.

This range is the largest difference there can be between zoomMinimum() and zoomMaximum().

This is especially useful in combination with on demand loading , when showing the entire chart is undesirable because the amount of data to be shown is too large.

## ◆ setMaxZoom()

void Wt::Chart::WAxis::setMaxZoom | ( | double | maxZoom | ) |

Sets the maximum zoom level for this axis.

Only applies to a WCartesianChart in interactive mode. The zoom level should be >= 1 (1 = no zoom).

Deprecated
  Use setMinimumZoomRange(double) instead

## ◆ setMinimum()

void Wt::Chart::WAxis::setMinimum | ( | double | minimum | ) |

Sets the minimum value 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
  setMaximum(), setAutoLimits()

## ◆ setMinimumZoomRange()

void Wt::Chart::WAxis::setMinimumZoomRange | ( | double | size | ) |

Sets the minimum zoom range for this axis.

Only applies to a WCartesianChart in interactive mode.

This range is the smallest difference there can be between zoomMinimum() and zoomMaximum().

## ◆ setMinZoom()

void Wt::Chart::WAxis::setMinZoom | ( | double | minZoom | ) |

Sets the minimum zoom level for this axis.

Only applies to a WCartesianChart in interactive mode. The zoom level should be >= 1 (1 = no zoom).

Deprecated
  Use setMaximumZoomRange(double) instead

## ◆ setPadding()

void Wt::Chart::WAxis::setPadding | ( | int | padding | ) |

Sets the padding between the chart area and this axis.

See also
  padding()

## ◆ setPan()

void Wt::Chart::WAxis::setPan | ( | double | pan | ) |

Sets the value to pan to for this axis.

This sets the leftmost (horizontal axis) or bottom (vertical axis) value to be displayed on the chart.

Note that if this would cause the chart to go out of bounds, the panning of the chart will be automatically adjusted.

Only applies to a WCartesianChart in interactive mode.

Note
  If the pan position has been changed on the client side, this may not reflect the actual pan position.

Deprecated
  Use setZoomRange() instead.

## ◆ setPen()

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

Changes the pen used for rendering the axis and ticks.

The default value is a StandardColor::Black pen of 0 width.

See also
  setGridLinesPen().

## ◆ setRange()

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(), setMaximum()

## ◆ setResolution()

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()

## ◆ setRoundLimits()

void Wt::Chart::WAxis::setRoundLimits | ( | WFlags< AxisValue > | locations | ) |

Specifies whether limits should be rounded.

When enabling rounding, this has the effect of rounding down the minimum value, or rounding up the maximum value, to the nearest label interval.

By default, rounding is enabled for an auto-calculated limited, and disabled for a manually specifed limit.

See also
  setAutoLimits()

## ◆ setScale()

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

Sets the scale of the axis.

For the X scale in a ChartType::Category, the scale should be left unchanged to AxisScale::Discrete.

For all other axes, the default value is AxisScale::Linear, but this may be changed to AxisScale::Log or AxisScale::Date. AxisScale::Date is only useful for the X axis in a ChartType::Scatter which contains WDate values.

See also
  scale()

## ◆ setSoftLabelClipping()

void Wt::Chart::WAxis::setSoftLabelClipping | ( | bool | enabled | ) |

Enables soft clipping of axis labels.

This is set to `false` by for a 3D chart and to `true` for a 2D chart.

This setting determines how labels should be clipped in case not the entire axis is visible due to clipping. "Hard" clipping is done by the paint device and may truncate labels. "Soft" clipping will determine if the corresponding tick is visible, and draw the label (unclipped), preventing labels from being truncated. For a 2D chart, this feature is only relevant when zoom is enabled on a WCartesianChart.

Soft clipping enabled (slower). This is the default for WCartesianChart. The tick for 0 is visible, and the 0 is shown completely. The tick for 01/01/86 is not visible, so its label is not shown. | Soft clipping disabled (faster). The tick of the 0 is visible, but the 0 is shown partially. Also, the tick of 01/01/86 is not visible, but the label is partially shown.

## ◆ setTextPen()

void Wt::Chart::WAxis::setTextPen | ( | const WPen & | pen | ) |

Changes the pen used for rendering labels for this axis.

The default value is a StandardColor::Black pen of 0 width.

See also
  setGridLinesPen().
  setPen().
  WCartesianChart::setTextPen()

## ◆ setTickDirection()

void Wt::Chart::WAxis::setTickDirection | ( | TickDirection | direction | ) |

Sets the direction that the axis ticks should point to.

If set to TickDirection::Outwards, the axis ticks will point outside of the chart, and the labels will be on the outside.

If set to TickDirection::Inwards, the axis ticks will point inside of the chart, and the labels will be on the inside. Also, the padding() will be set to 25.

See also
  tickDirection()
  setPadding()

## ◆ setTitle()

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

Sets the axis title.

The default title is empty.

See also
  title()

## ◆ setTitleFont()

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()

## ◆ setTitleOrientation()

void Wt::Chart::WAxis::setTitleOrientation | ( | const Orientation & | orientation | ) |

Sets the title orientation.

Sets the orientation used for displaying the title.

The default value is Orientation::Horizontal

See also
  titleOrientation()

## ◆ setVisible()

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 separately by setGridLinesEnabled().

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

See also
  setGridLinesEnabled().

## ◆ setZoom()

void Wt::Chart::WAxis::setZoom | ( | double | zoom | ) |

Sets the zoom level for this axis.

Only applies to a WCartesianChart in interactive mode. The zoom level should be >= 1 and smaller than maxZoom()

Deprecated
  Use setZoomRange() instead.

## ◆ setZoomRange()

void Wt::Chart::WAxis::setZoomRange | ( | double | minimum,
|  | double | maximum )

Set the range to zoom to on this axis.

The minimum is the lowest value to be displayed, and the maximum is the highest value to be displayed.

If the difference between minimum and maximum is less than minimumZoomRange(), the zoom range will be made more narrow around the center of minimum and maximum.

If the given minimum is larger than the given maximum, the two values are swapped.

Only applies to a WCartesianChart in interactive mode.

## ◆ softLabelClipping()

bool Wt::Chart::WAxis::softLabelClipping | ( |  | ) | const

Returns whether soft label clipping is enabled.

See also
  setSoftLabelCLipping()

## ◆ textPen()

const WPen & Wt::Chart::WAxis::textPen | ( |  | ) | const

Returns the pen used for rendering labels for this axis.

See also
  setTextPen()

## ◆ tickDirection()

TickDirection Wt::Chart::WAxis::tickDirection | ( |  | ) | const

Gets the direction that the axis ticks point to.

See also
  setTickDirection()

## ◆ title()

const WString & Wt::Chart::WAxis::title | ( |  | ) | const

Returns the axis title.

See also
  setTitle()

## ◆ titleFont()

const WFont & Wt::Chart::WAxis::titleFont | ( |  | ) | const

Returns the axis title font.

See also
  setTitleFont()

## ◆ titleOrientation()

const Orientation & Wt::Chart::WAxis::titleOrientation | ( |  | ) | const

Returns the title orientation.

See also
  setTitleOrientation()

## ◆ xAxisId()

int Wt::Chart::WAxis::xAxisId | ( |  | ) | const

Returns the X axis id.

Returns 0 if this axis is not a X axis.

See also
  chart(), WCartesianChart::xAxis()

## ◆ yAxisId()

int Wt::Chart::WAxis::yAxisId | ( |  | ) | const

Returns the Y axis id.

Returns 0 if this axis is not a Y axis.

See also
  chart(), WCartesianChart::yAxis()

## ◆ zoom()

double Wt::Chart::WAxis::zoom | ( |  | ) | const

Get the zoom level for this axis.

Only applies to a WCartesianChart in interactive mode.

See also
  setZoom()

Deprecated
  Use zoomMinimum() and zoomMaximum() instead.

## ◆ zoomMaximum()

double Wt::Chart::WAxis::zoomMaximum | ( |  | ) | const

Get the zoom range maximum for this axis.

Only applies to a WCartesianChart in interactive mode.

See also
  setZoomRange()

## ◆ zoomMinimum()

double Wt::Chart::WAxis::zoomMinimum | ( |  | ) | const

Get the zoom range minimum for this axis.

Only applies to a WCartesianChart in interactive mode.

See also
  setZoomRange()

## ◆ zoomRangeChanged()

Signal< double, double > & Wt::Chart::WAxis::zoomRangeChanged | ( |  | ) |

A signal triggered when the zoom range is changed on the client side.

Only applies to a WCartesianChart in interactive mode.

Note
  If you want to use this signal, you must connect a signal listener before the chart is rendered.

## Member Data Documentation

## ◆ AUTO_MAXIMUM

const double Wt::Chart::WAxis::AUTO_MAXIMUM
| static

Constant which indicates automatic maximum calculation.

See also
  setMaximum()

## ◆ AUTO_MINIMUM

const double Wt::Chart::WAxis::AUTO_MINIMUM
| static

Constant which indicates automatic minimum calculation.

See also
  setMinimum()