The QPieSeries class presents data in pie charts. 更多...
头: | #include <QPieSeries> |
实例化: | PieSeries |
继承: | QAbstractSeries |
|
|
QPieSeries (QObject * parent = nullptr) | |
virtual | ~QPieSeries () |
bool | append (QPieSlice * slice ) |
bool | append (const QList<QPieSlice *> & slices ) |
QPieSlice * | append (const 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 ) |
virtual QAbstractSeries::SeriesType | type () const override |
void | added (const 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 (const QList<QPieSlice *> & slices ) |
void | sumChanged () |
A pie series consists of slices that are defined as QPieSlice objects. The slices can have any values as the QPieSeries object calculates the percentage of a slice compared with the sum of all slices in the series to determine the actual size of the slice in the chart.
Pie size and position on the chart are controlled by using relative values that range from 0.0 to 1.0. These relate to the actual chart rectangle.
By default, the pie is defined as a full pie. A partial pie can be created by setting a starting angle and angle span for the series. A full pie is 360 degrees, where 0 is at 12 a'clock.
见 pie chart example or donut chart example to learn how to use QPieSeries.
[read-only]
count
: const
int
This property holds the number of slices in the series.
访问函数:
int | count () const |
通知程序信号:
void | countChanged () |
This property holds the ending angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a'clock.
The default value is 360.
访问函数:
qreal | pieEndAngle () const |
void | setPieEndAngle (qreal angle ) |
This property holds the donut hole size.
The value is relative to the chart rectangle, so that:
当设置此特性时, size property is adjusted if necessary, to ensure that the hole size is not greater than the pie size.
The default value is 0.0.
访问函数:
qreal | holeSize () const |
void | setHoleSize (qreal holeSize ) |
This property holds the horizontal position of the pie.
The value is relative to the chart rectangle, so that:
The default value is 0.5 (center).
访问函数:
qreal | horizontalPosition () const |
void | setHorizontalPosition (qreal relativePosition ) |
另请参阅 verticalPosition .
This property holds the pie size.
The value is relative to the chart rectangle, so that:
当设置此特性时, holeSize property is adjusted if necessary, to ensure that the hole size is not greater than the pie size.
The default value is 0.7.
访问函数:
qreal | pieSize () const |
void | setPieSize (qreal relativeSize ) |
This property holds the starting angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a'clock.
默认值为 0。
访问函数:
qreal | pieStartAngle () const |
void | setPieStartAngle (qreal startAngle ) |
[read-only]
sum
: const
qreal
This property holds the sum of all slices.
The series keeps track of the sum of all the slices it holds.
访问函数:
qreal | sum () const |
通知程序信号:
void | sumChanged () |
This property holds the vertical position of the pie.
The value is relative to the chart rectangle, so that:
The default value is 0.5 (center).
访问函数:
qreal | verticalPosition () const |
void | setVerticalPosition (qreal relativePosition ) |
另请参阅 horizontalPosition .
Constructs a series object that is a child of parent .
[signal]
void
QPieSeries::
added
(const
QList
<
QPieSlice
*> &
slices
)
This signal is emitted when the slices specified by slices are added to the series.
[signal]
void
QPieSeries::
clicked
(
QPieSlice
*
slice
)
This signal is emitted when the slice specified by slice 被点击。
另请参阅 QPieSlice::clicked ().
[signal]
void
QPieSeries::
countChanged
()
This signal is emitted when the slice count changes.
注意: 通知程序信号对于特性 count .
另请参阅 count .
[signal]
void
QPieSeries::
doubleClicked
(
QPieSlice
*
slice
)
This signal is emitted when the slice specified by slice is double-clicked.
另请参阅 QPieSlice::doubleClicked ().
[signal]
void
QPieSeries::
hovered
(
QPieSlice
*
slice
,
bool
state
)
This signal is emitted when a mouse is hovered over the slice specified by
slice
. When the mouse moves over the slice,
state
turns
true
, and when the mouse moves away again, it turns
false
.
另请参阅 QPieSlice::hovered ().
[signal]
void
QPieSeries::
pressed
(
QPieSlice
*
slice
)
This signal is emitted when the user clicks the slice specified by slice and holds down the mouse button.
另请参阅 QPieSlice::pressed ().
[signal]
void
QPieSeries::
released
(
QPieSlice
*
slice
)
This signal is emitted when the user releases the mouse press on the slice specified by slice .
另请参阅 QPieSlice::released ().
[signal]
void
QPieSeries::
removed
(const
QList
<
QPieSlice
*> &
slices
)
This signal is emitted when the slices specified by slices are removed from the series.
另请参阅 remove ().
[signal]
void
QPieSeries::
sumChanged
()
This signal is emitted when the sum of all slices changes.
注意: 通知程序信号对于特性 sum .
另请参阅 sum .
[virtual]
QPieSeries::
~QPieSeries
()
Removes the pie series and its slices.
Appends the slice specified by slice to the series. Slice ownership is passed to the series.
返回
true
if appending succeeds.
Appends the array of slices specified by slices to the series. Slice ownership is passed to the series.
返回
true
if appending succeeds.
Appends a single slice with the specified
value
and
label
to the series. Slice ownership is passed to the series. Returns null if
value
is
NaN
,
Inf
,或
-Inf
and adds nothing to the series.
Clears all slices from the series.
Returns the number of the slices in this series.
注意: Getter 函数对于特性 count。
Inserts the slice specified by slice to the series before the slice at the position specified by index . Slice ownership is passed to the series.
返回
true
if inserting succeeds.
返回
true
if the series is empty.
Returns the end angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a'clock.
注意: Getter 函数对于特性 endAngle .
另请参阅 setPieEndAngle (), pieStartAngle (),和 setPieStartAngle ().
Removes a single slice, specified by slice , from the series and deletes it permanently.
The pointer cannot be referenced after this call.
返回
true
if the removal succeeds.
Sets the position of all the slice labels to position .
注意: This function affects only the current slices in the series. If a new slice is added, the default label position is QPieSlice::LabelOutside .
另请参阅 QPieSlice::labelPosition () 和 QPieSlice::setLabelPosition ().
Sets the visibility of all slice labels to visible .
注意:
This function affects only the current slices in the series. If a new slice is added, the default label visibility is
false
.
另请参阅 QPieSlice::isLabelVisible () 和 QPieSlice::setLabelVisible ().
Sets the end angle of the pie.
A full pie is 360 degrees, where 0 degrees is at 12 a'clock.
angle must be greater than the start angle.
注意: Setter 函数对于特性 endAngle .
另请参阅 pieEndAngle (), pieStartAngle (),和 setPieStartAngle ().
Returns a list of slices that belong to this series.
Returns the sum of all slice values in this series.
注意: Getter function for property sum.
另请参阅 QPieSlice::value (), QPieSlice::setValue (),和 QPieSlice::percentage ().
Takes a single slice, specified by slice , from the series. Does not delete the slice object.
注意: The series remains the slice's parent object. You must set the parent object to take full ownership.
返回
true
if the take operation was successful.
[override virtual]
QAbstractSeries::SeriesType
QPieSeries::
type
() const
重实现访问函数为特性: QAbstractSeries::type .
Returns the type of the series.
Appends the slice specified by slice to the series and returns a reference to the series. Slice ownership is passed to the series.