KD Chart 2
[rev.2.7]
|
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). More... | |
void | setGlobalLeadingBottom (int leading) |
Sets the bottom leading (border). More... | |
void | setGlobalLeadingLeft (int leading) |
Sets the left leading (border). More... | |
void | setGlobalLeadingRight (int leading) |
Sets the right leading (border). More... | |
void | setGlobalLeadingTop (int leading) |
Sets the top leading (border). More... | |
void | setSubType (SubType subType) |
Sets the type of the chart without changing the main type. More... | |
void | setType (ChartType chartType, SubType subType=Normal) |
Sets the type of the chart. More... | |
Public Member Functions | |
void | addHeaderFooter (const QString &text, HeaderFooter::HeaderFooterType type, Position position) |
Adds a new header/footer with the given text to the position. More... | |
void | addHeaderFooter (HeaderFooter *header) |
Adds the existing header / footer object header. More... | |
void | addLegend (Position position) |
Adds an empty legend on the given position. More... | |
void | addLegend (Legend *legend) |
Adds a new, already existing, legend. More... | |
QList< HeaderFooter * > | allHeadersFooters () |
Returns a list with all headers. More... | |
QList< Legend * > | allLegends () |
Returns a list with all legends. More... | |
BarDiagram * | barDiagram () |
If the current diagram is a BarDiagram, it is returnd; otherwise 0 is returned. More... | |
AbstractCoordinatePlane * | coordinatePlane () |
Returns a pointer to the current coordinate plane. More... | |
AbstractDiagram * | diagram () |
Returns a pointer to the current diagram. More... | |
HeaderFooter * | firstHeaderFooter () |
Returns the first of all headers. More... | |
int | globalLeadingBottom () const |
Returns the bottom leading (border). More... | |
int | globalLeadingLeft () const |
Returns the left leading (border). More... | |
int | globalLeadingRight () const |
Returns the right leading (border). More... | |
int | globalLeadingTop () const |
Returns the top leading (border). More... | |
Legend * | legend () |
Returns the first of all legends. More... | |
LineDiagram * | lineDiagram () |
If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned. More... | |
PieDiagram * | pieDiagram () |
If the current diagram is a Plotter, it is returnd; otherwise 0 is returned. More... | |
Plotter * | plotter () |
If the current diagram is a LineDiagram, it is returnd; otherwise 0 is returned. More... | |
PolarDiagram * | polarDiagram () |
If the current diagram is a PolarDiagram, it is returnd; otherwise 0 is returned. More... | |
void | 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. More... | |
void | replaceLegend (Legend *legend, Legend *oldLegend=0) |
void | resetData () |
Resets all data. More... | |
RingDiagram * | ringDiagram () |
If the current diagram is a RingDiagram, it is returnd; otherwise 0 is returned. More... | |
void | setDataCell (int row, int column, qreal data) |
Sets the Y value data for a given cell. More... | |
void | setDataCell (int row, int column, QPair< qreal, qreal > data) |
Sets the data for a given column using an (X, Y) QPair of qreals. More... | |
void | setDataset (int column, const QVector< qreal > &data, const QString &title=QString()) |
Sets the data in the given column using a QVector of qreal for the Y values. More... | |
void | setDataset (int column, const QVector< QPair< qreal, qreal > > &data, const QString &title=QString()) |
Sets the data in the given column using a QVector of QPairs of qreal for the (X, Y) values. More... | |
SubType | subType () const |
Returns the sub-type of the chart. More... | |
void | takeHeaderFooter (HeaderFooter *header) |
Remove the header (or footer, resp.) from the widget, without deleting it. More... | |
void | takeLegend (Legend *legend) |
ChartType | type () const |
Returns the type of the chart. More... | |
Widget (QWidget *parent=0) | |
Standard Qt-style Constructor. More... | |
~Widget () override | |
Destructor. More... | |
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 60 of file KDChartWidget.h.
Enumerator | |
---|---|
NoType | |
Bar | |
Line | |
Plot | |
Pie | |
Ring | |
Polar |
Definition at line 208 of file KDChartWidget.h.
Sub type values, matching the values defines for the respective Diagram classes.
Enumerator | |
---|---|
Normal | |
Stacked | |
Percent | |
Rows |
Definition at line 214 of file KDChartWidget.h.
|
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.
|
override |
Destructor.
Definition at line 87 of file KDChartWidget.cpp.
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::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::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().
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().
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, | ||
qreal | data | ||
) |
Sets the Y value data for a given cell.
Definition at line 136 of file KDChartWidget.cpp.
References d.
void Widget::setDataCell | ( | int | row, |
int | column, | ||
QPair< qreal, qreal > | data | ||
) |
Sets the data for a given column using an (X, Y) QPair of qreals.
Definition at line 149 of file KDChartWidget.cpp.
References d.
void Widget::setDataset | ( | int | column, |
const QVector< qreal > & | data, | ||
const QString & | title = QString() |
||
) |
Sets the data in the given column using a QVector of qreal for the Y values.
Definition at line 96 of file KDChartWidget.cpp.
References d.
void Widget::setDataset | ( | int | column, |
const QVector< QPair< qreal, qreal > > & | data, | ||
const QString & | title = QString() |
||
) |
Sets the data in the given column using a QVector of QPairs of qreal for the (X, Y) values.
Definition at line 114 of file KDChartWidget.cpp.
References d.
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
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 481 of file KDChartWidget.cpp.
References diagram(), KDChart::BarDiagram::Normal, KDChart::Plotter::Normal, KDChart::LineDiagram::Normal, Normal, KDChart::BarDiagram::Percent, KDChart::Plotter::Percent, KDChart::LineDiagram::Percent, Percent, KDChart::BarDiagram::Rows, Rows, KDChart::BarDiagram::Stacked, KDChart::LineDiagram::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 534 of file KDChartWidget.cpp.
References Bar, d, diagram(), Line, KDChart::BarDiagram::Normal, KDChart::Plotter::Normal, KDChart::LineDiagram::Normal, Normal, KDChart::BarDiagram::Percent, KDChart::Plotter::Percent, KDChart::LineDiagram::Percent, Percent, Pie, Plot, Polar, Ring, KDChart::BarDiagram::Rows, Rows, KDChart::BarDiagram::Stacked, KDChart::LineDiagram::Stacked, 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 |