KDChart::Widget Class Reference

The KD Chart widget for usage without Model/View. More...

#include <KDChartWidget.h>

Inheritance diagram for KDChart::Widget:
Inheritance graph
[legend]
Collaboration diagram for KDChart::Widget:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ChartType {
  NoType,
  Bar,
  Line,
  Plot,
  Pie,
  Ring,
  Polar
}
enum  SubType {
  Normal,
  Stacked,
  Percent,
  Rows
}
 

Sub type values, matching the values defines for the respective Diagram classes.

More...

Public Slots

void setGlobalLeading (int left, int top, int right, int bottom)
 Sets all global leadings (borders).
void setGlobalLeadingBottom (int leading)
 Sets the bottom leading (border).
void setGlobalLeadingLeft (int leading)
 Sets the left leading (border).
void setGlobalLeadingRight (int leading)
 Sets the right leading (border).
void setGlobalLeadingTop (int leading)
 Sets the top leading (border).
void setSubType (SubType subType)
 Sets the type of the chart without changing the main type.
void setType (ChartType chartType, SubType subType=Normal)
 Sets the type of the chart.

Public Member Functions

void addHeaderFooter (HeaderFooter *header)
 Adds the existing header / footer object header.
void addHeaderFooter (const QString &text, HeaderFooter::HeaderFooterType type, Position position)
 Adds a new header/footer with the given text to the position.
void addLegend (Legend *legend)
 Adds a new, already existing, legend.
void addLegend (Position position)
 Adds an empty legend on the given position.
QList< HeaderFooter * > allHeadersFooters ()
 Returns a list with all headers.
QList< Legend * > allLegends ()
 Returns a list with all legends.
BarDiagrambarDiagram ()
 If the current diagram is a BarDiagram, it is returnd; otherwise 0 is returned.
AbstractCoordinatePlanecoordinatePlane ()
 Returns a pointer to the current coordinate plane.
AbstractDiagramdiagram ()
 Returns a pointer to the current diagram.
HeaderFooterfirstHeaderFooter ()
 Returns the first of all headers.
int globalLeadingBottom () const
 Returns the bottom leading (border).
int globalLeadingLeft () const
 Returns the left leading (border).
int globalLeadingRight () const
 Returns the right leading (border).
int globalLeadingTop () const
 Returns the top leading (border).
Legendlegend ()
 Returns the first of all legends.
LineDiagramlineDiagram ()
 If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned.
PieDiagrampieDiagram ()
 If the current diagram is a Plotter, it is returnd; otherwise 0 is returned.
Plotterplotter ()
 If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned.
PolarDiagrampolarDiagram ()
 If the current diagram is a PolarDiagram, it is returnd; otherwise 0 is returned.
void replaceHeaderFooter (HeaderFooter *header, HeaderFooter *oldHeader=0)
 Replaces the old header (or footer, resp.
void replaceLegend (Legend *legend, Legend *oldLegend=0)
void resetData ()
 Resets all data.
RingDiagramringDiagram ()
 If the current diagram is a RingDiagram, it is returnd; otherwise 0 is returned.
void setDataCell (int row, int column, QPair< double, double > data)
 Sets the data for a given column using an (X, Y) QPair of doubles.
void setDataCell (int row, int column, double data)
 Sets the Y value data for a given cell.
void setDataset (int column, const QVector< QPair< double, double > > &data, const QString &title=QString())
 Sets the data in the given column using a QVector of QPairs of double for the (X, Y) values.
void setDataset (int column, const QVector< double > &data, const QString &title=QString())
 Sets the data in the given column using a QVector of double for the Y values.
SubType subType () const
 Returns the sub-type of the chart.
void takeHeaderFooter (HeaderFooter *header)
 Remove the header (or footer, resp.
void takeLegend (Legend *legend)
ChartType type () const
 Returns the type of the chart.
 Widget (QWidget *parent=0)
 Standard Qt-style Constructor.
 ~Widget ()
 Destructor.

Detailed Description

The KD Chart widget for usage without Model/View.

If you want to use KD Chart with Model/View, use KDChart::Chart instead.

Definition at line 58 of file KDChartWidget.h.


Member Enumeration Documentation

Enumerator:
NoType 
Bar 
Line 
Plot 
Pie 
Ring 
Polar 

Definition at line 206 of file KDChartWidget.h.

Sub type values, matching the values defines for the respective Diagram classes.

Enumerator:
Normal 
Stacked 
Percent 
Rows 

Definition at line 212 of file KDChartWidget.h.


Constructor & Destructor Documentation

Widget::Widget ( QWidget parent = 0  )  [explicit]

Standard Qt-style Constructor.

Constructor.

Creates a new widget with all data initialized empty.

Parameters:
parent the widget parent; passed on to QWidget

Definition at line 76 of file KDChartWidget.cpp.

References Line, and setType().

Widget::~Widget (  ) 

Destructor.

Definition at line 87 of file KDChartWidget.cpp.


Member Function Documentation

void Widget::addHeaderFooter ( HeaderFooter header  ) 

Adds the existing header / footer object header.

Adds an existing header / footer object.

See also:
replaceHeaderFooter, takeHeaderFooter

Definition at line 279 of file KDChartWidget.cpp.

References d, and KDChart::HeaderFooter::setParent().

void Widget::addHeaderFooter ( const QString &  text,
HeaderFooter::HeaderFooterType  type,
Position  position 
)

Adds a new header/footer with the given text to the position.

Definition at line 265 of file KDChartWidget.cpp.

References d, KDChart::HeaderFooter::setPosition(), KDChart::TextLayoutItem::setText(), and KDChart::HeaderFooter::setType().

void Widget::addLegend ( Legend legend  ) 

Adds a new, already existing, legend.

Definition at line 325 of file KDChartWidget.cpp.

References d, diagram(), and KDChart::Legend::setDiagram().

void Widget::addLegend ( Position  position  ) 

Adds an empty legend on the given position.

Definition at line 315 of file KDChartWidget.cpp.

References d, diagram(), legend(), and KDChart::Legend::setPosition().

QList< KDChart::HeaderFooter * > Widget::allHeadersFooters (  ) 

Returns a list with all headers.

Definition at line 257 of file KDChartWidget.cpp.

References d.

QList< KDChart::Legend * > Widget::allLegends (  ) 

Returns a list with all legends.

Definition at line 307 of file KDChartWidget.cpp.

References d.

BarDiagram * Widget::barDiagram (  ) 

If the current diagram is a BarDiagram, it is returnd; otherwise 0 is returned.

This function provides type-safe casting.

Definition at line 352 of file KDChartWidget.cpp.

References diagram().

AbstractCoordinatePlane * Widget::coordinatePlane (  ) 

Returns a pointer to the current coordinate plane.

Definition at line 377 of file KDChartWidget.cpp.

References d.

Referenced by diagram(), and setType().

AbstractDiagram * Widget::diagram (  ) 
KDChart::HeaderFooter * Widget::firstHeaderFooter (  ) 

Returns the first of all headers.

Definition at line 249 of file KDChartWidget.cpp.

References d.

int Widget::globalLeadingBottom (  )  const

Returns the bottom leading (border).

Definition at line 241 of file KDChartWidget.cpp.

References d.

int Widget::globalLeadingLeft (  )  const

Returns the left leading (border).

Definition at line 193 of file KDChartWidget.cpp.

References d.

int Widget::globalLeadingRight (  )  const

Returns the right leading (border).

Definition at line 225 of file KDChartWidget.cpp.

References d.

int Widget::globalLeadingTop (  )  const

Returns the top leading (border).

Definition at line 209 of file KDChartWidget.cpp.

References d.

KDChart::Legend * Widget::legend (  ) 

Returns the first of all legends.

Definition at line 299 of file KDChartWidget.cpp.

References d.

Referenced by addLegend().

LineDiagram * Widget::lineDiagram (  ) 

If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned.

This function provides type-safe casting.

Definition at line 356 of file KDChartWidget.cpp.

References diagram().

PieDiagram * Widget::pieDiagram (  ) 

If the current diagram is a Plotter, it is returnd; otherwise 0 is returned.

This function provides type-safe casting.

Definition at line 364 of file KDChartWidget.cpp.

References diagram().

Plotter * Widget::plotter (  ) 

If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned.

This function provides type-safe casting.

Note:
Do not use lineDiagram for multi-dimensional diagrams, but use plotter instead
See also:
plotter

Definition at line 360 of file KDChartWidget.cpp.

References diagram().

PolarDiagram * Widget::polarDiagram (  ) 

If the current diagram is a PolarDiagram, it is returnd; otherwise 0 is returned.

This function provides type-safe casting.

Definition at line 372 of file KDChartWidget.cpp.

References diagram().

void Widget::replaceHeaderFooter ( HeaderFooter header,
HeaderFooter oldHeader = 0 
)

Replaces the old header (or footer, resp.

), or appends the new header or footer, it there is none yet.

Parameters:
header The header or footer to be used instead of the old one. This parameter must not be zero, or the method will do nothing.
oldHeader The header or footer to be removed by the new one. This header or footer will be deleted automatically. If the parameter is omitted, the very first header or footer will be replaced. In case, there was no header and no footer yet, the new header or footer will just be added.
Note:
If you want to re-use the old header or footer, call takeHeaderFooter and addHeaderFooter, instead of using replaceHeaderFooter.
See also:
addHeaderFooter, takeHeaderFooter

Definition at line 285 of file KDChartWidget.cpp.

References d, and KDChart::HeaderFooter::setParent().

void Widget::replaceLegend ( Legend legend,
Legend oldLegend = 0 
)

Definition at line 332 of file KDChartWidget.cpp.

References d, diagram(), and KDChart::Legend::setDiagram().

void Widget::resetData (  ) 

Resets all data.

Definition at line 168 of file KDChartWidget.cpp.

References d.

RingDiagram * Widget::ringDiagram (  ) 

If the current diagram is a RingDiagram, it is returnd; otherwise 0 is returned.

This function provides type-safe casting.

Definition at line 368 of file KDChartWidget.cpp.

References diagram().

void Widget::setDataCell ( int  row,
int  column,
QPair< double, double >  data 
)

Sets the data for a given column using an (X, Y) QPair of doubles.

Definition at line 149 of file KDChartWidget.cpp.

References d.

void Widget::setDataCell ( int  row,
int  column,
double  data 
)

Sets the Y value data for a given cell.

Definition at line 136 of file KDChartWidget.cpp.

References d.

void Widget::setDataset ( int  column,
const QVector< QPair< double, double > > &  data,
const QString &  title = QString() 
)

Sets the data in the given column using a QVector of QPairs of double for the (X, Y) values.

Definition at line 114 of file KDChartWidget.cpp.

References d.

void Widget::setDataset ( int  column,
const QVector< double > &  data,
const QString &  title = QString() 
)

Sets the data in the given column using a QVector of double for the Y values.

Definition at line 96 of file KDChartWidget.cpp.

References d.

void Widget::setGlobalLeading ( int  left,
int  top,
int  right,
int  bottom 
) [slot]

Sets all global leadings (borders).

Definition at line 177 of file KDChartWidget.cpp.

References d.

void Widget::setGlobalLeadingBottom ( int  leading  )  [slot]

Sets the bottom leading (border).

Definition at line 233 of file KDChartWidget.cpp.

References d.

void Widget::setGlobalLeadingLeft ( int  leading  )  [slot]

Sets the left leading (border).

Definition at line 185 of file KDChartWidget.cpp.

References d.

void Widget::setGlobalLeadingRight ( int  leading  )  [slot]

Sets the right leading (border).

Definition at line 217 of file KDChartWidget.cpp.

References d.

void Widget::setGlobalLeadingTop ( int  leading  )  [slot]

Sets the top leading (border).

Definition at line 201 of file KDChartWidget.cpp.

References d.

void Widget::setSubType ( SubType  subType  )  [slot]

Sets the type of the chart without changing the main type.

Make sure to use a sub-type that matches the main type, so e.g. setting sub-type Rows makes sense for Bar charts only, and it will be ignored for all other chart types.

See also:
KDChartBarDiagram::BarType, KDChartLineDiagram::LineType
KDChartPieDiagram::PieType, KDChartRingDiagram::RingType
KDChartPolarDiagram::PolarType

Definition at line 471 of file KDChartWidget.cpp.

References diagram(), KDChart::Plotter::Normal, KDChart::LineDiagram::Normal, KDChart::BarDiagram::Normal, Normal, KDChart::Plotter::Percent, KDChart::LineDiagram::Percent, KDChart::BarDiagram::Percent, Percent, KDChart::BarDiagram::Rows, Rows, SET_SUB_TYPE, KDChart::LineDiagram::Stacked, KDChart::BarDiagram::Stacked, and Stacked.

Referenced by setType().

void Widget::setType ( ChartType  chartType,
SubType  subType = Normal 
) [slot]
Widget::SubType Widget::subType (  )  const
void Widget::takeHeaderFooter ( HeaderFooter header  ) 

Remove the header (or footer, resp.

) from the widget, without deleting it. The chart no longer owns the header or footer, so it is the caller's responsibility to delete the header or footer.

See also:
addHeaderFooter, replaceHeaderFooter

Definition at line 291 of file KDChartWidget.cpp.

References d.

void Widget::takeLegend ( Legend legend  ) 

Definition at line 339 of file KDChartWidget.cpp.

References d.

Widget::ChartType Widget::type (  )  const

Returns the type of the chart.

Definition at line 518 of file KDChartWidget.cpp.

References Bar, diagram(), Line, NoType, Pie, Plot, Polar, and Ring.

Referenced by setType(), and subType().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

Klarälvdalens Datakonsult AB (KDAB)
Qt-related services and products
http://www.kdab.com/
http://www.kdab.com/products/kd-chart/