mirror of https://github.com/qt/qtcharts.git
Review corrections for pie
This commit is contained in:
parent
dea6d72e28
commit
fe666a26d3
|
@ -26,8 +26,8 @@ int main(int argc, char *argv[])
|
|||
//! [1]
|
||||
|
||||
//! [2]
|
||||
series->enableHoverHighlight(true);
|
||||
series->enableClickExplodes(true);
|
||||
series->setHoverHighlighting();
|
||||
series->setClickExplodes();
|
||||
//! [2]
|
||||
|
||||
window.setCentralWidget(chartView);
|
||||
|
|
|
@ -106,18 +106,13 @@ bool QPieSeries::ChangeSet::isEmpty() const
|
|||
|
||||
The pie series defines a pie chart which consists of pie slices which are 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 (span) is determined by that relative value.
|
||||
The actual slice size is determined by that relative value.
|
||||
|
||||
By default the pie is defined as full but it can be a partial pie.
|
||||
By default the pie is defined as a full pie but it can be a partial pie.
|
||||
This can be done by setting a starting angle and angle span to the series.
|
||||
|
||||
Example on how to create a chart with pie series:
|
||||
\snippet ../example/piechart/main.cpp 1
|
||||
|
||||
To help with the most common user intercation scenarions there some convenience functions. Specifically
|
||||
exploding and higlighting:
|
||||
\snippet ../example/piechart/main.cpp 2
|
||||
|
||||
To help with the most common user interaction scenarions there some convenience functions.
|
||||
Like exploding a slice when clicked and higlighting when user hovers over a slice.
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -341,7 +336,7 @@ void QPieSeries::setLabelsVisible(bool visible)
|
|||
|
||||
\sa QPieSlice::isExploded(), QPieSlice::setExploded(), QPieSlice::setExplodeDistance()
|
||||
*/
|
||||
void QPieSeries::enableClickExplodes(bool enable)
|
||||
void QPieSeries::setClickExplodes(bool enable)
|
||||
{
|
||||
if (enable)
|
||||
connect(this, SIGNAL(clicked(QPieSlice*)), this, SLOT(toggleExploded(QPieSlice*)));
|
||||
|
@ -357,7 +352,7 @@ void QPieSeries::enableClickExplodes(bool enable)
|
|||
\sa QPieSlice::isExploded(), QPieSlice::setExploded()
|
||||
*/
|
||||
|
||||
void QPieSeries::enableHoverHighlight(bool enable)
|
||||
void QPieSeries::setHoverHighlighting(bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
connect(this, SIGNAL(hoverEnter(QPieSlice*)), this, SLOT(highlightOn(QPieSlice*)));
|
||||
|
|
|
@ -66,20 +66,17 @@ public:
|
|||
void clear();
|
||||
|
||||
int count() const;
|
||||
|
||||
QList<QPieSlice*> slices() const;
|
||||
|
||||
void setSizeFactor(qreal sizeFactor);
|
||||
qreal sizeFactor() const;
|
||||
|
||||
void setPosition(PiePosition position);
|
||||
PiePosition position() const;
|
||||
|
||||
void setSpan(qreal startAngle, qreal angleSpan);
|
||||
|
||||
void setLabelsVisible(bool visible);
|
||||
void enableClickExplodes(bool enable);
|
||||
void enableHoverHighlight(bool enable);
|
||||
void setLabelsVisible(bool visible = true);
|
||||
void setClickExplodes(bool enable = true);
|
||||
void setHoverHighlighting(bool enable = true);
|
||||
|
||||
// TODO: find slices?
|
||||
// QList<QPieSlice*> findByValue(qreal value);
|
||||
|
|
|
@ -135,6 +135,7 @@ qreal QPieSlice::explodeDistance() const
|
|||
|
||||
/*!
|
||||
Returns the percentage of this slice compared to all slices in the same series.
|
||||
The returned value ranges from 0 to 1.0.
|
||||
|
||||
Updated internally after the slice is added to the series.
|
||||
*/
|
||||
|
@ -283,7 +284,7 @@ void QPieSlice::setLabelVisible(bool visible)
|
|||
|
||||
/*!
|
||||
Sets this slice \a exploded.
|
||||
\sa isExploded(), setExplodeDistance(), QPieSeries::enableClickExplodes()
|
||||
\sa isExploded(), setExplodeDistance(), QPieSeries::setClickExplodes()
|
||||
*/
|
||||
void QPieSlice::setExploded(bool exploded)
|
||||
{
|
||||
|
@ -296,7 +297,7 @@ void QPieSlice::setExploded(bool exploded)
|
|||
/*!
|
||||
Sets the explosion \a distance of this slice.
|
||||
It is the distance the slice is moved away from the pie center.
|
||||
\sa explodeDistance(), isExploded(), QPieSeries::enableClickExplodes()
|
||||
\sa explodeDistance(), isExploded(), QPieSeries::setClickExplodes()
|
||||
*/
|
||||
void QPieSlice::setExplodeDistance(qreal distance)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue