![]() |
KD Chart API Documentation
3.1
|
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 } |
Public Slots | |
void | setGlobalLeading (int left, int top, int right, int bottom) |
void | setGlobalLeadingBottom (int leading) |
void | setGlobalLeadingLeft (int leading) |
void | setGlobalLeadingRight (int leading) |
void | setGlobalLeadingTop (int leading) |
void | setSubType (SubType subType) |
Sets the type of the chart without changing the main type. More... | |
void | setType (ChartType chartType, SubType subType=Normal) |
Public Member Functions | |
Widget (QWidget *parent=nullptr) | |
~Widget () override | |
void | addHeaderFooter (const QString &text, HeaderFooter::HeaderFooterType type, Position position) |
void | addHeaderFooter (HeaderFooter *header) |
void | addLegend (Legend *legend) |
void | addLegend (Position position) |
QList< HeaderFooter * > | allHeadersFooters () |
QList< Legend * > | allLegends () |
BarDiagram * | barDiagram () |
AbstractCoordinatePlane * | coordinatePlane () |
AbstractDiagram * | diagram () |
HeaderFooter * | firstHeaderFooter () |
int | globalLeadingBottom () const |
int | globalLeadingLeft () const |
int | globalLeadingRight () const |
int | globalLeadingTop () const |
Legend * | legend () |
LineDiagram * | lineDiagram () |
PieDiagram * | pieDiagram () |
Plotter * | plotter () |
PolarDiagram * | polarDiagram () |
void | replaceHeaderFooter (HeaderFooter *header, HeaderFooter *oldHeader=nullptr) |
void | replaceLegend (Legend *legend, Legend *oldLegend=nullptr) |
void | resetData () |
RingDiagram * | ringDiagram () |
void | setDataCell (int row, int column, QPair< qreal, qreal > data) |
void | setDataCell (int row, int column, qreal data) |
void | setDataset (int column, const QVector< QPair< qreal, qreal >> &data, const QString &title=QString()) |
void | setDataset (int column, const QVector< qreal > &data, const QString &title=QString()) |
SubType | subType () const |
void | takeHeaderFooter (HeaderFooter *header) |
void | takeLegend (Legend *legend) |
ChartType | type () const |
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 44 of file KDChartWidget.h.
Enumerator | |
---|---|
NoType | |
Bar | |
Line | |
Plot | |
Pie | |
Ring | |
Polar |
Definition at line 190 of file KDChartWidget.h.
Sub type values, matching the values defines for the respective Diagram classes.
Enumerator | |
---|---|
Normal | |
Stacked | |
Percent | |
Rows |
Definition at line 205 of file KDChartWidget.h.
|
explicit |
Standard Qt-style Constructor
Creates a new widget with all data initialized empty.
parent | the widget parent; passed on to QWidget |
Constructor. Creates a new widget with all data initialized empty.
parent | the widget parent; passed on to QWidget |
Definition at line 65 of file KDChartWidget.cpp.
|
override |
Destructor.
Definition at line 77 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 254 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 268 of file KDChartWidget.cpp.
References d, and KDChart::HeaderFooter::setParent().
void Widget::addLegend | ( | Legend * | legend | ) |
Adds a new, already existing, legend.
Definition at line 314 of file KDChartWidget.cpp.
References d, diagram(), legend(), and KDChart::Legend::setDiagram().
void Widget::addLegend | ( | Position | position | ) |
Adds an empty legend on the given position.
Definition at line 304 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 returned; otherwise 0 is returned. This function provides type-safe casting.
Definition at line 341 of file KDChartWidget.cpp.
References diagram().
AbstractCoordinatePlane * Widget::coordinatePlane | ( | ) |
Returns a pointer to the current coordinate plane.
Definition at line 366 of file KDChartWidget.cpp.
References d.
AbstractDiagram * Widget::diagram | ( | ) |
Returns a pointer to the current diagram.
Definition at line 333 of file KDChartWidget.cpp.
References coordinatePlane(), and KDChart::AbstractCoordinatePlane::diagram().
Referenced by addLegend(), barDiagram(), lineDiagram(), pieDiagram(), plotter(), polarDiagram(), replaceLegend(), ringDiagram(), setSubType(), setType(), subType(), and type().
KDChart::HeaderFooter * Widget::firstHeaderFooter | ( | ) |
int Widget::globalLeadingBottom | ( | ) | const |
Returns the bottom leading (border).
Definition at line 230 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 288 of file KDChartWidget.cpp.
References d.
Referenced by addLegend(), replaceLegend(), and takeLegend().
LineDiagram * Widget::lineDiagram | ( | ) |
If the current diagram is a LineDiagram, it is returned; otherwise 0 is returned. This function provides type-safe casting.
Definition at line 345 of file KDChartWidget.cpp.
References diagram().
PieDiagram * Widget::pieDiagram | ( | ) |
If the current diagram is a Plotter, it is returned; otherwise 0 is returned. This function provides type-safe casting.
Definition at line 353 of file KDChartWidget.cpp.
References diagram().
Plotter * Widget::plotter | ( | ) |
If the current diagram is a LineDiagram, it is returned; otherwise 0 is returned. This function provides type-safe casting.
Definition at line 349 of file KDChartWidget.cpp.
References diagram().
PolarDiagram * Widget::polarDiagram | ( | ) |
If the current diagram is a PolarDiagram, it is returned; otherwise 0 is returned. This function provides type-safe casting.
Definition at line 361 of file KDChartWidget.cpp.
References diagram().
void Widget::replaceHeaderFooter | ( | HeaderFooter * | header, |
HeaderFooter * | oldHeader = nullptr |
||
) |
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 274 of file KDChartWidget.cpp.
References d, and KDChart::HeaderFooter::setParent().
Definition at line 321 of file KDChartWidget.cpp.
References d, diagram(), legend(), and KDChart::Legend::setDiagram().
void Widget::resetData | ( | ) |
RingDiagram * Widget::ringDiagram | ( | ) |
If the current diagram is a RingDiagram, it is returned; otherwise 0 is returned. This function provides type-safe casting.
Definition at line 357 of file KDChartWidget.cpp.
References diagram().
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 138 of file KDChartWidget.cpp.
References d.
void Widget::setDataCell | ( | int | row, |
int | column, | ||
qreal | data | ||
) |
Sets the Y value data for a given cell.
Definition at line 125 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 104 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 87 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 469 of file KDChartWidget.cpp.
References diagram(), KDChart::BarDiagram::Normal, KDChart::LineDiagram::Normal, KDChart::Plotter::Normal, Normal, KDChart::BarDiagram::Percent, KDChart::LineDiagram::Percent, KDChart::Plotter::Percent, Percent, Rows, KDChart::BarDiagram::Stacked, KDChart::LineDiagram::Stacked, Stacked, and subType().
Referenced by setType().
Sets the type of the chart.
Definition at line 383 of file KDChartWidget.cpp.
References Bar, coordinatePlane(), d, diagram(), isCartesian(), isPolar(), Line, NoType, Pie, Plot, Polar, KDChart::AbstractCoordinatePlane::replaceDiagram(), Ring, KDChart::AbstractDiagram::setModel(), setSubType(), subType(), and type().
Referenced by Widget().
Widget::SubType Widget::subType | ( | ) | const |
Returns the sub-type of the chart.
Definition at line 522 of file KDChartWidget.cpp.
References Bar, diagram(), Line, KDChart::BarDiagram::Normal, KDChart::LineDiagram::Normal, KDChart::Plotter::Normal, Normal, KDChart::BarDiagram::Percent, KDChart::LineDiagram::Percent, KDChart::Plotter::Percent, Percent, Pie, Plot, Polar, Ring, Rows, KDChart::BarDiagram::Stacked, KDChart::LineDiagram::Stacked, Stacked, TEST_SUB_TYPE, and type().
Referenced by setSubType(), and 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 280 of file KDChartWidget.cpp.
References d.
void Widget::takeLegend | ( | Legend * | legend | ) |
Definition at line 328 of file KDChartWidget.cpp.
Widget::ChartType Widget::type | ( | ) | const |