Qt Charts C++ 類

用於 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
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();