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