Legend QML Type

Legend is part of Qt Chart QML API. More...

Import Statement: import QtCharts 2.1
Instantiates: QLegend


Detailed Description

Legend is a graphical object, which displays legend of the chart. Legend state is updated by ChartView, when series have been changed. Legend is used via ChartView class. For example:

ChartView {
    legend.visible: true
    legend.alignment: Qt.AlignBottom
    // Add a few series...

Please note that there is no QML API available for modifying legend markers, unlike in the Qt API of Charts. The use case of modifying markers can be implemented for example by creating your own custom legend. For an example on how to do this, see Qml Custom Example application.

Property Documentation

alignment : Qt.Alignment

The alignment of the legend.

Legend paints on the defined position in the chart. The following alignments are supported: Qt.AlignTop, Qt.AlignBottom, Qt.AlignLeft, Qt.AlignRight. If you set more than one flag the result is undefined.

backgroundVisible : bool

Whether the legend background is visible or not.

borderColor : color

The border color of the legend, i.e. the line color.

color : color

The color of the legend, i.e. the background (brush) color.

font : Font

The font of markers used by legend.

labelColor : color

The color of brush used to draw labels.

reverseMarkers : bool

Whether reverse order is used for the markers in legend or not. False by default.

showToolTips : bool

Whether tooltips are shown when the text is truncated. This is false by default. This currently has no effect as there is no support for tooltips in QML.

visible : bool

Whether the legend is visible or not.

By default, this property is true.

See also QGraphicsObject::visible.

© 2016 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.