# class KPlotObject

###

Module | kdeui
Namespace |
Class | KPlotObject
Inherits |

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.

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

### enums

- PlotType { UnknownType, Points, Lines, Bars }
  typesafe object: PlotTypes
- PointStyle { NoPoints, Circle, Letter, Triangle, Square, Pentagon, Hexagon, Asterisk, Star, UnknwonPoint }

enum details

### methods

- KPlotObject (color, otype, size, ps)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  color | QColor | Qt.white
  otype | KPlotObject.PlotType | KPlotObject.Points
  size | double | 2
  ps | KPlotObject.PointStyle | KPlotObject.Circle

  Constructor.

  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

- KPlotObject (a0)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KPlotObject |

- KPlotObject (a0, a1, a2, a3)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QColor | Qt.white
  a1 | KPlotObject.PlotType | KPlotObject.Points
  a2 | double | 2
  a3 | KPlotObject.PointStyle | KPlotObject.Circle

- addPoint (p, label, barWidth)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | QPointF |
  label | QString | QString()
  barWidth | double | 0.0

  Add a point to the object's list of points, using input data to construct a KPlotPoint.

  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 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 (p)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | KPlotPoint |

  Add a given KPlotPoint to the object's list of points.

  p - pointer to the KPlotPoint to add.

- addPoint (x, y, label, barWidth)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  x | double |
  y | double |
  label | QString | QString()
  barWidth | double | 0.0

  Add a point to the object's list of points, using input data to construct a KPlotPoint.

  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 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.

- barBrush ( )

  returns QBrush

  Returns the brush to use for filling bars for this Object.

- barPen ( )

  returns QPen

  Returns the pen to use for drawing bars for this Object.

- brush ( )

  returns QBrush

  Returns the default Brush to use for this Object.

- clearPoints ( )

  returns Nothing

  Remove and destroy the points of this object

- draw (p, pw)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | QPainter |
  pw | KPlotWidget |

  Draw this KPlotObject on the given QPainter

  p - The QPainter to draw on

  pw - the KPlotWidget to draw on (this is needed for the KPlotWidget.mapToWidget() function)

- labelPen ( )

  returns QPen

  Returns the pen to use for drawing labels for this Object.

- linePen ( )

  returns QPen

  Returns the pen to use for drawing lines for this Object.

- pen ( )

  returns QPen

  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).

- plotTypes ( )

  returns KPlotObject.PlotTypes

  Returns the plot flags of the object

- pointStyle ( )

  returns KPlotObject.PointStyle

  Returns the style used for drawing the points in this object

- points ( )

  returns QList<KPlotPoint

  Returns the list of KPlotPoints that make up this object

- removePoint (index)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  index | int |

  Remove the QPointF at position index from the list of points

  index - the index of the point to be removed.

- setBarBrush (b)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  b | QBrush |

  Set the brush to use for drawing bars for this object The brush to use

- setBarPen (p)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | QPen |

  Set the pen to use for drawing bars for this object The pen to use

- setBrush (b)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  b | QBrush |

  Set the default brush to use for this object The brush to use

- setLabelPen (p)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | QPen |

  Set the pen to use for labels for this object The pen to use

- setLinePen (p)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | QPen |

  Set the pen to use for drawing lines for this object The pen to use

- setPen (p)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | QPen |

  Set the default pen for this object The pen to use

- setPointStyle (p)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  p | KPlotObject.PointStyle |

  Set a new style for drawing the points in this object

  p - the new style

- setShowBars (b)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  b | bool |

  Set whether bars will be drawn for this object

  b - if true, bars will be drawn

- setShowLines (b)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  b | bool |

  Set whether lines will be drawn for this object

  b - if true, lines will be drawn

- setShowPoints (b)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  b | bool |

  Set whether points will be drawn for this object

  b - if true, points will be drawn

- setSize (s)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  s | double |

  Set the size for plotted points in this object, in pixels

  s - the new size

- size ( )

  returns double

  Returns the size of the plotted points in this object, in pixels

### enums - detail

- PlotType { UnknownType, Points, Lines, Bars }

  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.

  points should be added in order of increasing x-coordinate when using Bars.

  typesafe object: PlotTypes

UnknownType - 0 -
Points - 1 -
Lines - 2 -
Bars - 4 -

- PointStyle { NoPoints, Circle, Letter, Triangle, Square, Pentagon, Hexagon, Asterisk, Star, UnknwonPoint }

  The available shape styles for plotted points.

  | NoPoints | - 0 | - |
  | Circle | - 1 | - |
  | Letter | - 2 | - |
  | Triangle | - 3 | - |
  | Square | - 4 | - |
  | Pentagon | - 5 | - |
  | Hexagon | - 6 | - |
  | Asterisk | - 7 | - |
  | Star | - 8 | - |
  | UnknwonPoint | - | - |