ErrorBarsCurve.h
Go to the documentation of this file.
/***************************************************************************
File : ErrorBarsCurve.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2010 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Error bars curve
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef ERRORBARS_H
#define ERRORBARS_H
#include "PlotCurve.h"
#include <qwt_plot.h>
class ErrorBarsCurve: public DataCurve
{
public:
enum Orientation{Horizontal = 0, Vertical = 1};
ErrorBarsCurve(int orientation, Table *t, const QString& name);
ErrorBarsCurve(Table *t, const QString& name);
void copy(const ErrorBarsCurve *e);
QwtDoubleRect boundingRect() const;
double errorValue(int i);
QwtArray<double> errors(){return err;};
void setErrors(const QwtArray<double>&data){err=data;};
int capLength(){return d_cap_length;};
void setCapLength(int t){d_cap_length = t;};
double width(){return pen().widthF();};
void setWidth(double w);
QColor color(){return pen().color();};
void setColor(const QColor& c);
int direction(){return type;};
void setDirection(int o){type = o;};
bool xErrors();
void setXErrors(bool yes);
bool throughSymbol(){return through;};
void drawThroughSymbol(bool yes){through=yes;};
bool plusSide(){return plus;};
void drawPlusSide(bool yes){plus=yes;};
bool minusSide(){return minus;};
void drawMinusSide(bool yes){minus=yes;};
DataCurve* masterCurve(){return d_master_curve;};
void setMasterCurve(DataCurve *c);
void detachFromMasterCurve(){d_master_curve->removeErrorBars(this);};
QStringList plotAssociation();
bool updateData(Table *t, const QString& colName);
void loadData();
private:
virtual void draw(QPainter *painter,const QwtScaleMap &xMap,
const QwtScaleMap &yMap, int from, int to) const;
void drawErrorBars(QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, int from, int to) const;
void init();
QwtArray<double> err;
int type;
int d_cap_length;
bool plus, minus, through;
DataCurve *d_master_curve;
};
#endif
ErrorBarsCurve::drawErrorBars
void drawErrorBars(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
Definition: ErrorBarsCurve.cpp:96
ErrorBarsCurve::Vertical
Definition: ErrorBarsCurve.h:39
ErrorBarsCurve::setErrors
void setErrors(const QwtArray< double > &data)
Definition: ErrorBarsCurve.h:50
ErrorBarsCurve::plotAssociation
QStringList plotAssociation()
A list of data sources for this curve.
Definition: ErrorBarsCurve.cpp:344
ErrorBarsCurve::plus
bool plus
Definition: ErrorBarsCurve.h:106
ErrorBarsCurve::masterCurve
DataCurve * masterCurve()
Returns the master curve to which this error bars curve is attached.
Definition: ErrorBarsCurve.h:77
ErrorBarsCurve::xErrors
bool xErrors()
Definition: ErrorBarsCurve.cpp:205
ErrorBarsCurve::Horizontal
Definition: ErrorBarsCurve.h:39
ErrorBarsCurve
Error bars curve.
Definition: ErrorBarsCurve.h:36
ErrorBarsCurve::updateData
bool updateData(Table *t, const QString &colName)
Definition: ErrorBarsCurve.cpp:358
ErrorBarsCurve::setWidth
void setWidth(double w)
Definition: ErrorBarsCurve.cpp:222
ErrorBarsCurve::drawThroughSymbol
void drawThroughSymbol(bool yes)
Definition: ErrorBarsCurve.h:68
ErrorBarsCurve::init
void init()
Definition: ErrorBarsCurve.cpp:55
ErrorBarsCurve::err
QwtArray< double > err
Stores the error bar values.
Definition: ErrorBarsCurve.h:98
ErrorBarsCurve::loadData
void loadData()
Definition: ErrorBarsCurve.cpp:292
ErrorBarsCurve::through
bool through
Definition: ErrorBarsCurve.h:106
PlotCurve.h
ErrorBarsCurve::errorValue
double errorValue(int i)
Definition: ErrorBarsCurve.cpp:197
ErrorBarsCurve::setDirection
void setDirection(int o)
Definition: ErrorBarsCurve.h:62
ErrorBarsCurve::ErrorBarsCurve
ErrorBarsCurve(int orientation, Table *t, const QString &name)
Definition: ErrorBarsCurve.cpp:39
ErrorBarsCurve::throughSymbol
bool throughSymbol()
Definition: ErrorBarsCurve.h:67
ErrorBarsCurve::minus
bool minus
Definition: ErrorBarsCurve.h:106
ErrorBarsCurve::drawPlusSide
void drawPlusSide(bool yes)
Definition: ErrorBarsCurve.h:71
ErrorBarsCurve::setColor
void setColor(const QColor &c)
Definition: ErrorBarsCurve.cpp:229
ErrorBarsCurve::capLength
int capLength()
Definition: ErrorBarsCurve.h:52
ErrorBarsCurve::Orientation
Orientation
Definition: ErrorBarsCurve.h:39
ErrorBarsCurve::minusSide
bool minusSide()
Definition: ErrorBarsCurve.h:73
DataCurve
Definition: PlotCurve.h:96
ErrorBarsCurve::color
QColor color()
Definition: ErrorBarsCurve.h:58
ErrorBarsCurve::copy
void copy(const ErrorBarsCurve *e)
Definition: ErrorBarsCurve.cpp:65
ErrorBarsCurve::boundingRect
QwtDoubleRect boundingRect() const
Definition: ErrorBarsCurve.cpp:236
ErrorBarsCurve::draw
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
Definition: ErrorBarsCurve.cpp:76
ErrorBarsCurve::type
int type
Orientation of the bars: Horizontal or Vertical.
Definition: ErrorBarsCurve.h:101
ErrorBarsCurve::d_cap_length
int d_cap_length
Length of the bar cap decoration.
Definition: ErrorBarsCurve.h:104
DataCurve::removeErrorBars
void removeErrorBars(ErrorBarsCurve *c)
Remove a single error bars curve from the list of attached error bars.
Definition: PlotCurve.cpp:681
ErrorBarsCurve::errors
QwtArray< double > errors()
Definition: ErrorBarsCurve.h:49
ErrorBarsCurve::d_master_curve
DataCurve * d_master_curve
Reference to the master curve to which this error bars curve is attached.
Definition: ErrorBarsCurve.h:109
ErrorBarsCurve::width
double width()
Definition: ErrorBarsCurve.h:55
Table
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:57
ErrorBarsCurve::setCapLength
void setCapLength(int t)
Definition: ErrorBarsCurve.h:53
ErrorBarsCurve::setMasterCurve
void setMasterCurve(DataCurve *c)
Definition: ErrorBarsCurve.cpp:278
ErrorBarsCurve::direction
int direction()
Definition: ErrorBarsCurve.h:61
PlotCurve::type
int type()
Sort of rtti()
Definition: PlotCurve.h:48
ErrorBarsCurve::detachFromMasterCurve
void detachFromMasterCurve()
Causes the master curve to delete this curve from its managed error bars list.
Definition: ErrorBarsCurve.h:81
ErrorBarsCurve::setXErrors
void setXErrors(bool yes)
Definition: ErrorBarsCurve.cpp:214
ErrorBarsCurve::drawMinusSide
void drawMinusSide(bool yes)
Definition: ErrorBarsCurve.h:74
ErrorBarsCurve::plusSide
bool plusSide()
Definition: ErrorBarsCurve.h:70