KDEUI
#include <kplotobject.h>
Public Types | |
enum | PlotType { UnknownType = 0, Points = 1, Lines = 2, Bars = 4 } |
enum | PointStyle { NoPoints = 0, Circle = 1, Letter = 2, Triangle = 3, Square = 4, Pentagon = 5, Hexagon = 6, Asterisk = 7, Star = 8, UnknwonPoint } |
Public Member Functions | |
KPlotObject (const QColor &color=Qt::white, PlotType otype=Points, double size=2, PointStyle ps=Circle) | |
~KPlotObject () | |
void | addPoint (const QPointF &p, const QString &label=QString(), double barWidth=0.0) |
void | addPoint (KPlotPoint *p) |
void | addPoint (double x, double y, const QString &label=QString(), double barWidth=0.0) |
const QBrush | barBrush () const |
const QPen & | barPen () const |
const QBrush | brush () const |
void | clearPoints () |
void | draw (QPainter *p, KPlotWidget *pw) |
const QPen & | labelPen () const |
const QPen & | linePen () const |
const QPen & | pen () const |
PlotTypes | plotTypes () const |
QList< KPlotPoint * > | points () const |
PointStyle | pointStyle () const |
void | removePoint (int index) |
void | setBarBrush (const QBrush &b) |
void | setBarPen (const QPen &p) |
void | setBrush (const QBrush &b) |
void | setLabelPen (const QPen &p) |
void | setLinePen (const QPen &p) |
void | setPen (const QPen &p) |
void | setPointStyle (PointStyle p) |
void | setShowBars (bool b) |
void | setShowLines (bool b) |
void | setShowPoints (bool b) |
void | setSize (double s) |
double | size () const |
Detailed Description
Encapsulates a data set to be plotted in a KPlotWidget.
Think of a KPlotObject as a set of data displayed as a group in the plot. Each KPlotObject consists of a list of KPlotPoints, a "type" controlling how the data points are displayed (some combination of Points, Lines, or Bars), a color, and a size. There is also a parameter which controls the shape of the points used to display the KPlotObject.
- Note
- KPlotObject will take care of the points added to it, so when clearing the points list (eg with clearPoints()) any previous reference to a KPlotPoint already added to a KPlotObject will be invalid.
- Version
- 1.1
Definition at line 53 of file kplotobject.h.
Member Enumeration Documentation
The type classification of the KPlotObject.
These are bitmask values that can be OR'd together, so that a set of points can be represented in the plot in multiple ways.
- Note
- points should be added in order of increasing x-coordinate when using Bars.
Enumerator | |
---|---|
UnknownType | |
Points |
each KPlotPoint is represented with a drawn point |
Lines |
each KPlotPoint is connected with a line |
Bars |
each KPlotPoint is shown as a vertical bar |
Definition at line 64 of file kplotobject.h.
The available shape styles for plotted points.
Enumerator | |
---|---|
NoPoints | |
Circle | |
Letter | |
Triangle | |
Square | |
Pentagon | |
Hexagon | |
Asterisk | |
Star | |
UnknwonPoint |
Definition at line 76 of file kplotobject.h.
Constructor & Destructor Documentation
|
explicit |
Constructor.
- Parameters
-
color The color for plotting this object. By default this sets the color for Points, Lines and Bars, but there are functions to override any of these. otype the PlotType for this object (Points, Lines or Bars) size the size to use for plotted points, in pixels ps The PointStyle describing the shape for plotted points
Definition at line 54 of file kplotobject.cpp.
KPlotObject::~KPlotObject | ( | ) |
Destructor.
Definition at line 70 of file kplotobject.cpp.
Member Function Documentation
void KPlotObject::addPoint | ( | const QPointF & | p, |
const QString & | label = QString() , |
||
double | barWidth = 0.0 |
||
) |
Add a point to the object's list of points, using input data to construct a KPlotPoint.
- Parameters
-
p the QPointF to add. label the optional text label for this point barWidth the width of the bar, if this object is to be drawn with bars
- Note
- if
- Parameters
-
barWidth is left at its default value of 0.0, then the width will be automatically set to the distance between this point and the one to its right.
Definition at line 201 of file kplotobject.cpp.
void KPlotObject::addPoint | ( | KPlotPoint * | p | ) |
Add a given KPlotPoint to the object's list of points.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
-
p pointer to the KPlotPoint to add.
Definition at line 206 of file kplotobject.cpp.
void KPlotObject::addPoint | ( | double | x, |
double | y, | ||
const QString & | label = QString() , |
||
double | barWidth = 0.0 |
||
) |
Add a point to the object's list of points, using input data to construct a KPlotPoint.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
-
x the X-coordinate of the point to add. y the Y-coordinate of the point to add. label the optional text label barWidth the width of the bar, if this object is to be drawn with bars
- Note
- if
- Parameters
-
barWidth is left at its default value of 0.0, then the width will be automatically set to the distance between this point and the one to its right.
Definition at line 213 of file kplotobject.cpp.
const QBrush KPlotObject::barBrush | ( | ) | const |
- Returns
- the brush to use for filling bars for this Object.
Definition at line 186 of file kplotobject.cpp.
const QPen & KPlotObject::barPen | ( | ) | const |
- Returns
- the pen to use for drawing bars for this Object.
Definition at line 156 of file kplotobject.cpp.
const QBrush KPlotObject::brush | ( | ) | const |
- Returns
- the default Brush to use for this Object.
Definition at line 176 of file kplotobject.cpp.
void KPlotObject::clearPoints | ( | ) |
Remove and destroy the points of this object.
Definition at line 227 of file kplotobject.cpp.
void KPlotObject::draw | ( | QPainter * | p, |
KPlotWidget * | pw | ||
) |
Draw this KPlotObject on the given QPainter.
- Parameters
-
p The QPainter to draw on pw the KPlotWidget to draw on (this is needed for the KPlotWidget::mapToWidget() function)
Definition at line 233 of file kplotobject.cpp.
const QPen & KPlotObject::labelPen | ( | ) | const |
- Returns
- the pen to use for drawing labels for this Object.
Definition at line 166 of file kplotobject.cpp.
const QPen & KPlotObject::linePen | ( | ) | const |
- Returns
- the pen to use for drawing lines for this Object.
Definition at line 146 of file kplotobject.cpp.
const QPen & KPlotObject::pen | ( | ) | const |
- Returns
- the default pen for this Object. If no other pens are set, this pen will be used for points, lines, bars and labels (this pen is always used for points).
Definition at line 136 of file kplotobject.cpp.
KPlotObject::PlotTypes KPlotObject::plotTypes | ( | ) | const |
- Returns
- the plot flags of the object
Definition at line 75 of file kplotobject.cpp.
QList< KPlotPoint * > KPlotObject::points | ( | ) | const |
- Returns
- the list of KPlotPoints that make up this object
Definition at line 196 of file kplotobject.cpp.
KPlotObject::PointStyle KPlotObject::pointStyle | ( | ) | const |
- Returns
- the style used for drawing the points in this object
Definition at line 126 of file kplotobject.cpp.
void KPlotObject::removePoint | ( | int | index | ) |
Remove the QPointF at position index from the list of points.
- Parameters
-
index the index of the point to be removed.
Definition at line 218 of file kplotobject.cpp.
void KPlotObject::setBarBrush | ( | const QBrush & | b | ) |
Set the brush to use for drawing bars for this object The brush to use.
Definition at line 191 of file kplotobject.cpp.
void KPlotObject::setBarPen | ( | const QPen & | p | ) |
Set the pen to use for drawing bars for this object The
pen to use.
Definition at line 161 of file kplotobject.cpp.
void KPlotObject::setBrush | ( | const QBrush & | b | ) |
Set the default brush to use for this object The brush to use.
Definition at line 181 of file kplotobject.cpp.
void KPlotObject::setLabelPen | ( | const QPen & | p | ) |
Set the pen to use for labels for this object The
pen to use.
Definition at line 171 of file kplotobject.cpp.
void KPlotObject::setLinePen | ( | const QPen & | p | ) |
Set the pen to use for drawing lines for this object The
pen to use.
Definition at line 151 of file kplotobject.cpp.
void KPlotObject::setPen | ( | const QPen & | p | ) |
Set the default pen for this object The
pen to use.
Definition at line 141 of file kplotobject.cpp.
void KPlotObject::setPointStyle | ( | PointStyle | p | ) |
Set a new style for drawing the points in this object.
- Parameters
-
p the new style
Definition at line 131 of file kplotobject.cpp.
void KPlotObject::setShowBars | ( | bool | b | ) |
Set whether bars will be drawn for this object.
- Parameters
-
b if true, bars will be drawn
Definition at line 104 of file kplotobject.cpp.
void KPlotObject::setShowLines | ( | bool | b | ) |
Set whether lines will be drawn for this object.
- Parameters
-
b if true, lines will be drawn
Definition at line 92 of file kplotobject.cpp.
void KPlotObject::setShowPoints | ( | bool | b | ) |
Set whether points will be drawn for this object.
- Parameters
-
b if true, points will be drawn
Definition at line 80 of file kplotobject.cpp.
void KPlotObject::setSize | ( | double | s | ) |
Set the size for plotted points in this object, in pixels.
- Parameters
-
s the new size
Definition at line 121 of file kplotobject.cpp.
double KPlotObject::size | ( | ) | const |
- Returns
- the size of the plotted points in this object, in pixels
Definition at line 116 of file kplotobject.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.