KPlotObject Class Reference
from PyKDE4.kdeui import *
Detailed Description
KPlotObject 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
Enumerations | |
| PlotType | { UnknownType, Points, Lines, Bars } |
| PointStyle | { NoPoints, Circle, Letter, Triangle, Square, Pentagon, Hexagon, Asterisk, Star, UnknwonPoint } |
Methods | |
| __init__ (self, QColor color=Qt.white, KPlotObject.PlotType otype=KPlotObject.Points, float size=2, KPlotObject.PointStyle ps=KPlotObject.Circle) | |
| __init__ (self, KPlotObject a0) | |
| addPoint (self, QPointF p, QString label=QString(), float barWidth=0.0) | |
| addPoint (self, KPlotPoint p) | |
| addPoint (self, float x, float y, QString label=QString(), float barWidth=0.0) | |
| QBrush | barBrush (self) |
| QPen | barPen (self) |
| QBrush | brush (self) |
| clearPoints (self) | |
| draw (self, QPainter p, KPlotWidget pw) | |
| QPen | labelPen (self) |
| QPen | linePen (self) |
| QPen | pen (self) |
| KPlotObject.PlotTypes | plotTypes (self) |
| KPlotObject.PointStyle | pointStyle (self) |
| [KPlotPoin] | points (self) |
| removePoint (self, int index) | |
| setBarBrush (self, QBrush b) | |
| setBarPen (self, QPen p) | |
| setBrush (self, QBrush b) | |
| setLabelPen (self, QPen p) | |
| setLinePen (self, QPen p) | |
| setPen (self, QPen p) | |
| setPointStyle (self, KPlotObject.PointStyle p) | |
| setShowBars (self, bool b) | |
| setShowLines (self, bool b) | |
| setShowPoints (self, bool b) | |
| setSize (self, float s) | |
| float | size (self) |
Method Documentation
| __init__ | ( | self, | ||
| QColor | color=Qt.white, | |||
| KPlotObject.PlotType | otype=KPlotObject.Points, | |||
| float | size=2, | |||
| KPlotObject.PointStyle | ps=KPlotObject.Circle | |||
| ) |
| __init__ | ( | self, | ||
| KPlotObject | a0 | |||
| ) |
Add a point to the object's list of points, using input data to construct a KPlotPoint.
- 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
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.
| addPoint | ( | self, | ||
| KPlotPoint | p | |||
| ) |
Add a point to the object's list of points, using input data to construct a KPlotPoint.
- 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
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.
| addPoint | ( | self, | ||
| float | x, | |||
| float | y, | |||
| QString | label=QString(), | |||
| float | barWidth=0.0 | |||
| ) |
Add a point to the object's list of points, using input data to construct a KPlotPoint.
- 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
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.
| QBrush barBrush | ( | self ) |
- Returns:
- the brush to use for filling bars for this Object.
| QPen barPen | ( | self ) |
- Returns:
- the pen to use for drawing bars for this Object.
| QBrush brush | ( | self ) |
- Returns:
- the default Brush to use for this Object.
| clearPoints | ( | self ) |
Remove and destroy the points of this object
| draw | ( | self, | ||
| 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)
| QPen labelPen | ( | self ) |
- Returns:
- the pen to use for drawing labels for this Object.
| QPen linePen | ( | self ) |
- Returns:
- the pen to use for drawing lines for this Object.
| QPen pen | ( | self ) |
- 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).
| KPlotObject.PlotTypes plotTypes | ( | self ) |
- Returns:
- the plot flags of the object
| KPlotObject.PointStyle pointStyle | ( | self ) |
- Returns:
- the style used for drawing the points in this object
| [KPlotPoin] points | ( | self ) |
- Returns:
- the list of KPlotPoints that make up this object
| removePoint | ( | self, | ||
| int | index | |||
| ) |
Remove the QPointF at position index from the list of points
- Parameters:
-
index the index of the point to be removed.
| setBarBrush | ( | self, | ||
| QBrush | b | |||
| ) |
Set the brush to use for drawing bars for this object The brush to use
| setBarPen | ( | self, | ||
| QPen | p | |||
| ) |
Set the pen to use for drawing bars for this object The pen to use
| setBrush | ( | self, | ||
| QBrush | b | |||
| ) |
Set the default brush to use for this object The brush to use
| setLabelPen | ( | self, | ||
| QPen | p | |||
| ) |
Set the pen to use for labels for this object The pen to use
| setLinePen | ( | self, | ||
| QPen | p | |||
| ) |
Set the pen to use for drawing lines for this object The pen to use
| setPen | ( | self, | ||
| QPen | p | |||
| ) |
Set the default pen for this object The pen to use
| setPointStyle | ( | self, | ||
| KPlotObject.PointStyle | p | |||
| ) |
Set a new style for drawing the points in this object
- Parameters:
-
p the new style
| setShowBars | ( | self, | ||
| bool | b | |||
| ) |
Set whether bars will be drawn for this object
- Parameters:
-
b if true, bars will be drawn
| setShowLines | ( | self, | ||
| bool | b | |||
| ) |
Set whether lines will be drawn for this object
- Parameters:
-
b if true, lines will be drawn
| setShowPoints | ( | self, | ||
| bool | b | |||
| ) |
Set whether points will be drawn for this object
- Parameters:
-
b if true, points will be drawn
| setSize | ( | self, | ||
| float | s | |||
| ) |
Set the size for plotted points in this object, in pixels
- Parameters:
-
s the new size
| float size | ( | self ) |
- Returns:
- the size of the plotted points in this object, in pixels
Enumeration Documentation
| PlotType |
- Enumerator:
-
| PointStyle |
- Enumerator:
-
KDE 4.4 PyKDE API Reference