Wt::Chart::WDataSeries Class Reference
[Chart library]

A single data series in a cartesian chart. More...

#include <Wt/Chart/WDataSeries>

List of all members.

Public Types

enum  CustomFlag {
  CustomPen = 0x1, CustomBrush = 0x2, CustomMarkerPen = 0x4, CustomMarkerBrush = 0x8,
  CustomLabelColor = 0x10
}
 Enumeration that indicates an aspect of the look. More...

Public Member Functions

 WDataSeries (int modelColumn, SeriesType seriesType=PointSeries, Axis axis=Y1Axis)
 Construct a new data series.
void setType (SeriesType t)
 Change the series type.
SeriesType type () const
 Returns the series type.
void setModelColumn (int modelColumn)
 Change the model column.
int modelColumn () const
 Returns the model column.
void setStacked (bool stacked)
 Sets whether this series is stacked on top of the preceding series.
bool isStacked () const
 Returns whether this series is stacked on top of the preceding series.
void bindToAxis (Axis axis)
 Bind this series to a chart axis.
Axis axis () const
 Returns the chart axis used for this series.
void setCustomFlags (WFlags< CustomFlag > customFlags)
 Set which aspects of the look are overriden.
WFlags< CustomFlagcurstomFlags () const
 Returns which aspects of the look are overriden.
void setPen (const WPen &pen)
 Override the pen used for drawing lines for this series.
WPen pen () const
 Returns the pen used for drawing lines for this series.
void setBrush (const WBrush &brush)
 Override the brush used for filling areas for this series.
WBrush brush () const
 Returns the brush used for filling areas for this series.
void setFillRange (FillRangeType fillRange)
 Sets the fill range for line or curve series.
FillRangeType fillRange () const
 Returns the fill range for line or curve series.
void setMarker (MarkerType marker)
 Sets the data point marker.
MarkerType marker () const
 Returns the data point marker.
void setMarkerPen (const WPen &pen)
 Sets the marker pen.
WPen markerPen () const
 Returns the marker pen.
void setMarkerBrush (const WBrush &brush)
 Sets the marker brush.
WBrush markerBrush () const
 Returns the marker brush.
void setLegendEnabled (bool enabled)
 Enable the entry for this series in the legend.
bool isLegendEnabled () const
 Returns whether this series has an entry in the legend.
void setLabelsEnabled (Axis axis, bool enabled=true)
 Enable a label that is shown at the series data points.
bool isLabelsEnabled (Axis axis) const
 Returns whether labels are enabled for the given axis.
void setLabelColor (const WColor &color)
 Set the label color.
WColor labelColor () const
 Returns the label color.


Detailed Description

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 asNumber(const boost::any&).

Multiple series of different types may be combined on a single chart.

ChartWDataSeries-1.png

Different styles of data series

For a category chart, series may be stacked on top of each other. This is controlled by setStacked(bool stacked) 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(double).

The line and color type are by default based on the chart palette, but may be overridden for a series using setPen(const WPen&), setBrush(const WBrush&), etc...

See also:
WCartesianChart::addSeries(const WDataSeries&)

Member Enumeration Documentation

Enumeration that indicates an aspect of the look.

These flags are used to keep track of which aspects of the look that are overridden from the values provided by the chart palette, using one of the methods in this class.

See also:
setPen(), setBrush(), setMarkerPen(), setMarkerBrush(), setLabelColor()
Enumerator:
CustomPen  A custom pen is set.
CustomBrush  A custom brush is set.
CustomMarkerPen  A custom marker pen is set.
CustomMarkerBrush  A custom marker brush is set.
CustomLabelColor  A custom label color is set.


Constructor & Destructor Documentation

Wt::Chart::WDataSeries::WDataSeries ( int  modelColumn,
SeriesType  seriesType = PointSeries,
Axis  axis = Y1Axis 
)

Construct a new data series.

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.

See also:
WCartesianChart::addSeries(const WDataSeries&)


Member Function Documentation

void Wt::Chart::WDataSeries::setType ( SeriesType  t  ) 

Change the series type.

The series type specifies how the data is plotted, i.e. using mere point markers, lines, curves, or bars.

SeriesType Wt::Chart::WDataSeries::type (  )  const [inline]

Returns the series type.

See also:
setType(SeriesType)

void Wt::Chart::WDataSeries::setModelColumn ( int  modelColumn  ) 

Change the model column.

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:
asNumber(const boost::any&)

int Wt::Chart::WDataSeries::modelColumn (  )  const [inline]

Returns the model column.

See also:
setModelColumn(int)

void Wt::Chart::WDataSeries::setStacked ( bool  stacked  ) 

Sets whether this series is stacked on top of the preceding series.

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.

bool Wt::Chart::WDataSeries::isStacked (  )  const [inline]

Returns whether this series is stacked on top of the preceding series.

See also:
setStacked(bool)

void Wt::Chart::WDataSeries::bindToAxis ( Axis  axis  ) 

Bind this series to a chart 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.

See also:
WAxis::setVisible()

Axis Wt::Chart::WDataSeries::axis (  )  const [inline]

Returns the chart axis used for this series.

See also:
bindToAxis(Axis)

void Wt::Chart::WDataSeries::setCustomFlags ( WFlags< CustomFlag customFlags  ) 

Set which aspects of the look are overriden.

Set which aspects of the look, that are by default based on the chart palette, or overridden by custom settings.

The default value is 0 (nothing overridden).

WFlags<CustomFlag> Wt::Chart::WDataSeries::curstomFlags (  )  const [inline]

Returns which aspects of the look are overriden.

See also:
setCustomFlags(WFlags<CustomFlag>)

void Wt::Chart::WDataSeries::setPen ( const WPen pen  ) 

Override the pen used for drawing lines for this series.

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

See also:
WChartPalette::strokePen(), WChartPalette::borderPen()

WPen Wt::Chart::WDataSeries::pen (  )  const

Returns the pen used for drawing lines for this series.

See also:
setPen(const WPen&)

void Wt::Chart::WDataSeries::setBrush ( const WBrush brush  ) 

Override the brush used for filling areas for this series.

Overrides the brush that is used to draw this series. 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.

See also:
WChartPalette::brush()

WBrush Wt::Chart::WDataSeries::brush (  )  const

Returns the brush used for filling areas for this series.

See also:
setBrush(const WBrush&)

void Wt::Chart::WDataSeries::setFillRange ( FillRangeType  fillRange  ) 

Sets the fill range for line or curve series.

Line or curve series may be filled under or above the curve, using the brush(). This setting specifies the range that is filled.

FillRangeType Wt::Chart::WDataSeries::fillRange (  )  const [inline]

Returns the fill range for line or curve series.

See also:
setFillRange(FillRangeType)

void Wt::Chart::WDataSeries::setMarker ( MarkerType  marker  ) 

Sets the data point 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.

See also:
setMarkerPen(const WPen&), setMarkerBrush(const WBrush&).

MarkerType Wt::Chart::WDataSeries::marker (  )  const [inline]

Returns the data point marker.

See also:
setMarker(MarkerType)

void Wt::Chart::WDataSeries::setMarkerPen ( const WPen pen  ) 

Sets the marker pen.

Overrides the pen used for stroking the marker. By default the marker pen is the same as pen(). Calling this method automatically adds CustomMarkerPen to the custom flags.

See also:
setPen(const WPen&), setMarkerBrush(const WBrush&)

WPen Wt::Chart::WDataSeries::markerPen (  )  const

Returns the marker pen.

See also:
setMarkerPen(const WPen&)

void Wt::Chart::WDataSeries::setMarkerBrush ( const WBrush brush  ) 

Sets the marker brush.

Overrides the brush used for filling the marker. By default the marker brush is the same as brush(). Calling this method automatically adds CustomMarkerBrush to the custom flags.

See also:
setBrush(const WBrush&), setMarkerPen(const WPen&)

WBrush Wt::Chart::WDataSeries::markerBrush (  )  const

Returns the marker brush.

See also:
setMarkerBrush(const WBrush&)

void Wt::Chart::WDataSeries::setLegendEnabled ( bool  enabled  ) 

Enable the entry for this series in the legend.

When enabled, this series is added to the chart legend.

The default value is true.

See also:
WCartesianChart::setLegendEnabled(bool).

bool Wt::Chart::WDataSeries::isLegendEnabled (  )  const [inline]

Returns whether this series has an entry in the legend.

See also:
setLegendEnabled(bool)

void Wt::Chart::WDataSeries::setLabelsEnabled ( Axis  axis,
bool  enabled = true 
)

Enable a label that is shown at the series data points.

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

See also:
isLabelsEnabled()

bool Wt::Chart::WDataSeries::isLabelsEnabled ( Axis  axis  )  const

Returns whether labels are enabled for the given axis.

See also:
setLabelsEnabled(Axis, bool)

void Wt::Chart::WDataSeries::setLabelColor ( const WColor color  ) 

Set the label color.

Specify the color used for the rendering labels at the data points.

See also:
setLabelsEnabled(Axis, bool)

WColor Wt::Chart::WDataSeries::labelColor (  )  const

Returns the label color.

See also:
setLabelColor(const WColor&)


Generated on Tue Sep 1 17:51:17 2009 for Wt by doxygen 1.5.6