- Qt 6.8
- Qt Graphs
- QML Types
- QtGraphs
- GraphsView
- Qt Graphs | Commercial or GPLv3

# GraphsView QML Type

Base type for all Qt Graphs views. More...

Import Statement: | `import QtGraphs`

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

## Properties

- axisX : AbstractAxis
- axisXSmoothing : real
- axisY : AbstractAxis
- axisYSmoothing : real
- gridSmoothing : real
- marginBottom : real
- marginLeft : real
- marginRight : real
- marginTop : real
- orientation : Qt.Orientation
- seriesList : list
- shadowBarWidth : real
- shadowColor : color
- shadowSmoothing : real
- shadowVisible : bool
- shadowXOffset : real
- shadowYOffset : real
- theme : GraphsTheme

## Methods

- addSeries(AbstractSeries series)
- bool hasSeries(AbstractSeries series)
- insertSeries(int index, AbstractSeries series)
- removeSeries(AbstractSeries series)
- removeSeries(int index)

## Detailed Description

This class collects the series and theming together and draws the graphs. You will need to import Qt Graphs module to use this type:

     import QtGraphs

After that you can use GraphsView in your qml files:

     import QtQuick
     import QtGraphs

     GraphsView {
         anchors.fill: parent
         theme: GraphsTheme {
             colorScheme: GraphsTheme.ColorScheme.Dark
             seriesColors: ["#E0D080", "#B0A060"]
             borderColors: ["#807040", "#706030"]
             grid.mainColor: "#ccccff"
             grid.subColor: "#eeeeff"
             axisY.mainColor: "#ccccff"
             axisY.subColor: "#eeeeff"
         }
         axisX: BarCategoryAxis {
             categories: ["2023", "2024", "2025"]
             lineVisible: false
         }
         axisY: ValueAxis {
             min: 0
             max: 10
             subTickCount: 4
         }
         BarSeries {
             BarSet {
                 values: [7, 6, 9]
             }
             BarSet {
                 values: [9, 8, 6]
             }
         }
     }

See also BarSeries, LineSeries, BarCategoryAxis, ValueAxis, and GraphsTheme.

## Property Documentation

axisX : AbstractAxis

The x-axis used for the series inside this view.

See also axisY.

axisXSmoothing : real

Controls the graph X axis smoothing (antialiasing) amount. By default, the smoothing is `1.0`.

axisY : AbstractAxis

The y-axis used for the series inside this view.

See also axisX.

axisYSmoothing : real

Controls the graph Y axis smoothing (antialiasing) amount. By default, the smoothing is `1.0`.

gridSmoothing : real

Controls the graph grid smoothing (antialiasing) amount. By default, the smoothing is `1.0`.

marginBottom : real

The amount of empty space on the bottom of the graph. By default, the margin is 20.

marginLeft : real

The amount of empty space on the left of the graph. By default, the margin is 20.

marginRight : real

The amount of empty space on the right of the graph. By default, the margin is 20.

marginTop : real

The amount of empty space on the top of the graph. By default, the margin is 20.

orientation : Qt.Orientation

Determines the orientation of the GraphsView. When the orientation is Qt.Horizontal, axisX and axisY will switch the positions so that axisX is rendered vertically and axisY horizontally. This property is currently used by the BarSeries. The default value is Qt.Vertical.

seriesList : list `[read-only]`

List of series that are rendered by the GraphsView. Filled automatically with the series type children of the GraphsView.

This is the default property, so child elements are automatically added into the series list.

See also BarSeries, LineSeries, and ScatterSeries.

shadowBarWidth : real

Controls the graph grid shadow width. By default, shadow width is set to `2.0`.

shadowColor : color

Controls the graph grid shadow color. By default, shadow color is set to `black`.

shadowSmoothing : real

Controls the graph grid shadow smoothing (antialiasing) amount. By default, shadow smoothing is set to `4.0`.

shadowVisible : bool

Controls if the graph grid shadow is visible. By default, shadow visibility is set to `false`.

shadowXOffset : real

Controls the graph grid shadow X offset. By default, shadow X offset is set to `0.0`.

shadowYOffset : real

Controls the graph grid shadow Y offset. By default, shadow Y offset is set to `0.0`.

theme : GraphsTheme

The theme used by the graph. Determines coloring, axis lines, fonts etc. If theme has not been set, the default theme is used.

## Method Documentation

addSeries(AbstractSeries series)

Appends a series into GraphsView. If the series is null, it will not be added. If the series already belongs to the graph, it will be moved into the end.

bool hasSeries(AbstractSeries series)

Returns `true` if the series is in the graph.

insertSeries(int index, AbstractSeries series)

Inserts a series at the position specified by index. If the series is null, it will not be inserted. If the series already belongs to the graph, it will be moved into index.

removeSeries(AbstractSeries series)

Removes the series from the graph.

removeSeries(int index)

Removes the series specified by index from the graph.