GraphsTheme QML Type

A visual style for graphs. More...

Import Statement: import QtGraphs
Instantiates: QGraphsTheme

Properties

Detailed Description

This type is used to specify visual properties that affect the whole graph. There are several built-in themes that can be used as is or modified freely.

Themes can be created from scratch by using the GraphsTheme.Theme.UserDefined enum value.

Default Theme

The following table lists the properties controlled by themes and the default values for QGraphsTheme.Theme.UserDefined.

Usage examples

Using a built-in theme without any modifications:

Scatter3D {
    ...
    theme: GraphsTheme { theme: GraphsTheme.Theme.YellowSeries }
    ...
}

Using a built-in theme and modifying some properties:

Bars3D {
    ...
    theme: GraphsTheme {
        theme: GraphsTheme.Theme.QtGreenNeon
        labelBorderEnabled: true
        labelFont.pointSize: 35
        labelBackgroundEnabled: false
    }
    ...
}

Using a user-defined theme:

Surface3D {
    ...
    theme: GraphsTheme {
        backgroundColor: "red"
        backgroundEnabled: true
        seriesColors: ["blue"]
        colorStyle: GraphsTheme.ColorStyle.Uniform
        labelFont.family: "Lucida Handwriting"
        labelFont.pointSize: 35
        gridEnabled: false
        gridMainColor: "black"
        labelBackgroundColor: "black"
        labelBackgroundEnabled: true
        labelBorderEnabled: false
        labelTextColor: "white"
        multiHighlightColor: "green"
        singleHighlightColor: "darkRed"
        windowColor: "white"
    }
    ...
}

For GraphsTheme enums, see GraphsTheme::ColorStyle and GraphsTheme::Theme.

Property Documentation

backgroundColor : color

The color of the view the graph is drawn into.


backgroundEnabled : bool

Defines whether the view background is drawn by using the value of backgroundColor.


colorScheme : Qt.ColorScheme

The color scheme of the graph in use.

See also Qt::ColorScheme.


colorStyle : GraphsTheme.ColorStyle

The style of the graph colors. One of QGraphsTheme::ColorStyle enum values.

This value can be overridden by setting Abstract3DSeries.colorStyle explicitly in the series.

See also QGraphsTheme::ColorStyle.


gridEnabled : bool

Defines whether the grid lines are drawn. This value affects all grid lines.


gridMainColor : color

The color of the main grid lines.


gridMainWidth : real

The width of the main grid lines

The higher the number, the wider the grid lines will be. The value must be between 0.0 and 1.0.

Only has effect if QAbstract3DGraph::shaderGridEnabled is true


gridSubColor : color

The color of the subgrid lines.


gridSubWidth : real

The width of the subgrid lines

The higher the number, the wider the grid lines will be. The value must be between 0.0 and 1.0.

Only has effect if QAbstract3DGraph::shaderGridEnabled is true


labelBackgroundColor : color

The color of the label backgrounds. Has no effect if labelBackgroundEnabled is false.


labelBackgroundEnabled : bool

Defines whether the label is drawn with a background that uses labelBackgroundColor (including alpha), or with a fully transparent background. Labels with a background are drawn to equal sizes per axis based on the longest label, and the text is centered in them. Labels without a background are drawn as is and are left or right aligned based on their position in the graph.


labelBorderEnabled : bool

Defines whether label borders are drawn for labels that have a background. Has no effect if labelBackgroundEnabled is false.


labelFont : font

Sets the font to be used for labels.


labelTextColor : color

The color of the font used for labels.


labelsEnabled : bool

Defines whether labels are drawn at all. If this is false, all other label properties have no effect.


multiHighlightColor : color

The highlight color for selected objects. Used if selectionMode has the AbstractGraph3D.SelectionRow or AbstractGraph3D.SelectionColumn flag set.


multiHighlightGradient : Gradient

The highlight gradient for selected objects. Used if selectionMode has the AbstractGraph3D.SelectionRow or AbstractGraph3D.SelectionColumn flag set.


plotAreaBackgroundColor : color

The color of the graph plot area background.


plotAreaBackgroundEnabled : bool

Defines whether the plot area background is drawn by using the value of plotAreaBackgroundColor.


seriesColors : list<Color>

The list of base colors to be used for all the objects in the graph, series by series. If there are more series than colors, color list wraps and starts again with the first color in the list. Has no immediate effect if colorStyle is not GraphsTheme.ColorStyle.Uniform.

This can be overridden by setting Abstract3DSeries.baseColor explicitly in the series.


seriesGradients : list<Gradient>

The list of base gradients to be used for all the objects in the graph, series by series. If there are more series than gradients, the gradient list wraps and starts again with the first gradient in the list.

Has no immediate effect if colorStyle is GraphsTheme.ColorStyle.Uniform.

This value can be overridden by setting Abstract3DSeries.baseGradient explicitly in the series.


singleHighlightColor : color

The highlight color for a selected object. Used if selectionMode has the AbstractGraph3D.SelectionItem flag set.


singleHighlightGradient : Gradient

The highlight gradient for a selected object. Used if selectionMode has the AbstractGraph3D.SelectionItem flag set.


theme : GraphsTheme.Theme

The type of the theme. If no type is set, the type is GraphsTheme.Theme.UserDefined. Changing the theme type after the item has been constructed will change all other properties of the theme to what the predefined theme specifies. Changing the theme type of the active theme of the graph will also reset all attached series to use the new theme.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.