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 .
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 |