|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.chart.WDataSeries
public class WDataSeries
A single data series in a cartesian chart.
This class configures all aspects for rendering a single data series in a cartesian chart. A data series renders Y data from a single model column against the X series configured for the chart.
The data column should contain data that can be converted to a number, but
should not necessarily be of a number type, see also
StringUtils.asNumber(Object).
Multiple series of different types may be combined on a single chart.
Different styles of data series
setStacked()
for a series, which if enabled, will stack that series on top of the
preceding data series. This works regardless of whether they are of the same
type, but obviously works visually best if these series are of the same type.
When not stacked, bar series are rendered next to each other. The margin
between bars of different data series is controlled using
WCartesianChart#setBarMargin().
The line and color type are by default based on the
chart palette, but may be overridden for
a series using setPen(),
setBrush(), etc...
WCartesianChart.addSeries(WDataSeries series)| Nested Class Summary | |
|---|---|
static class |
WDataSeries.CustomFlag
Enumeration that indicates an aspect of the look. |
| Constructor Summary | |
|---|---|
WDataSeries(int modelColumn)
Constructs a new data series. |
|
WDataSeries(int modelColumn,
SeriesType type)
Constructs a new data series. |
|
WDataSeries(int modelColumn,
SeriesType type,
Axis axis)
Constructs a new data series. |
|
| Method Summary | |
|---|---|
void |
bindToAxis(Axis axis)
Binds this series to a chart axis. |
Axis |
getAxis()
Returns the chart axis used for this series. |
double |
getBarWidth()
Returns the bar width. |
WBrush |
getBrush()
Returns the brush used for filling areas for this series. |
java.util.EnumSet<WDataSeries.CustomFlag> |
getCustomFlags()
Returns which aspects of the look are overriden. |
FillRangeType |
getFillRange()
Returns the fill range for line or curve series. |
WColor |
getLabelColor()
Returns the label color. |
MarkerType |
getMarker()
Returns the data point marker. |
WBrush |
getMarkerBrush()
Returns the marker brush. |
WPen |
getMarkerPen()
Returns the marker pen. |
double |
getMarkerSize()
Returns the marker size. |
int |
getModelColumn()
Returns the model column. |
WPen |
getPen()
Returns the pen used for drawing lines for this series. |
WShadow |
getShadow()
Returns the shadow used for stroking lines for this series. |
SeriesType |
getType()
Returns the series type. |
boolean |
isHidden()
Return whether the series is hidden. |
boolean |
isLabelsEnabled(Axis axis)
Returns whether labels are enabled for the given axis. |
boolean |
isLegendEnabled()
Returns whether this series has an entry in the legend. |
boolean |
isStacked()
Returns whether this series is stacked on top of the preceding series. |
WPointF |
mapFromDevice(WPointF deviceCoordinates)
Maps from device coordinates to model coordinates. |
WPointF |
mapToDevice(java.lang.Object xValue,
java.lang.Object yValue)
Maps from model values to device coordinates. |
WPointF |
mapToDevice(java.lang.Object xValue,
java.lang.Object yValue,
int segment)
Maps from model values to device coordinates. |
void |
setBarWidth(double width)
Sets the bar width. |
void |
setBrush(WBrush brush)
Overrides the brush used for filling areas for this series. |
void |
setCustomFlags(java.util.EnumSet<WDataSeries.CustomFlag> flags)
Sets which aspects of the look are overriden. |
void |
setCustomFlags(WDataSeries.CustomFlag flag,
WDataSeries.CustomFlag... flags)
Sets which aspects of the look are overriden. |
void |
setFillRange(FillRangeType fillRange)
Sets the fill range for line or curve series. |
void |
setHidden(boolean hidden)
Hide/unhide this series. |
void |
setLabelColor(WColor color)
Sets the label color. |
void |
setLabelsEnabled(Axis axis)
Enables a label that is shown at the series data points. |
void |
setLabelsEnabled(Axis axis,
boolean enabled)
Enables a label that is shown at the series data points. |
void |
setLegendEnabled(boolean enabled)
Enables the entry for this series in the legend. |
void |
setMarker(MarkerType marker)
Sets the data point marker. |
void |
setMarkerBrush(WBrush brush)
Sets the marker brush. |
void |
setMarkerPen(WPen pen)
Sets the marker pen. |
void |
setMarkerSize(double size)
Sets the marker size. |
void |
setModelColumn(int modelColumn)
Sets the model column. |
void |
setPen(WPen pen)
Overrides the pen used for drawing lines for this series. |
void |
setShadow(WShadow shadow)
Sets a shadow used for stroking lines for this series. |
void |
setStacked(boolean stacked)
Sets whether this series is stacked on top of the preceding series. |
void |
setType(SeriesType type)
Sets the series type. |
void |
setXSeriesColumn(int modelColumn)
Sets the X series column. |
int |
XSeriesColumn()
Returns the X series column. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WDataSeries(int modelColumn,
SeriesType type,
Axis axis)
Creates a new data series which plots the Y values from the model column modelColumn, with the indicated seriesType. The Y values are mapped to the indicated axis, which should correspond to one of the two Y axes.
WCartesianChart.addSeries(WDataSeries series)public WDataSeries(int modelColumn)
Calls this(modelColumn, SeriesType.PointSeries, Axis.Y1Axis)
public WDataSeries(int modelColumn,
SeriesType type)
Calls this(modelColumn, type, Axis.Y1Axis)
| Method Detail |
|---|
public void setBarWidth(double width)
The bar width specifies the bar width (in axis dimensions). For category plots, which may have several bars for different series next to each other, you will want to specify the same bar width for each series.
For scatter plots, you may want to set the bar width to a natural size. E.g. if you are plotting weekly measurements, you could set the width to correspond to a week (=7).
The default value is 0.8 (which leaves a 20% margin between bars for different categories in a category chart.
WCartesianChart.setBarMargin(double margin)public double getBarWidth()
setBarWidth(double width)public void setType(SeriesType type)
The series type specifies how the data is plotted, i.e. using mere point markers, lines, curves, or bars.
public SeriesType getType()
setType(SeriesType type)public void setModelColumn(int modelColumn)
This specifies the model column from which the Y data is retrieved that is plotted by this series.
The data column should contain data that can be converted to a number (but should not necessarily be of a number type).
See also StringUtils.asNumber(Object).
public int getModelColumn()
setModelColumn(int modelColumn)public void setXSeriesColumn(int modelColumn)
By default, the data series uses the X series column configured for the chart. For a scatter plot, each series can have its own matching X data, which is configured here. For other plots, this setting is ignored.
The default value is -1, which indicates that
WCartesianChart#XSeriesColumn()
is to be used.
WCartesianChart.setXSeriesColumn(int modelColumn)public int XSeriesColumn()
setXSeriesColumn(int modelColumn)public void setStacked(boolean stacked)
For category charts, data from different series may be rendered stacked on top of each other. The rendered value is the sum of the value of this series plus the rendered value of the preceding series. For line series, you probably will want to add filling under the curve. A stacked bar series is rendered by a bar on top of the preceding bar series.
The default value is false.
public boolean isStacked()
setStacked(boolean stacked)public void bindToAxis(Axis axis)
A data series may be bound to either the first or second Y axis. Note that the second Y axis is by default not displayed.
The default value is the first Y axis.
WAxis.setVisible(boolean visible)public Axis getAxis()
bindToAxis(Axis axis)public void setCustomFlags(java.util.EnumSet<WDataSeries.CustomFlag> flags)
Set which aspects of the look, that are by default based on the chart palette, are overridden by custom settings.
The default value is 0 (nothing overridden).
public final void setCustomFlags(WDataSeries.CustomFlag flag,
WDataSeries.CustomFlag... flags)
Calls setCustomFlags(EnumSet.of(flag, flags))
public java.util.EnumSet<WDataSeries.CustomFlag> getCustomFlags()
setCustomFlags(EnumSet flags)public void setPen(WPen pen)
Overrides the pen that is used to draw this series. Calling this method automatically adds CustomPen to the custom flags.
The default value is a default WPen().
WChartPalette.getStrokePen(int index),
WChartPalette.getBorderPen(int index)public WPen getPen()
setPen(WPen pen)public void setBrush(WBrush brush)
Overrides the brush that is used to draw this series which is otherwise provided by the chart palette. For a bar plot, this is the brush used to fill the bars. For a line chart, this is the brush used to fill the area under (or above) the line. Calling this method automatically adds CustomBrush to the custom flags.
WChartPalette.getBrush(int index)public WBrush getBrush()
setBrush(WBrush brush)public void setShadow(WShadow shadow)
public WShadow getShadow()
setShadow(WShadow shadow)public void setFillRange(FillRangeType fillRange)
Line or curve series may be filled under or above the curve, using the
getBrush(). This setting specifies the
range that is filled. Bar series may use MinimumValueFill to configure
the chart to render its bars from the data point to the bottom of the
chart or MaximumValueFill to render the bars from the data point to the
top of the chart. The default value is ZeroValueFill, this value
configures the chart to render the bars from the data point to zero.
public FillRangeType getFillRange()
setFillRange(FillRangeType fillRange)public void setMarker(MarkerType marker)
Specifies a marker that is displayed at the (X,Y) coordinate for each series data point.
The default value is a CircleMarker for a PointSeries, or NoMarker otherwise.
setMarkerPen(WPen pen),
setMarkerBrush(WBrush brush)public MarkerType getMarker()
setMarker(MarkerType marker)public void setMarkerSize(double size)
The default marker size is 6 pixels.
public double getMarkerSize()
setMarkerSize(double size)public void setMarkerPen(WPen pen)
Overrides the pen used for stroking the marker. By default the marker pen
is the same as getPen(). Calling this method
automatically adds CustomMarkerPen to the custom flags.
setPen(WPen pen),
setMarkerBrush(WBrush brush)public WPen getMarkerPen()
setMarkerPen(WPen pen)public void setMarkerBrush(WBrush brush)
Overrides the brush used for filling the marker. By default the marker
brush is the same as getBrush(). Calling
this method automatically adds CustomMarkerBrush to the custom flags.
setBrush(WBrush brush),
setMarkerPen(WPen pen)public WBrush getMarkerBrush()
setMarkerBrush(WBrush brush)public void setLegendEnabled(boolean enabled)
When enabled, this series is added to the chart legend.
The default value is true.
WCartesianChart.setLegendEnabled(boolean enabled)public boolean isLegendEnabled()
setLegendEnabled(boolean enabled)
public void setLabelsEnabled(Axis axis,
boolean enabled)
You may enable labels for the XAxis, YAxis or both axes. The label that is displayed is the corresponding value on that axis. If both labels are enabled then they are combined in a single text using the format: "<x-value>: <y-value>".
The default values are false for both axes (no labels).
isLabelsEnabled(Axis axis)public final void setLabelsEnabled(Axis axis)
Calls setLabelsEnabled(axis, true)
public boolean isLabelsEnabled(Axis axis)
setLabelsEnabled(Axis axis, boolean enabled)public void setLabelColor(WColor color)
Specify the color used for the rendering labels at the data points.
setLabelsEnabled(Axis axis, boolean enabled)public WColor getLabelColor()
setLabelColor(WColor color)public void setHidden(boolean hidden)
A hidden series will not be show in the chart and legend.
public boolean isHidden()
setHidden(boolean hidden)public WPointF mapFromDevice(WPointF deviceCoordinates)
Maps a position in the chart back to model coordinates, for data in this data series.
This uses WChart::mapFromDevice() passing the
getAxis() to which this series is bound.
This method uses the axis dimensions that are based on the latest chart
rendering. If you have not yet rendered the chart, or wish to already the
mapping reflect model changes since the last rendering, you should call
WCartesianChart#initLayout() first.
mapToDevice(Object xValue, Object yValue, int segment)
public WPointF mapToDevice(java.lang.Object xValue,
java.lang.Object yValue,
int segment)
Maps model values to device coordinates, for data in this data series.
This uses WChart::mapToDevice() passing the getAxis() to which this series is bound.
This method uses the axis dimensions that are based on the latest chart
rendering. If you have not yet rendered the chart, or wish to already the
mapping reflect model changes since the last rendering, you should call
WCartesianChart#initLayout() first.
mapFromDevice(WPointF deviceCoordinates)
public final WPointF mapToDevice(java.lang.Object xValue,
java.lang.Object yValue)
Returns mapToDevice(xValue, yValue, 0)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||