The KD Chart widget for usage without Model/View. More...
#include <KDChartWidget.h>
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. | |
BarDiagram * | barDiagram () |
If the current diagram is a BarDiagram, it is returnd; otherwise 0 is returned. | |
AbstractCoordinatePlane * | coordinatePlane () |
Returns a pointer to the current coordinate plane. | |
AbstractDiagram * | diagram () |
Returns a pointer to the current diagram. | |
HeaderFooter * | firstHeaderFooter () |
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). | |
Legend * | legend () |
Returns the first of all legends. | |
LineDiagram * | lineDiagram () |
If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned. | |
PieDiagram * | pieDiagram () |
If the current diagram is a Plotter, it is returnd; otherwise 0 is returned. | |
Plotter * | plotter () |
If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned. | |
PolarDiagram * | polarDiagram () |
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. | |
RingDiagram * | ringDiagram () |
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. |
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.
Definition at line 206 of file KDChartWidget.h.
Sub type values, matching the values defines for the respective Diagram classes.
Definition at line 212 of file KDChartWidget.h.
Widget::Widget | ( | QWidget * | parent = 0 |
) | [explicit] |
Standard Qt-style Constructor.
Constructor.
Creates a new widget with all data initialized empty.
parent | the widget parent; passed on to QWidget |
Definition at line 76 of file KDChartWidget.cpp.
Widget::~Widget | ( | ) |
Destructor.
Definition at line 87 of file KDChartWidget.cpp.
void Widget::addHeaderFooter | ( | HeaderFooter * | header | ) |
Adds the existing header / footer object header.
Adds an existing header / footer object.
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 | ( | ) |
QList< KDChart::Legend * > Widget::allLegends | ( | ) |
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.
AbstractDiagram * Widget::diagram | ( | ) |
Returns a pointer to the current diagram.
Definition at line 344 of file KDChartWidget.cpp.
References coordinatePlane(), and KDChart::AbstractCoordinatePlane::diagram().
Referenced by addLegend(), barDiagram(), lineDiagram(), pieDiagram(), plotter(), polarDiagram(), replaceLegend(), ringDiagram(), setSubType(), subType(), and type().
KDChart::HeaderFooter * Widget::firstHeaderFooter | ( | ) |
int Widget::globalLeadingBottom | ( | ) | const |
Returns the bottom leading (border).
Definition at line 241 of file KDChartWidget.cpp.
References d.
int Widget::globalLeadingLeft | ( | ) | const |
int Widget::globalLeadingRight | ( | ) | const |
int Widget::globalLeadingTop | ( | ) | const |
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.
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.
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. |
Definition at line 285 of file KDChartWidget.cpp.
References d, and KDChart::HeaderFooter::setParent().
Definition at line 332 of file KDChartWidget.cpp.
References d, diagram(), and KDChart::Legend::setDiagram().
void Widget::resetData | ( | ) |
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] |
void Widget::setGlobalLeadingBottom | ( | int | leading | ) | [slot] |
void Widget::setGlobalLeadingLeft | ( | int | leading | ) | [slot] |
void Widget::setGlobalLeadingRight | ( | int | leading | ) | [slot] |
void Widget::setGlobalLeadingTop | ( | int | leading | ) | [slot] |
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.
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().
Sets the type of the chart.
Definition at line 394 of file KDChartWidget.cpp.
References KDChart::AbstractCartesianDiagram::axes(), Bar, coordinatePlane(), d, KDChart::AbstractCoordinatePlane::diagram(), isCartesian(), isPolar(), Line, NoType, Pie, Plot, Polar, KDChart::AbstractCoordinatePlane::replaceDiagram(), Ring, KDChart::Legend::setDiagram(), KDChart::AbstractDiagram::setModel(), setSubType(), subType(), KDChart::AbstractCartesianDiagram::takeAxis(), and type().
Referenced by Widget().
Widget::SubType Widget::subType | ( | ) | const |
Returns the sub-type of the chart.
Definition at line 538 of file KDChartWidget.cpp.
References Bar, diagram(), Line, KDChart::Plotter::Normal, KDChart::LineDiagram::Normal, KDChart::BarDiagram::Normal, Normal, KDChart::Plotter::Percent, KDChart::LineDiagram::Percent, Percent, KDChart::BarDiagram::Percent, Pie, Plot, Polar, Ring, Rows, KDChart::BarDiagram::Rows, KDChart::LineDiagram::Stacked, Stacked, KDChart::BarDiagram::Stacked, TEST_SUB_TYPE, and type().
Referenced by setType().
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.
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 |