PieSeries QML Type

Presents data in pie graphs. More...

Import Statement: import QtGraphs
In C++: QPieSeries
Inherits:

AbstractSeries

Properties

Signals

Methods

  • PieSlice append(string label, real value)
  • PieSlice at(int index)
  • clear()
  • PieSlice find(string label)
  • bool remove(PieSlice slice)
  • bool remove(int index)
  • void removeMultiple(int index, int count)
  • bool replace(list<PieSlice> slices)
  • bool replace(PieSlice oldSlice, PieSlice newSlice)
  • bool replace(int index, PieSlice slice)
  • bool take(PieSlice slice)

Detailed Description

A pie series consists of slices that are defined using the PieSlice type. The slices can have any values as the PieSeries type 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 graph.

Pie size and position on the graph are controlled by using relative values that range from 0.0 to 1.0. These relate to the actual graph 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 o'clock.

The following QML example shows how to create a simple pie graph.

See also PieSlice and GraphsView.

Property Documentation

count : int [read-only]

The number of slices in the series.


endAngle : real

The ending angle of the pie.

A full pie is 360 degrees, where 0 degrees is at 12 o'clock.

The default value is 360.


holeSize : real

The donut hole size.

When setting the size property, this property is adjusted if necessary, to ensure that the hole size is not greater than the pie size.

The default value is 0.0.


horizontalPosition : real

The horizontal position of the pie.

The value is relative to the graph rectangle, so that:

  • 0.0 is the absolute left.
  • 1.0 is the absolute right.

The default value is 0.5 (center).

See also verticalPosition.


size : real

The pie size.

The value is relative to the graph rectangle, so that:

  • 0.0 is the minimum size (pie not drawn).
  • 1.0 is the maximum size that can fit the graph.

When setting this property, the 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.


startAngle : real

The starting angle of the pie.

A full pie is 360 degrees, where 0 degrees is at 12 o'clock.

The default value is 0.


sum : real [read-only]

The sum of all slices.

The series keeps track of the sum of all the slices it holds.


verticalPosition : real

The vertical position of the pie.

The value is relative to the graph rectangle, so that:

  • 0.0 is the absolute top.
  • 1.0 is the absolute bottom.

The default value is 0.5 (center).

See also horizontalPosition.


Signal Documentation

added(list<PieSlice> slices)

This signal is emitted when the slices specified by slices are added to the series.

Note: The corresponding handler is onAdded.


countChanged()

This signal is emitted when the slice count changes.

Note: The corresponding handler is onCountChanged.

See also count.


endAngleChanged()

This signal is emitted when the pie end angle changes.

Note: The corresponding handler is onEndAngleChanged.

See also endAngle.


holeSizeChanged()

This signal is emitted when the donut hole size changes.

Note: The corresponding handler is onHoleSizeChanged.

See also holeSize.


horizontalPositionChanged()

This signal is emitted when the horizontal position changes.

Note: The corresponding handler is onHorizontalPositionChanged.

See also horizontalPosition.


removed(list<PieSlice> slices)

This signal is emitted when the slices specified by slices are removed from the series.

Note: The corresponding handler is onRemoved.


sizeChanged()

This signal is emitted when the pie size changes.

Note: The corresponding handler is onSizeChanged.

See also size.


startAngleChanged()

This signal is emitted when the pie start angle changes.

Note: The corresponding handler is onStartAngleChanged.

See also startAngle.


sumChanged()

This signal is emitted when the sum of all slices changes.

Note: The corresponding handler is onSumChanged.

See also sum.


verticalPositionChanged()

This signal is emitted when the vertical position changes.

Note: The corresponding handler is onVerticalPositionChanged.

See also verticalPosition.


Method Documentation

PieSlice append(string label, real value)

Adds a new slice with the label label and the value value to the pie.


PieSlice at(int index)

Returns the slice at the position specified by index. Returns null if the index is not valid.


clear()

Removes all slices from the pie.


PieSlice find(string label)

Returns the first slice that has the label label. Returns null if the label is not found.


bool remove(PieSlice slice)

Removes the slice specified by slice from the pie. Returns true if the removal was successful, false otherwise.


bool remove(int index)

Removes the slice specified by index from the pie. Returns true if the removal was successful, false otherwise.


void removeMultiple(int index, int count)

Removes a range of slices as specified by the index and count. The call traverses over all slices even if removal of one fails.


bool replace(list<PieSlice> slices)

Completely replaces all current slices with slices. The size does not need to match. Returns false if any of the PieSlice in slices is invalid.


bool replace(PieSlice oldSlice, PieSlice newSlice)

Replaces the slice specified by oldSlice with newSlice. Returns true if the removal was successful, false otherwise. oldSlice is destroyed if this is successful.


bool replace(int index, PieSlice slice)

Replaces the slice specified by slice from the pie at index. Returns true if the replace was successful, false otherwise.


bool take(PieSlice slice)

Takes a single slice, specified by slice, from the series. Does not delete the slice object. Returns true if successful.


© 2024 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.