<?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[How can i remove qchart unuseful area?]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I am beginner in Qt.  Firstly, I want to build a line chart which starts from first pixel of QFrame , end last pixel of QFrame. I attached a picture. In this picture, how i can remove the area which is described with red arrows.</p>
<p dir="auto">Secondly, i want to add a axis for chart. the axis normally goes to 0,....,n(left to right). but i want to build an axis start right to left. i am using the negative point of the QLineSeries. Is it ok? Do you know any solution except mine?</p>
<p dir="auto">Finally, in my x axis, i want to seperate a fixed value. In other words, the x axis is have 800 point in every time. If i add 2 point to series, it display 2 point on 800 point. If i add 500 point to series, it display 500 point on 800 point. It may be not clear, because of that i attached a picture. I am send the code which i am working on.  Could you help me? Thank you :)</p>
<p dir="auto">Code:</p>
<p dir="auto">void MainWindow::lineChart(QFrame *horizontalFrame){</p>
<pre><code>// set pen for series
QPen pen(QRgb(0x00aa00));
pen.setWidth(2);

//try some example datas
QLineSeries *series = new QLineSeries();
series-&gt;setPen(pen);
series-&gt;append(0,1);
series-&gt;append(-1,4);

//set x axis parameters
QValueAxis* axisX = new QValueAxis();
axisX-&gt;setRange(-100,0);
axisX-&gt;setLabelsVisible(false);
axisX-&gt;setGridLineVisible(false);
axisX-&gt;setLineVisible(false);
axisX-&gt;setShadesVisible(false);
axisX-&gt;setMinorGridLineVisible(false);

//create chart with attributes
QChart *chart = new QChart();
chart-&gt;addAxis(axisX,Qt::AlignBottom);
series-&gt;attachAxis(axisX);
chart-&gt;setBackgroundBrush(Qt::white);
chart-&gt;layout()-&gt;setContentsMargins(0, 0, 0, 0);
chart-&gt;setBackgroundRoundness(0);
chart-&gt;setMaximumSize(810,100);
chart-&gt;setMinimumSize(810,100);
chart-&gt;setPreferredSize(810,100);
chart-&gt;addSeries(series);
chart-&gt;legend()-&gt;hide();

//create chartview with some attributes
QChartView *chartview = new QChartView(chart);
chartview-&gt;setRenderHint(QPainter::Antialiasing);
chartview-&gt;setParent(horizontalFrame);
chartview-&gt;setContentsMargins(0,0,0,0);
</code></pre>
<p dir="auto">}</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/f2391811-9c9d-4b48-b48d-e9e05b427729.png" alt="removeAreaFromChart_2.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/topic/135147/how-can-i-remove-qchart-unuseful-area</link><generator>RSS for Node</generator><lastBuildDate>Fri, 16 Oct 2026 08:15:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/135147.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Mar 2022 07:40:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How can i remove qchart unuseful area? on Fri, 18 Mar 2022 08:37:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Thank you for quick reply, i have tried but not working :(  2 data point completely envelop the chart like previously.<br />
Thank you so much :)</p>
]]></description><link>https://forum.qt.io/post/706858</link><guid isPermaLink="true">https://forum.qt.io/post/706858</guid><dc:creator><![CDATA[bossman48]]></dc:creator><pubDate>Fri, 18 Mar 2022 08:37:27 GMT</pubDate></item><item><title><![CDATA[Reply to How can i remove qchart unuseful area? on Fri, 18 Mar 2022 08:24:55 GMT]]></title><description><![CDATA[<p dir="auto">QChart is a QGraphicsWidget so <a href="https://doc.qt.io/qt-5/qgraphicswidget.html#size-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qgraphicswidget.html#size-prop</a> maybe?</p>
]]></description><link>https://forum.qt.io/post/706856</link><guid isPermaLink="true">https://forum.qt.io/post/706856</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 18 Mar 2022 08:24:55 GMT</pubDate></item><item><title><![CDATA[Reply to How can i remove qchart unuseful area? on Fri, 18 Mar 2022 08:22:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Thank you :) How can split x axis to 800 fixed point? Do you know anything about this subject? Thank you again :)</p>
]]></description><link>https://forum.qt.io/post/706854</link><guid isPermaLink="true">https://forum.qt.io/post/706854</guid><dc:creator><![CDATA[bossman48]]></dc:creator><pubDate>Fri, 18 Mar 2022 08:22:22 GMT</pubDate></item><item><title><![CDATA[Reply to How can i remove qchart unuseful area? on Fri, 18 Mar 2022 07:58:10 GMT]]></title><description><![CDATA[<p dir="auto">Take a look at <a href="https://doc.qt.io/qt-5/qchart.html#margins-prop" target="_blank" rel="noopener noreferrer nofollow ugc">QChart::margins()</a></p>
]]></description><link>https://forum.qt.io/post/706850</link><guid isPermaLink="true">https://forum.qt.io/post/706850</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 18 Mar 2022 07:58:10 GMT</pubDate></item></channel></rss>