00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef OMGGRAPH_H
00019 #define OMGGRAPH_H
00020 #include "omgdataseries.h"
00021
00022 #include <QString>
00023 #include <QPainter>
00024 #include <QLinearGradient>
00025 #include <QList>
00026 #include <QColor>
00032 class OMG_LIB_EXPORT OmgGraph
00033 {
00034 public:
00036 OmgGraph(QPainter * thepPainter);
00038 virtual ~OmgGraph();
00040 void render( );
00042 void addSeries(OmgDataSeries);
00051 bool removeSeriesAt(int theSeriesNo);
00053 int seriesCount() const;
00058 void clear(QColor theColour=Qt::white);
00059
00060
00061
00062
00064 void setAxisFont(QFont theFont);
00066 void setLegendFont(QFont theFont);
00068 void setVertexLabelFont(QFont theFont);
00069
00071 void setGridLinesEnabled(bool theFlag=true);
00073 bool hasGridLinesEnabled();
00074
00076 void setVerticesEnabled(bool theFlag=true);
00078 bool hasVerticesEnabled();
00079
00081 void setVertexLabelsEnabled(bool theFlag=true);
00083 bool hasVertexLabelsEnabled();
00084
00086 void setDiagonalEnabled(bool theFlag=true);
00088 bool hasDiagonalEnabled();
00089
00091 void setSpliningEnabled(bool theFlag=true);
00093 bool hasSpliningEnabled();
00094
00096 void setAreaFillEnabled(bool theFlag=true);
00098 bool hasAreaFillEnabled();
00099 private:
00100
00101 OmgGraph();
00106 void drawHighlight( QPointF theTopLeftPoint, QPointF theBottomRightPoint );
00107
00108 void initialise();
00109 QLinearGradient greenGradient();
00110 QLinearGradient redGradient();
00111 QLinearGradient blueGradient();
00112 QLinearGradient grayGradient();
00113 QLinearGradient customGradient(QColor theColour);
00114 QLinearGradient randomGradient();
00115 QLinearGradient highlightGradient();
00116
00117 qreal mGradientHeight;
00118 qreal mGradientWidth;
00119
00120 void drawAxes();
00121 void drawDiagonal();
00122 void makeLegend();
00123 void calculateGutters();
00124 void calculateLegendHeight();
00125
00126
00127
00128
00129
00130 QPainter * mpPainter;
00131 QList <OmgDataSeries> mSeriesList;
00132
00133 int mImageHeight;
00134 int mImageWidth;
00135
00136 int mGraphImageWidth;
00137 int mGraphImageHeight;
00138
00139 float mXAxisMin;
00140 float mXAxisMax;
00141 int mXGutterWidth;
00142 int mXGutterHeight;
00143 int mLegendHeight;
00144
00145 float mYAxisMin;
00146 float mYAxisMax;
00147 int mYGutterWidth;
00148 int mYGutterHeight;
00149
00150 QFont mAxisFont;
00151 QFont mLegendFont;
00152 QFont mVertexLabelFont;
00153
00154
00156 bool mGridLinesFlag;
00158 bool mShowVerticesFlag;
00160 bool mDrawDiagonal;
00162 bool mShowVertexLabelsFlag;
00164 bool mSplinePointsFlag;
00166 bool mAreaFillFlag;
00167 };
00168
00169 #endif //OMGGRAPH_H
00170