// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page qtcharts-lineandbar-example.html
    \title Combining Line and BarChart
    \brief Shows how to combine different charts and set the axes.
    \include gallery.qdocinc

    In the example we combine a linechart with
    a barchart and use the category axis as a common axis for both.

    \image examples_lineandbar.png

    Here we create data for our bar series.

    \snippet chartsgallery/lineandbarwidget.cpp 1

    We create a bar series and append sets to it.
    The first values of each set are grouped together in the first category, the second values in the second category and so on.

    \snippet chartsgallery/lineandbarwidget.cpp 2

    Then we create a line series and add data to it. To make the data match with the barchart, we use the index as an x-value for our line series, so that
    first point is at (0,value) second at (1,value) and so on.

    \snippet chartsgallery/lineandbarwidget.cpp 8

    Here we create the chart and add both series to it.

    \snippet chartsgallery/lineandbarwidget.cpp 3

    To make the chart show the series properly, we have to create custom axes for the series. If we don't create custom axes, then each series will get scaled to
    use the maximum area of the chart (like in single series case) and the result will be incorrect. With custom axes we set the range of both series to follow the
    same axis. For the x-axis we use the QBarCategoryAxis and for the y-axis we use QValuesAxis.

    \snippet chartsgallery/lineandbarwidget.cpp 4

    And we also want to show the legend.

    \snippet chartsgallery/lineandbarwidget.cpp 5

    Finally we add the chart onto a view.

    \snippet chartsgallery/lineandbarwidget.cpp 6

*/
