BoxCurve.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef BOXCURVE_H
00030 #define BOXCURVE_H
00031
00032 #include "PlotCurve.h"
00033 #include <qwt_plot.h>
00034 #include <qwt_symbol.h>
00035
00037 class BoxCurve: public DataCurve
00038 {
00039 public:
00040 enum BoxStyle{NoBox, Rect, Diamond, WindBox, Notch};
00041 enum Range{None, SD, SE, r25_75, r10_90, r5_95, r1_99, MinMax, UserDef};
00042
00043 BoxCurve(Table *t, const QString& name, int startRow = 0, int endRow = -1);
00044
00045 void copy(const BoxCurve *b);
00046
00047 virtual QwtDoubleRect boundingRect() const;
00048
00049 QwtSymbol::Style minStyle(){return min_style;};
00050 void setMinStyle(QwtSymbol::Style s){min_style = s;};
00051
00052 QwtSymbol::Style maxStyle(){return max_style;};
00053 void setMaxStyle(QwtSymbol::Style s){max_style = s;};
00054
00055 void setMeanStyle(QwtSymbol::Style s){mean_style = s;};
00056 QwtSymbol::Style meanStyle(){return mean_style;};
00057
00058 void setP99Style(QwtSymbol::Style s){p99_style = s;};
00059 QwtSymbol::Style p99Style(){return p99_style;};
00060
00061 void setP1Style(QwtSymbol::Style s){p1_style = s;};
00062 QwtSymbol::Style p1Style(){return p1_style;};
00063
00064 int boxStyle(){return b_style;};
00065 void setBoxStyle(int style);
00066
00067 int boxWidth(){return b_width;};
00068 void setBoxWidth(int width){b_width=width;};
00069
00070 double boxRange(){return b_coeff;};
00071 int boxRangeType(){return b_range;};
00072 void setBoxRange(int type, double coeff);
00073
00074 double whiskersRange(){return w_coeff;};
00075 int whiskersRangeType(){return w_range;};
00076 void setWhiskersRange(int type, double coeff);
00077
00078 void loadData();
00079
00080 private:
00081 void draw(QPainter *painter,const QwtScaleMap &xMap,
00082 const QwtScaleMap &yMap, int from, int to) const;
00083 void drawBox(QPainter *painter, const QwtScaleMap &xMap,
00084 const QwtScaleMap &yMap, double *dat, int size) const;
00085 void drawSymbols(QPainter *painter, const QwtScaleMap &xMap,
00086 const QwtScaleMap &yMap, double *dat, int size) const;
00087
00088 QwtSymbol::Style min_style, max_style, mean_style, p99_style, p1_style;
00089 double b_coeff, w_coeff;
00090 int b_style, b_width, b_range, w_range;
00091 };
00092
00093
00095 class QwtSingleArrayData: public QwtData
00096 {
00097 public:
00098 QwtSingleArrayData(const double x, QwtArray<double> y, size_t)
00099 {
00100 d_y = y;
00101 d_x = x;
00102 };
00103
00104 virtual QwtData *copy() const{return new QwtSingleArrayData(d_x, d_y, size());};
00105
00106 virtual size_t size() const{return d_y.size();};
00107 virtual double x(size_t) const{return d_x;};
00108 virtual double y(size_t i) const{return d_y[int(i)];};
00109
00110 private:
00111 QwtArray<double> d_y;
00112 double d_x;
00113 };
00114
00115 #endif