<?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[QChart Range &#x2F; TickCount Question]]></title><description><![CDATA[<p dir="auto">I have a report from the field on 5.12.x on  a chart.</p>
<p dir="auto">I have the following code with a file with maxTime = 106.4 and printerTimeScale = 0 (1min blocks).</p>
<pre><code>            // *** Chart Area ***
            int numBlocks = 0;
            switch(printerTimeScale) {
            default:
            case 0:
                numBlocks = static_cast&lt;int&gt;(maxTime) + 1;
                break;
            case 1:
                numBlocks = static_cast&lt;int&gt;(maxTime/2.0 + (static_cast&lt;int&gt;(maxTime) % 2) + 1);
                break;
            case 2:
                numBlocks = static_cast&lt;int&gt;(maxTime/5.0 + (static_cast&lt;int&gt;(maxTime) % 5) + 1);
                break;
            }

            reinterpret_cast&lt;QValueAxis*&gt;(chart.axes()[0])-&gt;setTickCount(numBlocks + 1);
            reinterpret_cast&lt;QValueAxis*&gt;(chart.axes()[0])-&gt;setRange(0.0, numBlocks*((printerTimeScale == 0) ? 1.0 : (printerTimeScale == 1) ? 2.0 : 5.0));
</code></pre>
<p dir="auto">The data ends at 106.4 minutes as expected and the last column #107 runs from 107.0 to 108.0.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/af4bb6aa-71df-486f-ab00-3d563fbc2001.png" alt="Acrobat_JuNRXZEbgQ.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">All good so far.  However, if I go to day column #40 it runs from 39.4 to 40.4...why?<br />
<img src="https://ddgobkiprc33d.cloudfront.net/613f6413-340e-4bd5-93f2-84599c0d74b9.png" alt="Acrobat_iJOOs90zlN.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Where is this decimal coming from?</p>
<p dir="auto">Thanks,<br />
-Rich</p>
]]></description><link>https://forum.qt.io/topic/164355/qchart-range-tickcount-question</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Apr 2026 06:18:38 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164355.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 02 Mar 2026 16:56:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QChart Range &#x2F; TickCount Question on Fri, 06 Mar 2026 05:04:26 GMT]]></title><description><![CDATA[<p dir="auto">How much does it affect you if the graph's boundaries grow by one unit? If the graph is drawn correctly, there shouldn't be a problem.</p>
]]></description><link>https://forum.qt.io/post/836839</link><guid isPermaLink="true">https://forum.qt.io/post/836839</guid><dc:creator><![CDATA[Joe von Habsburg]]></dc:creator><pubDate>Fri, 06 Mar 2026 05:04:26 GMT</pubDate></item><item><title><![CDATA[Reply to QChart Range &#x2F; TickCount Question on Wed, 04 Mar 2026 12:26:55 GMT]]></title><description><![CDATA[<p dir="auto">I tested on windows 5.12.12 and 6.10.2...no joy. The only way I can make the symptom appear is if I do something like change the range with the multiplier:</p>
<pre><code>            int numBlocks = 0;
            switch(printerTimeScale) {
            default:
            case 0:
                numBlocks = static_cast&lt;int&gt;(maxTime) + 1;
                break;
            case 1:
                numBlocks = static_cast&lt;int&gt;(maxTime/2.0 + (static_cast&lt;int&gt;(maxTime) % 2) + 1);
                break;
            case 2:
                numBlocks = static_cast&lt;int&gt;(maxTime/5.0 + (static_cast&lt;int&gt;(maxTime) % 5) + 1);
                break;
            }

            reinterpret_cast&lt;QValueAxis*&gt;(chart.axes()[0])-&gt;setTickCount(numBlocks + 1);
            reinterpret_cast&lt;QValueAxis*&gt;(chart.axes()[0])-&gt;setRange(0.0, numBlocks*((printerTimeScale == 0) ? **1.01** : (printerTimeScale == 1) ? 2.0 : 5.0));
</code></pre>
]]></description><link>https://forum.qt.io/post/836764</link><guid isPermaLink="true">https://forum.qt.io/post/836764</guid><dc:creator><![CDATA[Rich Bair]]></dc:creator><pubDate>Wed, 04 Mar 2026 12:26:55 GMT</pubDate></item><item><title><![CDATA[Reply to QChart Range &#x2F; TickCount Question on Tue, 03 Mar 2026 06:18:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/rich-bair">@<bdi>Rich-Bair</bdi></a> said in <a href="/post/836706">QChart Range / TickCount Question</a>:</p>
<blockquote>
<p dir="auto">107.0 to 108.0.</p>
</blockquote>
<p dir="auto">Maybe, it's about</p>
<pre><code>void QValueAxis::setRange(qreal min, qreal max)
setTickInterval(qreal insterval)
</code></pre>
<p dir="auto">or you can check with these</p>
<pre><code>void QValueAxis::minChanged(qreal min)
void QValueAxis::maxChanged(qreal max)
tickIntervalChanged(qreal interval)
</code></pre>
<p dir="auto">Because your code its calculate true.</p>
<pre><code>int getNum(int printerTimeScale, double maxTime){
    int numBlocks = 0;
    switch(printerTimeScale) {
    default:
    case 0:
        numBlocks = static_cast&lt;int&gt;(maxTime) + 1;
        break;
    case 1:
        numBlocks = static_cast&lt;int&gt;(maxTime/2.0 + (static_cast&lt;int&gt;(maxTime) % 2) + 1);
        break;
    case 2:
        numBlocks = static_cast&lt;int&gt;(maxTime/5.0 + (static_cast&lt;int&gt;(maxTime) % 5) + 1);
        break;
    }
    return numBlocks;
}

    double maxTime = 106.4;
    qDebug() &lt;&lt; "getNum 0" &lt;&lt; getNum(0, maxTime); //getNum 0 107
    qDebug() &lt;&lt; "getNum 1" &lt;&lt; getNum(1, maxTime); //getNum 1 54
    qDebug() &lt;&lt; "getNum 2" &lt;&lt; getNum(2, maxTime); //getNum 2 23

    maxTime = 39.4;
    qDebug() &lt;&lt; "getNum 0" &lt;&lt; getNum(0, maxTime); //getNum 0 40
    qDebug() &lt;&lt; "getNum 1" &lt;&lt; getNum(1, maxTime); //getNum 1 21
    qDebug() &lt;&lt; "getNum 2" &lt;&lt; getNum(2, maxTime); //getNum 2 12

</code></pre>
]]></description><link>https://forum.qt.io/post/836729</link><guid isPermaLink="true">https://forum.qt.io/post/836729</guid><dc:creator><![CDATA[Joe von Habsburg]]></dc:creator><pubDate>Tue, 03 Mar 2026 06:18:07 GMT</pubDate></item><item><title><![CDATA[Reply to QChart Range &#x2F; TickCount Question on Mon, 02 Mar 2026 21:15:29 GMT]]></title><description><![CDATA[<p dir="auto">On windows I cannot replicate using 6.10.2.  I'm trying to get 5.12 installed on this same system to see if that's related.</p>
]]></description><link>https://forum.qt.io/post/836720</link><guid isPermaLink="true">https://forum.qt.io/post/836720</guid><dc:creator><![CDATA[Rich Bair]]></dc:creator><pubDate>Mon, 02 Mar 2026 21:15:29 GMT</pubDate></item><item><title><![CDATA[Reply to QChart Range &#x2F; TickCount Question on Mon, 02 Mar 2026 20:05:45 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Can you compare that behaviour to a more recent version of Qt ? At least 5.15.</p>
]]></description><link>https://forum.qt.io/post/836710</link><guid isPermaLink="true">https://forum.qt.io/post/836710</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 02 Mar 2026 20:05:45 GMT</pubDate></item></channel></rss>