用于 Qt Charts API 的 C++ 类。 更多...
This module is deprecated since 6.10. We strongly advise against using it in new code.
| 用于专用轴类的基类 | |
| 用于所有条形系列类的抽象父级类 | |
| 用于所有 Qt Chart 系列的基类 | |
| Legend marker for an area series | |
| 在区域图表中呈现数据 | |
| 将类别添加到图表轴 | |
| Legend marker for a bar series | |
| 将一系列数据按类别分组呈现为垂直条形 | |
| 表示条形图表中的一组条形 | |
| Legend marker for a box plot series | |
| Presents data in box-and-whiskers charts | |
| Represents one item in a box-and-whiskers chart | |
| Legend marker for a candlestick series | |
| Abstract model mapper class for candlestick series | |
| Presents data as candlesticks | |
| Represents a single candlestick item in a candlestick chart | |
| Places named ranges on the axis | |
| 管理图表的系列、图例和轴的图形表示 | |
| 可以显示图表的独立 Widget | |
| Displays a color scale as one of the chart's axes | |
| Adds dates and times to a chart's axis | |
| Horizontal model mapper for bar series | |
| Horizontal model mapper for box plot series | |
| Horizontal model mapper for a candlestick series | |
| Horizontal model mapper for pie series | |
| Horizontal model mapper for line, spline, and scatter series | |
| Presents a series of data as horizontal bars grouped by category | |
| Presents a series of categorized data as a percentage of each category | |
| Presents a series of data as horizontally stacked bars, with one bar per category | |
| 显示图表的图例 | |
| Abstract object that can be used to access markers within a legend | |
| 以线图表形式呈现数据 | |
| Adds a logarithmic scale to a chart's axis | |
| Presents a series of categorized data as a percentage of each category | |
| Legend marker for a pie series | |
| Presents data in pie charts | |
| Represents a single slice in a pie series | |
| Presents data in polar charts | |
| Presents data in scatter charts | |
| 以样条线图表形式呈现数据 | |
| Presents a series of data as vertically stacked bars, with one bar per category | |
| Vertical model mapper for bar series | |
| Vertical model mapper for box plot series | |
| Vertical model mapper for a candlestick series | |
| Vertical model mapper for pie series | |
| Vertical model mapper for line, spline, and scatter series | |
| 将值添加到图表轴 | |
| Legend marker for a line, spline, or scatter series | |
| Base class for line, spline, and scatter series |
使用 QtGraphs 代替。
Charts API 构建于 Qt 图形视图框架之上。Charts 可以显示为 QGraphicsWidget 使用 QChart 类。不管怎样,还有方便类 QChartView ,其是 QWidget 基于。这些使我们能够快速将 Qt Charts 用作正常 Qt 小部件。
注意: 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 形状 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.
注意: 采用 Qt Creator 的 Qt Quick 应用程序向导创建的工程是基于 Qt Quick 2 的模板使用 QGuiApplication 默认情况下。所有这种 QGuiApplication 实例在工程中均必须被替换采用 QApplication 因为模块依赖于 Qt 的 图形视图框架 为渲染。
要将模块用于 CMake,使用
find_package()
命令定位所需模块组件在
Qt6
包:
find_package(Qt6 COMPONENTS Charts REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Charts)
要采用 qmake 构建模块,将模块添加作为值对于
QT
变量在工程的 .pro 文件:
QT += charts
各图表类型的表示通过 QAbstractSeries 派生类。要创建图表,用户必须使用相关系列类的实例并将它添加到 QChart 实例。
QLineSeries* series = new QLineSeries(); series->append(0, 6); series->append(2, 4); ... chartView->chart()->addSeries(series); chartView->chart()->createDefaultAxes();