Vertical model mapper for a candlestick series. 更多...
导入语句: | import QtCharts 2.2 |
Since: | QtCharts 2.2 |
实例化: | QVCandlestickModelMapper |
模型映射器允许使用的数据模型派生自 QAbstractItemModel class as a data source for a chart. A vertical model mapper is used to create a connection between a data model and CandlestickSeries , so that each column in the data model defines a candlestick item and each row 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 columns). Each candlestick item contains data defined by the timestamp, open, high, low, and close rows. The name of an item is defined by the horizontal header of the column.
CandlestickSeries { VCandlestickModelMapper { model: myCustomModel // QAbstractItemModel derived implementation timestampRow: 1 openRow: 2 highRow: 3 lowRow: 4 closeRow: 5 firstSetColumn: 1 lastSetColumn: 3 } }
另请参阅 CandlestickSeries , CandlestickSet ,和 HCandlestickModelMapper .
closeRow : int |
The row of the model that contains the close values of the candlestick items in the series. The default value is -1 (invalid mapping).
firstSetColumn : int |
The column of the model that is used as the data source for the first item. The default value is -1 (invalid mapping).
highRow : int |
The row of the model that contains the high values of the candlestick items in the series. The default value is -1 (invalid mapping).
lastSetColumn : int |
The column of the model that is used as the data source for the last item. The default value is -1 (invalid mapping).
lowRow : int |
The row of the model that contains the low values of the candlestick items in the series. The default value is -1 (invalid mapping).
model : QAbstractItemModel |
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.
openRow : int |
The row of the model that contains the open values of the candlestick items in the series. The default value is -1 (invalid mapping).
series : CandlestickSeries |
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 (but it preserves its data).
timestampRow : int |
The row of the model that contains the timestamp values of the candlestick items in the series. The default value is -1 (invalid mapping).