<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Display all bars in a barset in one category.]]></title><description><![CDATA[<p dir="auto">Hi. Here is a piece of code:<br />
QBarSet *set2 = new QBarSet("A");<br />
*set2 &lt;&lt; 294 &lt;&lt; 246 &lt;&lt; 257 &lt;&lt; 319 &lt;&lt; 300 &lt;&lt; 325;<br />
QBarSet *set3 = new QBarSet("B");<br />
*set3 &lt;&lt; 248 &lt;&lt; 244 &lt;&lt; 265 &lt;&lt; 281 &lt;&lt; 278 &lt;&lt; 313;<br />
QStringList category;<br />
category &lt;&lt; "2013" &lt;&lt; "2014";<br />
If I use the QBarSeries, the bars from the sets are interleaved, which is not what I want.<br />
I want to display all bars from set2 in category 2013 and those from set3 in category 2014.<br />
How do I do it?<br />
Thank you.</p>
]]></description><link>https://forum.qt.io/topic/157231/display-all-bars-in-a-barset-in-one-category</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 04:46:30 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/157231.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 13 Jun 2024 00:56:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Display all bars in a barset in one category. on Thu, 13 Jun 2024 02:59:52 GMT]]></title><description><![CDATA[<p dir="auto">Thank you. Could you recommend a Qt's data structure to display the numbers 294 &lt;&lt; 246 &lt;&lt; 257 &lt;&lt; 319 &lt;&lt; 300 &lt;&lt; 325 in bar form?</p>
]]></description><link>https://forum.qt.io/post/802531</link><guid isPermaLink="true">https://forum.qt.io/post/802531</guid><dc:creator><![CDATA[ntos]]></dc:creator><pubDate>Thu, 13 Jun 2024 02:59:52 GMT</pubDate></item><item><title><![CDATA[Reply to Display all bars in a barset in one category. on Thu, 13 Jun 2024 01:44:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ntos">@<bdi>ntos</bdi></a> said in <a href="/post/802524">Display all bars in a barset in one category.</a>:</p>
<blockquote>
<p dir="auto">If I use the QBarSeries, the bars from the sets are interleaved, which is not what I want.<br />
I want to display all bars from set2 in category 2013 and those from set3 in category 2014.</p>
</blockquote>
<p dir="auto">See how <code>QBarSet</code> actually works, which is not as you think:</p>
<blockquote>
<p dir="auto"><code>A bar set contains one data value for each category. The first value of a set is assumed to belong to the first category, the second one to the second category, and so on. If the set has fewer values than there are categories, the missing values are assumed to be located at the end of the set</code></p>
</blockquote>
<p dir="auto">(from: <a href="https://doc.qt.io/qt-6/qbarset.html#details" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qbarset.html#details</a>)</p>
<p dir="auto">So your</p>
<pre><code>*set2 &lt;&lt; 294 &lt;&lt; 246 &lt;&lt; 257 &lt;&lt; 319 &lt;&lt; 300 &lt;&lt; 325;
</code></pre>
<p dir="auto">is not fully cat.A. or cat.B.<br />
<code>294</code> is category "2013", <code>246</code> is category "2014"</p>
<p dir="auto">In general, a set is expected to have <strong>a value for each category</strong> and <strong>not all values for one category</strong>.</p>
<p dir="auto">You will find a better example here:</p>
<ul>
<li><a href="https://doc.qt.io/qt-6/qtcharts-barchart-example.html" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qtcharts-barchart-example.html</a></li>
</ul>
<p dir="auto">In your case, I think you can't use <code>QBarSet</code> in the way you do currently.</p>
<p dir="auto">Either implement your own "logic" to handle this or deal with it that your data index equals the category.</p>
]]></description><link>https://forum.qt.io/post/802526</link><guid isPermaLink="true">https://forum.qt.io/post/802526</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Thu, 13 Jun 2024 01:44:35 GMT</pubDate></item></channel></rss>