Qt 5.13 | Qt Charts | Qt Charts C++ Classes

Qt Charts | Commercial or GPLv3

# Qt Charts C++ Classes

C++ classes for the Qt Charts API. More...

## Detailed Description

Charts API is built on top of Qt Graphics View Framework. Charts can be displayed as QGraphicsWidget using the QChart class. However there is also the convenience class QChartView, which is QWidget based. These enable us to quickly use Qt Charts as a normal Qt widget.

If you intend to use Qt Charts C++ classes in your application, use the following include and using directives:

      #include <QtCharts>

      using namespace QtCharts;

Note: Projects created with Qt Creator's Qt Quick Application wizard are based on the Qt Quick 2 template that uses QGuiApplication by default. All such QGuiApplication instances in the project must be replaced with QApplication as the module depends on Qt's Graphics View Framework for rendering.

To link against the Qt Charts module, add this line to your `qmake` project file:

      QT += charts

Each chart type is represented by the QAbstractSeries derived class. To create charts, the users have to use an instance of the related series class and add it to a QChart instance.

      QLineSeries* series = new QLineSeries();
      series->append(0, 6);
      series->append(2, 4);
      ...
      chartView->chart()->addSeries(series);
      chartView->chart()->createDefaultAxes();