- Qt 6.8
- Qt Charts
- QML Types
- VCandlestickModelMapper
- Qt Charts | Commercial or GPLv3

# VCandlestickModelMapper QML Type

Vertical model mapper for a candlestick series. More...

Import Statement: | import QtCharts 2.8
Since: | QtCharts 2.2
Instantiates: | QVCandlestickModelMapper

- List of all members, including inherited members

## Properties

- closeRow : int
- firstSetColumn : int
- highRow : int
- lastSetColumn : int
- lowRow : int
- model : QAbstractItemModel
- openRow : int
- series : CandlestickSeries
- timestampRow : int

## Detailed Description

Model mappers enable using a data model derived from the 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
         }
     }

See also CandlestickSeries, CandlestickSet, and HCandlestickModelMapper.

## Property Documentation

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

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

Note: 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

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