Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

OmgGraph Class Reference
[Library]

#include <omggraph.h>

Collaboration diagram for OmgGraph:

Collaboration graph
[legend]
List of all members.

Detailed Description

A utility class for creating graphs.

Author:
Tim Sutton

Definition at line 32 of file omggraph.h.

Public Member Functions

 OmgGraph (QPainter *thepPainter)
virtual ~OmgGraph ()
void render ()
void addSeries (OmgDataSeries)
bool removeSeriesAt (int theSeriesNo)
int seriesCount () const
void clear (QColor theColour=Qt::white)
void setAxisFont (QFont theFont)
void setLegendFont (QFont theFont)
void setVertexLabelFont (QFont theFont)
void setGridLinesEnabled (bool theFlag=true)
bool hasGridLinesEnabled ()
void setVerticesEnabled (bool theFlag=true)
bool hasVerticesEnabled ()
void setVertexLabelsEnabled (bool theFlag=true)
bool hasVertexLabelsEnabled ()
void setDiagonalEnabled (bool theFlag=true)
bool hasDiagonalEnabled ()
void setSpliningEnabled (bool theFlag=true)
bool hasSpliningEnabled ()
void setAreaFillEnabled (bool theFlag=true)
bool hasAreaFillEnabled ()

Private Member Functions

 OmgGraph ()
void drawHighlight (QPointF theTopLeftPoint, QPointF theBottomRightPoint)
void initialise ()
QLinearGradient greenGradient ()
QLinearGradient redGradient ()
QLinearGradient blueGradient ()
QLinearGradient grayGradient ()
QLinearGradient customGradient (QColor theColour)
QLinearGradient randomGradient ()
QLinearGradient highlightGradient ()
void drawAxes ()
void drawDiagonal ()
void makeLegend ()
void calculateGutters ()
void calculateLegendHeight ()

Private Attributes

qreal mGradientHeight
qreal mGradientWidth
QPainter * mpPainter
QList< OmgDataSeriesmSeriesList
int mImageHeight
int mImageWidth
int mGraphImageWidth
int mGraphImageHeight
float mXAxisMin
float mXAxisMax
int mXGutterWidth
int mXGutterHeight
int mLegendHeight
float mYAxisMin
float mYAxisMax
int mYGutterWidth
int mYGutterHeight
QFont mAxisFont
QFont mLegendFont
QFont mVertexLabelFont
bool mGridLinesFlag
bool mShowVerticesFlag
bool mDrawDiagonal
bool mShowVertexLabelsFlag
bool mSplinePointsFlag
bool mAreaFillFlag


Constructor & Destructor Documentation

OmgGraph::OmgGraph QPainter *  thepPainter  ) 
 

Constructor .

Definition at line 28 of file omggraph.cpp.

References initialise(), and mpPainter.

Here is the call graph for this function:

OmgGraph::~OmgGraph  )  [virtual]
 

Desctructor .

Definition at line 37 of file omggraph.cpp.

OmgGraph::OmgGraph  )  [private]
 

Definition at line 34 of file omggraph.cpp.


Member Function Documentation

void OmgGraph::addSeries OmgDataSeries   ) 
 

Used to add a new series to the chart

Definition at line 134 of file omggraph.cpp.

References mSeriesList.

Referenced by OmgModel::createRocGraph(), OmgExperiment::summaryMapToGraph(), OmgGraphTest::testRemoveSeries(), OmgGraphTest::testRenderGraph(), and OmgModel::toHtml().

QLinearGradient OmgGraph::blueGradient  )  [private]
 

Definition at line 479 of file omggraph.cpp.

References mGradientHeight, and mGradientWidth.

void OmgGraph::calculateGutters  )  [private]
 

Definition at line 601 of file omggraph.cpp.

References mXAxisMax, mXAxisMin, mXGutterHeight, mXGutterWidth, mYAxisMax, and mYGutterWidth.

Referenced by render().

void OmgGraph::calculateLegendHeight  )  [private]
 

Definition at line 701 of file omggraph.cpp.

References OmgDataSeries::label(), mImageWidth, mLegendFont, mLegendHeight, and mSeriesList.

Referenced by render().

Here is the call graph for this function:

void OmgGraph::clear QColor  theColour = Qt::white  ) 
 

Clear the graph by painting onto it with a solid colour

Parameters:
theColour - a colour to use to fill / clear the drawing area.

Definition at line 129 of file omggraph.cpp.

References mImageHeight, mImageWidth, and mpPainter.

Referenced by OmgExperiment::summaryMapToGraph(), and OmgGraphTest::testRenderGraph().

QLinearGradient OmgGraph::customGradient QColor  theColour  )  [private]
 

Definition at line 507 of file omggraph.cpp.

References mGradientHeight, and mGradientWidth.

Referenced by render().

void OmgGraph::drawAxes  )  [private]
 

Definition at line 531 of file omggraph.cpp.

References mAxisFont, mGraphImageHeight, mGraphImageWidth, mGridLinesFlag, mImageHeight, mImageWidth, mLegendHeight, mpPainter, mXAxisMax, mXAxisMin, mXGutterHeight, mXGutterWidth, mYAxisMax, mYAxisMin, and mYGutterWidth.

Referenced by render().

void OmgGraph::drawDiagonal  )  [private]
 

Definition at line 593 of file omggraph.cpp.

References mImageHeight, mImageWidth, mLegendHeight, mpPainter, mXGutterHeight, and mYGutterWidth.

Referenced by render().

void OmgGraph::drawHighlight QPointF  theTopLeftPoint,
QPointF  theBottomRightPoint
[private]
 

Draw a highlight.

Parameters:
QPointF for the top left corner of the highlight.
QPointF for the bottom right corner of the highlight.

Definition at line 754 of file omggraph.cpp.

References mpPainter.

QLinearGradient OmgGraph::grayGradient  )  [private]
 

Definition at line 488 of file omggraph.cpp.

References mGradientHeight, and mGradientWidth.

QLinearGradient OmgGraph::greenGradient  )  [private]
 

Definition at line 470 of file omggraph.cpp.

References mGradientHeight, and mGradientWidth.

bool OmgGraph::hasAreaFillEnabled  ) 
 

Whether to fill areas under the graph

Definition at line 124 of file omggraph.cpp.

References mAreaFillFlag.

bool OmgGraph::hasDiagonalEnabled  ) 
 

Whether to render a BR to TL diagonal onto the graph

Definition at line 91 of file omggraph.cpp.

References mDrawDiagonal.

bool OmgGraph::hasGridLinesEnabled  ) 
 

Whether to render the vertices onto the graph

Definition at line 82 of file omggraph.cpp.

References mGridLinesFlag.

bool OmgGraph::hasSpliningEnabled  ) 
 

Whether to try to make the line into a spline curve

Definition at line 116 of file omggraph.cpp.

References mSplinePointsFlag.

bool OmgGraph::hasVertexLabelsEnabled  ) 
 

Whether to render the vertex labels onto the graph

Definition at line 108 of file omggraph.cpp.

References mShowVertexLabelsFlag.

bool OmgGraph::hasVerticesEnabled  ) 
 

Whether to render the vertices onto the graph

Definition at line 100 of file omggraph.cpp.

References mShowVerticesFlag.

QLinearGradient OmgGraph::highlightGradient  )  [private]
 

Definition at line 521 of file omggraph.cpp.

References mGradientHeight, and mGradientWidth.

void OmgGraph::initialise  )  [private]
 

Definition at line 41 of file omggraph.cpp.

References mAreaFillFlag, mAxisFont, mDrawDiagonal, mGradientHeight, mGradientWidth, mGridLinesFlag, mImageHeight, mImageWidth, mLegendFont, mLegendHeight, mpPainter, mShowVertexLabelsFlag, mShowVerticesFlag, mSplinePointsFlag, mVertexLabelFont, mXAxisMax, mXAxisMin, mXGutterWidth, mYAxisMax, mYAxisMin, and mYGutterWidth.

Referenced by OmgGraph().

void OmgGraph::makeLegend  )  [private]
 

Definition at line 628 of file omggraph.cpp.

References OmgDataSeries::fillColor(), OmgDataSeries::label(), OmgDataSeries::lineColor(), mImageHeight, mImageWidth, mLegendFont, mLegendHeight, mpPainter, and mSeriesList.

Referenced by render().

Here is the call graph for this function:

QLinearGradient OmgGraph::randomGradient  )  [private]
 

Definition at line 497 of file omggraph.cpp.

References mGradientHeight, mGradientWidth, and Omgui::randomColour().

Here is the call graph for this function:

QLinearGradient OmgGraph::redGradient  )  [private]
 

Definition at line 461 of file omggraph.cpp.

References mGradientHeight, and mGradientWidth.

bool OmgGraph::removeSeriesAt int  theSeriesNo  ) 
 

Used to remove a series from the chart

Parameters:
theSeriesNo - the number in the series to remove where the first is 0. Note that if you have 3 series, and you remove the 1st, 2 will become 1, 3 become 2 and so on.
Returns:
true if removal was successful otherwise false if it failed.

Definition at line 138 of file omggraph.cpp.

References mSeriesList.

Referenced by OmgGraphTest::testRemoveSeries(), and OmgGraphTest::testRenderGraph().

void OmgGraph::render  ) 
 

Get the graph as a pixmap

Definition at line 155 of file omggraph.cpp.

References calculateGutters(), calculateLegendHeight(), customGradient(), drawAxes(), drawDiagonal(), OmgDataSeries::fillColor(), OmgDataSeries::lineColor(), makeLegend(), mAreaFillFlag, mDrawDiagonal, mGraphImageHeight, mGraphImageWidth, mImageHeight, mImageWidth, mLegendHeight, mpPainter, mSeriesList, mShowVertexLabelsFlag, mShowVerticesFlag, mSplinePointsFlag, mVertexLabelFont, mXAxisMax, mXAxisMin, mXGutterHeight, mYAxisMax, mYAxisMin, mYGutterWidth, OmgDataSeries::size(), OmgDataSeries::xAt(), OmgDataSeries::xMax(), OmgDataSeries::xMin(), OmgDataSeries::yAt(), OmgDataSeries::yMax(), and OmgDataSeries::yMin().

Referenced by OmgModel::createRocGraph(), OmgExperiment::summaryMapToGraph(), OmgGraphTest::testRenderGraph(), and OmgModel::toHtml().

Here is the call graph for this function:

int OmgGraph::seriesCount  )  const
 

Get the number of series in this graph

Definition at line 150 of file omggraph.cpp.

References mSeriesList.

Referenced by OmgGraphTest::testRemoveSeries().

void OmgGraph::setAreaFillEnabled bool  theFlag = true  ) 
 

Set whether to fill areas under the graph

Definition at line 120 of file omggraph.cpp.

References mAreaFillFlag.

Referenced by OmgModel::createRocGraph(), OmgExperiment::summaryMapToGraph(), OmgGraphTest::testRenderGraph(), and OmgModel::toHtml().

void OmgGraph::setAxisFont QFont  theFont  ) 
 

Set the font for axis scale

Definition at line 66 of file omggraph.cpp.

References mAxisFont.

void OmgGraph::setDiagonalEnabled bool  theFlag = true  ) 
 

Set whether to render a BR to TL diagonal onto the graph

Definition at line 87 of file omggraph.cpp.

References mDrawDiagonal.

Referenced by OmgModel::createRocGraph().

void OmgGraph::setGridLinesEnabled bool  theFlag = true  ) 
 

Set whether to render the vertices onto the graph

Definition at line 78 of file omggraph.cpp.

References mGridLinesFlag.

Referenced by OmgModel::createRocGraph(), OmgExperiment::summaryMapToGraph(), OmgGraphTest::testRenderGraph(), and OmgModel::toHtml().

void OmgGraph::setLegendFont QFont  theFont  ) 
 

Set the font for the legend

Definition at line 70 of file omggraph.cpp.

References mLegendFont.

void OmgGraph::setSpliningEnabled bool  theFlag = true  ) 
 

Set whether to try to make the line into a spline curve

Definition at line 112 of file omggraph.cpp.

References mSplinePointsFlag.

Referenced by OmgModel::createRocGraph(), OmgGraphTest::testRenderGraph(), and OmgModel::toHtml().

void OmgGraph::setVertexLabelFont QFont  theFont  ) 
 

Set the font for the vertex labels

Definition at line 74 of file omggraph.cpp.

References mVertexLabelFont.

void OmgGraph::setVertexLabelsEnabled bool  theFlag = true  ) 
 

Set whether to render the vertex labels onto the graph

Definition at line 104 of file omggraph.cpp.

References mShowVertexLabelsFlag.

Referenced by OmgModel::createRocGraph(), OmgExperiment::summaryMapToGraph(), OmgGraphTest::testRenderGraph(), and OmgModel::toHtml().

void OmgGraph::setVerticesEnabled bool  theFlag = true  ) 
 

Set whether to render the vertices onto the graph

Definition at line 96 of file omggraph.cpp.

References mShowVerticesFlag.

Referenced by OmgModel::createRocGraph(), OmgGraphTest::testRenderGraph(), and OmgModel::toHtml().


Member Data Documentation

bool OmgGraph::mAreaFillFlag [private]
 

Whether to fill areas under the graph

Definition at line 166 of file omggraph.h.

Referenced by hasAreaFillEnabled(), initialise(), render(), and setAreaFillEnabled().

QFont OmgGraph::mAxisFont [private]
 

Definition at line 150 of file omggraph.h.

Referenced by drawAxes(), initialise(), and setAxisFont().

bool OmgGraph::mDrawDiagonal [private]
 

whether to render a diagonal from bl to tr on the graph

Definition at line 160 of file omggraph.h.

Referenced by hasDiagonalEnabled(), initialise(), render(), and setDiagonalEnabled().

qreal OmgGraph::mGradientHeight [private]
 

Definition at line 117 of file omggraph.h.

Referenced by blueGradient(), customGradient(), grayGradient(), greenGradient(), highlightGradient(), initialise(), randomGradient(), and redGradient().

qreal OmgGraph::mGradientWidth [private]
 

Definition at line 118 of file omggraph.h.

Referenced by blueGradient(), customGradient(), grayGradient(), greenGradient(), highlightGradient(), initialise(), randomGradient(), and redGradient().

int OmgGraph::mGraphImageHeight [private]
 

Definition at line 137 of file omggraph.h.

Referenced by drawAxes(), and render().

int OmgGraph::mGraphImageWidth [private]
 

Definition at line 136 of file omggraph.h.

Referenced by drawAxes(), and render().

bool OmgGraph::mGridLinesFlag [private]
 

whether to render the vertices onto the graph

Definition at line 156 of file omggraph.h.

Referenced by drawAxes(), hasGridLinesEnabled(), initialise(), and setGridLinesEnabled().

int OmgGraph::mImageHeight [private]
 

Definition at line 133 of file omggraph.h.

Referenced by clear(), drawAxes(), drawDiagonal(), initialise(), makeLegend(), and render().

int OmgGraph::mImageWidth [private]
 

Definition at line 134 of file omggraph.h.

Referenced by calculateLegendHeight(), clear(), drawAxes(), drawDiagonal(), initialise(), makeLegend(), and render().

QFont OmgGraph::mLegendFont [private]
 

Definition at line 151 of file omggraph.h.

Referenced by calculateLegendHeight(), initialise(), makeLegend(), and setLegendFont().

int OmgGraph::mLegendHeight [private]
 

Definition at line 143 of file omggraph.h.

Referenced by calculateLegendHeight(), drawAxes(), drawDiagonal(), initialise(), makeLegend(), and render().

QPainter* OmgGraph::mpPainter [private]
 

Definition at line 130 of file omggraph.h.

Referenced by clear(), drawAxes(), drawDiagonal(), drawHighlight(), initialise(), makeLegend(), OmgGraph(), and render().

QList<OmgDataSeries> OmgGraph::mSeriesList [private]
 

Definition at line 131 of file omggraph.h.

Referenced by addSeries(), calculateLegendHeight(), makeLegend(), removeSeriesAt(), render(), and seriesCount().

bool OmgGraph::mShowVertexLabelsFlag [private]
 

whether to render the vertex labels onto the graph

Definition at line 162 of file omggraph.h.

Referenced by hasVertexLabelsEnabled(), initialise(), render(), and setVertexLabelsEnabled().

bool OmgGraph::mShowVerticesFlag [private]
 

whether to render the vertices onto the graph

Definition at line 158 of file omggraph.h.

Referenced by hasVerticesEnabled(), initialise(), render(), and setVerticesEnabled().

bool OmgGraph::mSplinePointsFlag [private]
 

whether to try to make the line into a spline curve

Definition at line 164 of file omggraph.h.

Referenced by hasSpliningEnabled(), initialise(), render(), and setSpliningEnabled().

QFont OmgGraph::mVertexLabelFont [private]
 

Definition at line 152 of file omggraph.h.

Referenced by initialise(), render(), and setVertexLabelFont().

float OmgGraph::mXAxisMax [private]
 

Definition at line 140 of file omggraph.h.

Referenced by calculateGutters(), drawAxes(), initialise(), and render().

float OmgGraph::mXAxisMin [private]
 

Definition at line 139 of file omggraph.h.

Referenced by calculateGutters(), drawAxes(), initialise(), and render().

int OmgGraph::mXGutterHeight [private]
 

Definition at line 142 of file omggraph.h.

Referenced by calculateGutters(), drawAxes(), drawDiagonal(), and render().

int OmgGraph::mXGutterWidth [private]
 

Definition at line 141 of file omggraph.h.

Referenced by calculateGutters(), drawAxes(), and initialise().

float OmgGraph::mYAxisMax [private]
 

Definition at line 146 of file omggraph.h.

Referenced by calculateGutters(), drawAxes(), initialise(), and render().

float OmgGraph::mYAxisMin [private]
 

Definition at line 145 of file omggraph.h.

Referenced by drawAxes(), initialise(), and render().

int OmgGraph::mYGutterHeight [private]
 

Definition at line 148 of file omggraph.h.

int OmgGraph::mYGutterWidth [private]
 

Definition at line 147 of file omggraph.h.

Referenced by calculateGutters(), drawAxes(), drawDiagonal(), initialise(), and render().


The documentation for this class was generated from the following files:
Generated on Mon Apr 28 15:13:11 2008 for openModellerDesktop by  doxygen 1.4.1-20050210