- Qt 5.15
- Qt Charts
- QML Types
- HCandlestickModelMapper QML Type
- Qt Charts | Commercial or GPLv3

# HCandlestickModelMapper QML Type

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

Import Statement: | import QtCharts 2.15
Since: | QtCharts 2.2

- List of all members, including inherited members

## Properties

- closeColumn : int
- firstSetRow : int
- highColumn : int
- lastSetRow : int
- lowColumn : int
- model : QAbstractItemModel
- openColumn : int
- series : CandlestickSeries
- timestampColumn : int

## Detailed Description

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

See also CandlestickSeries, CandlestickSet, and VCandlestickModelMapper.

## Property Documentation

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.

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