Qt Charts C++ Classes | Qt Charts | Qt 6.11.1
Description: C++ classes for the Qt Charts API.

- Qt 6.11
- Qt Charts
- Qt Charts C++ Classes
- Qt Charts | Commercial or GPLv3

# Qt Charts C++ Classes

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

This module is deprecated since 6.10. We strongly advise against using it in new code.

## Classes

QAbstractAxis | Base class used for specialized axis classes
QAbstractBarSeries | Abstract parent class for all bar series classes
QAbstractSeries | Base class for all Qt Chart series
QAreaLegendMarker | Legend marker for an area series
QAreaSeries | Presents data in area charts
QBarCategoryAxis | Adds categories to a chart's axes
QBarLegendMarker | Legend marker for a bar series
QBarSeries | Presents a series of data as vertical bars grouped by category
QBarSet | Represents one set of bars in a bar chart
QBoxPlotLegendMarker | Legend marker for a box plot series
QBoxPlotSeries | Presents data in box-and-whiskers charts
QBoxSet | Represents one item in a box-and-whiskers chart
QCandlestickLegendMarker | Legend marker for a candlestick series
QCandlestickModelMapper | Abstract model mapper class for candlestick series
QCandlestickSeries | Presents data as candlesticks
QCandlestickSet | Represents a single candlestick item in a candlestick chart
QCategoryAxis | Places named ranges on the axis
QChart | Manages the graphical representation of the chart's series, legends, and axes
QChartView | Standalone widget that can display charts
QColorAxis | Displays a color scale as one of the chart's axes
QDateTimeAxis | Adds dates and times to a chart's axis
QHBarModelMapper | Horizontal model mapper for bar series
QHBoxPlotModelMapper | Horizontal model mapper for box plot series
QHCandlestickModelMapper | Horizontal model mapper for a candlestick series
QHPieModelMapper | Horizontal model mapper for pie series
QHXYModelMapper | Horizontal model mapper for line, spline, and scatter series
QHorizontalBarSeries | Presents a series of data as horizontal bars grouped by category
QHorizontalPercentBarSeries | Presents a series of categorized data as a percentage of each category
QHorizontalStackedBarSeries | Presents a series of data as horizontally stacked bars, with one bar per category
QLegend | Displays the legend of a chart
QLegendMarker | Abstract object that can be used to access markers within a legend
QLineSeries | Presents data in line charts
QLogValueAxis | Adds a logarithmic scale to a chart's axis
QPercentBarSeries | Presents a series of categorized data as a percentage of each category
QPieLegendMarker | Legend marker for a pie series
QPieSeries | Presents data in pie charts
QPieSlice | Represents a single slice in a pie series
QPolarChart | Presents data in polar charts
QScatterSeries | Presents data in scatter charts
QSplineSeries | Presents data as spline charts
QStackedBarSeries | Presents a series of data as vertically stacked bars, with one bar per category
QVBarModelMapper | Vertical model mapper for bar series
QVBoxPlotModelMapper | Vertical model mapper for box plot series
QVCandlestickModelMapper | Vertical model mapper for a candlestick series
QVPieModelMapper | Vertical model mapper for pie series
QVXYModelMapper | Vertical model mapper for line, spline, and scatter series
QValueAxis | Adds values to a chart's axes
QXYLegendMarker | Legend marker for a line, spline, or scatter series
QXYSeries | Base class for line, spline, and scatter series

## Detailed Description

Use QtGraphs instead.

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.

Note: The Qt Charts module has been deprecated since Qt 6.10. For new projects, use the Qt Graphs module instead. Qt Graphs uses each platform's native rendering backend (Metal on macOS, DirectX on Windows, OpenGL or Vulkan on Linux) to achieve hardware-accelerated rendering for both 2D and 3D graphs. Qt Graphs uses Qt Quick Shapes for 2D graph rendering, instead of the outdated Qt Graphics View Framework used by the Qt Charts module. To migrate from Qt Charts to Qt Graphs module, refer to Qt Graphs Migration from Qt Charts.

Using a Qt module's C++ API requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.

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 use the module with CMake, use the `find_package()` command to locate the needed module components in the `Qt6` package:

     find_package(Qt6 COMPONENTS Charts REQUIRED)
     target_link_libraries(mytarget PRIVATE Qt6::Charts)

To use the module for building with qmake, add the module as a value of the `QT` variable in the project's .pro 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();