QPieSeries Class
Pie series API for Qt Charts. More...
Header: | #include <QPieSeries> |
Instantiated By: | PieSeries |
Inherits: | QAbstractSeries |
Properties
|
|
- 5 properties inherited from QAbstractSeries
- 1 property inherited from QObject
Public Functions
QPieSeries(QObject *parent = Q_NULLPTR) | |
virtual | ~QPieSeries() |
bool | append(QPieSlice *slice) |
bool | append(QList<QPieSlice *> slices) |
QPieSlice * | append(QString label, qreal value) |
void | clear() |
int | count() const |
qreal | holeSize() const |
qreal | horizontalPosition() const |
bool | insert(int index, QPieSlice *slice) |
bool | isEmpty() const |
qreal | pieEndAngle() const |
qreal | pieSize() const |
qreal | pieStartAngle() const |
bool | remove(QPieSlice *slice) |
void | setHoleSize(qreal holeSize) |
void | setHorizontalPosition(qreal relativePosition) |
void | setLabelsPosition(QPieSlice::LabelPosition position) |
void | setLabelsVisible(bool visible = true) |
void | setPieEndAngle(qreal angle) |
void | setPieSize(qreal relativeSize) |
void | setPieStartAngle(qreal startAngle) |
void | setVerticalPosition(qreal relativePosition) |
QList<QPieSlice *> | slices() const |
qreal | sum() const |
bool | take(QPieSlice *slice) |
qreal | verticalPosition() const |
QPieSeries & | operator<<(QPieSlice *slice) |
Reimplemented Public Functions
virtual QAbstractSeries::SeriesType | type() const |
- 15 public functions inherited from QAbstractSeries
- 31 public functions inherited from QObject
Signals
void | added(QList<QPieSlice *> slices) |
void | clicked(QPieSlice *slice) |
void | countChanged() |
void | doubleClicked(QPieSlice *slice) |
void | hovered(QPieSlice *slice, bool state) |
void | pressed(QPieSlice *slice) |
void | released(QPieSlice *slice) |
void | removed(QList<QPieSlice *> slices) |
void | sumChanged() |
- 4 signals inherited from QAbstractSeries
- 2 signals inherited from QObject
Additional Inherited Members
- 1 public slot inherited from QObject
- 11 static public members inherited from QObject
- 9 protected functions inherited from QObject
Detailed Description
Pie series API for Qt Charts.
The pie series defines a pie chart which consists of pie slices which are defined as QPieSlice objects. The slices can have any values as the QPieSeries will calculate its relative value to the sum of all slices. The actual slice size is determined by that relative value.
Pie size and position on the chart is controlled by using relative values which range from 0.0 to 1.0. These relate to the actual chart rectangle.
By default the pie is defined as a full pie but it can also be a partial pie. This can be done by setting a starting angle and angle span to the series. Full pie is 360 degrees where 0 is at 12 a'clock.
See the pie chart example or donut chart example to learn how to use QPieSeries.
Property Documentation
count : const int
Number of slices in the series.
Access functions:
int | count() const |
Notifier signal:
void | countChanged() |
endAngle : qreal
This property defines the ending angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Default is value is 360.
Access functions:
qreal | pieEndAngle() const |
void | setPieEndAngle(qreal angle) |
holeSize : qreal
This property defines the donut hole size.
The value is a relative value to the chart rectangle where:
- 0.0 is the minimum size (full pie drawn, without any hole inside).
- 1.0 is the maximum size that can fit the chart. (donut has no width)
The value is never greater then size property. Default value is 0.0.
Access functions:
qreal | holeSize() const |
void | setHoleSize(qreal holeSize) |
horizontalPosition : qreal
This property defines the horizontal position of the pie.
The value is a relative value to the chart rectangle where:
- 0.0 is the absolute left.
- 1.0 is the absolute right.
Default value is 0.5 (center).
Access functions:
qreal | horizontalPosition() const |
void | setHorizontalPosition(qreal relativePosition) |
See also verticalPosition.
size : qreal
This property defines the pie size.
The value is a relative value to the chart rectangle where:
- 0.0 is the minimum size (pie not drawn).
- 1.0 is the maximum size that can fit the chart.
When setting this property the holeSize property is adjusted if necessary, to ensure that the hole size is not greater than the outer size.
Default value is 0.7.
Access functions:
qreal | pieSize() const |
void | setPieSize(qreal relativeSize) |
startAngle : qreal
This property defines the starting angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Default is value is 0.
Access functions:
qreal | pieStartAngle() const |
void | setPieStartAngle(qreal startAngle) |
sum : const qreal
Sum of all slices.
The series keeps track of the sum of all slices it holds.
Access functions:
qreal | sum() const |
Notifier signal:
void | sumChanged() |
verticalPosition : qreal
This property defines the vertical position of the pie.
The value is a relative value to the chart rectangle where:
- 0.0 is the absolute top.
- 1.0 is the absolute bottom.
Default value is 0.5 (center).
Access functions:
qreal | verticalPosition() const |
void | setVerticalPosition(qreal relativePosition) |
See also horizontalPosition.
Member Function Documentation
QPieSeries::QPieSeries(QObject *parent = Q_NULLPTR)
Constructs a series object which is a child of parent.
[virtual]
QPieSeries::~QPieSeries()
Destroys the series and its slices.
[signal]
void QPieSeries::added(QList<QPieSlice *> slices)
This signal is emitted when slices have been added to the series.
See also append() and insert().
bool QPieSeries::append(QPieSlice *slice)
Appends a single slice to the series. Slice ownership is passed to the series.
Returns true if append was succesfull.
bool QPieSeries::append(QList<QPieSlice *> slices)
Appends an array of slices to the series. Slice ownership is passed to the series.
Returns true if append was successful.
QPieSlice *QPieSeries::append(QString label, qreal value)
Appends a single slice to the series with give value and label. Slice ownership is passed to the series. Returns NULL if value is NaN, Inf or -Inf and no slice is added to the series.
void QPieSeries::clear()
Clears all slices from the series.
[signal]
void QPieSeries::clicked(QPieSlice *slice)
This signal is emitted when a slice has been clicked.
See also QPieSlice::clicked().
int QPieSeries::count() const
returns the number of the slices in this series.
Note: Getter function for property count.
[signal]
void QPieSeries::countChanged()
Emitted when the slice count has changed.
Note: Notifier signal for property count.
See also count.
[signal]
void QPieSeries::doubleClicked(QPieSlice *slice)
This signal is emitted when a slice has been doubleClicked.
See also QPieSlice::doubleClicked().
[signal]
void QPieSeries::hovered(QPieSlice *slice, bool state)
This signal is emitted when user has hovered over or away from the slice. state is true when user has hovered over the slice and false when hover has moved away from the slice.
See also QPieSlice::hovered().
bool QPieSeries::insert(int index, QPieSlice *slice)
Inserts a single slice to the series before the slice at index position. Slice ownership is passed to the series.
Returns true if insert was successful.
bool QPieSeries::isEmpty() const
Returns true is the series is empty.
qreal QPieSeries::pieEndAngle() const
Returns the end angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
Note: Getter function for property endAngle.
See also setPieEndAngle(), pieStartAngle(), and setPieStartAngle().
[signal]
void QPieSeries::pressed(QPieSlice *slice)
This signal is emitted when a slice has been pressed.
See also QPieSlice::pressed().
[signal]
void QPieSeries::released(QPieSlice *slice)
This signal is emitted when a slice has been released.
See also QPieSlice::released().
bool QPieSeries::remove(QPieSlice *slice)
Removes a single slice from the series and deletes the slice.
Do not reference the pointer after this call.
Returns true if remove was successful.
[signal]
void QPieSeries::removed(QList<QPieSlice *> slices)
This signal is emitted when slices have been removed from the series.
See also remove().
void QPieSeries::setLabelsPosition(QPieSlice::LabelPosition position)
Sets the all the slice labels position
Note that this affects only the current slices in the series. If user adds a new slice the default label position is LabelOutside
See also QPieSlice::labelPosition() and QPieSlice::setLabelPosition().
void QPieSeries::setLabelsVisible(bool visible = true)
Sets the all the slice labels visible or invisible.
Note that this affects only the current slices in the series. If user adds a new slice the default label visibility is false.
See also QPieSlice::isLabelVisible() and QPieSlice::setLabelVisible().
void QPieSeries::setPieEndAngle(qreal angle)
Sets the end angle of the pie.
Full pie is 360 degrees where 0 degrees is at 12 a'clock.
angle must be greater than start angle.
Note: Setter function for property endAngle.
See also pieEndAngle(), pieStartAngle(), and setPieStartAngle().
QList<QPieSlice *> QPieSeries::slices() const
Returns a list of slices that belong to this series.
qreal QPieSeries::sum() const
Returns the sum of all slice values in this series.
Note: Getter function for property sum.
See also QPieSlice::value(), QPieSlice::setValue(), and QPieSlice::percentage().
[signal]
void QPieSeries::sumChanged()
Emitted when the sum of all slices has changed.
Note: Notifier signal for property sum.
See also sum.
bool QPieSeries::take(QPieSlice *slice)
Takes a single slice from the series. Does not destroy the slice object.
Note: The series remains as the slice's parent object. You must set the parent object to take full ownership.
Returns true if take was successful.
[virtual]
QAbstractSeries::SeriesType QPieSeries::type() const
Reimplemented from QAbstractSeries::type().
Returns QAbstractSeries::SeriesTypePie.
QPieSeries &QPieSeries::operator<<(QPieSlice *slice)
Appends a single slice to the series and returns a reference to the series. Slice ownership is passed to the series.
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.