KDE 4.5 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

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.

Author:
Jason Harris
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)
[KPlotPoint] 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
)

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

__init__ (  self,
KPlotObject  a0
)
addPoint (  self,
QPointF  p,
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.

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

[KPlotPoint] 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

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 = 0
Points = 1
Lines = 2
Bars = 4

PointStyle

The available shape styles for plotted points.

Enumerator:
NoPoints = 0
Circle = 1
Letter = 2
Triangle = 3
Square = 4
Pentagon = 5
Hexagon = 6
Asterisk = 7
Star = 8
UnknwonPoint 

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • polkitqt
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal