KiviatView Class Reference

Generic Qt-Widget for displaying Kiviats (polar diagrams). More...

#include <KiviatView.h>

Inheritance diagram for KiviatView:

Inheritance graph
[legend]
List of all members.

Public Slots

void setMarkerCount (int newMarkerCount)
void setInactiveAlpha (int newVal)
void setActiveAlpha (int newVal)
void setCornerPointRadius (int newVal)
void setAngleOffset (int newVal)
void setDataColor (int dataHandle, const QColor &color)
void setAxisLabel (int axisNr, const QString &name)
 Change/Set the Label of given axis.
void setActiveItem (int dataHandle)
 Sets the Item which is displayed in the foreground (i.e. the "selected").
void setGradientBackground (bool on=true)
void clear ()
void setAxisCount (int newAxisCount)
 Set axis count.
void removeAxis (int axisID)

Signals

void clickedOnData (int dataId)
void cleared ()

Public Member Functions

 KiviatView (QWidget *parent=NULL, int axisCount=8)
 needed because of calcPosition
virtual ~KiviatView ()
int addData (const QVector< float > &data, QColor color=Qt::blue)
int addData (const QVector< int > &data, int valueToNormalize, QColor color=Qt::blue)
void removeData (int dataHandle)
void setDataPoint (int dataHandle, int axisNr, float newValue)
float getDataPoint (int dataHandle, int axisNr)
QColor getDataColor (int dataHandle)
const QVector< float > & getData (int dataHandle)
int getAxisCount () const
 Returns the axis count.
int getDataCount () const
void setToolTip (int dataHandle, int axisNr, const QString &string)
int cornerPointRadius () const
int markerCount () const
int inactiveAlpha () const
int activeAlpha () const
int angleOffset () const
bool hasGradientBackground () const

Protected Member Functions

void redrawAll ()
void redrawData ()
void setupAxesCaptions ()
virtual void resizeEvent (QResizeEvent *ev)
 Overwritten Resize Event, used for scaling of scene.
virtual void mousePressEvent (QMouseEvent *ev)
QGraphicsPolygonItem * addMarker (float position)
QPointF calcPosition (int axisNr, float normedDistance) const

Protected Attributes

int curDataItem
 Index of active data-item, or -1 if none is active.
int axisCount
 Number of Axis.
int prop_markerCount
int prop_activeAlpha
int prop_inactiveAlpha
int prop_cornerPointRadius
 Radius of the cornerPoints (dots on intersection of axis and polygon.
int prop_angleOffset
 Angle Offset (rotates the diagram) (set between 0 and 360).
QFont labelFont
QVector< KiviatData * > dataset
 KiviatData manages the storing and drawing of the data.
QGraphicsScene scene
QVector< QGraphicsTextItem * > axisLabels
QVector< QGraphicsLineItem * > axes
QVector< QGraphicsPolygonItem * > markers

Static Protected Attributes

static const int AXIS_LENGTH = 300
 Axis Length in pixel.

Properties

int AxisCount []
int MarkerCount []
int ActiveAlpha []
int InactiveAlpha []
int CornerPointRadius []
int AngleOffset []
bool GradientBackground []

Friends

class KiviatData

Classes

class  KiviatData

Detailed Description

Generic Qt-Widget for displaying Kiviats (polar diagrams).

KiviatTester.jpg

This class doesn't depend on rose, the rose specific version for displaying MetricAttributes is MetricsKiviat

Definition at line 22 of file KiviatView.h.


Constructor & Destructor Documentation

KiviatView::KiviatView ( QWidget *  parent = NULL,
int  axisCount = 8 
)

needed because of calcPosition

Definition at line 183 of file KiviatView.cpp.

Here is the call graph for this function:

virtual KiviatView::~KiviatView (  )  [inline, virtual]

Definition at line 42 of file KiviatView.h.


Member Function Documentation

int KiviatView::activeAlpha (  )  const [inline]

Definition at line 93 of file KiviatView.h.

Referenced by KiviatView::KiviatData::setActive().

Here is the caller graph for this function:

int KiviatView::addData ( const QVector< int > &  data,
int  valueToNormalize,
QColor  color = Qt::blue 
)

Adds Data from an integer-vector,

Parameters:
data Float Data (between 0 and 1), size of vector has to be axisCount std::vectors can be converted with QVector::fromStdVector()
valueToNormalize the value which represents 100% data is calulated as data[i]/valueToNormalize
color color for displaying this dataset (to distinguish datasets, if more than one are displayed in one single kiviat)
Returns:
handle to modify or delete data

Definition at line 408 of file KiviatView.cpp.

Here is the call graph for this function:

int KiviatView::addData ( const QVector< float > &  data,
QColor  color = Qt::blue 
)

Adds a dataset to the diagram

Parameters:
data Float Data (between 0 and 1), size of vector has to be axisCount std::vectors can be converted with QVector::fromStdVector()
color color for displaying this dataset (to distinguish datasets, if more than one are displayed in one single kiviat)
Returns:
handle to modify or delete data

Definition at line 395 of file KiviatView.cpp.

Referenced by addData(), MetricsKiviat::addNode(), and MetricsKiviat::init().

Here is the caller graph for this function:

QGraphicsPolygonItem * KiviatView::addMarker ( float  position  )  [protected]

Adds Marking ( lines with equal -values)

Parameters:
position Value between 0 and 1 (where to draw the marking)

Definition at line 255 of file KiviatView.cpp.

Referenced by setMarkerCount().

Here is the call graph for this function:

int KiviatView::angleOffset (  )  const [inline]

Definition at line 94 of file KiviatView.h.

QPointF KiviatView::calcPosition ( int  axisNr,
float  normedDistance 
) const [protected]

Calculates the Cartesian coordinates, of a point on axis with given nr

Parameters:
axisNr 
normedDistance 0 means center of diagram, 1 end of the axis line

Definition at line 449 of file KiviatView.cpp.

Referenced by addMarker(), KiviatView::KiviatData::changeDataPoint(), KiviatView::KiviatData::redraw(), redrawAll(), and setAxisLabel().

Here is the caller graph for this function:

void KiviatView::clear (  )  [slot]

Definition at line 354 of file KiviatView.cpp.

void KiviatView::cleared (  )  [signal]

Referenced by clear().

void KiviatView::clickedOnData ( int  dataId  )  [signal]

Referenced by MetricsKiviat::MetricsKiviat(), and mousePressEvent().

int KiviatView::cornerPointRadius (  )  const [inline]

Definition at line 90 of file KiviatView.h.

Referenced by KiviatView::KiviatData::changeDataPoint(), and KiviatView::KiviatData::redraw().

Here is the caller graph for this function:

int KiviatView::getAxisCount (  )  const [inline]

Returns the axis count.

Definition at line 81 of file KiviatView.h.

Referenced by KiviatView::KiviatData::redraw().

Here is the caller graph for this function:

const QVector< float > & KiviatView::getData ( int  dataHandle  ) 

Definition at line 488 of file KiviatView.cpp.

Referenced by KiviatInfo::update().

QColor KiviatView::getDataColor ( int  dataHandle  ) 

Definition at line 427 of file KiviatView.cpp.

Referenced by KiviatInfo::changeColor(), and MetricsKiviat::drawData().

Here is the caller graph for this function:

int KiviatView::getDataCount (  )  const [inline]

Returns number of dataSETS, whereas each dataSet contains axisCount entries

Definition at line 84 of file KiviatView.h.

float KiviatView::getDataPoint ( int  dataHandle,
int  axisNr 
) [inline]

Definition at line 74 of file KiviatView.h.

bool KiviatView::hasGradientBackground (  )  const [inline]

Definition at line 95 of file KiviatView.h.

int KiviatView::inactiveAlpha (  )  const [inline]

Definition at line 92 of file KiviatView.h.

Referenced by KiviatView::KiviatData::setActive().

Here is the caller graph for this function:

int KiviatView::markerCount (  )  const [inline]

Definition at line 91 of file KiviatView.h.

void KiviatView::mousePressEvent ( QMouseEvent *  ev  )  [protected, virtual]

Used for selecting active dataset, and generating signal clicked_onData

Reimplemented in MetricsKiviat.

Definition at line 376 of file KiviatView.cpp.

Referenced by MetricsKiviat::mousePressEvent().

Here is the caller graph for this function:

void KiviatView::redrawAll (  )  [protected]

Definition at line 287 of file KiviatView.cpp.

Referenced by KiviatView(), removeAxis(), and setAxisCount().

Here is the call graph for this function:

Here is the caller graph for this function:

void KiviatView::redrawData (  )  [protected]

Definition at line 210 of file KiviatView.cpp.

Referenced by redrawAll(), and setDataColor().

Here is the caller graph for this function:

void KiviatView::removeAxis ( int  axisID  )  [slot]

Definition at line 338 of file KiviatView.cpp.

void KiviatView::removeData ( int  dataHandle  ) 

Removes dataset with given handle

Definition at line 219 of file KiviatView.cpp.

Referenced by MetricsKiviat::delNode().

void KiviatView::resizeEvent ( QResizeEvent *  ev  )  [protected, virtual]

Overwritten Resize Event, used for scaling of scene.

Reimplemented in MetricsKiviat.

Definition at line 365 of file KiviatView.cpp.

Referenced by MetricsKiviat::resizeEvent().

Here is the caller graph for this function:

void KiviatView::setActiveAlpha ( int  newVal  )  [inline, slot]

Definition at line 102 of file KiviatView.h.

void KiviatView::setActiveItem ( int  dataHandle  )  [slot]

Sets the Item which is displayed in the foreground (i.e. the "selected").

Definition at line 494 of file KiviatView.cpp.

Referenced by addData(), MetricsKiviat::drawData(), and MetricsKiviat::MetricsKiviat().

void KiviatView::setAngleOffset ( int  newVal  )  [inline, slot]

Definition at line 104 of file KiviatView.h.

void KiviatView::setAxisCount ( int  newAxisCount  )  [slot]

Set axis count.

Definition at line 323 of file KiviatView.cpp.

Referenced by MetricsKiviat::configureMetrics(), and MetricsKiviat::init().

void KiviatView::setAxisLabel ( int  axisNr,
const QString &  name 
) [slot]

Change/Set the Label of given axis.

Definition at line 432 of file KiviatView.cpp.

Referenced by MetricsKiviat::configureMetrics().

void KiviatView::setCornerPointRadius ( int  newVal  )  [inline, slot]

Definition at line 103 of file KiviatView.h.

void KiviatView::setDataColor ( int  dataHandle,
const QColor &  color 
) [slot]

Definition at line 419 of file KiviatView.cpp.

Referenced by MetricsKiviat::addNode(), KiviatInfo::changeColor(), and MetricsKiviat::drawData().

void KiviatView::setDataPoint ( int  dataHandle,
int  axisNr,
float  newValue 
)

Modifies a single entry in already existing data

Definition at line 231 of file KiviatView.cpp.

Referenced by MetricsKiviat::drawData().

Here is the caller graph for this function:

void KiviatView::setGradientBackground ( bool  on = true  )  [slot]

Turns the gradient background on and off color gradient from green (center) over yellow to red (on outside)

Definition at line 462 of file KiviatView.cpp.

void KiviatView::setInactiveAlpha ( int  newVal  )  [inline, slot]

Definition at line 101 of file KiviatView.h.

void KiviatView::setMarkerCount ( int  newMarkerCount  )  [slot]

Definition at line 238 of file KiviatView.cpp.

Referenced by redrawAll().

void KiviatView::setToolTip ( int  dataHandle,
int  axisNr,
const QString &  string 
)

Definition at line 511 of file KiviatView.cpp.

Referenced by MetricsKiviat::drawData().

Here is the caller graph for this function:

void KiviatView::setupAxesCaptions (  )  [protected]

Definition at line 268 of file KiviatView.cpp.

Referenced by redrawAll().

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class KiviatData [friend]

Definition at line 35 of file KiviatView.h.

Referenced by addData().


Member Data Documentation

QVector<QGraphicsLineItem*> KiviatView::axes [protected]

Definition at line 185 of file KiviatView.h.

Referenced by redrawAll().

const int KiviatView::AXIS_LENGTH = 300 [static, protected]

Axis Length in pixel.

Definition at line 178 of file KiviatView.h.

Referenced by calcPosition(), MetricsKiviat::drawData(), and setGradientBackground().

int KiviatView::axisCount [protected]

Number of Axis.

Definition at line 157 of file KiviatView.h.

Referenced by addData(), addMarker(), MetricsKiviat::addNode(), calcPosition(), MetricsKiviat::init(), redrawAll(), removeAxis(), setAxisCount(), setAxisLabel(), and setupAxesCaptions().

QVector<QGraphicsTextItem*> KiviatView::axisLabels [protected]

Definition at line 184 of file KiviatView.h.

Referenced by redrawAll(), setAxisLabel(), and setupAxesCaptions().

int KiviatView::curDataItem [protected]

Index of active data-item, or -1 if none is active.

Definition at line 154 of file KiviatView.h.

Referenced by clear(), KiviatView(), redrawData(), removeData(), and setActiveItem().

QVector<KiviatData*> KiviatView::dataset [protected]

KiviatData manages the storing and drawing of the data.

Definition at line 181 of file KiviatView.h.

Referenced by addData(), clear(), getData(), getDataColor(), mousePressEvent(), redrawData(), removeAxis(), removeData(), setActiveItem(), setAxisCount(), setDataColor(), setDataPoint(), and setToolTip().

QFont KiviatView::labelFont [protected]

Definition at line 175 of file KiviatView.h.

Referenced by MetricsKiviat::drawData(), KiviatView(), and setupAxesCaptions().

QVector<QGraphicsPolygonItem*> KiviatView::markers [protected]

Definition at line 186 of file KiviatView.h.

Referenced by redrawAll(), and setMarkerCount().

int KiviatView::prop_activeAlpha [protected]

Transparency value of active and inactive dataset (between 0 and 255, where 0 is fully transparent)

Definition at line 165 of file KiviatView.h.

Referenced by KiviatView().

int KiviatView::prop_angleOffset [protected]

Angle Offset (rotates the diagram) (set between 0 and 360).

Definition at line 172 of file KiviatView.h.

Referenced by calcPosition(), and KiviatView().

int KiviatView::prop_cornerPointRadius [protected]

Radius of the cornerPoints (dots on intersection of axis and polygon.

Definition at line 169 of file KiviatView.h.

Referenced by KiviatView().

int KiviatView::prop_inactiveAlpha [protected]

Definition at line 166 of file KiviatView.h.

Referenced by KiviatView().

int KiviatView::prop_markerCount [protected]

Markers are the lines which connect the points of equal value Number of markers i.e. 5 would be: draw 20%, 40%... line

Definition at line 161 of file KiviatView.h.

Referenced by KiviatView(), redrawAll(), and setMarkerCount().

QGraphicsScene KiviatView::scene [protected]

Definition at line 183 of file KiviatView.h.

Referenced by addData(), addMarker(), MetricsKiviat::drawData(), KiviatView(), MetricsKiviat::MetricsKiviat(), redrawAll(), resizeEvent(), and setupAxesCaptions().


Property Documentation

int KiviatView::ActiveAlpha [read, write]

Definition at line 28 of file KiviatView.h.

int KiviatView::AngleOffset [read, write]

Definition at line 31 of file KiviatView.h.

int KiviatView::AxisCount [read, write]

Definition at line 26 of file KiviatView.h.

int KiviatView::CornerPointRadius [read, write]

Definition at line 30 of file KiviatView.h.

bool KiviatView::GradientBackground [read, write]

Definition at line 32 of file KiviatView.h.

int KiviatView::InactiveAlpha [read, write]

Definition at line 29 of file KiviatView.h.

int KiviatView::MarkerCount [read, write]

Definition at line 27 of file KiviatView.h.


The documentation for this class was generated from the following files:
Generated on Tue Sep 15 14:48:49 2009 for RoseQtWidgets by  doxygen 1.4.7