Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Graph Class Reference

#include <Graph.h>

List of all members.

Public Member Functions

 Graph (QWidget *parent=0, const char *name=0)
 ~Graph (void)
void setTitle (const char *title)
void setDescriptions (const vector< const char * > &desc)
void setDisplayType (GraphDisplayType type)
void clear (void)
void setValues (const vector< vector< double > > &plots)
void addValue (const vector< double > &plotitem)
void setDisplaySize (unsigned int display_size)
unsigned int getDisplaySize (void) const
void setColor (const QColor &col)
void setColor (const vector< QColor > &colors)
void setMax (const double maximum)
void setMargins (unsigned int margin_bars=2, unsigned int margin_left=4, unsigned int margin_right=4, unsigned int margin_up=4, unsigned int margin_down=4)

Protected Member Functions

void paintEvent (QPaintEvent *ev)

Private Member Functions

void plotFunction (const vector< double > &plot, const QColor &col, const vector< const char * > &desc)
const QColor & selectColor (const unsigned int idx) const

Private Attributes

GraphDisplayType type
double max
vector< vector< double > > plots
vector< QColor > colors
vector< const char * > desc
const char * title
unsigned int display_size
QPainter * painter
unsigned int margin_left
unsigned int margin_right
unsigned int margin_down
unsigned int margin_up
unsigned int margin_bars


Detailed Description

Function plotting widget.

Shows a number of discrete input vectors as multiple function plots within one widget. Rather unflexible and trimmed for use within the neural network result GUI part. Function plots can plot only positive values, while Barchart and Waveform objects can plot negatives, too.


Constructor & Destructor Documentation

Graph::Graph QWidget *    parent = 0,
const char *    name = 0
 

Default QT-style constructor.

Parameters:
parent The QT parent widget.
name Optional name of the widget.

Graph::~Graph void   
 

Default destructor.


Member Function Documentation

void Graph::addValue const vector< double > &    plotitem
 

Add a plot item to the end of the current plot content.

Parameters:
plotitem A single plot item to be added.

void Graph::clear void   
 

Clear the plot data and associated colors.

unsigned int Graph::getDisplaySize void    const
 

Get the current amount to be plotted.

Note: Only applicable for Function type plots.

Returns:
Number of fixed items plotted.

void Graph::paintEvent QPaintEvent *    ev [protected]
 

QT paintEvent method, used to redraw the modified screen content.

Parameters:
ev Event.

void Graph::plotFunction const vector< double > &    plot,
const QColor &    col,
const vector< const char * > &    desc
[private]
 

Plot a single graph.

Parameters:
plot Plot data to display.
col Color to display plot with.
desc (Optional) description to be displayed with each value of the graph. Only used for Barchart and BarchartPositive type of graphs.

const QColor & Graph::selectColor const unsigned int    idx const [private]
 

Select the appropiate color.

Parameters:
idx The index of the graph that should be displayed.
Returns:
The color that was set for the graph.

void Graph::setColor const vector< QColor > &    colors
 

Setter for individual plot colors.

Parameters:
colors Vector of individual colors for each plot.

void Graph::setColor const QColor &    col
 

Setter for the default plot color.

Parameters:
col Default color to use in the chart.

void Graph::setDescriptions const vector< const char * > &    desc
 

Set the bar descriptions.

The placement and meaning of the descriptions are interpreted according to the graph type. For Waveform and Function type graphs the text is displayed at the right border, after each graph trail. The array of descriptions refers to one description per graph. For Barchart and BarchartPositive type of graphs however, the descriptions refer to single bars and will be displayed right under each bar.

Parameters:
desc Ordered description strings.

void Graph::setDisplaySize unsigned int    display_size
 

Set a fixed amount of values to plot.

Note: Only applicable for Function plots.

When more than display size items are given to plot, only the last display size items are shown, the first are discarded.

Parameters:
display_size Number of plot entries to display. Zero means automatic scaling.

void Graph::setDisplayType GraphDisplayType    type
 

Set the display type of the widget.

Parameters:
type The visualization type.

void Graph::setMargins unsigned int    margin_bars = 2,
unsigned int    margin_left = 4,
unsigned int    margin_right = 4,
unsigned int    margin_up = 4,
unsigned int    margin_down = 4
 

Set the margins to be used for the chart.

All margins are specified as pixels.

Parameters:
margin_bars The margin between individual bars within a Barchart type plot. For all other types, this is ignored.
margin_left Left border.
margin_right Right border.
margin_up Upper border.
margin_down Downward border.

void Graph::setMax const double    maximum [inline]
 

Setter for the maximum display value. For the Waveform display, the negative value is used as minimum.

Parameters:
maximum The maximal displayed value.

void Graph::setTitle const char *    title
 

Set the graph title.

Parameters:
title Title string.

void Graph::setValues const vector< vector< double > > &    plots
 

Setter for the function plot content.

Parameters:
plots Vector of (possibly negative) values. Note that all plots have to be of the same element count.


Member Data Documentation

vector<QColor> Graph::colors [private]
 

Respective color for each plot. When .size() is zero, the default color is used (black).

vector<const char *> Graph::desc [private]
 

Descriptions for individual bars, used only with Barchart and BarchartPositive type of graphs.

unsigned int Graph::display_size [private]
 

Amount of plot items to display (only used for Function plots) Zero means scale appropiatly.

unsigned int Graph::margin_bars [private]
 

Margin between individual bars (only Barchart types).

unsigned int Graph::margin_down [private]
 

Margin to the downward widget border.

unsigned int Graph::margin_left [private]
 

Margin to the left widget border.

unsigned int Graph::margin_right [private]
 

Margin to the right widget border.

unsigned int Graph::margin_up [private]
 

Margin to the upward widget border.

double Graph::max [private]
 

The maximum displayable value. Used for all three chart types.

QPainter* Graph::painter [private]
 

The QT painter needed to (re-) draw the canvas. Initialized once upon object construction and used from there.

vector<vector <double> > Graph::plots [private]
 

The values to be displayed. Can be negative when negative is true.

const char* Graph::title [private]
 

The overall plot title. Once set through the constructor.

GraphDisplayType Graph::type [private]
 

Type of display used to visualize data.


The documentation for this class was generated from the following files:
Generated on Mon Feb 24 19:37:44 2003 by doxygen1.3-rc3