- Qt 6.10
- Qt Graphs
- QML Types
- QtGraphs
- XYModelMapper
- Qt Graphs | Commercial or GPLv3

# XYModelMapper QML Type

A model mapper for XYSeries. More...

Import Statement: | `import QtGraphs`
In C++: | QXYModelMapper

- List of all members, including inherited members
- XYModelMapper is part of Qt Graphs QML Types for 2D.

## Properties

- count : qsizetype
- first : qsizetype
- model : SomeModel
- orientation : orientation
- series : XYSeries
- xSection : qsizetype
- ySection : qsizetype

## Signals

- countChanged()
- firstChanged()
- modelChanged()
- xSectionChanged()
- ySectionChanged()

## Detailed Description

Model mappers enable using a data model derived from the QAbstractItemModel class as a data source for a graph. A model mapper is used to create a connection between a line, spline, or scatter series. A TableModel is a natural choice for the model.

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

See also XYSeries.

## Property Documentation

count : qsizetype

The number of rows of the model that are mapped as the data for series. The default value is -1 (the number is limited by the number of rows in the model).

See also orientation.

first : qsizetype

The row of the model that contains the data for the first point of the series. The default value is 0.

See also orientation.

model : SomeModel

The data model that is used by the mapper. You need to implement the model and expose it to QML.

Note: The model has to support adding and removing rows or columns and modifying the data in the cells.

orientation : orientation

Tells the modelmapper how to map data from a model. If `Qt.Vertical` is used, the model has X and Y columns, and the model's rows define the data points. When the orientation is set to `Qt.Horizontal`, the model has X and Y rows, and the model's columns define the data points.

series : XYSeries

The series 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).

xSection : qsizetype

the section of the model that contains the x-coordinates of data points. The default value is -1 (invalid mapping).

See also orientation.

ySection : qsizetype

the section of the model that contains the y-coordinates of data points. The default value is -1 (invalid mapping).

See also orientation.

## Signal Documentation

countChanged()

This signal is emitted when the number of rows changes.

Note: The corresponding handler is `onCountChanged`.

firstChanged()

This signal is emitted when the first row changes.

Note: The corresponding handler is `onFirstChanged`.

modelChanged()

This signal is emitted when the model that the mapper is connected to changes.

Note: The corresponding handler is `onModelChanged`.

xSectionChanged()

This signal is emitted when the section that contains the x-coordinates of data points changes.

Note: The corresponding handler is `onXSectionChanged`.

ySectionChanged()

This signal is emitted when the section that contains the y-coordinates of data points changes.

Note: The corresponding handler is `onYSectionChanged`.