|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.chart.WAxis
public class WAxis
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 getId() that identifies which of
these three axes it is in the enclosing getChart().
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
"dd/MM/yyyy" (for DateScale). 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.
WCartesianChart| Field Summary | |
|---|---|
static double |
AUTO_MAXIMUM
Constant which indicates automatic maximum calculation. |
static double |
AUTO_MINIMUM
Constant which indicates automatic minimum calculation. |
| Method Summary | |
|---|---|
java.util.EnumSet<AxisValue> |
getAutoLimits()
Returns the limits that are calculated automatically. |
WCartesianChart |
getChart()
Returns the chart to which this axis belongs. |
WPen |
getGridLinesPen()
Returns the pen used for rendering the grid lines. |
Axis |
getId()
Returns the axis id. |
double |
getLabelAngle()
Returns the label angle. |
WFont |
getLabelFont()
Returns the axis label font. |
WString |
getLabelFormat()
Returns the label format string. |
double |
getLabelInterval()
Returns the label interval. |
AxisValue |
getLocation()
Returns the axis location. |
int |
getMargin()
Returns the margin between the axis and the plot area. |
double |
getMaximum()
Returns the maximum value displayed on the axis. |
double |
getMinimum()
Returns the minimum value displayed on the axis. |
WPen |
getPen()
Returns the pen used for rendering the axis and ticks. |
double |
getResolution()
Returns the axis resolution. |
AxisScale |
getScale()
Returns the scale of the axis. |
WString |
getTitle()
Returns the axis title. |
WFont |
getTitleFont()
Returns the axis title font. |
boolean |
isGridLinesEnabled()
Returns whether gridlines are displayed for this axis. |
boolean |
isVisible()
Returns whether this axis is visible. |
void |
setAutoLimits(AxisValue location,
AxisValue... locations)
Let the minimum and/or maximum be calculated from the data. |
void |
setAutoLimits(java.util.EnumSet<AxisValue> locations)
Let the minimum and/or maximum be calculated from the data. |
void |
setBreak(double minimum,
double maximum)
Specify a range that needs to be omitted from the axis. |
void |
setGridLinesEnabled(boolean enabled)
Sets whether gridlines are displayed for this axis. |
void |
setGridLinesPen(WPen pen)
Changes the pen used for rendering the grid lines. |
void |
setLabelAngle(double angle)
Sets the label angle. |
void |
setLabelFont(WFont labelFont)
Sets the axis label font. |
void |
setLabelFormat(java.lang.CharSequence format)
Sets the label format. |
void |
setLabelInterval(double labelInterval)
Sets the label interval. |
void |
setLocation(AxisValue location)
Sets the axis location. |
void |
setMargin(int pixels)
Sets the margin between the axis and the plot area. |
void |
setMaximum(double maximum)
Sets the maximum value for the axis displayed on the axis. |
void |
setMinimum(double minimum)
Sets the minimum value displayed on the axis. |
void |
setPen(WPen pen)
Changes the pen used for rendering the axis and ticks. |
void |
setRange(double minimum,
double maximum)
Sets the axis range (minimum and maximum values) manually. |
void |
setResolution(double resolution)
Sets the axis resolution. |
void |
setScale(AxisScale scale)
Sets the scale of the axis. |
void |
setTitle(java.lang.CharSequence title)
Sets the axis title. |
void |
setTitleFont(WFont titleFont)
Sets the axis title font. |
void |
setVisible(boolean visible)
Sets whether this axis is visible. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double AUTO_MINIMUM
setMinimum(double minimum),
Constant Field Valuespublic static final double AUTO_MAXIMUM
setMaximum(double maximum),
Constant Field Values| Method Detail |
|---|
public Axis getId()
getChart(),
WCartesianChart.getAxis(Axis axis)public void setVisible(boolean visible)
Changes whether the axis is displayed, including ticks and labels. The
rendering of the grid lines is controlled seperately by
setGridLinesEnabled().
The default value is true for the X axis and first Y axis, but false for the second Y axis.
setGridLinesEnabled(boolean enabled)public boolean isVisible()
setVisible(boolean visible)public void setLocation(AxisValue 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 AxisValue.MinimumValue.
getLocation()public AxisValue getLocation()
setLocation(AxisValue location)public void setScale(AxisScale scale)
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.
getScale()public AxisScale getScale()
setScale(AxisScale scale)public void setMinimum(double minimum)
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.
getMinimum(),
setMaximum(double maximum)public double getMinimum()
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.
getMaximum(),
setMinimum(double minimum),
setAutoLimits(EnumSet locations)public void setMaximum(double maximum)
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.
getMinimum(),
setMinimum(double minimum)public double getMaximum()
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.
getMinimum(),
setMaximum(double maximum)
public void setRange(double minimum,
double maximum)
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.
setMinimum(double minimum),
setMaximum(double maximum)public void setResolution(double 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.
getResolution()public double getResolution()
setResolution(double resolution)public void setAutoLimits(java.util.EnumSet<AxisValue> locations)
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 AxisValue.MinimumValue and/or
AxisValue.MaximumValue.
The default value is AxisValue.MinimumValue |
AxisValue.MaximumValue.
public final void setAutoLimits(AxisValue location,
AxisValue... locations)
Calls setAutoLimits(EnumSet.of(location, locations))
public java.util.EnumSet<AxisValue> getAutoLimits()
This returns the limits (AxisValue.MinimumValue and/or
AxisValue.MaximumValue) that are calculated automatically from
the data, rather than being specified manually using
setMinimum() and/or
setMaximum().
setAutoLimits(EnumSet locations)
public void setBreak(double minimum,
double maximum)
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.
public void setLabelInterval(double labelInterval)
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.
setLabelFormat(CharSequence format)public double getLabelInterval()
setLabelInterval(double labelInterval)public void setLabelFormat(java.lang.CharSequence 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 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 ("").
getLabelFormat()public WString getLabelFormat()
setLabelFormat(CharSequence format)public void setLabelAngle(double 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").
getLabelAngle()public double getLabelAngle()
setLabelAngle(double angle)public void setGridLinesEnabled(boolean enabled)
When enabled, gird lines are drawn for each tick on this axis,
using the getGridLinesPen().
Unlike all other visual aspects of an axis, rendering of the gridlines is not controlled by setDisplayEnabled(bool).
setGridLinesPen(WPen pen),
isGridLinesEnabled()public boolean isGridLinesEnabled()
setGridLinesEnabled(boolean enabled)public void setPen(WPen pen)
The default value is a black pen of 0 width.
setGridLinesPen(WPen pen)public WPen getPen()
setPen(WPen pen)public void setGridLinesPen(WPen pen)
The default value is a gray pen of 0 width.
setPen(WPen pen),
getGridLinesPen()public WPen getGridLinesPen()
setGridLinesPen(WPen pen)public void setMargin(int pixels)
The margin is defined in pixels.
The default value is 0.
getMargin()public int getMargin()
setMargin(int pixels)public void setTitle(java.lang.CharSequence title)
The default title is empty.
getTitle()public WString getTitle()
setTitle(CharSequence title)public void setTitleFont(WFont titleFont)
The default title font is a 12 point Sans Serif font.
getTitleFont()public WFont getTitleFont()
setTitleFont(WFont titleFont)public void setLabelFont(WFont labelFont)
The default label font is a 10 point Sans Serif font.
getLabelFont()public WFont getLabelFont()
setLabelFont(WFont labelFont)public WCartesianChart getChart()
WCartesianChart.getAxis(Axis axis)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||