/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Charts module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
     \example nesteddonuts
     \title Nested Donuts Example
     \ingroup qtcharts_examples

     \brief This example shows how to create a nested donuts chart using the QPieSeries API.
     \image examples_nesteddonuts.png

    \include examples-run.qdocinc

    \section1 Creating Nested Donut Charts

     Let's start by creating a QChartView instance and enabling the Antialiasing on it. A QChart object is then obtained from the QChartView instance.
     The legend is disabled and the title of the chart is set. Last line enables the animations of the chart.

     \snippet nesteddonuts/widget.cpp 1

     Three variables are defined that will be used to define the donut chart. Min and max size define the relative size of the whole donut.
     minSize is the relative inner size of the smallest donut. maxSize is the relative outer size of the biggest donut.

     \snippet nesteddonuts/widget.cpp 2

     The following block of code defines the individual donuts and their slices. First a new QPieSeries object is created.
     The number of slices in each donut is randomized.
     The internal for loop creates the slices with a random value and label same as the value.
     Next the label of the slice is set to be visible and its color is set to white.
     To make the example more interesting the hovered signal of the slice is connected to widget's slot,  of which the inner workings are explained later.
     Finally the slice is added to the donut. The donut's size is adjusted to achieve the nesting of the donuts.
     Then the donut is added to the widget's list of donuts and to the chart.

     \snippet nesteddonuts/widget.cpp 3

     Finally the widget is placed in a layout used by the application.

     \snippet nesteddonuts/widget.cpp 4

     To make the example more interesting the donuts are rotated randomly every 1.25 sec.

     \snippet nesteddonuts/widget.cpp 5

     The widget's updatedRotation slot is defined below.
     It goes through all of the donuts and modifies their current rotation by a random value.

     \snippet nesteddonuts/widget.cpp 6

     The earlier mentioned explodeSlice slot code is provided below.
     If the slice is set to exploded, then stop the timer that controls the donuts rotation.
     Then the slice's start and end angles are obtained from the slice.
     To highlight the selected slice all the other donuts that lie outward from the one that contains the selected slice
     have their start and end angles modified so that they wouldn't "block" the way for the hightlighted slice.
     If the slice is no longer selected return to the original state.

     \snippet nesteddonuts/widget.cpp 7
*/
