[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] PyQt Chart Documentation
From:       Nick <napperley () gmail ! com>
Date:       2016-08-25 10:34:16
Message-ID: CAG_o7uOffuL7rO3=B3vFBMzr_s38dknRJNE3hMhN16c3nvcWdg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Did the trick, thanks.

On Thu, 25 Aug 2016 at 22:25 Phil Thompson <phil@riverbankcomputing.com>
wrote:

>
> > On 25 Aug 2016, at 10:17 am, Nick <napperley@gmail.com> wrote:
> >
> > Thanks! Realised that there was an extra "s" that needed to be removed
> at the end of the import. Got the Bar chart example working based on the
> one in the Qt C++ documentation. However the axis legend doesn't appear.
> Below is the function that creates the QChart which is used in the
> QChartView:
> >
> > ===================================================
> > def create_bar_chart(self):
> >         set0 = QBarSet('Jane')
> >         set1 = QBarSet('John')
> >         series = QBarSeries()
> >         chart = QChart()
> >         axis = QBarCategoryAxis()
> >         categories = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
> >
> >         set0.append([1, 2, 3, 4, 5, 6])
> >         set1.append([5, 0, 0, 4, 0, 7])
> >         series.append(set0)
> >         series.append(set1)
> >         chart.addSeries(series)
> >         axis.append(categories)
> >
> >         chart.setTitle('Simple barchart example')
> >         chart.createDefaultAxes()
> >         chart.setAxisX(axis, series)
> >         chart.legend().setAlignment(Qt.AlignBottom)
> >         return chart
> > ===================================================
>
> It's an ownership bug in PyQtChart.  To work around do...
>
>     axis = QBarCategoryAxis(chart)
>
> Phil

[Attachment #5 (text/html)]

<div dir="ltr">Did the trick, thanks.</div><br><div class="gmail_quote"><div \
dir="ltr">On Thu, 25 Aug 2016 at 22:25 Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br> &gt; On 25 Aug 2016, at 10:17 \
am, Nick &lt;<a href="mailto:napperley@gmail.com" \
target="_blank">napperley@gmail.com</a>&gt; wrote:<br> &gt;<br>
&gt; Thanks! Realised that there was an extra &quot;s&quot; that needed to be removed \
at the end of the import. Got the Bar chart example working based on the one in the \
Qt C++ documentation. However the axis legend doesn&#39;t appear. Below is the \
function that creates the QChart which is used in the QChartView:<br> &gt;<br>
&gt; ===================================================<br>
&gt; def create_bar_chart(self):<br>
&gt;              set0 = QBarSet(&#39;Jane&#39;)<br>
&gt;              set1 = QBarSet(&#39;John&#39;)<br>
&gt;              series = QBarSeries()<br>
&gt;              chart = QChart()<br>
&gt;              axis = QBarCategoryAxis()<br>
&gt;              categories = [&#39;Jan&#39;, &#39;Feb&#39;, &#39;Mar&#39;, \
&#39;Apr&#39;, &#39;May&#39;, &#39;Jun&#39;]<br> &gt;<br>
&gt;              set0.append([1, 2, 3, 4, 5, 6])<br>
&gt;              set1.append([5, 0, 0, 4, 0, 7])<br>
&gt;              series.append(set0)<br>
&gt;              series.append(set1)<br>
&gt;              chart.addSeries(series)<br>
&gt;              axis.append(categories)<br>
&gt;<br>
&gt;              chart.setTitle(&#39;Simple barchart example&#39;)<br>
&gt;              chart.createDefaultAxes()<br>
&gt;              chart.setAxisX(axis, series)<br>
&gt;              chart.legend().setAlignment(Qt.AlignBottom)<br>
&gt;              return chart<br>
&gt; ===================================================<br>
<br>
It&#39;s an ownership bug in PyQtChart.   To work around do...<br>
<br>
      axis = QBarCategoryAxis(chart)<br>
<br>
Phil</blockquote></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic