HCandlestickModelMapper QML Type

Horizontal model mapper for a candlestick series. 更多...

import 语句: import QtCharts 2.3
Since: QtCharts 2.2
实例化: QHCandlestickModelMapper

特性

详细描述

模型映射器允许使用的数据模型派生自 QAbstractItemModel class as a data source for a chart. A horizontal model mapper is used to create a connection between a data model and CandlestickSeries , so that each row in the data model defines a candlestick item and each column maps to the open, high, low, close, and timestamp values of the candlestick item.

Both model and candlestick series properties can be used to manipulate the data. The model mapper keeps the candlestick series and the data model in sync.

The model mapper ensures that all the candlestick items in the candlestick series have equal sizes. Therefore, adding or removing a value from a candlestick item causes the same change to be made in all the candlestick items in the candlestick series.

The following QML example creates a candlestick series with three candlestick items (assuming the model has at least four rows). Each candlestick item contains data defined by the timestamp, open, high, low, and close columns. The name of an item is defined by the vertical header of the row.

CandlestickSeries {
    HCandlestickModelMapper {
        model: myCustomModel // QAbstractItemModel derived implementation
        timestampColumn: 1
        openColumn: 2
        highColumn: 3
        lowColumn: 4
        closeColumn: 5
        firstSetRow: 1
        lastSetRow: 3
    }
}
					

另请参阅 CandlestickSeries , CandlestickSet ,和 VCandlestickModelMapper .

特性文档编制

closeColumn : int

The column of the model that contains the close values of the candlestick items in the series. The default value is -1 (invalid mapping).

firstSetRow : int

The row of the model that is used as the data source for the first item. The default value is -1 (invalid mapping).

highColumn : int

The column of the model that contains the high values of the candlestick items in the series. The default value is -1 (invalid mapping).

lastSetRow : int

The row of the model that is used as the data source for the last item. The default value is -1 (invalid mapping).

lowColumn : int

The column of the model that contains the low values of the candlestick items in the series. The default value is -1 (invalid mapping).

model : QAbstractItemModel

The QAbstractItemModel -based model that is used by the mapper. The model must be implemented and exposed to QML.

注意: The model used must support adding and removing rows or columns and modifying the data of the cells.

openColumn : int

The column of the model that contains the open values of the candlestick items in the series. The default value is -1 (invalid mapping).

series : CandlestickSeries

The CandlestickSeries based object that is used by the mapper.

All the data in the series is discarded when it is set to the mapper. When a new series is specified, the old series is disconnected (preserving its data).

timestampColumn : int

The column of the model that contains the timestamp values of the candlestick items in the series. The default value is -1 (invalid mapping).