#include <Wt/Chart/WDataSeries>
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 (int customFlags) |
Set which aspects of the look are overriden. | |
int | curstomFlags () 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. |
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.
Different styles of data series
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...
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.
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.
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] |
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).
int Wt::Chart::WDataSeries::modelColumn | ( | ) | const [inline] |
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] |
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.
Axis Wt::Chart::WDataSeries::axis | ( | ) | const [inline] |
void Wt::Chart::WDataSeries::setCustomFlags | ( | int | 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).
int Wt::Chart::WDataSeries::curstomFlags | ( | ) | const [inline] |
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().
WPen Wt::Chart::WDataSeries::pen | ( | ) | const |
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.
WBrush Wt::Chart::WDataSeries::brush | ( | ) | const |
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] |
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.
MarkerType Wt::Chart::WDataSeries::marker | ( | ) | const [inline] |
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.
WPen Wt::Chart::WDataSeries::markerPen | ( | ) | const |
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.
WBrush Wt::Chart::WDataSeries::markerBrush | ( | ) | const |
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.
bool Wt::Chart::WDataSeries::isLegendEnabled | ( | ) | const [inline] |
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).
bool Wt::Chart::WDataSeries::isLabelsEnabled | ( | Axis | axis | ) | const |
void Wt::Chart::WDataSeries::setLabelColor | ( | const WColor & | color | ) |
Set the label color.
Specify the color used for the rendering labels at the data points.
WColor Wt::Chart::WDataSeries::labelColor | ( | ) | const |