<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qcategoryaxis.cpp --> <title>CategoryAxis 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 >CategoryAxis 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="#methods">Methods</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">CategoryAxis QML Type</h1> <span class="subtitle"></span> <!-- $$$CategoryAxis-brief --> <p><a href="qml-qtcharts-categoryaxis.html">CategoryAxis</a> places named ranges on the axis. <a href="#details">More...</a></p> <!-- @@@CategoryAxis --> <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-categoryaxis.html"><a href="qcategoryaxis.html">QCategoryAxis</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtcharts-abstractaxis.html">AbstractAxis</a></p> </td></tr></table></div><ul> <li><a href="qml-qtcharts-categoryaxis-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-categoryaxis.html#categoriesLabels-prop">categoriesLabels</a></b></b> : StringList</li> <li class="fn"><b><b><a href="qml-qtcharts-categoryaxis.html#count-prop">count</a></b></b> : int</li> <li class="fn"><b><b><a href="qml-qtcharts-categoryaxis.html#labelsPosition-prop">labelsPosition</a></b></b> : enumeration</li> <li class="fn"><b><b><a href="qml-qtcharts-categoryaxis.html#startValue-prop">startValue</a></b></b> : int</li> </ul> <a name="methods"></a> <h2 id="methods">Methods</h2> <ul> <li class="fn"><b><b><a href="qml-qtcharts-categoryaxis.html#append-method">append</a></b></b>(string <i>label</i>, real <i>endValue</i>)</li> <li class="fn"><b><b><a href="qml-qtcharts-categoryaxis.html#remove-method">remove</a></b></b>(string <i>label</i>)</li> <li class="fn"><b><b><a href="qml-qtcharts-categoryaxis.html#replace-method">replace</a></b></b>(string <i>oldLabel</i>, string <i>newLabel</i>)</li> </ul> <!-- $$$CategoryAxis-description --> <a name="details"></a> <h2 id="details">Detailed Description</h2> <p>This type can be used to explain the underlying data by adding labeled categories. The widths of the category ranges can be specified freely.</p> <p>For example:</p> <p class="centerAlign"><img src="images/examples_qmlaxes3.png" alt="" /></p><pre class="qml"> <span class="type"><a href="qml-qtcharts-chartview.html">ChartView</a></span> { <span class="name">title</span>: <span class="string">"Numerical Data for Dummies"</span> <span class="name">anchors</span>.fill: <span class="name">parent</span> <span class="name">legend</span>.visible: <span class="number">false</span> <span class="name">antialiasing</span>: <span class="number">true</span> <span class="type"><a href="qml-qtcharts-lineseries.html">LineSeries</a></span> { <span class="name">axisY</span>: <span class="name">CategoryAxis</span> { <span class="name">min</span>: <span class="number">0</span> <span class="name">max</span>: <span class="number">30</span> <span class="type"><a href="qml-qtcharts-categoryrange.html">CategoryRange</a></span> { <span class="name">label</span>: <span class="string">"critical"</span> <span class="name">endValue</span>: <span class="number">2</span> } <span class="type"><a href="qml-qtcharts-categoryrange.html">CategoryRange</a></span> { <span class="name">label</span>: <span class="string">"low"</span> <span class="name">endValue</span>: <span class="number">4</span> } <span class="type"><a href="qml-qtcharts-categoryrange.html">CategoryRange</a></span> { <span class="name">label</span>: <span class="string">"normal"</span> <span class="name">endValue</span>: <span class="number">7</span> } <span class="type"><a href="qml-qtcharts-categoryrange.html">CategoryRange</a></span> { <span class="name">label</span>: <span class="string">"high"</span> <span class="name">endValue</span>: <span class="number">15</span> } <span class="type"><a href="qml-qtcharts-categoryrange.html">CategoryRange</a></span> { <span class="name">label</span>: <span class="string">"extremely high"</span> <span class="name">endValue</span>: <span class="number">30</span> } } <span class="type"><a href="qml-qtcharts-xypoint.html">XYPoint</a></span> { <span class="name">x</span>: <span class="number">0</span>; <span class="name">y</span>: <span class="number">4.3</span> } <span class="type"><a href="qml-qtcharts-xypoint.html">XYPoint</a></span> { <span class="name">x</span>: <span class="number">1</span>; <span class="name">y</span>: <span class="number">4.1</span> } <span class="type"><a href="qml-qtcharts-xypoint.html">XYPoint</a></span> { <span class="name">x</span>: <span class="number">2</span>; <span class="name">y</span>: <span class="number">4.7</span> } <span class="type"><a href="qml-qtcharts-xypoint.html">XYPoint</a></span> { <span class="name">x</span>: <span class="number">3</span>; <span class="name">y</span>: <span class="number">3.9</span> } <span class="type"><a href="qml-qtcharts-xypoint.html">XYPoint</a></span> { <span class="name">x</span>: <span class="number">4</span>; <span class="name">y</span>: <span class="number">5.2</span> } } } </pre> <!-- @@@CategoryAxis --> <h2>Property Documentation</h2> <!-- $$$categoriesLabels --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="categoriesLabels-prop"> <td class="tblQmlPropNode"><p> <a name="categoriesLabels-prop"></a><span class="name">categoriesLabels</span> : <span class="type">StringList</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The category labels as a list of strings.</p> </div></div><!-- @@@categoriesLabels --> <br/> <!-- $$$count --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="count-prop"> <td class="tblQmlPropNode"><p> <a name="count-prop"></a><span class="name">count</span> : <span class="type">int</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The number of categories.</p> </div></div><!-- @@@count --> <br/> <!-- $$$labelsPosition --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="labelsPosition-prop"> <td class="tblQmlPropNode"><p> <a name="labelsPosition-prop"></a><span class="name">labelsPosition</span> : <span class="type">enumeration</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The position of the category labels. The labels in the beginning and in the end of the axes may overlap other axes' labels when positioned on value.</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>CategoryAxis.AxisLabelsPositionCenter</code></td><td class="topAlign">Labels are centered to category.</td></tr> <tr><td class="topAlign"><code>CategoryAxis.AxisLabelsPositionOnValue</code></td><td class="topAlign">Labels are positioned to the high end limit of the category.</td></tr> </table></div> </div></div><!-- @@@labelsPosition --> <br/> <!-- $$$startValue --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="startValue-prop"> <td class="tblQmlPropNode"><p> <a name="startValue-prop"></a><span class="name">startValue</span> : <span class="type">int</span></p></td></tr> </table></div> </div><div class="qmldoc"><p>The low end of the first category on the axis.</p> </div></div><!-- @@@startValue --> <br/> <h2>Method Documentation</h2> <!-- $$$append --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="append-method"> <td class="tblQmlFuncNode"><p> <a name="append-method"></a><span class="name">append</span>(<span class="type">string</span> <i>label</i>, <span class="type">real</span> <i>endValue</i>)</p></td></tr> </table></div> </div><div class="qmldoc"><p>Appends a new category to the axis with the label <i>label</i>. A category label has to be unique. <i>endValue</i> specifies the high end limit of the category. It has to be greater than the high end limit of the previous category. Otherwise the method returns without adding a new category.</p> </div></div><!-- @@@append --> <br/> <!-- $$$remove --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="remove-method"> <td class="tblQmlFuncNode"><p> <a name="remove-method"></a><span class="name">remove</span>(<span class="type">string</span> <i>label</i>)</p></td></tr> </table></div> </div><div class="qmldoc"><p>Removes a category specified by the label <i>label</i> from the axis.</p> </div></div><!-- @@@remove --> <br/> <!-- $$$replace --> <div class="qmlitem"><div class="qmlproto"> <div class="table"><table class="qmlname"> <tr valign="top" class="odd" id="replace-method"> <td class="tblQmlFuncNode"><p> <a name="replace-method"></a><span class="name">replace</span>(<span class="type">string</span> <i>oldLabel</i>, <span class="type">string</span> <i>newLabel</i>)</p></td></tr> </table></div> </div><div class="qmldoc"><p>Replaces an existing category label specified by <i>oldLabel</i> with <i>newLabel</i>. If the old label does not exist, the method returns without making any changes.</p> </div></div><!-- @@@replace --> <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>