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 類型

AbstractAxis

用於專用軸類型的基本類型

AbstractBarSeries

用於所有條形係列類型的抽象父級類型

AbstractSeries

用於所有 Qt Chart 係列類型的基類型

AreaSeries

在區域圖錶中呈現數據

BarCategoryAxis

將類彆添加到圖錶軸

BarSeries

將一係列數據按類彆分組呈現為垂直條形

BarSet

錶示條形圖錶中的一組條形

BoxPlotSeries

Presents data in box-and-whiskers charts

BoxSet

Represents one item in a box-and-whiskers chart

CandlestickSeries

Represents a series of data as candlesticks

CandlestickSet

Represents a single candlestick item in a candlestick chart

CategoryAxis

Places named ranges on the axis

CategoryRange

Defines a range on a category axis

ChartView

管理圖錶的係列、圖例和軸的圖形錶示

DateTimeAxis

Adds dates and times to a chart's axis

HBarModelMapper

Horizontal model mapper for bar series

HBoxPlotModelMapper

Horizontal model mapper for box plot series

HCandlestickModelMapper

Horizontal model mapper for a candlestick series

HPieModelMapper

Horizontal model mapper for pie series

HXYModelMapper

A horizontal model mapper for XYSeries

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

圖例

顯示圖錶的圖例

LineSeries

以綫圖錶形式呈現數據

LogValueAxis

Adds a logarithmic scale to a chart's axis

Margins

Defines margins between the edge of the chart rectangle and the plot area

PercentBarSeries

Presents a series of categorized data as a percentage of each category

PieSeries

Presents data in pie charts

PieSlice

Represents a single slice in a pie series

PolarChartView

Presents data in polar charts

ScatterSeries

Type presents data in scatter charts

SplineSeries

以樣條綫圖錶形式呈現數據

StackedBarSeries

Presents a series of data as vertically stacked bars, with one bar per category

VBarModelMapper

Vertical model mapper for bar series

VBoxPlotModelMapper

Vertical model mapper for box plot series

VCandlestickModelMapper

Vertical model mapper for a candlestick series

VPieModelMapper

Vertical model mapper for pie series

VXYModelMapper

A vertical model mapper for XYSeries

ValueAxis

將值添加到圖錶軸

XYPoint

Initializes XY-series coordinate data

XYSeries

A base type for line, spline, and scatter series