<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qlegend.cpp --> <title>Legend QML Type | Qt Charts 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtcharts-index.html">Qt Charts</a></td><td ><a href="qtcharts-qmlmodule.html">QML Types</a></td><td >Legend QML Type</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#properties">Properties</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Legend QML Type</h1> <span class="subtitle"></span> <!-- $$$Legend-brief --> <p>Displays the legend of a chart. <a href="#details">More...</a></p> <!-- @@@Legend --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtCharts 2.2</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Instantiates:</td><td class="memItemRight bottomAlign"> <a href="qml-qtcharts-legend.html"><a href="qlegend.html">QLegend</a></td></tr></table></div><ul> <li><a href="qml-qtcharts-legend-members.html">List of all members, including inherited members</a></li> </ul> <a name="properties"></a> <h2 id="properties">Properties</h2> <ul> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#alignment-prop">alignment</a></b></b> : alignment</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#backgroundVisible-prop">backgroundVisible</a></b></b> : bool</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#borderColor-prop">borderColor</a></b></b> : color</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#color-prop">color</a></b></b> : color</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#font-prop">font</a></b></b> : Font</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#labelColor-prop">labelColor</a></b></b> : color</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#markerShape-prop">markerShape</a></b></b> : enumeration</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#reverseMarkers-prop">reverseMarkers</a></b></b> : bool</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#showToolTips-prop">showToolTips</a></b></b> : bool</li> <li class="fn"><b><b><a href="qml-qtcharts-legend.html#visible-prop">visible</a></b></b> : bool</li> </ul> <!-- $$$Legend-description --> <a name="details"></a> <h2 id="details">Detailed Description</h2> <p>A legend is a graphical object that displays the legend of a chart. The legend state is updated by the <a href="qml-qtcharts-chartview.html">ChartView</a> type when series change. The <a href="qtcharts-overview.html#legend">Legend</a> type properties can be attached to the <a href="qml-qtcharts-chartview.html">ChartView</a> type. For example:</p> <pre class="cpp"> ChartView { legend<span class="operator">.</span>visible: <span class="keyword">true</span> legend<span class="operator">.</span>alignment: <span class="type">Qt</span><span class="operator">.</span>AlignBottom <span class="comment">// Add a few series...</span> } </pre> <p class="centerAlign"><img src="images/examples_percentbarchart_legend.png" alt="" /></p><p><b>Note: </b>There is no QML API available for modifying legend markers. Markers can be modified by creating a custom legend, as illustrated by <a href="qtcharts-qmlcustomlegend-example.html">Qml Custom Example</a>.</p><!-- @@@Legend --> <h2>Property Documentation</h2> <!-- $$$alignment --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="alignment-prop"> <td class="tblQmlPropNode"><p> <a name="alignment-prop"></a><span class="name">alignment</span> : <span class="type"><a href="qml-qtcharts-legend.html#alignment-prop">alignment</a></span></p></td></tr> </table></div> </div><div class="qmldoc"><p>Defines how the legend is aligned with the chart. Can be Qt.AlignLeft, Qt.AlignRight, Qt.AlignBottom, or Qt.AlignTop. If you set more than one flag, the result is undefined.</p> </div></div><!-- @@@alignment --> <br/> <!-- $$$backgroundVisible --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="backgroundVisible-prop"> <td class="tblQmlPropNode"><p> <a name="backgroundVisible-prop"></a><span class="name">backgroundVisible</span> : <span class="type">bool</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>Whether the legend background is visible.</p> </div></div><!-- @@@backgroundVisible --> <br/> <!-- $$$borderColor --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="borderColor-prop"> <td class="tblQmlPropNode"><p> <a name="borderColor-prop"></a><span class="name">borderColor</span> : <span class="type">color</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The line color of the legend.</p> </div></div><!-- @@@borderColor --> <br/> <!-- $$$color --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="color-prop"> <td class="tblQmlPropNode"><p> <a name="color-prop"></a><span class="name">color</span> : <span class="type">color</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The background (brush) color of the legend.</p> </div></div><!-- @@@color --> <br/> <!-- $$$font --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="font-prop"> <td class="tblQmlPropNode"><p> <a name="font-prop"></a><span class="name">font</span> : <span class="type">Font</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The font of the markers used by the legend.</p> </div></div><!-- @@@font --> <br/> <!-- $$$labelColor --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="labelColor-prop"> <td class="tblQmlPropNode"><p> <a name="labelColor-prop"></a><span class="name">labelColor</span> : <span class="type">color</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The color of the brush used to draw labels.</p> </div></div><!-- @@@labelColor --> <br/> <!-- $$$markerShape --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="markerShape-prop"> <td class="tblQmlPropNode"><p> <a name="markerShape-prop"></a><span class="name">markerShape</span> : <span class="type">enumeration</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The default shape of the legend markers. The default value is <code>MarkerShapeRectangle</code>.</p> <div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tbldscr">Description</th></tr> <tr><td class="topAlign"><code>Legend.MarkerShapeRectangle</code></td><td class="topAlign">Legend markers are rectangular</td></tr> <tr><td class="topAlign"><code>Legend.MarkerShapeCircle</code></td><td class="topAlign">Legend markers are circular</td></tr> <tr><td class="topAlign"><code>Legend.MarkerShapeFromSeries</code></td><td class="topAlign">Legend marker shape is determined by the series</td></tr> </table></div> <p>This QML property was introduced in Qt 5.9.</p> <p><b>See also </b><a href="qlegend.html#MarkerShape-enum">QLegend::MarkerShape</a>.</p> </div></div><!-- @@@markerShape --> <br/> <!-- $$$reverseMarkers --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="reverseMarkers-prop"> <td class="tblQmlPropNode"><p> <a name="reverseMarkers-prop"></a><span class="name">reverseMarkers</span> : <span class="type">bool</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>Whether reverse order is used for the markers in the legend. This property is <code>false</code> by default.</p> </div></div><!-- @@@reverseMarkers --> <br/> <!-- $$$showToolTips --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="showToolTips-prop"> <td class="tblQmlPropNode"><p> <a name="showToolTips-prop"></a><span class="name">showToolTips</span> : <span class="type">bool</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>Whether tooltips are shown when the text is truncated. This property is <code>false</code> by default. This property currently has no effect as there is no support for tooltips in QML.</p> </div></div><!-- @@@showToolTips --> <br/> <!-- $$$visible --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="visible-prop"> <td class="tblQmlPropNode"><p> <a name="visible-prop"></a><span class="name">visible</span> : <span class="type">bool</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>Whether the legend is visible.</p> <p>By default, this property is <code>true</code>.</p> <p><b>See also </b>QGraphicsObject::visible.</p> </div></div><!-- @@@visible --> <br/> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> 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. </p> </div> </body> </html>