#include <Wt/Chart/WAxis>
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 WString & | labelFormat () 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 WPen & | pen () 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 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) |
Set the axis title. | |
const WString & | title () const |
Returns the axis title. | |
void | setTitleFont (const WFont &titleFont) |
Set the axis title font. | |
const WFont & | titleFont () const |
Returns the axis title font. | |
WCartesianChart * | chart () 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. |
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.
Axis Wt::Chart::WAxis::id | ( | ) | const [inline] |
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.
bool Wt::Chart::WAxis::isVisible | ( | ) | const [inline] |
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.
AxisLocation Wt::Chart::WAxis::location | ( | ) | const [inline] |
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.
AxisScale Wt::Chart::WAxis::scale | ( | ) | const [inline] |
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.
double Wt::Chart::WAxis::minimum | ( | ) | const |
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.
double Wt::Chart::WAxis::maximum | ( | ) | const |
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.
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.
double Wt::Chart::WAxis::labelInterval | ( | ) | const [inline] |
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 ("").
const WString& Wt::Chart::WAxis::labelFormat | ( | ) | const [inline] |
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").
double Wt::Chart::WAxis::labelAngle | ( | ) | const [inline] |
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).
bool Wt::Chart::WAxis::isGridLinesEnabled | ( | ) | const [inline] |
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.
const WPen& Wt::Chart::WAxis::pen | ( | ) | const [inline] |
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.
const WPen& Wt::Chart::WAxis::gridLinesPen | ( | ) | const [inline] |
Returns the pen used for rendering the grid lines.
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.
int Wt::Chart::WAxis::margin | ( | ) | const [inline] |
void Wt::Chart::WAxis::setTitle | ( | const WString & | title | ) |
const WString& Wt::Chart::WAxis::title | ( | ) | const [inline] |
void Wt::Chart::WAxis::setTitleFont | ( | const WFont & | titleFont | ) |
const WFont& Wt::Chart::WAxis::titleFont | ( | ) | const [inline] |
WCartesianChart* Wt::Chart::WAxis::chart | ( | ) | const [inline] |
Returns the chart to which this axis belongs.
const double Wt::Chart::WAxis::AUTO_MINIMUM = DBL_MAX [static] |
const double Wt::Chart::WAxis::AUTO_MAXIMUM = -DBL_MAX [static] |