Qt Charts QML 類型

Qt Charts QML API 是在 QML 應用程序中,直觀且簡單展示圖錶的手段。

使用以下 QML 創建簡單餅狀圖錶:

import QtQuick 2.0
import QtCharts 2.0
ChartView {
    width: 400
    height: 300
    theme: ChartView.ChartThemeBrownSand
    antialiasing: true
    PieSeries {
        id: pieSeries
        PieSlice { label: "eaten"; value: 94.9 }
        PieSlice { label: "not yet eaten"; value: 5.1 }
    }
}
					

注意: 從 Qt Creator 3.0 起,采用基於 Qt Quick 2 模闆的 Qt Quick 應用程序嚮導創建的工程使用 QGuiApplication 在默認情況下。由於 Qt Charts 利用 Qt 圖形視圖框架為繪製, QApplication 必須使用。采用嚮導創建的工程可用於 Qt Charts 後於 QGuiApplication 被替換采用 QApplication .

QML 類型

AreaSeries 在區域圖錶中呈現數據
BarCategoryAxis 將類彆添加到圖錶軸
CategoryAxis Places named ranges on the axis
DateTimeAxis Adds dates and times to a chart's axis
LogValueAxis Adds a logarithmic scale to a chart's axis
AbstractAxis 用於專用軸類型的基本類型
ValueAxis 將值添加到圖錶軸
HorizontalBarSeries Presents a series of data as horizontal bars grouped by category
HorizontalPercentBarSeries Presents a series of categorized data as a percentage of each category
HorizontalStackedBarSeries Presents a series of data as stacked horizontal bars, with one bar per category
AbstractBarSeries 用於所有條形係列類型的抽象父級類型
BarSet 錶示條形圖錶中的一組條形
HBarModelMapper Horizontal model mapper for bar series
VBarModelMapper Vertical model mapper for bar series
BarSeries 將一係列數據按類彆分組呈現為垂直條形
PercentBarSeries Presents a series of categorized data as a percentage of each category
StackedBarSeries Presents a series of data as vertically stacked bars, with one bar per category
HBoxPlotModelMapper Horizontal model mapper for box plot series
VBoxPlotModelMapper Vertical model mapper for box plot series
CandlestickSeries Represents a series of data as candlesticks
CandlestickSet Represents a single candlestick item in a candlestick chart
HCandlestickModelMapper Horizontal model mapper for a candlestick series
VCandlestickModelMapper Vertical model mapper for a candlestick series
圖例 顯示圖錶的圖例
LineSeries 以綫圖錶形式呈現數據
HPieModelMapper Horizontal model mapper for pie series
PieSeries Presents data in pie charts
PieSlice Represents a single slice in a pie series
VPieModelMapper Vertical model mapper for pie series
AbstractSeries 用於所有 Qt Chart 係列類型的基類型
ScatterSeries Type presents data in scatter charts
SplineSeries 以樣條綫圖錶形式呈現數據
HXYModelMapper A horizontal model mapper for XYSeries
VXYModelMapper A vertical model mapper for XYSeries
XYSeries A base type for line, spline, and scatter series
BoxPlotSeries Presents data in box-and-whiskers charts
BoxSet Represents one item in a box-and-whiskers chart
CategoryRange Defines a range on a category axis
ChartView 管理圖錶的係列、圖例和軸的圖形錶示
Margins Defines margins between the edge of the chart rectangle and the plot area
PolarChartView Presents data in polar charts
XYPoint Initializes XY-series coordinate data