QtiPlot  0.9.8.2
ErrorBarsCurve.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ErrorBarsCurve.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2010 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Error bars curve
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef ERRORBARS_H
30 #define ERRORBARS_H
31 
32 #include "PlotCurve.h"
33 #include <qwt_plot.h>
34 
37 {
38 public:
40 
41  ErrorBarsCurve(int orientation, Table *t, const QString& name);
42  ErrorBarsCurve(Table *t, const QString& name);
43 
44  void copy(const ErrorBarsCurve *e);
45 
46  QwtDoubleRect boundingRect() const;
47 
48  double errorValue(int i);
49  QwtArray<double> errors(){return err;};
50  void setErrors(const QwtArray<double>&data){err=data;};
51 
52  int capLength(){return d_cap_length;};
53  void setCapLength(int t){d_cap_length = t;};
54 
55  double width(){return pen().widthF();};
56  void setWidth(double w);
57 
58  QColor color(){return pen().color();};
59  void setColor(const QColor& c);
60 
61  int direction(){return type;};
62  void setDirection(int o){type = o;};
63 
64  bool xErrors();
65  void setXErrors(bool yes);
66 
67  bool throughSymbol(){return through;};
68  void drawThroughSymbol(bool yes){through=yes;};
69 
70  bool plusSide(){return plus;};
71  void drawPlusSide(bool yes){plus=yes;};
72 
73  bool minusSide(){return minus;};
74  void drawMinusSide(bool yes){minus=yes;};
75 
78  void setMasterCurve(DataCurve *c);
79 
82 
83  QStringList plotAssociation();
84 
85  bool updateData(Table *t, const QString& colName);
86  void loadData();
87 
88 private:
89  virtual void draw(QPainter *painter,const QwtScaleMap &xMap,
90  const QwtScaleMap &yMap, int from, int to) const;
91 
92  void drawErrorBars(QPainter *painter, const QwtScaleMap &xMap,
93  const QwtScaleMap &yMap, int from, int to) const;
94 
95  void init();
96 
98  QwtArray<double> err;
99 
101  int type;
102 
105 
107 
110 };
111 
112 #endif
void drawErrorBars(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
Definition: ErrorBarsCurve.cpp:96
Definition: ErrorBarsCurve.h:39
void setErrors(const QwtArray< double > &data)
Definition: ErrorBarsCurve.h:50
QStringList plotAssociation()
A list of data sources for this curve.
Definition: ErrorBarsCurve.cpp:344
bool plus
Definition: ErrorBarsCurve.h:106
DataCurve * masterCurve()
Returns the master curve to which this error bars curve is attached.
Definition: ErrorBarsCurve.h:77
bool xErrors()
Definition: ErrorBarsCurve.cpp:205
Definition: ErrorBarsCurve.h:39
Error bars curve.
Definition: ErrorBarsCurve.h:36
bool updateData(Table *t, const QString &colName)
Definition: ErrorBarsCurve.cpp:358
void setWidth(double w)
Definition: ErrorBarsCurve.cpp:222
void drawThroughSymbol(bool yes)
Definition: ErrorBarsCurve.h:68
void init()
Definition: ErrorBarsCurve.cpp:55
QwtArray< double > err
Stores the error bar values.
Definition: ErrorBarsCurve.h:98
void loadData()
Definition: ErrorBarsCurve.cpp:292
bool through
Definition: ErrorBarsCurve.h:106
double errorValue(int i)
Definition: ErrorBarsCurve.cpp:197
void setDirection(int o)
Definition: ErrorBarsCurve.h:62
ErrorBarsCurve(int orientation, Table *t, const QString &name)
Definition: ErrorBarsCurve.cpp:39
bool throughSymbol()
Definition: ErrorBarsCurve.h:67
bool minus
Definition: ErrorBarsCurve.h:106
void drawPlusSide(bool yes)
Definition: ErrorBarsCurve.h:71
void setColor(const QColor &c)
Definition: ErrorBarsCurve.cpp:229
int capLength()
Definition: ErrorBarsCurve.h:52
Orientation
Definition: ErrorBarsCurve.h:39
bool minusSide()
Definition: ErrorBarsCurve.h:73
Definition: PlotCurve.h:96
QColor color()
Definition: ErrorBarsCurve.h:58
void copy(const ErrorBarsCurve *e)
Definition: ErrorBarsCurve.cpp:65
QwtDoubleRect boundingRect() const
Definition: ErrorBarsCurve.cpp:236
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
Definition: ErrorBarsCurve.cpp:76
int type
Orientation of the bars: Horizontal or Vertical.
Definition: ErrorBarsCurve.h:101
int d_cap_length
Length of the bar cap decoration.
Definition: ErrorBarsCurve.h:104
void removeErrorBars(ErrorBarsCurve *c)
Remove a single error bars curve from the list of attached error bars.
Definition: PlotCurve.cpp:681
QwtArray< double > errors()
Definition: ErrorBarsCurve.h:49
DataCurve * d_master_curve
Reference to the master curve to which this error bars curve is attached.
Definition: ErrorBarsCurve.h:109
double width()
Definition: ErrorBarsCurve.h:55
MDI window providing a spreadsheet table with column logic.
Definition: Table.h:57
void setCapLength(int t)
Definition: ErrorBarsCurve.h:53
void setMasterCurve(DataCurve *c)
Definition: ErrorBarsCurve.cpp:278
int direction()
Definition: ErrorBarsCurve.h:61
int type()
Sort of rtti()
Definition: PlotCurve.h:48
void detachFromMasterCurve()
Causes the master curve to delete this curve from its managed error bars list.
Definition: ErrorBarsCurve.h:81
void setXErrors(bool yes)
Definition: ErrorBarsCurve.cpp:214
void drawMinusSide(bool yes)
Definition: ErrorBarsCurve.h:74
bool plusSide()
Definition: ErrorBarsCurve.h:70