用于 Qt Charts API 的 C++ 类。 更多...
QAbstractAxis | 用于专用轴类的基类 |
QAbstractBarSeries | 用于所有条形系列类的抽象父级类 |
QAbstractSeries | 用于所有 Qt Chart 系列的基类 |
QAreaLegendMarker | Legend marker for an area series |
QAreaSeries | 在区域图表中呈现数据 |
QBarCategoryAxis | 将类别添加到图表轴 |
QBarLegendMarker | Legend marker for a bar series |
QBarSeries | 将一系列数据按类别分组呈现为垂直条形 |
QBarSet | 表示条形图表中的一组条形 |
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 | 管理图表的系列、图例和轴的图形表示 |
QChartView | 可以显示图表的独立 Widget |
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 | 显示图表的图例 |
QLegendMarker | Abstract object that can be used to access markers within a legend |
QLineSeries | 以线图表形式呈现数据 |
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 | 以样条线图表形式呈现数据 |
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 | 将值添加到图表轴 |
QXYLegendMarker | Legend marker for a line, spline, or scatter series |
QXYSeries | Base class for line, spline, and scatter series |
Charts API 构建于 Qt 图形视图框架之上。Charts 可以显示为 QGraphicsWidget 使用 QChart 类。不管怎样,还有方便类 QChartView ,其是 QWidget 基于。这些使我们能够快速将 Qt Charts 用作正常 Qt 小部件。
若打算在应用程序中使用 Qt Charts C++ 类,使用以下 include 和 using 指令:
#include <QtCharts> using namespace QtCharts;
注意: 采用 Qt Creator 的 Qt Quick 应用程序向导创建的工程是基于 Qt Quick 2 的模板使用 QGuiApplication 默认情况下。所有这种 QGuiApplication 实例在工程中均必须被替换采用 QApplication 因为模块依赖于 Qt 的 图形视图框架 为渲染。
要链接到 Qt Charts 模块,添加此行到
qmake
工程文件:
QT += charts
各图表类型的表示通过 QAbstractSeries 派生类。要创建图表,用户必须使用相关系列类的实例并将它添加到 QChart 实例。
QLineSeries* series = new QLineSeries(); series->append(0, 6); series->append(2, 4); ... chartView->chart()->addSeries(series); chartView->chart()->createDefaultAxes();