# PlotMM::ErrorCurve Class Reference

Inheritance diagram for PlotMM::ErrorCurve:

[legend]
Collaboration diagram for PlotMM::ErrorCurve:
[legend]
List of all members.

## Detailed Description

A class which draws curves with errors.

This class can be used to display data as a curve in the x-y plane. It supports different display styles and symbols.

See also:
  Curve, Symbol, DoubleIntMap

## Public Member Functions

| ErrorCurve (const Glib::ustring &title="")
| ErrorCurve (const ErrorCurve &c)
virtual | ~ErrorCurve ()
const ErrorCurve & | operator= (const ErrorCurve &c)
virtual void | set_data (const double *xData, const double *yData, int size)
virtual void | set_data (const double *xData, const double *yData, const double *xErr, const double *yErr, int size)
virtual void | set_data (const std::vector< double > &xData, const std::vector< double > &yData)
virtual void | set_data (const std::vector< double > &xData, const std::vector< double > &yData, const std::vector< double > &xErr, const std::vector< double > &yErr)
virtual void | set_data (const Glib::ArrayHandle< DoublePoint > &data)
double | dx (int i) const
double | dy (int i) const
virtual Glib::RefPtr< Paint > | error_paint () const
virtual void | draw (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from=0, int to=-1)
virtual void | set_enabled (bool b)
virtual bool | enabled ()
virtual int | data_size () const
double | x (int i) const
double | y (int i) const
virtual DoubleRect | bounding_rect () const
double | min_x_value () const
double | max_x_value () const
double | min_y_value () const
double | max_y_value () const
virtual void | set_options (CurveOptions t)
virtual CurveOptions | options () const
virtual void | set_title (const Glib::ustring &title)
virtual const Glib::ustring & | title () const
virtual void | set_baseline (double ref)
virtual double | baseline () const
virtual void | set_curve_style (CurveStyleID style, CurveOptions options=CURVE_AUTO)
virtual CurveStyleID | curve_style () const
virtual Glib::RefPtr< Paint > | paint () const
virtual void | set_symbol (const Glib::RefPtr< Symbol > &s)
virtual Glib::RefPtr< Symbol > | symbol () const

## Public Attributes

SigC::Signal0< void > | signal_curve_changed

## Protected Member Functions

virtual void | init (const Glib::ustring &title)
virtual void | copy (const Curve &c)
virtual void | copy (const ErrorCurve &c)
virtual void | draw_errors_ (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from=0, int to=-1)
virtual void | draw_x_error_ (const Glib::RefPtr< Gdk::Drawable > &p, int x1, int y1, int x2, int y2)
virtual void | draw_y_error_ (const Glib::RefPtr< Gdk::Drawable > &p, int x1, int y1, int x2, int y2)
bool | have_dx_ () const
bool | have_dy_ () const
virtual void | draw_curve_ (const Glib::RefPtr< Gdk::Drawable > &p, int style, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | draw_symbols_ (const Glib::RefPtr< Gdk::Drawable > &p, const Glib::RefPtr< Symbol > &, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | draw_lines_ (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | draw_sticks_ (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | draw_dots_ (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | draw_lsteps_ (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | draw_csteps_ (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | draw_rsteps_ (const Glib::RefPtr< Gdk::Drawable > &p, const DoubleIntMap &xMap, const DoubleIntMap &yMap, int from, int to)
virtual void | close_polyline_ (const DoubleIntMap &, const DoubleIntMap &, std::vector< Gdk::Point > &) const
virtual void | curve_changed ()
virtual int | verify_range (int &i1, int &i2)

## Constructor & Destructor Documentation

ErrorCurve::ErrorCurve | ( | const Glib::ustring & | title = `""` | ) |

Ctor.

Parameters:

  | title | title of the curve

ErrorCurve::ErrorCurve | ( | const ErrorCurve & | c | ) |

| Copy Constructor.

ErrorCurve::~ErrorCurve | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

double Curve::baseline | ( |  | ) | const`[virtual, inherited]`

Return the value of the baseline.

See also:
  Curve::set_baseline

DoubleRect Curve::bounding_rect | ( |  | ) | const`[virtual, inherited]`

| Returns the bounding rectangle of the curve data. If there is no bounding rect, like for empty data the rectangle is invalid: DoubleRect.is_valid() == FALSE

void Curve::close_polyline_ | ( | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | std::vector< Gdk::Point > & | pa
| ) | const`[protected, virtual, inherited]`

Complete a polygon to be a closed polygon including the area between the original polygon and the baseline.

Parameters:

  | xMap | X map
  | yMap | Y map
  | pa | Polygon to be completed

void ErrorCurve::copy | ( | const ErrorCurve & | c | ) | `[protected, virtual]`

| Copy the contents of a curve into another curve.

void ErrorCurve::copy | ( | const Curve & | c | ) | `[protected, virtual]`

| Copy the contents of a curve into another curve. Reimplemented from PlotMM::Curve.

void Curve::curve_changed | ( |  | ) | `[protected, virtual, inherited]`

| Notify a change of attributes. This virtual function is called when an attribute of the curve has changed. It can be redefined by derived classes. The default implementation does nothing.

CurveStyleID Curve::curve_style | ( |  | ) | const`[virtual, inherited]`

Return the current style.

See also:
  Curve::set_style

int Curve::data_size | ( |  | ) | const`[virtual, inherited]`

| Return the size of the data arrays

void ErrorCurve::draw | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from = `0`,
|  | int | to = `-1`
| ) | `[virtual]`

Draw an intervall of the curve.

Parameters:

  | painter | Painter
  | xMap | maps x-values into pixel coordinates.
  | yMap | maps y-values into pixel coordinates.
  | from | index of the first point to be painted
  | to | index of the last point to be painted. If to < 0 the curve will be painted to its last point.

See also:
  Curve::draw, ErrorCurve::draw_x_error_, ErrorCurve::draw_x_error_, ErrorCurve::draw_errors_

Reimplemented from PlotMM::Curve.

void Curve::draw_csteps_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw step function.

Parameters:

  | painter | Painter
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

See also:
  Curve::draw, Curve::draw_curve_, Curve::draw_dots_, Curve::draw_lines_, Curve::draw_sticks_

void Curve::draw_curve_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | int | style,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw the line part (without symbols) of a curve interval.

Parameters:

  | painter | Painter
  | style | curve style, see CurveStyleID
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

See also:
  Curve::draw

void Curve::draw_dots_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw dots.

Parameters:

  | painter | Painter
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

See also:
  Curve::draw

void ErrorCurve::draw_errors_ | ( | const Glib::RefPtr< Gdk::Drawable > & | p,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from = `0`,
|  | int | to = `-1`
| ) | `[protected, virtual]`

| Draw error bars.

void Curve::draw_lines_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw lines.

Parameters:

  | painter | Painter
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

See also:
  Curve::draw

void Curve::draw_lsteps_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw step function.

Parameters:

  | painter | Painter
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

See also:
  Curve::draw

void Curve::draw_rsteps_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw step function.

Parameters:

  | painter | Painter
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

See also:
  Curve::draw, Curve::draw_curve_, Curve::draw_dots_, Curve::draw_lines_, Curve::draw_sticks_

void Curve::draw_sticks_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw sticks.

Parameters:

  | painter | Painter
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

See also:
  Curve::draw

void Curve::draw_symbols_ | ( | const Glib::RefPtr< Gdk::Drawable > & | painter,
|  | const Glib::RefPtr< Symbol > & | symbol,
|  | const DoubleIntMap & | xMap,
|  | const DoubleIntMap & | yMap,
|  | int | from,
|  | int | to
| ) | `[protected, virtual, inherited]`

Draw symbols.

Parameters:

  | painter | Painter
  | symbol | Curve symbol
  | xMap | x map
  | yMap | y map
  | from | index of the first point to be painted
  | to | index of the last point to be painted

double PlotMM::ErrorCurve::dx | ( | int | i | ) | const

Parameters:

  | i | index

Returns:
  x-value at position i

double PlotMM::ErrorCurve::dy | ( | int | i | ) | const

Parameters:

  | i | index

Returns:
  y-value at position i

virtual bool PlotMM::Curve::enabled | ( |  | ) | `[virtual, inherited]`

| Query if this curve is enabled for drawing.

Glib::RefPtr< Paint > ErrorCurve::error_paint | ( |  | ) | const`[virtual]`

| Return a reference to the Paint the curve is drawn with

void ErrorCurve::init | ( | const Glib::ustring & | title | ) | `[protected, virtual]`

| Initialize data members. Reimplemented from PlotMM::Curve.

const ErrorCurve & ErrorCurve::operator= | ( | const ErrorCurve & | c | ) |

| Copy Assignment.

CurveOptions Curve::options | ( |  | ) | const`[virtual, inherited]`

Return the current style options.

See also:
  Curve::set_options

Glib::RefPtr< Paint > Curve::paint | ( |  | ) | const`[virtual, inherited]`

| Return a reference to the Paint the curve is drawn with

void Curve::set_baseline | ( | double | ref | ) | `[virtual, inherited]`

Set the value of the baseline.

The baseline is needed for filling the curve with a brush or the CURVE_STICKS drawing style. The default value is 0.0. The interpretation of the baseline depends on the style options. With CURVE_Y_FX, the baseline is interpreted as a horizontal line at y = baseline(), with Curve::Yfy, it is interpreted as a vertical line at x = baseline().

Parameters:

  | ref | baseline

See also:
  Curve::set_brush(), Curve::set_style(), Curve::set_options()

void Curve::set_curve_style | ( | CurveStyleID | cStyle,
|  | CurveOptions | options = `CURVE_AUTO`
| ) | `[virtual, inherited]`

Set the curve's drawing style.

Valid styles are:

CURVE_NONE
  Don't draw a curve. Note: This doesn't affect the symbol.
CURVE_LINES
  Connect the points with straight lines.
CURVE_STICKS
  Draw vertical sticks from a baseline which is defined by set_baseline().
Curve::Steps
  Connect the points with a step function. The step function is drawn from the left to the right or vice versa, depending on the 'CURVE_INVERTED' option.
Curves::CURVE_DOTS
  Draw dots at the locations of the data points. Note: This is different from a dotted line (see set_pen()).
Curve::UserCurve ...
  Styles >= Curve::UserCurve are reserved for derived classes of Curve that overload Curve::draw() with additional application specific curve types.

See also:
  Curve::paint()

void ErrorCurve::set_data | ( | const Glib::ArrayHandle< DoublePoint > & | data | ) | `[virtual]`

Initialize data with an array of points (explicitly shared).

Parameters:

  | data | Data

Todo:
  test if this method really works

Reimplemented from PlotMM::Curve.

void ErrorCurve::set_data | ( | const std::vector< double > & | xData,
|  | const std::vector< double > & | yData,
|  | const std::vector< double > & | xErr,
|  | const std::vector< double > & | yErr
| ) | `[virtual]`

Initialize data with x- and y-arrays (explicitly shared).

Todo:
  handle unevenly sized arrays correctly

void ErrorCurve::set_data | ( | const std::vector< double > & | xData,
|  | const std::vector< double > & | yData
| ) | `[virtual]`

Initialize data with x- and y-arrays (explicitly shared).

Parameters:

  | xData | x data
  | yData | y data

Todo:
  handle unevenly sized arrays correctly

Reimplemented from PlotMM::Curve.

void ErrorCurve::set_data | ( | const double * | xData,
|  | const double * | yData,
|  | const double * | xErr,
|  | const double * | yErr,
|  | int | size
| ) | `[virtual]`

Set data by copying x- and y-values from specified memory blocks This function makes a 'deep copy' of the data.

See also:
  QwData::set_data.

Todo:
  handle null pointers correctly

void ErrorCurve::set_data | ( | const double * | xData,
|  | const double * | yData,
|  | int | size
| ) | `[virtual]`

Set data by copying x- and y-values from specified memory blocks This function makes a 'deep copy' of the data.

Parameters:

  | xData | pointer to x values
  | yData | pointer to y values
  | size | size of xData and yData

See also:
  QwData::set_data.

Todo:
  handle null pointers correctly

Reimplemented from PlotMM::Curve.

virtual void PlotMM::Curve::set_enabled | ( | bool | b | ) | `[virtual, inherited]`

| Enable or disable this curve for drawing.

void Curve::set_options | ( | CurveOptions | opt | ) | `[virtual, inherited]`

Specify options for the drawing style.

The options can be used to modify the drawing style. Options can be or-combined. The following options are defined:

CURVE_AUTO
  The default setting. This means that y is regarded as a function of x.
CURVE_Y_FX
  Draws y as a function of x (the default). The baseline is interpreted as a horizontal line with y = baseline().
CURVE_X_FY
  Draws x as a function of y. The baseline is interpreted as a vertical line with x = baseline().
CURVE_INVERTED
  For Curve::Steps only. Draws a step function from the right to the left.

Parameters:

  | opt | new options /sa Curve::options()

void Curve::set_symbol | ( | const Glib::RefPtr< Symbol > & | s | ) | `[virtual, inherited]`

Assign a symbol.

Parameters:

  | s | symbol

See also:
  Symbol

void Curve::set_title | ( | const Glib::ustring & | title | ) | `[virtual, inherited]`

Assign a title to a curve.

Parameters:

  | title | new title

Glib::RefPtr< Symbol > Curve::symbol | ( |  | ) | const`[virtual, inherited]`

Return the current symbol.

See also:
  Curve::set_symbol

const Glib::ustring & Curve::title | ( |  | ) | const`[virtual, inherited]`

Return the title.

See also:
  Curve::set_title

int Curve::verify_range | ( | int & | i1,
|  | int & | i2
| ) | `[protected, virtual, inherited]`

Checks if a range of indices is valid and corrects it if necessary.

Parameters:

  | i1 | Index 1
  | i2 | Index 2

double PlotMM::Curve::x | ( | int | i | ) | const`[inherited]`

Parameters:

  | i | index

Returns:
  x-value at position i

double PlotMM::Curve::y | ( | int | i | ) | const`[inherited]`

Parameters:

  | i | index

Returns:
  y-value at position i

## Member Data Documentation

SigC::Signal0<void> PlotMM::Curve::signal_curve_changed`[inherited]`

| Signals that this curve has changed in some way or the other.